Game (functions)/Inventory
This page documents the ScriptGame class for Lua scripting.
As a singleton class, it can be accessed from Lua with GAME.
FindPlayerItem
GAME:FindPlayerItem(id, held, inv)
Finds an item in the player's team and returns its slot within the inventory or among its team's equips.
Parameters
| Name | Type | Description |
|---|---|---|
| System.String | System.String | The item ID to search for. |
| System.Boolean | System.Boolean | Check equipped items. |
| System.Boolean | System.Boolean | Check inventory items. |
Returns
| Type | Description |
|---|---|
| RogueEssence.Dungeon.InvSlot | The InvSlot of the item. Invalid if the item could not be found. |
GetPlayerEquippedCount
GAME:GetPlayerEquippedCount()
Get the number of items equipped by players. Does not include guests.
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of items. |
GetPlayerBagCount
GAME:GetPlayerBagCount()
Get the number of items in the bag.
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of items. |
GetPlayerBagLimit
GAME:GetPlayerBagLimit()
Gets the maximum amount of item the player's team can carry.
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of items. |
GetPlayerEquippedItem
GAME:GetPlayerEquippedItem(slot)
Gets the equipped item for the character in the specified slot.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The team slot of the character to check |
Returns
| Type | Description |
|---|---|
| System.Object | The character's equipped item |
GetGuestEquippedItem
GAME:GetGuestEquippedItem(slot)
Gets the equipped item for the character in the specified guest slot.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The guest slot of the character to check |
Returns
| Type | Description |
|---|---|
| System.Object | The character's equipped item |
GivePlayerItem
GAME:GivePlayerItem(item)
Gives an item and adds it to the player team's bag.
Parameters
| Name | Type | Description |
|---|---|---|
| RogueEssence.Dungeon.InvItem | RogueEssence.Dungeon.InvItem | The item to give |
GivePlayerItem
GAME:GivePlayerItem(id, count, cursed, hiddenval)
Gives an item and adds it to the player team's bag.
Parameters
| Name | Type | Description |
|---|---|---|
| System.String | System.String | The ID of the item |
| System.Int32 | System.Int32 | The amount to give. Default 1 |
| System.Boolean | System.Boolean | Whether the item is cursed. Default false. |
| System.String | System.String | The hidden value of the item. Default empty string. |
GetPlayerBagItem
GAME:GetPlayerBagItem(slot)
Gets the item found at the specified slot of the player's bag.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The slot to check |
Returns
| Type | Description |
|---|---|
| System.Object | The item found in the slot |
TakePlayerBagItem
GAME:TakePlayerBagItem(slot, takeAll)
Remove an item from player inventory
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The slot from which to remove the item |
| System.Boolean | System.Boolean |
TakePlayerEquippedItem
GAME:TakePlayerEquippedItem(slot, takeAll)
Remove the equipped item from a chosen member of the team
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The slot of the character on the team from which to remove the item |
| System.Boolean | System.Boolean | Removes all stacks if set to true, removes one if set to false. Has no effect for unstackable items. |
TakeGuestEquippedItem
GAME:TakeGuestEquippedItem(slot, takeAll)
Remove the equipped item from a chosen guest of the team
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The slot of the character on the team's guest list from which to remove the item |
| System.Boolean | System.Boolean | Removes all stacks if set to true, removes one if set to false. Has no effect for unstackable items. |
GetPlayerStorageCount
GAME:GetPlayerStorageCount()
Get the amount of items in the player's storage
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetPlayerStorageItemCount
GAME:GetPlayerStorageItemCount(id)
Get the amount of a specific item in the player's storage
Parameters
| Name | Type | Description |
|---|---|---|
| System.String | System.String | ID of the item ot check |
Returns
| Type | Description |
|---|---|
| System.Int32 | The amount of copies currently in storage |
GivePlayerStorageItem
GAME:GivePlayerStorageItem(item)
Gives an item and adds it to the player team's storage.
Parameters
| Name | Type | Description |
|---|---|---|
| RogueEssence.Dungeon.InvItem | RogueEssence.Dungeon.InvItem | The item to give |
GivePlayerStorageItem
GAME:GivePlayerStorageItem(id, count, cursed, hiddenval)
Gives an item and adds it to the player team's storage.
Parameters
| Name | Type | Description |
|---|---|---|
| System.String | System.String | The ID of the item |
| System.Int32 | System.Int32 | The amount to give. Default 1 |
| System.Boolean | System.Boolean | Whether the item is cursed. Default false. |
| System.String | System.String | The hidden value of the item. Default empty string. |
TakePlayerStorageItem
GAME:TakePlayerStorageItem(id)
Takes an item from the storage
Parameters
| Name | Type | Description |
|---|---|---|
| System.String | System.String | The ID of the item to take |
DepositAll
GAME:DepositAll()
Takes all items in the player team's bag and equipped items, and deposits them in storage.
GetPlayerMoney
GAME:GetPlayerMoney()
Gets the amount of money the player currently has on hand.
Returns
| Type | Description |
|---|---|
| System.Int32 | The amount of money. |
AddToPlayerMoney
GAME:AddToPlayerMoney(toadd)
Adds money to the player's wallet.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The amount of money to add. |
RemoveFromPlayerMoney
GAME:RemoveFromPlayerMoney(toremove)
Removes money from the player's wallet.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The amount of money to remove. |
GetPlayerMoneyBank
GAME:GetPlayerMoneyBank()
Gets the amount of money in the player's bank
Returns
| Type | Description |
|---|---|
| System.Int32 | The amount of money. |
AddToPlayerMoneyBank
GAME:AddToPlayerMoneyBank(toadd)
Adds money to the player's bank.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The amount of money to add. |
RemoveFromPlayerMoneyBank
GAME:RemoveFromPlayerMoneyBank(toremove)
Removes money from the player's bank.
Parameters
| Name | Type | Description |
|---|---|---|
| System.Int32 | System.Int32 | The amount of money to remove. |
References
https://github.com/RogueCollab/RogueEssence/blob/master/RogueEssence/Lua/ScriptGameInventory.cs
