|
@ -222,7 +222,6 @@ impl InventoryItem { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// pub fn get_sell_price(&self) -> Option<u32> {
|
|
|
|
|
|
pub fn get_sell_price(&self) -> Result<u32, ItemManagerError> {
|
|
|
pub fn get_sell_price(&self) -> Result<u32, ItemManagerError> {
|
|
|
match self {
|
|
|
match self {
|
|
|
InventoryItem::Individual(individual_item) => {
|
|
|
InventoryItem::Individual(individual_item) => {
|
|
@ -230,66 +229,50 @@ impl InventoryItem { |
|
|
// TODO: can wrapped items be sold?
|
|
|
// TODO: can wrapped items be sold?
|
|
|
ItemDetail::Weapon(w) => {
|
|
|
ItemDetail::Weapon(w) => {
|
|
|
if !w.tekked {
|
|
|
if !w.tekked {
|
|
|
// return Some(1u32)
|
|
|
|
|
|
return Ok(1u32)
|
|
|
return Ok(1u32)
|
|
|
}
|
|
|
}
|
|
|
if w.is_rare_item() {
|
|
|
if w.is_rare_item() {
|
|
|
// return Some(10u32)
|
|
|
|
|
|
return Ok(10u32)
|
|
|
return Ok(10u32)
|
|
|
}
|
|
|
}
|
|
|
// other item factors?
|
|
|
|
|
|
// Some((WeaponShopItem::from(w).price() / 8) as u32)
|
|
|
|
|
|
Ok((WeaponShopItem::from(w).price() / 8) as u32)
|
|
|
Ok((WeaponShopItem::from(w).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::Armor(a) => {
|
|
|
ItemDetail::Armor(a) => {
|
|
|
if a.is_rare_item() {
|
|
|
if a.is_rare_item() {
|
|
|
// return Some(10u32)
|
|
|
|
|
|
return Ok(10u32)
|
|
|
return Ok(10u32)
|
|
|
}
|
|
|
}
|
|
|
// Some((ArmorShopItem::from(a).price() / 8) as u32)
|
|
|
|
|
|
return Ok((ArmorShopItem::from(a).price() / 8) as u32)
|
|
|
return Ok((ArmorShopItem::from(a).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::Shield(s) => {
|
|
|
ItemDetail::Shield(s) => {
|
|
|
if s.is_rare_item() {
|
|
|
if s.is_rare_item() {
|
|
|
// return Some(10u32)
|
|
|
|
|
|
return Ok(10u32)
|
|
|
return Ok(10u32)
|
|
|
}
|
|
|
}
|
|
|
// Some((ArmorShopItem::from(s).price() / 8) as u32)
|
|
|
|
|
|
return Ok((ArmorShopItem::from(s).price() / 8) as u32)
|
|
|
return Ok((ArmorShopItem::from(s).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::Unit(u) => {
|
|
|
ItemDetail::Unit(u) => {
|
|
|
if u.is_rare_item() {
|
|
|
if u.is_rare_item() {
|
|
|
// return Some(10u32)
|
|
|
|
|
|
return Ok(10u32)
|
|
|
return Ok(10u32)
|
|
|
}
|
|
|
}
|
|
|
// Some((ArmorShopItem::from(u).price() / 8) as u32)
|
|
|
|
|
|
return Ok((ArmorShopItem::from(u).price() / 8) as u32)
|
|
|
return Ok((ArmorShopItem::from(u).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::Tool(t) => {
|
|
|
ItemDetail::Tool(t) => {
|
|
|
if !matches!(t.tool, ToolType::PhotonDrop | ToolType::PhotonSphere | ToolType::PhotonCrystal) && t.is_rare_item() {
|
|
|
if !matches!(t.tool, ToolType::PhotonDrop | ToolType::PhotonSphere | ToolType::PhotonCrystal) && t.is_rare_item() {
|
|
|
// return Some(10u32)
|
|
|
|
|
|
return Ok(10u32)
|
|
|
return Ok(10u32)
|
|
|
}
|
|
|
}
|
|
|
// Some((ToolShopItem::from(t).price() / 8) as u32)
|
|
|
|
|
|
return Ok((ToolShopItem::from(t).price() / 8) as u32)
|
|
|
return Ok((ToolShopItem::from(t).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::TechniqueDisk(d) => { // TODO: are all techs the same?
|
|
|
|
|
|
// Some((ToolShopItem::from(d).price() / 8) as u32)
|
|
|
|
|
|
|
|
|
ItemDetail::TechniqueDisk(d) => {
|
|
|
return Ok((ToolShopItem::from(d).price() / 8) as u32)
|
|
|
return Ok((ToolShopItem::from(d).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::Mag(_m) => { //TODO: error. mags are not sellable
|
|
|
|
|
|
// None
|
|
|
|
|
|
|
|
|
ItemDetail::Mag(_m) => {
|
|
|
return Err(ItemManagerError::ItemNotSellable(self.clone()))
|
|
|
return Err(ItemManagerError::ItemNotSellable(self.clone()))
|
|
|
},
|
|
|
},
|
|
|
ItemDetail::ESWeapon(_e) => {
|
|
|
ItemDetail::ESWeapon(_e) => {
|
|
|
// Some(10u32) // TODO: check price
|
|
|
|
|
|
return Ok(10u32)
|
|
|
return Ok(10u32)
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
// the number of stacked items sold is handled by the caller. this is just the price of 1
|
|
|
// the number of stacked items sold is handled by the caller. this is just the price of 1
|
|
|
InventoryItem::Stacked(stacked_item) => {
|
|
|
InventoryItem::Stacked(stacked_item) => {
|
|
|
// Some((ToolShopItem::from(&stacked_item.tool).price() / 8) as u32)
|
|
|
|
|
|
return Ok((ToolShopItem::from(&stacked_item.tool).price() / 8) as u32)
|
|
|
return Ok((ToolShopItem::from(&stacked_item.tool).price() / 8) as u32)
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|