add unit structure
This commit is contained in:
		
							parent
							
								
									74bbd5ed49
								
							
						
					
					
						commit
						c65994fb7b
					
				@ -2,6 +2,7 @@ pub mod weapon;
 | 
			
		||||
pub mod armor; 
 | 
			
		||||
pub mod shield;
 | 
			
		||||
pub mod tool;
 | 
			
		||||
pub mod unit;
 | 
			
		||||
 | 
			
		||||
//use libpso::item;
 | 
			
		||||
use libpso::character::character;
 | 
			
		||||
@ -57,6 +58,12 @@ pub struct Shield {
 | 
			
		||||
    pub shield: shield::Shield,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Clone, Debug, PartialEq)]
 | 
			
		||||
pub struct Unit {
 | 
			
		||||
    pub equipped: bool,
 | 
			
		||||
    pub unit: unit::Unit,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Clone, Debug, PartialEq)]
 | 
			
		||||
pub struct Tool {
 | 
			
		||||
    pub tool: tool::ToolType,
 | 
			
		||||
@ -75,6 +82,7 @@ pub enum ItemDetail {
 | 
			
		||||
    Weapon(Weapon),
 | 
			
		||||
    Armor(Armor),
 | 
			
		||||
    Shield(Shield),
 | 
			
		||||
    Unit(Unit),
 | 
			
		||||
    Tool(Tool),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -91,6 +99,7 @@ impl ItemDetail {
 | 
			
		||||
            ItemDetail::Weapon(weapon) => weapon.weapon.as_bytes(),
 | 
			
		||||
            ItemDetail::Armor(armor) => armor.armor.as_bytes(),
 | 
			
		||||
            ItemDetail::Shield(shield) => shield.shield.as_bytes(),
 | 
			
		||||
            ItemDetail::Unit(unit) => unit.unit.as_bytes(),
 | 
			
		||||
            ItemDetail::Tool(tool) => tool.as_bytes(),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -108,6 +108,7 @@ impl Hash for StackedItemKey {
 | 
			
		||||
            ItemDetail::Weapon(w) => w.weapon.weapon.value().hash(hasher),
 | 
			
		||||
            ItemDetail::Armor(a) => a.armor.armor.value().hash(hasher),
 | 
			
		||||
            ItemDetail::Shield(s) => s.shield.shield.value().hash(hasher),
 | 
			
		||||
            ItemDetail::Unit(u) => u.unit.unit.value().hash(hasher),
 | 
			
		||||
            ItemDetail::Tool(t) => t.tool.value().hash(hasher),
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user