davelens / fvtt-party-resources

A simple module for FoundryVTT to manage (and track) custom party-wide numeric values.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Simple Calendar integration

RaaviArda opened this issue · comments

Here's an idea: allow resources to be consumed or produced per-time-unit using Simple Calendar's API.

Would require additional configuration for each resource that would let you put in 'change per time unit' and 'type of time unit'. Additionally the resource would also need a storage underneath that would keep last update date.
Example:
Let's say that I have party food and I want it consumed every day. So I'd put in as a negative number in 'change per time unit' and "day" in 'type of time unit'.

Then you'll need a hook on SimpleCalendar.Hooks.DateTimeChange, (data) that is exported by Simple Calendar and just parse the data object that it returns to figure out what day is it. If it is different than last day (from resource) and it's an increment (gotta take into account that these can reset back to 1 but that's still increase) then we just add 'change per time unit' to current resource value and it's done - in this case since change is a negative number the resource will decrease.