Skip to content

Fix: enchanting off-hand weapon hides both weapon-enchant reminders - #2071

Open
svart2521 wants to merge 1 commit into
EllesmereGaming:mainfrom
svart2521:oil-reminder-disappears-when-offhand-applied-first
Open

Fix: enchanting off-hand weapon hides both weapon-enchant reminders#2071
svart2521 wants to merge 1 commit into
EllesmereGaming:mainfrom
svart2521:oil-reminder-disappears-when-offhand-applied-first

Conversation

@svart2521

Copy link
Copy Markdown
Contributor

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:

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant