pub type Item = item;
Expand description
An item slot. It has a quantity if it’s stackable and optionally a reference to an entity that holds it.
A quantity of zero indicates that the item is not stackable.
Implementations§
source§impl Item
impl Item
sourcepub fn generate_explicit(
&mut self,
item_id: ItemId,
quantity: u16,
sticky: bool,
_ov29: OverlayLoadLease<29>
)
pub fn generate_explicit( &mut self, item_id: ItemId, quantity: u16, sticky: bool, _ov29: OverlayLoadLease<29> )
Initializes an item struct with the given information.
sourcepub fn generate(
&mut self,
item_id: ItemId,
quantity: u16,
sticky_type: Type,
_ov29: OverlayLoadLease<29>
)
pub fn generate( &mut self, item_id: ItemId, quantity: u16, sticky_type: Type, _ov29: OverlayLoadLease<29> )
Initializes an item struct with the given information.
This wraps Self::init
, but with extra logic to resolve the item’s stickiness.
It also calls Self::generate_item_quantity
for Poké.
sourcepub fn generate_item_quantity(&mut self, max_money: i32)
pub fn generate_item_quantity(&mut self, max_money: i32)
Set the quantity code on an item (assuming it’s Poké), given some maximum acceptable money amount.
source§impl Item
impl Item
sourcepub fn new(item_id: ItemId, quantity: u16, sticky: bool) -> Self
pub fn new(item_id: ItemId, quantity: u16, sticky: bool) -> Self
Allocates a new item.
This will resolve the quantity based on the item type:
- For Poké, the quantity code will always be set to 1.
- For thrown items, the quantity code will be randomly generated on the range of valid quantities for that item type.
- For non-stackable items, the quantity code will always be set to 0.
- Otherwise, the quantity will be assigned from the quantity argument.
sourcepub fn init(&mut self, item_id: ItemId, quantity: u16, sticky: bool)
pub fn init(&mut self, item_id: ItemId, quantity: u16, sticky: bool)
Initialize an item struct with the given information.
This will resolve the quantity based on the item type:
- For Poké, the quantity code will always be set to 1.
- For thrown items, the quantity code will be randomly generated on the range of valid quantities for that item type.
- For non-stackable items, the quantity code will always be set to 0.
- Otherwise, the quantity will be assigned from the quantity argument.