Skip to content

fix(bags): New Items Only lists only the new copies of items that do not stack - #3424

Open
tester617 wants to merge 1 commit into
EllesmereGaming:mainfrom
tester617:bags-recent-new-copies
Open

tester617 wants to merge 1 commit into
EllesmereGaming:mainfrom
tester617:bags-recent-new-copies

Conversation

@tester617

Copy link
Copy Markdown
Contributor

What does this PR do?

Follow-up to #3346. With New Items Only on, an item that does not stack was matched by item ID, so crafting a third Red Linen Bag next to two carried ones listed all three under Recent Items. Now only the new copy is listed.

  • While New Items Only is on, items with a max stack of 1 are told apart by item GUID, one per copy. Recent Items lists only the copies picked up after the others were known.
  • Turning the option on records the copies you already carry (EUI_Bags.SeedRecentCopies), so nothing you held before shows up as new.
  • A bag update pass reads GUIDs only for items whose count changed or whose known copies are incomplete. A pass without such an item reads none.
  • While the mailbox or a trade is open, every item that does not stack is read, because a copy can arrive as another leaves without changing the count. Such a swap counts as an arrival there. Elsewhere, a swap within a single pass that keeps the count unchanged stays undetected.
  • If the data is incomplete (no GUID, max stack not cached yet), the item falls back to listing every copy, which is the behavior of 9.8.8.
  • Every view asks one predicate, EUI_Bags.IsRecentEntry(data): grid, list and the icon picker of the Recent category in the sidebar. While a per-copy set exists, the list view builds Recent from the unmerged entries, so Merge Duplicates does not pull the older copies back in.
  • Toggling New Items Only now refreshes the bags right away.
  • With the option off nothing changes: no GUID reads and no extra tables.

How was it tested?

In game on WoW Forever 1.60.1.70938 with EllesmereUI 9.8.8: crafting a third Red Linen Bag next to two carried ones lists only the new bag.

Lua 5.1 stub tests cover the copy rules, count-neutral swaps at the mailbox and in a trade, seeding when the option is turned on, the fallback for incomplete data, the option-off case without GUID reads, and the list view against upstream. They are not part of this PR (test files stay out per CONTRIBUTING), but I can share them on request. python3 .tools/guardrails.py passes.

Checklist

  • New settings default OFF (no behavior change without opt-in): N/A, no new setting. The fix acts only while the existing New Items Only option (default off) is on.
  • Zero cost while disabled: with New Items Only off, no GUID reads and no extra tables.
  • Cheap while enabled: event-driven; GUIDs are read only for items whose count changed, and for all non-stackables only while the mailbox or a trade is open.
  • No writes onto Blizzard-owned frames: N/A, no Blizzard frames touched.
  • Tested in-game on live: tested in game on WoW Forever (see above). No version gates or pre-Midnight APIs added.

…not stack

With New Items Only on, an item with max stack 1 was listed by item ID, so crafting a third Red Linen Bag next to two carried ones listed all three. Copies are now told apart by item GUID while the option is on: Recent Items lists only the copies picked up since the item was listed. Every view, and the Recent category's icon picker, asks one per-slot predicate, EUI_Bags.IsRecentEntry, and the list view filters before it merges.

The carried GUIDs are taken at the snapshot and when the option is turned on. A pass reads GUIDs only for items whose count changed or whose known GUIDs are incomplete, so a pass without such an item reads none; at the mailbox and in a trade every item that does not stack is read, so a copy received as another leaves still counts as new. Unknown data (no GUID, max stack not cached) falls back to every copy, as before. With the option off nothing changes and no GUID is read. Toggling the option now refreshes the bags.
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