Equipment
What a player wears and holds ready: the ten slots of the page inside their backpack's door.
A handle to something in the game. Once that thing is gone, its calls fail with Gone. You get one from player.equipment().
Methods
| Method | Description |
|---|---|
fn defense(&self) -> Result<i64>long defense() | Defense from everything worn. |
fn attack(&self) -> Result<i64>long attack() | Attack of the main-hand weapon. |
fn block(&self) -> Result<i64>long block() | Block of the off-hand shield. |
fn get(&self, slot: GearSlot) -> Result<Option<ItemStack>>Optional<ItemStack> get(GearSlot slot) | What a slot holds. |
fn set(&self, slot: GearSlot, stack: Option<ItemStack>) -> Result<()>void set(GearSlot slot, ItemStack stack) player_data | Puts a piece on (it must suit the slot), or takes it off to nowhere. |
fn swap_hands(&self) -> Result<()>void swapHands() player_data | Swaps the main-hand and off-hand pieces, as SWAP does. |
GearSlot
A slot of the equipment page.
One of a fixed set of values.
| Value | Meaning |
|---|---|
GearSlot::HelmetGearSlot.HELMET | Head. |
GearSlot::NecklaceGearSlot.NECKLACE | Neck. |
GearSlot::ChestGearSlot.CHEST | Chest. |
GearSlot::LegsGearSlot.LEGS | Legs. |
GearSlot::BootsGearSlot.BOOTS | Feet. |
GearSlot::GlovesGearSlot.GLOVES | Hands. |
GearSlot::Ring1GearSlot.RING_1 | First ring. |
GearSlot::Ring2GearSlot.RING_2 | Second ring. |
GearSlot::MainHandGearSlot.MAIN_HAND | The weapon holstered for the main hand. |
GearSlot::OffHandGearSlot.OFF_HAND | The shield or weapon holstered for the other hand. |