docs(tradable): explain component check#858
Conversation
…items The tradableConditions function was blocking all Prime items with weapon/warframe types (Rifle, Pistol, Melee, Warframe, etc.), making 148 Prime items incorrectly untradable. Most of these (143) have tradable components and represent tradable sets. Replace the blanket block with a three-layer approach: 1. Explicit override map for edge cases (Baro weapons, quest-locked items) 2. Component-based detection as the default fallback 3. Items with no tradable components remain untradable (Founders items) Also simplifies the Wraith regex from Wraith\w|\wWraith to just Wraith, which properly matches item names with spaces (e.g. "Strun Wraith"). Adds 25 unit tests for the tradable function covering all cases.
📝 WalkthroughWalkthroughChanges introduce explicit tradability overrides for built Prime items through a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update JSDoc to use plain Object types instead of import() syntax to satisfy valid-jsdoc rule. Remove Wraith name-match test that was left over after reverting the Wraith regex change.
build/tradable.mjs
Outdated
| const builtPrimeOverrides = { | ||
| 'Gotva Prime': true, | ||
| 'Galariak Prime': false, | ||
| 'Sagek Prime': false, | ||
| }; |
There was a problem hiding this comment.
If you're making an override, move it out of code and into a config file, and use the unique names, not the localized name.
There was a problem hiding this comment.
this is also not exhaustive of all baro prime weapons, and should probably use something on the item, like either a drop source or add that it's a baro weapon in the weapon overrides, and key off of that, instead of making an explicit list of tradable weapons, because that requires an extra PR to add to this specific list, and adding to configs is a bit more straightforward
Revert component-check approach per review feedback. Built Prime items are not directly tradable; only their parts are. Components get their own tradable flag. To determine if a Prime set is tradable, check item.components for parts with tradable: true.
And a comment to clarify how the tradable status is computed.
Considerations
Summary by CodeRabbit