Skip to content

inventory.h

add_item

s32 add_item(s32 itemID) source

Add itemID to player inventory and return inventory slot in which it was placed. Returns the index of the new item in the player's inventory, or -1 if there was no room.

remove_item

s32 remove_item(s32 itemID) source

Remove first instance of itemID found in player inventory. Returns the index of the removed item in the player's inventory, or -1 none was found.

has_item

s32 has_item(s32 itemID) source

Check whether player has itemID in their inventory. Returns boolean 'does player have item?'.

find_item

s32 find_item(s32 itemID) source

Search player inventory for itemID and return first matching array index. Returns the index of the given item in the player's inventory, or -1 if not found.

count_item

s32 count_item(s32 itemID) source

Search player inventory for itemID and count the number matches. Returns the number of items matching itemID.

is_badge_equipped

s32 is_badge_equipped(s32 itemID) source

Returns whether the player has itemID as an equipped badge.

get_consumables_count

s32 get_consumables_count() source

Returns the number of consumables in player inventory.

get_consumables_empty

s32 get_consumables_empty() source

Returns the available room for consumables in player inventory.

store_item

s32 store_item(s32 itemID) source

Add itemID to player storage and return slot in which it was placed. Returns the index of the new item in player storage, or -1 if there was no room.

get_stored_count

s32 get_stored_count() source

Returns the number of consumables in player storage.

get_stored_empty

s32 get_stored_empty() source

Returns the available room in player storage.

item_is_consumable

static s32 item_is_consumable(s32 itemID) source

Returns whether itemID is a Consumable.

item_is_badge

static s32 item_is_badge(s32 itemID) source

Returns whether itemID is a Badge.

item_is_key

static s32 item_is_key(s32 itemID) source

Returns whether itemID is a Key Item.

recover_hp

s32 recover_hp(s32 amt) source

Recover player HP. amt is the amount to recover, -1 for full, or -2 for full and increase max by 1 (unused). Returns the new HP value, after recovery has been applied.

recover_fp

s32 recover_fp(s32 amt) source

Recover player FP. amt is the amount to recover, -1 for full, or -2 for full and increase max by 1 (unused). Returns the new FP value, after recovery has been applied.