feat: add rollItem hook

This commit is contained in:
Johannes Loher 2022-05-19 02:36:05 +02:00
parent 58577beacd
commit 3b74ce2a5b
3 changed files with 11 additions and 0 deletions

View file

@ -11,6 +11,13 @@ declare global {
interface DocumentClassConfig {
Item: typeof DS4Item;
}
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Hooks {
interface StaticCallbacks {
"ds4.rollItem": (item: DS4Item) => void;
}
}
}
/**

View file

@ -55,6 +55,8 @@ export class DS4Spell extends DS4Item {
flavorData: { actor: speaker.alias ?? this.actor.name, spell: this.name },
speaker,
});
Hooks.callAll("ds4.rollItem", this);
}
}

View file

@ -47,6 +47,8 @@ export class DS4Weapon extends DS4Item {
flavorData: { actor: speaker.alias ?? this.actor.name, weapon: this.name },
speaker,
});
Hooks.callAll("ds4.rollItem", this);
}
private async getCombatValueKeyForAttackType(attackType: AttackType): Promise<"meleeAttack" | "rangedAttack"> {