|
|
@ -5,7 +5,7 @@ use crate::entity::gateway::EntityGateway; |
|
|
|
use crate::entity::character::{CharacterEntity, CharacterEntityId};
|
|
|
|
use crate::entity::item::{ItemDetail, ItemLocation, BankName};
|
|
|
|
use crate::entity::item::{Meseta, NewItemEntity};
|
|
|
|
use crate::entity::item::tool::Tool;
|
|
|
|
use crate::entity::item::tool::{Tool, ToolType};
|
|
|
|
use crate::ship::map::MapArea;
|
|
|
|
use crate::ship::ship::ItemDropLocation;
|
|
|
|
use crate::ship::drops::{ItemDrop, ItemDropType};
|
|
|
@ -14,6 +14,7 @@ use crate::ship::location::{AreaClient, RoomId}; |
|
|
|
use crate::ship::items::bank::*;
|
|
|
|
use crate::ship::items::floor::*;
|
|
|
|
use crate::ship::items::inventory::*;
|
|
|
|
use crate::ship::items::use_tool;
|
|
|
|
|
|
|
|
|
|
|
|
pub enum TriggerCreateItem {
|
|
|
@ -636,4 +637,45 @@ impl ItemManager { |
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub async fn use_item<EG: EntityGateway>(&mut self,
|
|
|
|
used_item: ItemDetail,
|
|
|
|
entity_gateway: &mut EG,
|
|
|
|
character: &mut CharacterEntity) -> Result<(), ItemManagerError> {
|
|
|
|
match used_item {
|
|
|
|
ItemDetail::Weapon(_w) => {
|
|
|
|
// something like when items are used to combine/transform them?
|
|
|
|
//_ => {}
|
|
|
|
},
|
|
|
|
ItemDetail::Tool(t) => {
|
|
|
|
match t.tool {
|
|
|
|
ToolType::PowerMaterial => {
|
|
|
|
use_tool::power_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
ToolType::MindMaterial => {
|
|
|
|
use_tool::mind_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
ToolType::EvadeMaterial => {
|
|
|
|
use_tool::evade_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
ToolType::DefMaterial => {
|
|
|
|
use_tool::def_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
ToolType::LuckMaterial => {
|
|
|
|
use_tool::luck_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
ToolType::HpMaterial => {
|
|
|
|
use_tool::hp_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
ToolType::TpMaterial => {
|
|
|
|
use_tool::tp_material(entity_gateway, character).await;
|
|
|
|
},
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|