Repository navigation
Gear sets: a category named after a set takes the set's items (#1368) - #1372
Merged
Merged
Conversation
Since #1333 each equipment set is a category named "Gear: <set>", and a set gets none when another category (the player's or a plugin's) already has that name. Before #1333, items:GetCategory labeled every set item "Gear: " and its first set's name ahead of every category, so a category of the player's with that name received every item of the set. Players have such categories: made by hand to style the set's section, a search category named after it, or made by the classic bags' Shift title drop on the set's header. After #1333 the set's items fell through to their type category, so a rule `category = "Gear: Tank"` matched nothing and a bare set name matched only item names. Reproduced on the real Items, Categories and Search modules over test.lua, against the build before 1d1299a and against this one. - Categories:gearSetOf: for a set with no gear set category of its own, the category named after it (the player's first, else a plugin's) is the set's category. The bag's Equipment Set switch, the category's Used In and its Ignored Items apply as for a set's category, and it competes by the order of the Categories list as a set's category does. Deleting the player's category gives the set its own category at the next sweep. - Categories:GetCustomCategory returns a fourth value, `added`: the item was added to the category by hand. items:GetCategory and the vendor's copy of the same decision (next/merchant.lua) read it in place of the category's `save` flag. A category of the player's reached through its set also has `save`, and with the old check it would have won every set item over every rule, including rules placed above it. - Docs: category-lifecycle.md §6 and §12 (paths now include next/merchant.lua and its spec), README.md (the `category` field and Gear Set Categories), data/README.md, and the help article's Gear: name line. Bug review (Prime Directive #2): no proven bug. It found no test pinning which category takes the items when both the player's and a plugin's have the set's name (a surviving mutation); one now does. Not built for, recorded in §12: a set whose "Gear: " name equals a group by's section of another category puts its items in that section, whose own Ignored Items are empty. Tests: spec/categories_spec.lua ("gear sets": the player's and a plugin's category of the name, the order, ignored, Used In, the switch, a rename onto the name, deletion, precedence), spec/refresh_pipeline_spec.lua and spec/next/merchant_spec.lua (a rule above the player's category named after the set takes the item; hand-added stubs return `added`), spec/debug_dump_harness_spec.lua (the real profile: a rule and a list named after a set taking its items, the profile's rules above the list taking theirs). Each new assertion failed before the change. Full suite: 8174 passing before the precedence test was added, which passes on its own in spec/categories_spec.lua; luacheck clean.
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.
Fixes #1368.
Problem
Since #1333, an equipment set gets no
Gear: <set>category when one of the player's categories (or a plugin's) already has that name. Before #1333, every set item was labeledGear: <set>ahead of every category, so a category with that name received all of the set's items. Players have such categories: made by hand to style the section, a search category named after it, or made by the classic bags' Shift title drop on the set's header. After #1333 those items went to their type category, so a rulecategory = "Gear: Tank"matched nothing and a search for the set's name matched only item names.Reproduced on the real Items, Categories and Search modules over
test.lua, before 1d1299a and on main:Gear: TankGear: Tank,category = "Gear: Tank"Gear: Tankholding 1 of the set's itemsChange
Categories:gearSetOf: a set with no category of its own uses the category named after it (the player's first, else a plugin's). The Equipment Set switch, Used In and Ignored Items apply as for a set's category, and the category competes by its place in the Categories list as a set's category does.Categories:GetCustomCategoryreturns a fourth value,added(the item was added by hand).items:GetCategoryand the vendor (next/merchant.lua) read it in place of the category'ssaveflag, so a category of the player's reached through its set does not win over rules placed above it.category-lifecycle.md§6 and §12,README.md,data/README.md, help article.Tests
New assertions in
spec/categories_spec.lua,spec/refresh_pipeline_spec.lua,spec/next/merchant_spec.luaandspec/debug_dump_harness_spec.lua(real profile). Each failed before the change. Full suite and luacheck pass.Bug review
No proven bug. A missing test for which category wins when both the player's and a plugin's have the set's name was added. One edge case, a set whose
Gear:name equals a group by's section of another category, is recorded in §12 and not built for.