From 25d5658042ac640a65ef08ae8d715f2c587992ba Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 6 May 2020 07:51:29 -0600 Subject: [PATCH] don't double count picked up meseta --- src/ship/packet/handler/direct_message.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ship/packet/handler/direct_message.rs b/src/ship/packet/handler/direct_message.rs index fcbd3ae..5b4e228 100644 --- a/src/ship/packet/handler/direct_message.rs +++ b/src/ship/packet/handler/direct_message.rs @@ -5,7 +5,7 @@ use crate::common::serverstate::ClientId; use crate::ship::ship::{SendShipPacket, ShipError, Clients, Rooms}; use crate::ship::location::{ClientLocation, ClientLocationError}; use crate::ship::drops::ItemDrop; -use crate::ship::items::{ItemManager, ItemManagerError}; +use crate::ship::items::{ItemManager, ItemManagerError, FloorItemType}; use crate::entity::gateway::EntityGateway; use libpso::utf8_to_utf16_array; use crate::ship::packet::builder; @@ -144,7 +144,10 @@ where }; let remove_item = builder::message::remove_item_from_floor(area_client, &item)?; - let create_item = builder::message::create_item(area_client, &item)?; + let create_item = match item.item { + FloorItemType::Meseta(_) => None, + _ => Some(builder::message::create_item(area_client, &item)?), + }; match item_manager.move_item_from_floor_to_inventory(entity_gateway, &mut client, item) { Ok(_) => { Ok(Box::new(Vec::new().into_iter() @@ -158,9 +161,11 @@ where .map(move |c| { (c.client, SendShipPacket::Message(Message::new(GameMessage::RemoveItemFromFloor(remove_item.clone())))) })) - .chain(clients_in_area.into_iter().map(move |c| { - (c.client, SendShipPacket::Message(Message::new(GameMessage::CreateItem(create_item.clone())))) - }))) + .chain(clients_in_area.into_iter().filter_map(move |c| { + //(c.client, SendShipPacket::Message(Message::new(GameMessage::CreateItem(create_item.clone())))) + create_item.clone().map(|ci| (c.client, SendShipPacket::Message(Message::new(GameMessage::CreateItem(ci))))) + } + ))) ) }, Err(err) => {