1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-29 09:15:11 +01:00
Peacock/components/candle
Reece Dunham 7780d4fc89
Revert accidental change MK2
Co-authored-by: Pavel Alexandrov <krabanek@gmail.com>
Signed-off-by: Reece Dunham <me@rdil.rocks>
2024-02-16 09:42:38 -05:00
..
challengeHelpers.ts Enable strict types mode (#362) 2024-02-02 14:46:44 -05:00
challengeService.ts Enable strict types mode (#362) 2024-02-02 14:46:44 -05:00
masteryService.ts Enable strict types mode (#362) 2024-02-02 14:46:44 -05:00
progressionService.ts Revert accidental change MK2 2024-02-16 09:42:38 -05:00
README.md Added featured contracts challenges (#186) 2023-04-06 17:05:36 +01:00

Candle

Lighting the way through the new era of Hitman.

Candle is the subsystem for handling Challenges, Progression, and XP.

Credits

Thanks to Moo for the name suggestion.

Loading challenges

Challenge data reside in files in contractdata ending in _CHALLENGES.json. When building, the packResources function in buildTasks.mjs will take all such files and pack them into files in the resources/challenges folder.

Then, when the server starts, challenge data is loaded from the files in the resources/challenges folder into the memory, via the _loadResources function in controller.ts. It calls the _handleChallengeResources function that in turn calls challengeService.registerGroup and challengeService.registerChallenge to register the challenge group and the respective challenges.

These two registration functions initialize two data structures, groups: Map<string, Map<string, SavedChallengeGroup>>, which maps parentLocationIds to Maps of groupIds to SavedChallengeGroup objects for this group of this parent location, and groupContents: Map<string, Map<string, Set<string>>>, which maps parentLocationIds to Maps of groupIds to Sets of challenge Ids in this group of this parent location. All subsequent operations on challenges write to or read from these two Maps.