You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
889 B
43 lines
889 B
#![allow(dead_code)]
|
|
pub mod weapon;
|
|
pub mod tool;
|
|
pub mod armor;
|
|
pub mod shield;
|
|
|
|
use std::io::{Read, Seek};
|
|
use crate::{PacketParseError};
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
pub enum Item {
|
|
Weapon(weapon::Weapon),
|
|
Armor(armor::Armor),
|
|
Shield(shield::Shield),
|
|
//Unit(Unit),
|
|
//Mag(Mag),
|
|
Tool(tool::Tool),
|
|
}
|
|
|
|
|
|
impl Item {
|
|
fn from_bytes<R: Read + Seek>(_cursor: &mut R) -> Result<Self, PacketParseError> {
|
|
unimplemented!()
|
|
}
|
|
pub fn as_bytes(&self) -> [u8; 16] {
|
|
match self {
|
|
Item::Weapon(wep) => wep.as_bytes(),
|
|
Item::Armor(armor) => armor.as_bytes(),
|
|
Item::Shield(shield) => shield.as_bytes(),
|
|
Item::Tool(tool) => tool.as_bytes(),
|
|
}
|
|
}
|
|
|
|
pub fn is_stackable(&self) -> bool {
|
|
match self {
|
|
Item::Tool(_) => true,
|
|
_ => false,
|
|
}
|
|
}
|
|
|
|
}
|