|
@ -3,9 +3,11 @@ use std::hash::{Hash, Hasher}; |
|
|
|
|
|
|
|
|
use libpso::character::character::InventoryItem;
|
|
|
use libpso::character::character::InventoryItem;
|
|
|
|
|
|
|
|
|
use crate::entity::item::{Item, ItemDetail, ItemLocation, Shield};
|
|
|
|
|
|
|
|
|
use crate::entity::item::{Item, ItemDetail, ItemLocation};
|
|
|
use crate::entity::item::weapon::Weapon;
|
|
|
use crate::entity::item::weapon::Weapon;
|
|
|
use crate::entity::item::armor::Armor;
|
|
|
use crate::entity::item::armor::Armor;
|
|
|
|
|
|
use crate::entity::item::shield::Shield;
|
|
|
|
|
|
use crate::entity::item::unit::Unit;
|
|
|
use crate::entity::item::tool::StackedTool;
|
|
|
use crate::entity::item::tool::StackedTool;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -13,7 +15,8 @@ fn are_items_same_type(itema: &Item, itemb: &Item) -> bool { |
|
|
match (&itema.item, &itemb.item) {
|
|
|
match (&itema.item, &itemb.item) {
|
|
|
(ItemDetail::Weapon(a), ItemDetail::Weapon(b)) => a.weapon == b.weapon,
|
|
|
(ItemDetail::Weapon(a), ItemDetail::Weapon(b)) => a.weapon == b.weapon,
|
|
|
(ItemDetail::Armor(a), ItemDetail::Armor(b)) => a.armor == b.armor,
|
|
|
(ItemDetail::Armor(a), ItemDetail::Armor(b)) => a.armor == b.armor,
|
|
|
(ItemDetail::Shield(a), ItemDetail::Shield(b)) => a.shield.shield == b.shield.shield,
|
|
|
|
|
|
|
|
|
(ItemDetail::Shield(a), ItemDetail::Shield(b)) => a.shield == b.shield,
|
|
|
|
|
|
(ItemDetail::Unit(a), ItemDetail::Unit(b)) => a.unit == b.unit,
|
|
|
(ItemDetail::Tool(a), ItemDetail::Tool(b)) => a.tool == b.tool,
|
|
|
(ItemDetail::Tool(a), ItemDetail::Tool(b)) => a.tool == b.tool,
|
|
|
_ => false
|
|
|
_ => false
|
|
|
}
|
|
|
}
|
|
@ -109,8 +112,8 @@ impl Hash for StackedItemKey { |
|
|
match &self.0.item {
|
|
|
match &self.0.item {
|
|
|
ItemDetail::Weapon(w) => w.weapon.value().hash(hasher),
|
|
|
ItemDetail::Weapon(w) => w.weapon.value().hash(hasher),
|
|
|
ItemDetail::Armor(a) => a.armor.value().hash(hasher),
|
|
|
ItemDetail::Armor(a) => a.armor.value().hash(hasher),
|
|
|
ItemDetail::Shield(s) => s.shield.shield.value().hash(hasher),
|
|
|
|
|
|
ItemDetail::Unit(u) => u.unit.unit.value().hash(hasher),
|
|
|
|
|
|
|
|
|
ItemDetail::Shield(s) => s.shield.value().hash(hasher),
|
|
|
|
|
|
ItemDetail::Unit(u) => u.unit.value().hash(hasher),
|
|
|
ItemDetail::Tool(t) => t.tool.value().hash(hasher),
|
|
|
ItemDetail::Tool(t) => t.tool.value().hash(hasher),
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -195,6 +198,7 @@ impl Inventory { |
|
|
StackedItem::Individual(Item {item: ItemDetail::Weapon(Weapon {equipped: true, ..}), ..}) => 1,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Weapon(Weapon {equipped: true, ..}), ..}) => 1,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Armor(Armor {equipped: true, ..}), ..}) => 1,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Armor(Armor {equipped: true, ..}), ..}) => 1,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Shield(Shield {equipped: true, ..}), ..}) => 1,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Shield(Shield {equipped: true, ..}), ..}) => 1,
|
|
|
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Unit(Unit{equipped: true, ..}), ..}) => 1,
|
|
|
_ => 0,
|
|
|
_ => 0,
|
|
|
};
|
|
|
};
|
|
|
// because this actually equips the item
|
|
|
// because this actually equips the item
|
|
@ -202,6 +206,7 @@ impl Inventory { |
|
|
StackedItem::Individual(Item {item: ItemDetail::Weapon(Weapon {equipped: true, ..}), ..}) => 8,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Weapon(Weapon {equipped: true, ..}), ..}) => 8,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Armor(Armor {equipped: true, ..}), ..}) => 8,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Armor(Armor {equipped: true, ..}), ..}) => 8,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Shield(Shield {equipped: true, ..}), ..}) => 8,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Shield(Shield {equipped: true, ..}), ..}) => 8,
|
|
|
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Unit(Unit {equipped: true, ..}), ..}) => 8,
|
|
|
_ => 0,
|
|
|
_ => 0,
|
|
|
};
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|