|
@ -10,6 +10,7 @@ use crate::entity::item::armor::Armor; |
|
|
use crate::entity::item::shield::Shield;
|
|
|
use crate::entity::item::shield::Shield;
|
|
|
use crate::entity::item::unit::Unit;
|
|
|
use crate::entity::item::unit::Unit;
|
|
|
use crate::entity::item::tool::Tool;
|
|
|
use crate::entity::item::tool::Tool;
|
|
|
|
|
|
use crate::entity::item::mag::Mag;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, PartialEq)]
|
|
|
#[derive(Debug, PartialEq)]
|
|
@ -39,6 +40,7 @@ impl ActiveItem { |
|
|
ItemDetail::Unit(u) => u.as_bytes(),
|
|
|
ItemDetail::Unit(u) => u.as_bytes(),
|
|
|
ItemDetail::Tool(t) => t.as_individual_bytes(),
|
|
|
ItemDetail::Tool(t) => t.as_individual_bytes(),
|
|
|
ItemDetail::TechniqueDisk(d) => d.as_bytes(),
|
|
|
ItemDetail::TechniqueDisk(d) => d.as_bytes(),
|
|
|
|
|
|
ItemDetail::Mag(m) => m.as_bytes(),
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
StackedItem::Stacked(i) => {
|
|
|
StackedItem::Stacked(i) => {
|
|
@ -61,6 +63,7 @@ impl ActiveInventory { |
|
|
.fold([InventoryItem::default(); 30], |mut inventory, (index, item)| {
|
|
|
.fold([InventoryItem::default(); 30], |mut inventory, (index, item)| {
|
|
|
let bytes = item.as_client_bytes();
|
|
|
let bytes = item.as_client_bytes();
|
|
|
inventory[index].data1.copy_from_slice(&bytes[0..12]);
|
|
|
inventory[index].data1.copy_from_slice(&bytes[0..12]);
|
|
|
|
|
|
inventory[index].data2.copy_from_slice(&bytes[12..16]);
|
|
|
inventory[index].item_id = item.id.0;
|
|
|
inventory[index].item_id = item.id.0;
|
|
|
|
|
|
|
|
|
// does this do anything?
|
|
|
// does this do anything?
|
|
@ -69,7 +72,7 @@ impl ActiveInventory { |
|
|
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,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Unit(Unit{equipped: true, ..}), ..}) => 1,
|
|
|
//StackedItem::Individual(Item {item: ItemDetail::Mag(Mag{equipped: true, ..}), ..}) => 1,
|
|
|
|
|
|
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Mag(Mag{equipped: true, ..}), ..}) => 1,
|
|
|
_ => 0,
|
|
|
_ => 0,
|
|
|
};
|
|
|
};
|
|
|
// because this actually equips the item
|
|
|
// because this actually equips the item
|
|
@ -78,7 +81,7 @@ impl ActiveInventory { |
|
|
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,
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Unit(Unit {equipped: true, ..}), ..}) => 8,
|
|
|
//StackedItem::Individual(Item {item: ItemDetail::Mag(Mag{equipped: true, ..}), ..}) => 8,
|
|
|
|
|
|
|
|
|
StackedItem::Individual(Item {item: ItemDetail::Mag(Mag{equipped: true, ..}), ..}) => 8,
|
|
|
_ => 0,
|
|
|
_ => 0,
|
|
|
};
|
|
|
};
|
|
|
inventory
|
|
|
inventory
|
|
|