pub struct Item {Show 17 fields
pub id: u64,
pub name: String,
pub description: String,
pub category: ItemCategory,
pub rarity: Rarity,
pub level: u32,
pub base_stats: Vec<StatModifier>,
pub affixes: Vec<ItemAffix>,
pub effects: Vec<ItemEffect>,
pub stack_size: u32,
pub max_stack: u32,
pub value: u64,
pub weight: f32,
pub glyph: char,
pub sockets: Vec<Option<Item>>,
pub element: Option<Element>,
pub set_id: Option<u32>,
}Fields§
§id: u64§name: String§description: String§category: ItemCategory§rarity: Rarity§level: u32§base_stats: Vec<StatModifier>§affixes: Vec<ItemAffix>§effects: Vec<ItemEffect>§stack_size: u32§max_stack: u32§value: u64§weight: f32§glyph: char§sockets: Vec<Option<Item>>§element: Option<Element>§set_id: Option<u32>Implementations§
Source§impl Item
impl Item
pub fn new( name: impl Into<String>, category: ItemCategory, rarity: Rarity, level: u32, ) -> Self
pub fn with_description(self, desc: impl Into<String>) -> Self
pub fn with_stat(self, stat: StatId, kind: ModifierType) -> Self
pub fn with_affix(self, affix: ItemAffix) -> Self
pub fn with_effect(self, effect: ItemEffect) -> Self
pub fn with_element(self, el: Element) -> Self
pub fn add_socket(self) -> Self
pub fn socket_gem(&mut self, slot: usize, gem: Item) -> bool
pub fn display_name(&self) -> String
pub fn all_modifiers(&self) -> Vec<&StatModifier>
pub fn tooltip(&self) -> String
Sourcepub fn stat_bonus(&self, stat: StatId, base: f32) -> f32
pub fn stat_bonus(&self, stat: StatId, base: f32) -> f32
Compute net combat stat bonus for a specific stat.
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.