Bags: add optional Sort to Bottom - #1192
Merged
EllesmereGaming merged 2 commits intoAug 5, 2026
Merged
Conversation
Sorting packs items into the first free slots, so a half-empty bag reads as a block of items at the top and a run of empty slots below it. Some players want the opposite: items settled at the bottom, free space at the top, so the gap sits next to nothing and new loot does not shift the block they just organised. New "Sort to Bottom" toggle in a cog popup on the Show Sort Icon row (Bags -> EXTRAS), defaulting off. The item order inside the block never changes; only where the block starts does. Three sort paths back the one button and each needed its own handling: - OneBag runs the module's own physical sort. Sorted item i targeted slot i; it now targets slot i + offset, where offset is the free-slot count when the option is on and 0 otherwise, so the default path is unchanged. The walk direction has to follow: forwards when packing to the top, backwards when packing to the bottom, so that the item displaced by a swap always lands in a slot the pass has yet to visit and gets placed in the same pass. Keeping the forward walk while packing to the bottom is still correct but strands every displaced item behind the cursor, one BAG_UPDATE retry each -- a half-full bag went from 2 passes to 12+ and blew the 15-retry cap, leaving bags visibly half-sorted. - MultiBag and the bank defer to Blizzard (SortBags / SortBank), which fills by its own right-to-left direction: right-to-left starts at the backpack, which sits at the right end of the default bag bar and is the top of our views, so packing to the bottom means clearing it. That is a real game setting shared with Blizzard's Clean Up button, so it is only ever written while the option is on -- an untouched setup keeps whatever direction the player chose. Turning the option on stashes their value and turning it off restores it, and each sort re-asserts ours in case a profile switch or the Blizzard settings panel moved it in between. - Category views need nothing: they pack their own grid with no gaps. The move loop is pure index arithmetic, so it was extracted and run standalone over 6000 randomised bag states (1-120 slots, 0-100% full, unique through heavy duplicate stacks, both directions), asserting the block lands contiguous, in order, at the right end, with no items lost. Worst case is 4 retry passes against the cap of 15. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The committed list was 8 keys stale: it still carried the profile-import Window Skins / overrides strings whose L() calls are gone from the source. Pre-existing on main, not from this branch -- running the extractor on a clean upstream/main checkout produces the same 658 keys against the 666 committed, so the locale-check job fails on any PR touching Lua until this lands. Regenerated with .tools/extract-locale-keys.sh, no hand edits. The Sort to Bottom strings add nothing here: like every options row label they reach L() as a variable, so the static extractor cannot see them and translators pick them up from the in-game /euiloc harvester instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5 tasks
EllesmereGaming
pushed a commit
that referenced
this pull request
Aug 7, 2026
The Bags "Sort to Bottom" cog from #1192 and the gold DataBar's rebuilt tooltip, whose new section checklist shipped with 8.7.6 itself. Sort stays 排序 to match the Show Sort Icon row that owns the cog (顯示排序圖示). The long explanation reuses the file's own 單一背包 and 多重背包 for the two bag views, 格線 for the item grid, and the client's 整理背包 for the Blizzard cleanup direction the option flips. On the DataBars side the gold block is 金錢 and its tooltip parts are 區段, the same word L["Section"] already uses, so they do not read as the DataBar blocks (區塊); 工作階段 (Session) and 魔獸代幣 (WoW Token) were already translated, so Characters joins them as 角色.
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.
What does this PR do?
Adds a new option to sort to the bottom instead of top for onebag
How was it tested?
8.7.5 live
Screenshots
Recording.2026-08-04.125551.mp4
Checklist
HookScript/hooksecurefunconly, neverSetScripton Blizzard frames