DynRPG v0.32 Unofficial
Plugin SDK
Public Member Functions | Public Attributes | List of all members
RPG::Inventory Class Reference

Used for the inventory data and statistics of the current game being played. More...

#include <Inventory.h>

Public Member Functions

int getPartyIndex (int databaseId)
 Checks if a particular RPG::Actor is in the party.
 
bool isItemOwned (int id)
 Built-in RM2k3 function checks the inventory to see if an item is owned.
 
void addItem (int id, int amount)
 Built-in RM2k3 function that adds an item to the inventory.
 
void removeItem (int id, int amount)
 Built-in RM2k3 function that removes an item to the inventory.
 
void incrementItemUses (int id)
 Built-in RM2k3 function that increments an items use count by one if it's set to more than one use.
 

Public Attributes

DArray< shortparty
 Similarly to RPG::Actor::partyMember(index), this returns the database value of the hero, however, you can also use this DArray to retrieve the party's size (RPG::inventory->party.size)
 
DArray< shortitems
 Items in the inventory. Index is zero-based.
 
unsigned charitemAmount
 Amount of each item in the inventory.
 
unsigned charitemUses
 Uses count of each item in the inventory.
 
int goldAmount
 Amount of gold the party holds.
 
ImagepartyFaceImage [4]
 Array for the facesets of the 4 party members.
 
int timerOneTicks
 Number of ticks in the first timer.
 
bool timerOneRunning
 Is the first timer running?
 
bool timerOneVisible
 Is the first timer visible?
 
bool timerOneBattle
 Can the first timer be displayed in battle?
 
int numBattles
 Total number of battles.
 
int numVictories
 Total number of victories.
 
int numDefeats
 Total number of defeats.
 
int numEscapes
 Total number of escapes.
 
int numTurns
 Total number of battle turns?
 
int numSteps
 Total umber of steps taken.
 
int timerTwoTicks
 Number of ticks in the second timer.
 
bool timerTwoRunning
 Is the second timer running?
 
bool timerTwoVisible
 Is the second timer visible?
 
bool timerTwoBattle
 Can the second timer be displayed in battle?
 

Detailed Description

Used for the inventory data and statistics of the current game being played.

See also
RPG::inventory
RPG::Item
RPG::items

Member Function Documentation

◆ addItem()

void RPG::Inventory::addItem ( int id,
int amount )

Built-in RM2k3 function that adds an item to the inventory.

Parameters
idThe database ID of the item
amountAmount of the item to add

◆ getPartyIndex()

int RPG::Inventory::getPartyIndex ( int databaseId)

Checks if a particular RPG::Actor is in the party.

Parameters
databaseIdThe database ID of the actor.
Returns
If the actor is in the party, their party index is returned (0-3), otherwise -1 is returned.

◆ incrementItemUses()

void RPG::Inventory::incrementItemUses ( int id)

Built-in RM2k3 function that increments an items use count by one if it's set to more than one use.

Parameters
idThe database ID of the item

◆ isItemOwned()

bool RPG::Inventory::isItemOwned ( int id)

Built-in RM2k3 function checks the inventory to see if an item is owned.

Parameters
idThe database ID of the item
Returns
true if the item is owned, otherwise false

◆ removeItem()

void RPG::Inventory::removeItem ( int id,
int amount )

Built-in RM2k3 function that removes an item to the inventory.

Parameters
idThe database ID of the item
amountAmount of the item to add

Member Data Documentation

◆ goldAmount

int RPG::Inventory::goldAmount

Amount of gold the party holds.

Note
Max value: 999999. Any value higher will be automatically set to 999999.

◆ itemAmount

unsigned char* RPG::Inventory::itemAmount

Amount of each item in the inventory.

Note
This points to the item's amount array, which shares the same size as RPG::Inventory::items. Therefore, you could do "for (int i=0; i<RPG::inventory->items[i]; i++)" to loop through all of the items, followed by RPG::inventory->itemAmount[i] to access the amounts. RPG::inventory->itemAmount[3] will get the amount of the fourth item.

◆ itemUses

unsigned char* RPG::Inventory::itemUses

Uses count of each item in the inventory.

Note
This points to the item's uses array in memory, which shares the same size as RPG::Inventory::items, in the same manner as RPG::Inventory::itemAmount. The item's use value is set via "Number of Uses" in the database or RPG::Item::numUses.

Assuming a Potion has 5 uses, and itemAmount is 3:

itemUses = 0 -- The potion hasn't been used yet
itemUses = 1 -- It's been used once, itemAmount hasn't decreased yet
itemUses = 2 -- It's been used twice, itemAmount hasn't decreased yet
itemUses = 3 -- It's been used three times, itemAmount hasn't decreased yet
itemUses = 4 -- It's been used four times, itemAmount hasn't decreased yet

On the fifth use, itemUses is reset to 0, and itemAmount decreases to 2.


The documentation for this class was generated from the following file: