tyhayescreative / foundry-5e-stargate

0 stars 0 forks source link

Add TD support #2

Closed tyhayescreative closed 1 year ago

tyhayescreative commented 1 year ago

This needs to be at the world level.

tyhayescreative commented 1 year ago

I think we need something along these lines. But even the stargate system doesn't seem to implement a TD that is rollable from the chat log at least, so I don't have a pattern for how to do this.

game.settings.register("StargateTyHayesCreative", "td", { name: "Tension Die", hint: "The tension die", scope: "world", // This specifies a client-stored setting config: true, // This specifies that the setting appears in the configuration view type: object, choices: { // If choices are defined, the resulting setting will be a select menu "d4": new Die({faces: 4, number: 1}).evaluate(); "d6": "new Die({faces: 6, number: 1}).evaluate(); "d8": new Die({faces: 8, number: 1}).evaluate(); "d10": new Die({faces: 10, number: 1}).evaluate(); "d12": new Die({faces: 12, number: 1}).evaluate(); }, default: "d6", // The default value for the setting onChange: value => { // A callback function which triggers when the setting is changed console.log(value) } });

tyhayescreative commented 1 year ago

It's definitely got something to do with https://foundryvtt.com/api/DiceTerm.html too

tyhayescreative commented 1 year ago

Also consider looking in systems (but stargate doesn't make /roll 1td work, at least from the chat log) or digging into the foundry source itself

tyhayescreative commented 1 year ago

maybe a hook that intercepts rolls and parses the roll formula replacing "td" with the actual die.

The actual die should be set in a module setting: https://foundryvtt.wiki/en/development/guides/handling-data

tyhayescreative commented 1 year ago

implemented in v0.1a