|
|
@ -8,9 +8,9 @@ use crate::entity::gateway::{EntityGateway, GatewayError}; |
|
|
|
use crate::entity::character::{CharacterEntity, TechLevel};
|
|
|
|
use crate::entity::item::mag::{MagCell, MagCellError};
|
|
|
|
use crate::entity::item::tool::{Tool, ToolType};
|
|
|
|
use crate::entity::item::tech::{TechniqueDisk, Technique};
|
|
|
|
use crate::entity::item::tech::TechniqueDisk;
|
|
|
|
use crate::entity::item::{ItemDetail, ItemEntityId};
|
|
|
|
use crate::ship::items::state::{ItemStateProxy, ItemStateError};
|
|
|
|
use crate::ship::items::state::ItemStateProxy;
|
|
|
|
use crate::ship::items::inventory::{InventoryItem, InventoryItemDetail};
|
|
|
|
|
|
|
|
|
|
|
@ -26,10 +26,6 @@ pub enum ApplyItemError { |
|
|
|
InvalidTool,
|
|
|
|
#[error("gateway error {0}")]
|
|
|
|
GatewayError(#[from] GatewayError),
|
|
|
|
|
|
|
|
//#[error("itemstate error {0}")]
|
|
|
|
//ItemStateError(Box<ItemStateError>),
|
|
|
|
|
|
|
|
#[error("magcell error {0}")]
|
|
|
|
MagCellError(#[from] MagCellError),
|
|
|
|
}
|
|
|
@ -42,15 +38,6 @@ pub enum ApplyItemAction { |
|
|
|
//RemoveItem,
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
impl From<ItemStateError> for ApplyItemError {
|
|
|
|
fn from(other: ItemStateError) -> ApplyItemError {
|
|
|
|
ApplyItemError::ItemStateError(Box::new(other))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
async fn power_material<EG: EntityGateway + ?Sized>(entity_gateway: &mut EG, character: &mut CharacterEntity) -> Result<Vec<ApplyItemAction>, anyhow::Error> {
|
|
|
|
character.materials.power += 1;
|
|
|
|
entity_gateway.save_character(character).await?;
|
|
|
@ -315,14 +302,14 @@ where |
|
|
|
// TODO: rest of these
|
|
|
|
_ => Err(anyhow::Error::from(ApplyItemError::InvalidTool))
|
|
|
|
.with_context(|| {
|
|
|
|
format!("invalid tool {:?}", tool)
|
|
|
|
format!("invalid tool {tool:?}")
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn apply_tech<'a, EG>(item_state: &mut ItemStateProxy,
|
|
|
|
async fn apply_tech<'a, EG>(_item_state: &mut ItemStateProxy,
|
|
|
|
entity_gateway: &mut EG,
|
|
|
|
character: &mut CharacterEntity,
|
|
|
|
_entity_id: ItemEntityId,
|
|
|
@ -353,7 +340,7 @@ where |
|
|
|
ItemDetail::TechniqueDisk(tech) => apply_tech(item_state, entity_gateway, character, individual_item.entity_id, tech).await,
|
|
|
|
_ => Err(anyhow::Error::from(ApplyItemError::InvalidItem))
|
|
|
|
.with_context(|| {
|
|
|
|
format!("item {:?}", individual_item)
|
|
|
|
format!("item {individual_item:?}")
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|