Initial commit, implements most of the static_data side.
This commit is contained in:
34
src/static_data/items/item.rs
Normal file
34
src/static_data/items/item.rs
Normal file
@@ -0,0 +1,34 @@
|
||||
use super::item_category::{BattleItemCategory, ItemCategory};
|
||||
use derive_getters::Getters;
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[derive(Getters, Debug)]
|
||||
pub struct Item {
|
||||
name: String,
|
||||
category: ItemCategory,
|
||||
battle_category: BattleItemCategory,
|
||||
price: i32,
|
||||
flags: HashSet<String>,
|
||||
}
|
||||
|
||||
impl Item {
|
||||
pub fn new(
|
||||
name: &str,
|
||||
category: ItemCategory,
|
||||
battle_category: BattleItemCategory,
|
||||
price: i32,
|
||||
flags: HashSet<String>,
|
||||
) -> Item {
|
||||
Item {
|
||||
name: name.to_string(),
|
||||
category,
|
||||
battle_category,
|
||||
price,
|
||||
flags,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn has_flag(&self, key: &str) -> bool {
|
||||
self.flags.contains(key)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user