Fix: enchanting off-hand weapon hides both weapon-enchant reminders - #2071
Open
svart2521 wants to merge 1 commit into
Open
Fix: enchanting off-hand weapon hides both weapon-enchant reminders#2071svart2521 wants to merge 1 commit into
svart2521 wants to merge 1 commit into
Conversation
Bug:
Applying a temporary weapon enchant (oil) to the off-hand weapon made the
main-hand reminder disappear too, even though the main hand still had no
enchant. Removing the off-hand's enchant brought both reminders back.
Issue:
EmitWeaponEnchantReminders (EllesmereUIAuraBuffReminders.lua) picked each
hand's "has enchant" state with the "cond and a or b" idiom:
local has = (i == 1) and hasMH or hasOH
This idiom silently falls through to b whenever a is falsy. For the main
hand (i == 1), whenever hasMH was false (no enchant), the expression
evaluated to hasOH instead -- so an unenchanted main hand was read as
having the off hand's enchant state. With the off hand freshly enchanted,
the main hand's reminder was wrongly suppressed as "not needed yet". The
off hand's own slot was unaffected (its branch never depended on a
falsy value to pick the right side), which is why enchanting main hand
first never showed the bug.
Fix:
Replaced the idiom with a plain if/else that assigns the correct values
unconditionally, per slot. Compiles clean (luac5.1 -p). Confirmed live:
enchanting only the off hand now correctly leaves the main hand's
reminder visible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug: https://discord.com/channels/585577383847788554/1548340151544188930
Applying a temporary weapon enchant (oil) to the off-hand weapon made the main-hand reminder disappear too, even though the main hand still had no enchant. Removing the off-hand's enchant brought both reminders back.
Issue:
EmitWeaponEnchantReminders (EllesmereUIAuraBuffReminders.lua) picked each hand's "has enchant" state with the "cond and a or b" idiom:
This idiom silently falls through to b whenever a is falsy. For the main hand (i == 1), whenever hasMH was false (no enchant), the expression evaluated to hasOH instead -- so an unenchanted main hand was read as having the off hand's enchant state. With the off hand freshly enchanted, the main hand's reminder was wrongly suppressed as "not needed yet". The off hand's own slot was unaffected (its branch never depended on a falsy value to pick the right side), which is why enchanting main hand first never showed the bug.
Fix:
Replaced the idiom with a plain if/else that assigns the correct values unconditionally, per slot.