pub struct Item {Show 18 fields
pub id: u64,
pub name: String,
pub description: String,
pub icon_char: char,
pub weight: f32,
pub value: u32,
pub rarity: ItemRarity,
pub item_type: ItemType,
pub tags: Vec<String>,
pub stack_size: u32,
pub max_stack: u32,
pub equip_slot: Option<EquipSlot>,
pub weapon_data: Option<WeaponData>,
pub armor_data: Option<ArmorData>,
pub consumable_effects: Vec<ConsumableEffect>,
pub stat_modifiers: Vec<StatModifier>,
pub required_level: u32,
pub affixes: Vec<Affix>,
}Fields§
§id: u64§name: String§description: String§icon_char: char§weight: f32§value: u32§rarity: ItemRarity§item_type: ItemType§stack_size: u32§max_stack: u32§equip_slot: Option<EquipSlot>§weapon_data: Option<WeaponData>§armor_data: Option<ArmorData>§consumable_effects: Vec<ConsumableEffect>§stat_modifiers: Vec<StatModifier>§required_level: u32§affixes: Vec<Affix>Implementations§
Source§impl Item
impl Item
pub fn new(id: u64, name: impl Into<String>, item_type: ItemType) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_icon(self, c: char) -> Self
pub fn with_rarity(self, rarity: ItemRarity) -> Self
pub fn with_value(self, value: u32) -> Self
pub fn with_weight(self, weight: f32) -> Self
pub fn with_slot(self, slot: EquipSlot) -> Self
pub fn with_weapon(self, data: WeaponData) -> Self
pub fn with_armor(self, data: ArmorData) -> Self
pub fn add_modifier(self, m: StatModifier) -> Self
pub fn add_tag(self, tag: impl Into<String>) -> Self
pub fn sell_value(&self) -> u32
pub fn total_stat_bonus(&self, kind: StatKind) -> f32
pub fn is_stackable(&self) -> bool
pub fn can_stack_with(&self, other: &Item) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnsafeUnpin for Item
impl UnwindSafe for Item
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.