Compare commits
No commits in common. "0f0adb05a3d3d8d53007166530983e8b83a15447" and "e8494c5bbd5d368cbd4459da98b8217a7f5551c3" have entirely different histories.
0f0adb05a3
...
e8494c5bbd
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1040,6 +1040,7 @@ checksum = "739e9d7726dc32173fed2d69d17eef3c54682169e4e20ff1d0a45dcd37063cef"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "libpso"
|
name = "libpso"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
source = "git+http://git.sharnoth.com/jake/libpso#05222bbf9fe402675447bc163b45e07a327cdb1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"psopacket",
|
"psopacket",
|
||||||
@ -1398,6 +1399,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "psopacket"
|
name = "psopacket"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
source = "git+http://git.sharnoth.com/jake/libpso#05222bbf9fe402675447bc163b45e07a327cdb1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -612,9 +612,6 @@ pub enum PgItemNoteDetail {
|
|||||||
Deposit {
|
Deposit {
|
||||||
character_id: u32,
|
character_id: u32,
|
||||||
bank: BankIdentifier,
|
bank: BankIdentifier,
|
||||||
},
|
|
||||||
FloorLimitReached {
|
|
||||||
map_area: MapArea,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,12 +658,7 @@ impl From<ItemNote> for PgItemNoteDetail {
|
|||||||
character_id: character_id.0,
|
character_id: character_id.0,
|
||||||
bank,
|
bank,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
ItemNote::FloorLimitReached { map_area } => {
|
|
||||||
PgItemNoteDetail::FloorLimitReached {
|
|
||||||
map_area,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -711,9 +703,6 @@ impl From<PgItemNoteDetail> for ItemNote {
|
|||||||
character_id: CharacterEntityId(character_id),
|
character_id: CharacterEntityId(character_id),
|
||||||
bank,
|
bank,
|
||||||
},
|
},
|
||||||
PgItemNoteDetail::FloorLimitReached { map_area } => ItemNote::FloorLimitReached {
|
|
||||||
map_area,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,6 @@ pub enum ItemNote {
|
|||||||
character_id: CharacterEntityId,
|
character_id: CharacterEntityId,
|
||||||
bank: BankIdentifier,
|
bank: BankIdentifier,
|
||||||
},
|
},
|
||||||
FloorLimitReached {
|
|
||||||
map_area: MapArea,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||||
|
@ -1148,25 +1148,3 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn delete_item_from_floor<'a, EG, TR>(
|
|
||||||
map_area: MapArea
|
|
||||||
) -> impl Fn((ItemStateProxy, TR), FloorItem)
|
|
||||||
-> BoxFuture<'a, Result<((ItemStateProxy, TR), ()), anyhow::Error>>
|
|
||||||
where
|
|
||||||
EG: EntityGateway,
|
|
||||||
TR: EntityGatewayTransaction<ParentGateway = EG> + Clone + 'a,
|
|
||||||
{
|
|
||||||
move |(item_state, transaction), floor_item| {
|
|
||||||
Box::pin(async move {
|
|
||||||
let transaction = floor_item.with_entity_id(transaction, |mut transaction, entity_id| {
|
|
||||||
async move {
|
|
||||||
transaction.gateway().add_item_note(&entity_id, ItemNote::FloorLimitReached {
|
|
||||||
map_area
|
|
||||||
}).await?;
|
|
||||||
Ok(transaction)
|
|
||||||
}}).await?;
|
|
||||||
Ok(((item_state, transaction), ()))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -508,27 +508,3 @@ where
|
|||||||
Ok((transaction, item))
|
Ok((transaction, item))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn floor_item_limit_reached<'a, EG> (
|
|
||||||
item_state: &'a ItemState,
|
|
||||||
entity_gateway: &'a mut EG,
|
|
||||||
character: &'a CharacterEntity,
|
|
||||||
item_id: &'a ClientItemId,
|
|
||||||
map_area: MapArea
|
|
||||||
) -> BoxFuture<'a, Result<(), anyhow::Error>>
|
|
||||||
where
|
|
||||||
EG: EntityGateway + 'static,
|
|
||||||
EG::Transaction<'a>: Clone,
|
|
||||||
{
|
|
||||||
entity_gateway.with_transaction(move |transaction| async move {
|
|
||||||
let item_state_proxy = ItemStateProxy::new(item_state.clone());
|
|
||||||
let((item_state_proxy, transaction), result) = ItemStateAction::default()
|
|
||||||
.act(actions::take_item_from_floor(character.id, *item_id))
|
|
||||||
.act(actions::delete_item_from_floor(map_area))
|
|
||||||
.commit((item_state_proxy, transaction))
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
item_state_proxy.commit().await;
|
|
||||||
Ok((transaction, result))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -10,7 +10,7 @@ use crate::ship::location::{ClientLocation, ClientLocationError};
|
|||||||
use crate::ship::items::ClientItemId;
|
use crate::ship::items::ClientItemId;
|
||||||
use crate::ship::packet::builder;
|
use crate::ship::packet::builder;
|
||||||
use crate::ship::items::state::ItemState;
|
use crate::ship::items::state::ItemState;
|
||||||
use crate::ship::items::tasks::{drop_item, drop_partial_item, drop_meseta, equip_item, unequip_item, sort_inventory, use_item, feed_mag, sell_item, take_meseta, floor_item_limit_reached};
|
use crate::ship::items::tasks::{drop_item, drop_partial_item, drop_meseta, equip_item, unequip_item, sort_inventory, use_item, feed_mag, sell_item, take_meseta};
|
||||||
|
|
||||||
pub async fn request_exp<EG>(id: ClientId,
|
pub async fn request_exp<EG>(id: ClientId,
|
||||||
request_exp: RequestExp,
|
request_exp: RequestExp,
|
||||||
@ -500,28 +500,3 @@ where
|
|||||||
})}).await??;
|
})}).await??;
|
||||||
Ok(Vec::new()) // TODO: send the packet to other clients
|
Ok(Vec::new()) // TODO: send the packet to other clients
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn floor_item_limit_deletion<EG> (id: ClientId,
|
|
||||||
floor_item_limit_delete: FloorItemLimitItemDeletion,
|
|
||||||
entity_gateway: &mut EG,
|
|
||||||
client_location: &ClientLocation,
|
|
||||||
clients: &Clients,
|
|
||||||
rooms: &Rooms,
|
|
||||||
item_state: &mut ItemState)
|
|
||||||
-> Result<Vec<(ClientId, SendShipPacket)>, anyhow::Error>
|
|
||||||
where
|
|
||||||
EG: EntityGateway + Clone + 'static,
|
|
||||||
{
|
|
||||||
let room_id = client_location.get_room(id).await.map_err(|err| -> ClientLocationError { err.into() })?;
|
|
||||||
let map_area = rooms.with(room_id, |room| Box::pin(async move {
|
|
||||||
room.map_areas.get_area_map(floor_item_limit_delete.map_area)
|
|
||||||
})).await??;
|
|
||||||
|
|
||||||
clients.with(id, |client| {
|
|
||||||
let mut entity_gateway = entity_gateway.clone();
|
|
||||||
let item_state = item_state.clone();
|
|
||||||
Box::pin(async move {
|
|
||||||
floor_item_limit_reached(&item_state, &mut entity_gateway, &client.character, &ClientItemId(floor_item_limit_delete.item_id), map_area).await
|
|
||||||
})}).await??;
|
|
||||||
Ok(Vec::new())
|
|
||||||
}
|
|
||||||
|
@ -575,10 +575,6 @@ impl<EG: EntityGateway + Clone + 'static> ShipServerState<EG> {
|
|||||||
GameMessage::PlayerSoldItem(player_sold_item) => {
|
GameMessage::PlayerSoldItem(player_sold_item) => {
|
||||||
handler::message::player_sells_item(id, player_sold_item, &mut self.entity_gateway, &self.clients, &mut self.item_state).await?
|
handler::message::player_sells_item(id, player_sold_item, &mut self.entity_gateway, &self.clients, &mut self.item_state).await?
|
||||||
},
|
},
|
||||||
GameMessage::FloorItemLimitItemDeletion(floor_item_limit_delete) => {
|
|
||||||
let block = self.blocks.get_from_client(id, &self.clients).await?;
|
|
||||||
handler::message::floor_item_limit_deletion(id, floor_item_limit_delete, &mut self.entity_gateway, &block.client_location, &self.clients, &block.rooms, &mut self.item_state).await?
|
|
||||||
},
|
|
||||||
_ => {
|
_ => {
|
||||||
let cmsg = msg.clone();
|
let cmsg = msg.clone();
|
||||||
let block = self.blocks.get_from_client(id, &self.clients).await?;
|
let block = self.blocks.get_from_client(id, &self.clients).await?;
|
||||||
|
@ -262,7 +262,6 @@ async fn test_pick_up_meseta_when_inventory_full() {
|
|||||||
room: 0,
|
room: 0,
|
||||||
x: 0.0,
|
x: 0.0,
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
amount: 23,
|
|
||||||
})))).await.unwrap();
|
})))).await.unwrap();
|
||||||
|
|
||||||
ship.handle(ClientId(2), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
ship.handle(ClientId(2), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
||||||
@ -487,7 +486,6 @@ async fn test_can_not_drop_more_meseta_than_is_held() {
|
|||||||
room: 0,
|
room: 0,
|
||||||
x: 0.0,
|
x: 0.0,
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
amount: 301,
|
|
||||||
})))).await.unwrap();
|
})))).await.unwrap();
|
||||||
|
|
||||||
let split_attempt = ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
let split_attempt = ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
||||||
@ -606,7 +604,6 @@ async fn test_can_not_pick_up_meseta_when_full() {
|
|||||||
room: 0,
|
room: 0,
|
||||||
x: 0.0,
|
x: 0.0,
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
amount: 23,
|
|
||||||
})))).await.unwrap();
|
})))).await.unwrap();
|
||||||
|
|
||||||
ship.handle(ClientId(2), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
ship.handle(ClientId(2), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
||||||
@ -661,7 +658,6 @@ async fn test_meseta_caps_at_999999_when_trying_to_pick_up_more() {
|
|||||||
room: 0,
|
room: 0,
|
||||||
x: 0.0,
|
x: 0.0,
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
amount: 23,
|
|
||||||
})))).await.unwrap();
|
})))).await.unwrap();
|
||||||
|
|
||||||
ship.handle(ClientId(2), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
ship.handle(ClientId(2), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
||||||
@ -726,7 +722,6 @@ async fn test_player_drops_partial_stack_and_other_player_picks_it_up() {
|
|||||||
room: 0,
|
room: 0,
|
||||||
x: 0.0,
|
x: 0.0,
|
||||||
z: 0.0,
|
z: 0.0,
|
||||||
amount: 2,
|
|
||||||
})))).await.unwrap();
|
})))).await.unwrap();
|
||||||
|
|
||||||
ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
ship.handle(ClientId(1), RecvShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(PlayerNoLongerHasItem {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user