|
|
@ -6,6 +6,8 @@ use std::future::Future; |
|
|
|
use std::pin::Pin;
|
|
|
|
use std::iter::IntoIterator;
|
|
|
|
|
|
|
|
use log::warn;
|
|
|
|
|
|
|
|
use libpso::packet::{ship::Message, messages::GameMessage};
|
|
|
|
use crate::ship::map::MapArea;
|
|
|
|
use crate::ship::ship::SendShipPacket;
|
|
|
@ -35,7 +37,7 @@ pub(super) fn take_item_from_floor<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
item_id: ClientItemId
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway + Send,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -54,7 +56,7 @@ where |
|
|
|
pub(super) fn add_floor_item_to_inventory<EG, TR>(
|
|
|
|
character: &CharacterEntity
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), FloorItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), TriggerCreateItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), TriggerCreateItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + Clone + 'static,
|
|
|
@ -103,7 +105,7 @@ pub(super) fn take_item_from_inventory<EG, TR>( |
|
|
|
item_id: ClientItemId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -127,7 +129,7 @@ pub(super) fn add_inventory_item_to_shared_floor<EG, TR>( |
|
|
|
map_area: MapArea,
|
|
|
|
drop_position: (f32, f32, f32),
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -160,7 +162,7 @@ pub(super) fn take_meseta_from_inventory<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -181,7 +183,7 @@ pub(super) fn add_meseta_to_inventory<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
amount: u32 |
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -204,7 +206,7 @@ pub(super) fn add_meseta_to_shared_floor<EG, TR>( |
|
|
|
map_area: MapArea,
|
|
|
|
drop_position: (f32, f32)
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -233,7 +235,7 @@ pub(super) fn take_meseta_from_bank<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -253,7 +255,7 @@ pub(super) fn add_meseta_from_bank_to_inventory<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -274,7 +276,7 @@ pub(super) fn add_meseta_to_bank<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -296,7 +298,7 @@ pub(super) fn take_item_from_bank<EG, TR>( |
|
|
|
item_id: ClientItemId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), BankItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), BankItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -316,7 +318,7 @@ where |
|
|
|
pub(super) fn add_bank_item_to_inventory<EG, TR>(
|
|
|
|
character: &CharacterEntity,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), BankItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -367,7 +369,7 @@ where |
|
|
|
pub(super) fn add_inventory_item_to_bank<EG, TR>(
|
|
|
|
character_id: CharacterEntityId,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -403,7 +405,7 @@ pub(super) fn equip_inventory_item<EG, TR>( |
|
|
|
item_id: ClientItemId,
|
|
|
|
equip_slot: u8,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -425,7 +427,7 @@ pub(super) fn unequip_inventory_item<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
item_id: ClientItemId,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -448,7 +450,7 @@ pub(super) fn sort_inventory_items<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
item_ids: Vec<ClientItemId>,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -470,7 +472,7 @@ where |
|
|
|
pub(super) fn use_consumed_item<EG, TR>(
|
|
|
|
character: &CharacterEntity,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<ApplyItemAction>), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<ApplyItemAction>), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway + Clone + 'static,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -497,7 +499,7 @@ pub(super) fn feed_mag_item<EG, TR>( |
|
|
|
character: CharacterEntity,
|
|
|
|
mag_item_id: ClientItemId,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), CharacterEntity), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), CharacterEntity), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -551,7 +553,7 @@ pub(super) fn add_bought_item_to_inventory<'a, EG, TR>( |
|
|
|
item_id: ClientItemId,
|
|
|
|
amount: u32,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> Pin<Box<dyn Future<Output=Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>> + Send + 'a>>
|
|
|
|
-> Pin<Box<dyn Future<Output=Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>> + Send + 'a>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -613,7 +615,7 @@ where |
|
|
|
pub(super) fn sell_inventory_item<EG, TR>(
|
|
|
|
character_id: CharacterEntityId,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -643,7 +645,7 @@ async fn iterate_inner<'a, EG, TR, I, O, T, F, FR>( |
|
|
|
mut input: Vec<I>,
|
|
|
|
func: F,
|
|
|
|
arg: T,
|
|
|
|
) -> Result<((ItemStateProxy, TR), Vec<O>), ItemStateError>
|
|
|
|
) -> Result<((ItemStateProxy, TR), Vec<O>), anyhow::Error>
|
|
|
|
where
|
|
|
|
'a: 'async_recursion,
|
|
|
|
EG: EntityGateway,
|
|
|
@ -653,7 +655,7 @@ where |
|
|
|
T: Clone + Send + Sync,
|
|
|
|
F: Fn(I) -> FR + Send + Sync + Clone + 'static,
|
|
|
|
FR: Fn((ItemStateProxy, TR), T)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), ItemStateError>> + Send + Sync,
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), anyhow::Error>> + Send + Sync,
|
|
|
|
{
|
|
|
|
let item = match input.pop() {
|
|
|
|
Some(item) => item,
|
|
|
@ -673,7 +675,7 @@ pub(super) fn iterate<EG, TR, I, O, T, F, FR>( |
|
|
|
input: Vec<I>,
|
|
|
|
func: F,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), T)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<O>), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<O>), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -682,7 +684,7 @@ where |
|
|
|
T: Send + Clone + 'static + std::fmt::Debug,
|
|
|
|
F: Fn(I) -> FR + Send + Sync + Clone + 'static,
|
|
|
|
FR: Fn((ItemStateProxy, TR), T)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), ItemStateError>> + Send + Sync,
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), anyhow::Error>> + Send + Sync,
|
|
|
|
T: Clone + Send + Sync,
|
|
|
|
{
|
|
|
|
move |(item_state, transaction), arg| {
|
|
|
@ -701,7 +703,7 @@ async fn foreach_inner<'a, EG, TR, O, T, F, I>( |
|
|
|
state: (ItemStateProxy, TR),
|
|
|
|
mut input: I,
|
|
|
|
func: Arc<F>,
|
|
|
|
) -> Result<((ItemStateProxy, TR), Vec<O>), ItemStateError>
|
|
|
|
) -> Result<((ItemStateProxy, TR), Vec<O>), anyhow::Error>
|
|
|
|
where
|
|
|
|
'a: 'async_recursion,
|
|
|
|
EG: EntityGateway,
|
|
|
@ -709,7 +711,7 @@ where |
|
|
|
O: Send,
|
|
|
|
T: Send,
|
|
|
|
F: Fn((ItemStateProxy, TR), T)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), ItemStateError>> + Send + Sync,
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), anyhow::Error>> + Send + Sync,
|
|
|
|
I: Iterator<Item = T> + Send + Sync + 'static,
|
|
|
|
{
|
|
|
|
let item = match input.next() {
|
|
|
@ -728,14 +730,14 @@ where |
|
|
|
pub(super) fn foreach<EG, TR, O, T, F, I>(
|
|
|
|
func: F
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), I)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<O>), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<O>), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
|
O: Send,
|
|
|
|
T: Send + Clone + 'static + std::fmt::Debug,
|
|
|
|
F: Fn((ItemStateProxy, TR), T)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), ItemStateError>> + Send + Sync + 'static,
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), O), anyhow::Error>> + Send + Sync + 'static,
|
|
|
|
T: Send + Sync,
|
|
|
|
I: IntoIterator<Item = T> + Send + Sync + 'static,
|
|
|
|
I::IntoIter: Send + Sync,
|
|
|
@ -754,7 +756,7 @@ where |
|
|
|
pub(super) fn insert<'a, EG, TR, T>(
|
|
|
|
element: T
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> Pin<Box<dyn Future<Output=Result<((ItemStateProxy, TR), T), ItemStateError>> + Send + 'a>>
|
|
|
|
-> Pin<Box<dyn Future<Output=Result<((ItemStateProxy, TR), T), anyhow::Error>> + Send + 'a>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -772,12 +774,12 @@ pub(super) fn fork<EG, TR, F1, F2, T, O1, O2>( |
|
|
|
func1: F1,
|
|
|
|
func2: F2,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), T)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), (O1, O2)), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), (O1, O2)), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
|
F1: Fn((ItemStateProxy, TR), T) -> BoxFuture<Result<((ItemStateProxy, TR), O1), ItemStateError>> + Send + Sync + 'static,
|
|
|
|
F2: Fn((ItemStateProxy, TR), T) -> BoxFuture<Result<((ItemStateProxy, TR), O2), ItemStateError>> + Send + Sync + 'static,
|
|
|
|
F1: Fn((ItemStateProxy, TR), T) -> BoxFuture<Result<((ItemStateProxy, TR), O1), anyhow::Error>> + Send + Sync + 'static,
|
|
|
|
F2: Fn((ItemStateProxy, TR), T) -> BoxFuture<Result<((ItemStateProxy, TR), O2), anyhow::Error>> + Send + Sync + 'static,
|
|
|
|
T: Send + Sync + Clone + 'static,
|
|
|
|
O1: Send,
|
|
|
|
O2: Send,
|
|
|
@ -799,7 +801,7 @@ where |
|
|
|
pub(super) fn add_item_to_inventory<EG, TR>(
|
|
|
|
character: CharacterEntity,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>> + Clone
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>> + Clone
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -829,7 +831,7 @@ pub(super) fn record_trade<EG, TR>( |
|
|
|
character_to: CharacterEntityId,
|
|
|
|
character_from: CharacterEntityId,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), Vec<InventoryItem>)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<InventoryItem>), ItemStateError>> + Clone
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<InventoryItem>), anyhow::Error>> + Clone
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -855,7 +857,7 @@ where |
|
|
|
|
|
|
|
pub(super) fn assign_new_item_id<EG, TR>(
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>> + Clone
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>> + Clone
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -873,7 +875,7 @@ pub(super) fn convert_item_drop_to_floor_item<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
item_drop: ItemDrop,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ())
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), ItemStateError>> + Clone
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), FloorItem), anyhow::Error>> + Clone
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -881,6 +883,7 @@ where |
|
|
|
move |(mut item_state, mut transaction), _| {
|
|
|
|
let item_drop = item_drop.clone();
|
|
|
|
Box::pin(async move {
|
|
|
|
warn!("converting item drop to floor item");
|
|
|
|
enum ItemOrMeseta {
|
|
|
|
Individual(ItemDetail),
|
|
|
|
Stacked(Tool),
|
|
|
@ -993,7 +996,7 @@ where |
|
|
|
pub(super) fn apply_modifier_to_inventory_item<EG, TR>(
|
|
|
|
modifier: ItemModifier,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), InventoryItem), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -1006,7 +1009,7 @@ where |
|
|
|
weapon.apply_modifier(&modifier);
|
|
|
|
transaction.gateway().add_weapon_modifier(entity_id, modifier).await?;
|
|
|
|
},
|
|
|
|
_ => return Err(ItemStateError::InvalidModifier)
|
|
|
|
_ => return Err(ItemStateError::InvalidModifier.into())
|
|
|
|
}
|
|
|
|
|
|
|
|
Ok(((item_state, transaction), inventory_item))
|
|
|
@ -1016,7 +1019,7 @@ where |
|
|
|
|
|
|
|
pub(super) fn as_individual_item<EG, TR>(
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), InventoryItem)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), IndividualItemDetail), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), IndividualItemDetail), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -1025,7 +1028,7 @@ where |
|
|
|
Box::pin(async move {
|
|
|
|
let item = match inventory_item.item {
|
|
|
|
InventoryItemDetail::Individual(individual_item) => individual_item,
|
|
|
|
_ => return Err(ItemStateError::WrongItemType(inventory_item.item_id))
|
|
|
|
_ => return Err(ItemStateError::WrongItemType(inventory_item.item_id).into())
|
|
|
|
};
|
|
|
|
|
|
|
|
Ok(((item_state, transaction), item))
|
|
|
@ -1038,7 +1041,7 @@ pub(super) fn apply_item_action_packets<EG, TR>( |
|
|
|
character_id: CharacterEntityId,
|
|
|
|
area_client: AreaClient,
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), ApplyItemAction)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<SendShipPacket>), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), Vec<SendShipPacket>), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
@ -1095,7 +1098,7 @@ where |
|
|
|
pub(super) fn apply_item_action_character<EG, TR>(
|
|
|
|
character: &CharacterEntity
|
|
|
|
) -> impl Fn((ItemStateProxy, TR), Vec<ApplyItemAction>)
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), CharacterEntity), ItemStateError>>
|
|
|
|
-> BoxFuture<Result<((ItemStateProxy, TR), CharacterEntity), anyhow::Error>>
|
|
|
|
where
|
|
|
|
EG: EntityGateway,
|
|
|
|
TR: EntityGatewayTransaction<ParentGateway = EG> + 'static,
|
|
|
|