Struct eos_rs::ffi::item

source ·
#[repr(C)]
pub struct item { pub _bitfield_align_1: [u8; 0], pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1]>, pub held_by: u8, pub quantity: u16, pub id: item_id_16, }

Fields§

§_bitfield_align_1: [u8; 0]§_bitfield_1: __BindgenBitfieldUnit<[u8; 1]>§held_by: u8§quantity: u16§id: item_id_16

Implementations§

source§

impl item

source

pub fn generate_explicit( &mut self, item_id: ItemId, quantity: u16, sticky: bool, _ov29: OverlayLoadLease<29> )

Initializes an item struct with the given information.

source

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é.

source

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

source

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.
source

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.
source§

impl item

source

pub fn f_exists(&self) -> bool_

source

pub fn set_f_exists(&mut self, val: bool_)

source

pub fn f_in_shop(&self) -> bool_

source

pub fn set_f_in_shop(&mut self, val: bool_)

source

pub fn f_unpaid(&self) -> bool_

source

pub fn set_f_unpaid(&mut self, val: bool_)

source

pub fn f_sticky(&self) -> bool_

source

pub fn set_f_sticky(&mut self, val: bool_)

source

pub fn f_set(&self) -> bool_

source

pub fn set_f_set(&mut self, val: bool_)

source

pub fn flags_unk5(&self) -> u8

source

pub fn set_flags_unk5(&mut self, val: u8)

source

pub fn new_bitfield_1( f_exists: bool_, f_in_shop: bool_, f_unpaid: bool_, f_sticky: bool_, f_set: bool_, flags_unk5: u8 ) -> __BindgenBitfieldUnit<[u8; 1]>

Auto Trait Implementations§

§

impl RefUnwindSafe for item

§

impl Send for item

§

impl Sync for item

§

impl Unpin for item

§

impl UnwindSafe for item

Blanket Implementations§

§

impl<T> Any for Twhere T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
§

impl<T> Borrow<T> for Twhere T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Src, Dst> CastFrom<Src> for Dstwhere Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for Twhere U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

source§

impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.