Type Definition eos_rs::api::items::ItemId

source ·
pub type ItemId = item_id;
Expand description

An item ID with associated methods to get metadata.

Use the associated constants or the Self::new method to get instances of this.

Implementations§

source§

impl ItemId

This impl provides general metadata about items in the game.

source

pub const unsafe fn new(id: u32) -> Self

Returns the ID struct for the item with the given ID.

Safety

The caller must make sure the ID is valid (refers to an existing item), otherwise this is UB.

source

pub const fn id(&self) -> u32

Returns the ID of this item.

source

pub fn category(&self) -> ItemCategoryId

Returns the category ID of this item.

source

pub fn can_be_thrown(&self) -> bool

source

pub fn is_valid(&self) -> bool

source

pub fn fallback_if_invalid(self) -> Self

source

pub fn is_money(&self) -> bool

source

pub fn is_aura_bow(&self) -> bool

Checks if the item is one of the aura bows received at the start of the game.

source

pub fn get_exclusive_item_offset(&self) -> i32

Gets the exclusive item offset, which is the item ID relative to that of the first exclusive item, the Prism Ruff.

source

pub fn get_dungeon_item_action(&self, _ov29: OverlayLoadLease<29>) -> Type

Returns the action ID that corresponds to an item given its ID.

The action is based on the category of the item (see ITEM_CATEGORY_ACTIONS), unless the specified ID is 0x16B, in which case ACTION_UNK_35 is returned.

Some items can have unexpected actions, such as thrown items, which have ACTION_NOTHING. This is done to prevent duplicate actions from being listed in the menu (since items always have a “throw” option), since a return value of ACTION_NOTHING prevents the option from showing up in the menu.

source

pub fn get_exclusive_item_offset_checked_for_validity(&self) -> i32

Gets the exclusive item offset, which is the item ID relative to that of the first exclusive item, the Prism Ruff.

If the given item ID is not a valid item ID, ItemId::ITEM_PLAIN_SEED (0x55) is returned. This is a bug, since 0x55 is the valid exclusive item offset for the Icy Globe.

source

pub fn get_thrown_item_quantity_minimum(&self) -> u8

Get the minimum quantity for this (thrown) item ID.

source

pub fn get_thrown_item_quantity_maximum(&self) -> u8

Get the maximum quantity for this (thrown) item ID.

source

pub fn apply_exclusive_item_stat_boosts( &self, atk_to_modify: &mut u8, sp_atk_to_modify: &mut u8, def_to_modify: &mut u8, sp_def_to_modify: &mut u8 )

Applies stat boosts from an exclusive item.

source

pub fn get_faint_reason(&self, move_id: MoveId) -> faint_reason

Gets the faint reason code (see HandleFaint) for a given move-item combination.

If there’s no item, the reason code is the move ID. If the item is an orb, return FAINT_REASON_ORB_ITEM. Otherwise, return FAINT_REASON_NON_ORB_ITEM.

Trait Implementations§

source§

impl Copy for ItemId