Suggested API Enhancements for Inventory and Progression Systems

I have compiled a few suggestions for API changes. I am interested in your opinions:

Inventory/Economy:

  • InventorySystem.SetOnConsumeReward:

    • IMO there should be an additional consumedItem parameter. There is no way to access the speficic instance properties of the source item.
    • Would it be possible to add a metadata object to the ConsumeItems call? This object could then be read out in the SetOnConsumeReward hook, to modify the resulting rewards with additional user input.
  • InventorySystem.GrantItems:

    • Could we have a parameter to set inventory item properties directly when granting items? Currently you’d have to grant the items, then call the InventorySystem.UpdateItems call. It would be more convenient to set the initial properties via GrantItems(..., properties map[string]*hiro.InventoryUpdateItemProperties, ...) or something
  • EconomySystem.CanPurchaseItem:

    • I’d like to be able to check if an economy store item can be purchased, without actually having to call EconomySystem.PurchaseItem, almost like adding --dry-run flag. As of now I need to go through all rewards in the economy store item, and check their costs and item (set) limits,

Progression:

  • The ability to define progressions as prerequisite for item purchases would be very convenient. According to the docs only costs can be defined as requirement. At the moment we have a custom system to check if an item can be bought, based on its associated progression (matching ids)
"some_id": {
    "cost": { ... }
    "progressions": {
        "some_progression_id" // Required to be completed
    }
  }
}