Repository navigation
Conversation
- Add CosmeticItem catalog entity covering titles, avatar frames,
name colours and profile badges, each with a JSON unlock condition
(level, total XP, puzzles solved, streak days, achievement, manual)
- Add PlayerCosmeticUnlock (unique per player and item) for ownership
- Add PlayerEquippedCosmetic with one slot per cosmetic type
- CosmeticsService:
- catalog create/update with condition validation
- evaluateUnlocks grants every newly met milestone, skips owned
items and tolerates concurrent duplicate inserts
- listens to player.level_up so level/XP titles unlock automatically
- idempotent manual grants
- equip/unequip with ownership check before equip
- profile display data with the equipped title and items
- CosmeticsController: public catalog and profile display, JWT player
routes for owned items and equip/unequip, admin-only catalog edits,
grants and milestone evaluation
- Register CosmeticsModule in AppModule
- 33 unit tests
Closes MindFlowInteractive#463
|
@AwesomeuncleB Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
@AwesomeuncleB please resolve conflict |
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.
Closes #463
What does this PR do?
Adds player titles and cosmetic items that unlock at milestones. Players can equip the ones they own, and profiles can show the equipped title.
Why?
Closes #463
Type of change
How was it tested?
npx jest src/cosmetics: 33 tests pass.What's included
New module
src/cosmetics/:cosmetic_items): titles, avatar frames, name colours and profile badges. Each item has an unlock condition:level,total_xp,puzzles_solved,streak_days,achievementormanual. Conditions are validated when items are created or updated.player_cosmetic_unlocks, unique per player and item):evaluateUnlocksgrants every item whose milestone is now reached and skips items the player already owns. If two requests insert the same unlock at once, the duplicate is ignored safely.player.level_upevent, so level and XP titles unlock with no extra wiring.player_equipped_cosmetics, one slot per type): ownership is checked before equipping, and equipping replaces whatever was in that slot./cosmetics?type=title/cosmetics/profile/:userId/cosmetics/me/cosmetics/me/equip/cosmetics/me/equip/:slot/cosmetics/cosmetics/:cosmeticId/cosmetics/:cosmeticId/grant/cosmetics/evaluateChecklist
npm run lintpasses for the new filesnpm run format:checkpassesnpm run typecheck: no new errors (mainalready has 149 existing errors; this PR adds none)npm testpasses for the new suiteCONTRIBUTING.mdRisk & rollout
Additive only: new tables and new routes. The only change to existing code is registering the module in
AppModule. Other milestone sources (puzzles solved, streaks, achievements) can callCosmeticsService.evaluateUnlocksor the admin endpoint. Production needs a migration for the new tables.Closes #463