Item Validations
When Items
are added/removed to/from backpacks, the Player program checks for the presence of an add_to_pack_validation
on the PlayerClass
of the Player
. If set, this callback is called, and if it fails, then the add_item
or remove_item
call fails. This can be quite useful for making sure users cannot add items that are too powerful to packs, or something like that.
The key layout for this callback's args is:
If the call is add_item
, it will try to call a method on your callback contract called add_item_validation
and if it's remove_item
, it will be remove_item_validation
. The args passed will be:
This Callback expects an Anchor program on the other end, so if it isn't one, God have mercy on your soul.
Last updated