1
mirror of https://github.com/thepeacockproject/Peacock synced 2024-11-29 09:15:11 +01:00
Peacock/components/candle/README.md
moonysolari 21b3663c50
Added featured contracts challenges (#186)
* Add semi-working featured contracts challenges

* Pass contract IDs to $pushunique (need SMP update)

* Add readme for challenges

* Use drop ids

* fix fc challenges json

* Added h2 featuren contracts challenges

* Update smp to 5.4.0
2023-04-06 17:05:36 +01:00

1.3 KiB

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.