davelens / fvtt-party-resources

A simple module for FoundryVTT to manage (and track) custom party-wide numeric values.
MIT License
6 stars 16 forks source link

[Feature Request] Simple Calendar integration #75

Open RaaviArda opened 1 year ago

RaaviArda commented 1 year ago

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.