fantasycalendar / FoundryVTT-ItemPiles

Other
34 stars 54 forks source link

[REQUEST] - Put the currency management in a separate module or add some more "simple" API for manage the currency ? #498

Closed p4535992 closed 8 months ago

p4535992 commented 8 months ago

Is your feature request related to a problem? Please describe.

I'm recently working with my lazy money module to make it multi-system and integrable with Item Piles, but before I go advanced I wanted to make a proposal... separate the currency management part in a separate module ? Or alternatively add simpler API methods like addCurrency, substractCurrency, etc. ? Usually 99% of my opertions are add, remove and check currency on actors.

This is because I believe that currency management should be something separate from item piles from a logical point of view.

Describe the solution you'd like

Below are the three options I propose:

1) Create a separate utility module for currency so as to help all the other modules that are around (several among the ones I manage XD) that need to manage currency and secondary currency of Item Piles, so i can try to pr what little code I did in a more focused enviroment.

2) Add on Item Piles some "simpler" APIs, (I read the api , but I got lost at some point, so maybe they are already there) e.g. addCurrency({actor, value: 5, denom: "gp"}), substractCurrency({actor,value: 5, denom: "gp"}), hasEnoughMoney({actor,value: 5, denom: "gp"}) in short something like what I did here for lazy money API.

3) Kill lazy money and integrate what little code I did directly on item piles (maybe this is the better solution).

These are the solutions I thought of but let me know

Describe alternatives you've considered

Kill lazy money and integrate what little code I did directly on item piles.

Additional context

Haxxer commented 8 months ago
// Add 10 GP to the target
game.itempiles.API.addCurrencies(token, "10gp");

// Remove 10 GP and 5 SP from the target
game.itempiles.API.removeCurrencies(token, "10gp 5sp");

// Get the payment data for a certain price
game.itempiles.API.getaPayementData("10gp", { target: token });

What was confusing about the documentation? How can I improve it?

p4535992 commented 8 months ago

OK now I've seen them... I don't know how I missed them...