thepeacockproject / Peacock

The Peacock Project is a HITMAN™ World of Assassination trilogy server replacement.
https://thepeacockproject.org
GNU Affero General Public License v3.0
367 stars 57 forks source link

feat: Add API to simplify creation of global challenges #459

Closed Yanrishatum closed 4 months ago

Yanrishatum commented 4 months ago

Scope

This PR aims to provide plguin creators a way to create global challenges that act along the lines of Arcade challenge group, where it shows all challenges regardless of location. Exact API is up to debate, and it's more to kickstart discussion on how to better implement it. Right now it's mirroring the way challenge packs are implemented.

Current API usage example:

controller.challengeService.globalGroups.set('group-key', {
    allLocations: true,
    gameVersions: ["h3"],
    groupId: 'group-key',
    location: "GLOBAL_GROUP_LOCATION"
})

With allLocations flag it will add the global challenge group location always, regardless if there are any challenges from that group linked to the location. (Use case: Roulette mod) Otherwise it will do so only if location contains challenges from the same challenge group. (Example: Classic challenges)

Test Plan

Checklist

RDIL commented 4 months ago

I like this! I'd be willing to merge if nobody has any other feedback on the API design.

Yanrishatum commented 4 months ago

Changes from initial draft:

The example plugin is ready, but I'm not sure where to put it.

RDIL commented 4 months ago

I think the place for that would be on the WIP plugin development guide on the website