You can retrieve the player's current items using:
JavaScript:
let items = $gameParty.items();
let weapons = $gameParty.weapons();
let armors = $gameParty.armors();
let equipItems = $gameParty.equipItems(); // contains weapons and armors.
let allItems = $gameParty.allItems(); // contains items, weapons, and armors.
These are all arrays.
Note that the inventory
DOES NOT contain items that are currently equipped. For example, if the player finds a helmet, that helmet will be in the inventory. If the player equips that helmet, it will be
removed from the inventory.
You can retrieve the party's equipped items like this:
JavaScript:
let equippedItems = $gameParty.members().flatMap(member => member.equips()).filter(equip => equip !== null);
// To combine it with allItems:
let allItemsAndEquipped = allItems.concat(equippedItems);
In order to find out how many of a specific item the player has:
JavaScript:
let item = $gameParty.allItems()[0];
let itemCount = $gameParty.numItems(item);
In this example,
itemCount will be a number representing how many of the first item (item with index 0) the player owns, whatever that "first item" may be.
Again, this does not include equipped items. To include those:
JavaScript:
let equippedItemCount = $gameParty.members().flatMap(member => member.equips()).filter(equip => equip === item).length;
let itemCountAndEquipped = itemCount + equippedItemCount;
As for retrieving an item's data, you can take a look at the
Armors.json,
Items.json, and
Weapons.json files to learn about their structure.
The structure of an item:
JavaScript:
item.animationId // number
item.consumable // boolean
item.damage.critical // boolean
item.damage.elementId // number
item.damage.formula // string
item.damage.type // number
item.damage.variance // number
item.description // string
item.effects[i].code // number
item.effects[i].dataId // number
item.effects[i].value1 // number
item.effects[i].value2 // number
item.hitType // number
item.iconIndex // number
item.id // number
item.itypeId // number
item.meta // notetags
item.name // string
item.note // string
item.occasion // number
item.price // number
item.repeats // number
item.scope // number
item.speed // number
item.successRate // number
item.tpGain // number
The structure of a weapon:
JavaScript:
weapon.animationId // number
weapon.description // string
weapon.etypeId // number
weapon.iconIndex // number
weapon.id // number
weapon.meta // notetags
weapon.name // string
weapon.note // string
weapon.params // array of numbers of length 8
weapon.price // number
weapon.traits[i].code // number
weapon.traits[i].dataId // number
weapon.traits[i].value // number
weapon.wtypeId // number
The structure of an armor:
JavaScript:
armor.atypeId // number
armor.description // string
armor.etypeId // number
armor.iconIndex // number
armor.id // number
armor.meta // notetags
armor.name // string
armor.note // string
armor.params // array of numbers of length 8
armor.price // number
armor.traits[i].code // number
armor.traits[i].dataId // number
armor.traits[i].value // number
The structure of
meta depends on what you put in the "Note" for the item. For example, if you put
<tag1:13>, then you'd have
item.meta.tag1 of type string with the value
"13". And if you have
<tag1:13><tag2:hello>, you'd have
item.meta.tag1 and
item.meta.tag2 of type string with the values
"13" and
"hello" respectively. You can also put notetags without value, like
<tagWithoutValue>, which will give you
item.meta.tagWithoutValue of type boolean with value
true.