Commit 0425303
feat(sorting): add Expansion sort option for items (#890)
Add a new "Expansion" sort option to the Item Order dropdown, allowing
users to sort items chronologically by the expansion they were introduced
in (Classic -> TBC -> ... -> Midnight).
Changes:
- core/constants.lua:273: Add EXPANSION = 4 to ITEM_SORT_TYPE enum
- config/config.lua:220-228: Add "Expansion" option to Item Order dropdown
for both Backpack and Bank, mapping to const.ITEM_SORT_TYPE.EXPANSION
- util/sort.lua:220-242: Implement SortItemsByExpansion function that:
* Uses data.itemInfo.expacID for expansion ordering
* Defaults to 0 (Classic) for items with missing expacID
* Falls back to alphabetical sort when expansions are equal
* Falls back to item count and GUID for stable sorting
- util/sort.lua:61-76: Update GetItemSortFunction to return
SortItemsByExpansion when EXPANSION sort type is selected
The expansion ID is already populated by the WoW API via C_Item.GetItemInfo()
and stored in itemInfo.expacID. Lower expansion IDs represent older content
(0 = Classic, 11 = Midnight), providing chronological ordering.
All luacheck validation passes with no warnings or errors.
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 06b076d commit 0425303
3 files changed
+31
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
228 | | - | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
213 | 241 | | |
214 | 242 | | |
215 | 243 | | |
| |||
0 commit comments