@tellandshow/badges-core
v0.0.3
Published
Badge + trophy system for the Tell and Show engagement layer. 30 badges across 6 categories + 4 per-track ship trophies. BadgeAwarder subscribes to ProfileCore and awards badges automatically when conditions are met.
Maintainers
Readme
@tellandshow/badges-core
30 badges + 4 per-track ship trophies. Subscribe to @tellandshow/profile-core and badges award automatically when conditions are met.
Categories
| category | count | examples | | --------------- | ----- | ----------------------------------------------- | | shipping | 5+4 | First Ship, Three of Three, Quadruple Threat, per-track trophies | | styles | 5 | Make It Yours, Style Explorer, Quiz Whiz | | wizards | 5 | First Spell, Wizard Master, Voice Keeper | | ai-exploration | 5 | Met Pip, Friend of All, Behind the Curtain | | persistence | 5 | Side Quester, Coming Back, Half a Decade | | special | 5 | Pioneer, Completionist, Spread the Magic |
Wiring
import { ProfileCore } from '@tellandshow/profile-core';
import { BadgeAwarder } from '@tellandshow/badges-core';
const profile = new ProfileCore({ storage: localStorage });
const awarder = new BadgeAwarder({
profile,
onAward: ({ badge }) => addToToastQueue(badge),
});
awarder.start();After that the studio just fires events; badges award themselves:
profile.addEvent({ type: 'project-shipped', xp: 40 });
profile.addEvent({ type: 'project-shipped:game', xp: 0 }); // variant for trophy
// → 'first-ship' + 'trophy-game' both award; toast queue receives bothVariant event convention
Badges that key off a specific style / persona / track use type:variant event names:
profile.addEvent({ type: 'style-confirmed', xp: 5 });
profile.addEvent({ type: `style-confirmed:${preset.id}`, xp: 0 });Bare events keep XP_AMOUNTS tidy (only counted once); variant events feed the badge matchers.
License
MIT.
