tell other players you don't have meseta when you drop it
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
872794e45f
commit
3a10de502a
@ -156,6 +156,15 @@ pub fn player_no_longer_has_item(area_client: AreaClient, item_id: ClientItemId,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn player_no_longer_has_meseta(area_client: AreaClient, amount: u32) -> PlayerNoLongerHasItem {
|
||||
PlayerNoLongerHasItem {
|
||||
client: area_client.local_client.id(),
|
||||
target: 0,
|
||||
item_id: 0xFFFFFFFF,
|
||||
amount,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shop_list<I: ShopItem>(shop_type: u8, items: &[I]) -> ShopList {
|
||||
let items = items.iter()
|
||||
.enumerate()
|
||||
|
@ -135,13 +135,26 @@ where
|
||||
let dropped_meseta = item_manager.player_drops_meseta_on_shared_floor(entity_gateway, &mut client.character, drop_location, no_longer_has_item.amount as u32).await?;
|
||||
|
||||
let dropped_meseta_pkt = builder::message::drop_split_meseta_stack(area_client, &dropped_meseta)?;
|
||||
let no_longer_has_meseta_pkt = builder::message::player_no_longer_has_meseta(area_client, no_longer_has_item.amount as u32);
|
||||
client.item_drop_location = None;
|
||||
|
||||
let clients_in_area = client_location.get_clients_in_room(room_id).map_err(|err| -> ClientLocationError { err.into() })?;
|
||||
Ok(Box::new(clients_in_area.into_iter()
|
||||
.map(move |c| {
|
||||
(c.client, SendShipPacket::Message(Message::new(GameMessage::DropSplitStack(dropped_meseta_pkt.clone()))))
|
||||
})))
|
||||
std::iter::once((c.client, SendShipPacket::Message(Message::new(GameMessage::DropSplitStack(dropped_meseta_pkt.clone())))))
|
||||
.chain(
|
||||
if c.client != id {
|
||||
Box::new(std::iter::once(
|
||||
(c.client, SendShipPacket::Message(Message::new(GameMessage::PlayerNoLongerHasItem(no_longer_has_meseta_pkt.clone()))))
|
||||
)) as Box<dyn Iterator<Item = _> + Send>
|
||||
}
|
||||
else {
|
||||
Box::new(std::iter::empty()) as Box<dyn Iterator<Item = _> + Send>
|
||||
}
|
||||
)
|
||||
})
|
||||
.flatten()
|
||||
))
|
||||
}
|
||||
else {
|
||||
let dropped_item = item_manager.player_drops_partial_stack_on_shared_floor(entity_gateway, &client.character, drop_location.item_id, drop_location, no_longer_has_item.amount as usize).await?;
|
||||
|
Loading…
x
Reference in New Issue
Block a user