Skip to content

Commit

Permalink
[ImprovedCraftingLog] Fix Framework Update event handler unsubscrib…
Browse files Browse the repository at this point in the history
…ing (#661)
  • Loading branch information
Taurenkey authored Nov 5, 2023
1 parent bf45ca6 commit 858ed06
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Tweaks/UiAdjustment/ImprovedCraftingLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,16 @@ private void ForceUpdate() {
}

private void ForceUpdateFramework() {
if (removeFrameworkUpdateEventStopwatch.ElapsedMilliseconds > 5000) Common.FrameworkUpdate -= ForceUpdateFramework;
ForceUpdate();
if (removeFrameworkUpdateEventStopwatch.ElapsedMilliseconds > 5000) {
Common.FrameworkUpdate -= ForceUpdateFramework;
removeFrameworkUpdateEventStopwatch.Stop();
}
if (standingUp == false || Service.ClientState.LocalPlayer == null) return;
var localPlayer = (Character*) Service.ClientState.LocalPlayer.Address;
if (localPlayer->Mode != Character.CharacterModes.Crafting) {
standingUp = false;
}
ForceUpdate();
}

public enum CraftReadyState {
Expand Down Expand Up @@ -193,6 +196,7 @@ private void ReopenCraftingLog() {
agent->OpenRecipeByRecipeId(selectedRecipeId);

standingUp = true;
removeFrameworkUpdateEventStopwatch.Restart();
Common.FrameworkUpdate += ForceUpdateFramework;
}
}
Expand Down

0 comments on commit 858ed06

Please sign in to comment.