kypvalanx / Foundry-VTT-StarWars-SagaEdition

25 stars 7 forks source link

Populating cost attribute for Item Piles module #443

Closed cpadilla closed 10 months ago

cpadilla commented 10 months ago

This closes #435. Overwrote toObject method to include item cost since that is what Item Piles module uses to determine cost.

Initially attempted to add a getter to system.cost, but that didn't work because Item Piles uses toObject first. Since there is no constructor, the best placed I figured I could put the cost getter would be in prepareData, but there were cases where you could have an item in an Item Pile without triggering prepareData so rather than using a getter, I just put the getter logic inside the toObject override method.