HitDice hooks MR

WWasp3/13/2022
I just added my first merge request 😄 https://gitlab.com/foundrynet/dnd5e/-/merge_requests/495
WWasp3/13/2022
TLDR; I want to implement a way to override hit die rolls for item and feats such as Periapt of Wound Closure and Durable
Cccjmk3/13/2022
i understand what you want to change is on parts ?
WWasp3/13/2022
Since Actor5e#rollHitDie uses the native damageRoll in the 5e system, there's no distinct way to easily change it
Cccjmk3/13/2022
would it make sense to return a new Parts ?
WWasp3/13/2022
Hooks.on("preRollHitDie", (actor, parts) => {

    let periapt = actor.items.getName(game.i18n.format("REST-RECOVERY.FeatureNames.Periapt"));
    periapt = periapt && periapt.data.data.attunement === 2;

    let durable = actor.items.getName(game.i18n.format("REST-RECOVERY.FeatureNames.Durable"));
    durable = durable && durable.data.type === "feat";

    const conMod = actor.data.data.abilities.con.mod;

    if (periapt && durable) {

        parts = [`{1${denomination}+${conMod},${Math.max(conMod,2)}}kh*2`]

    } else {

        if (periapt) {
            parts[0] = "(" + parts[0];
            parts[1] += ")*2";
        }

        if (durable) {
            parts[0] = "{" + parts[0]
            parts[1] += `,${conMod*2}}kh`
        }
    }

});
WWasp3/13/2022
That could work, yeah
WWasp3/13/2022
If multiple hooks are called, I don't think it will properly mutate though?
WWasp3/13/2022
ie, if module A and B both use preRollHitDie, and they both return the parts data, only one will win out?
Cccjmk3/13/2022
i just started a dota match so my attenetion is a little limted xD
Cccjmk3/13/2022
brb
WWasp3/13/2022
all good
WWasp3/13/2022
crush the opposition
Cccjmk3/13/2022
back!
Cccjmk3/13/2022
you closed it! xD
Cccjmk3/13/2022
also, I think you should not change the system version on your mr 😛
WWasp3/13/2022
I saw in a different MR that it was recommended to make em for 1.6.x
Cccjmk3/13/2022
hmm no I mean, not change the version on the system.json
Cccjmk3/13/2022
you just make the MR to the current next version, let them change the version & download link when ready for release
CCalego3/13/2022
I do want to put in a bunch of hooks in various places (see the more-hooks-5e module for my proof of concept), so I'm definitely interested in what your use case is and hwo to accomodate.
CCalego3/13/2022
I havne't fully caught up here but when I do I'll see about adding some hooks to the more-hooks module on this front