Browse Source

don't double count picked up meseta

pbs
jake 5 years ago
parent
commit
25d5658042
  1. 15
      src/ship/packet/handler/direct_message.rs

15
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::ship::{SendShipPacket, ShipError, Clients, Rooms};
use crate::ship::location::{ClientLocation, ClientLocationError}; use crate::ship::location::{ClientLocation, ClientLocationError};
use crate::ship::drops::ItemDrop; use crate::ship::drops::ItemDrop;
use crate::ship::items::{ItemManager, ItemManagerError};
use crate::ship::items::{ItemManager, ItemManagerError, FloorItemType};
use crate::entity::gateway::EntityGateway; use crate::entity::gateway::EntityGateway;
use libpso::utf8_to_utf16_array; use libpso::utf8_to_utf16_array;
use crate::ship::packet::builder; use crate::ship::packet::builder;
@ -144,7 +144,10 @@ where
}; };
let remove_item = builder::message::remove_item_from_floor(area_client, &item)?; 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) { match item_manager.move_item_from_floor_to_inventory(entity_gateway, &mut client, item) {
Ok(_) => { Ok(_) => {
Ok(Box::new(Vec::new().into_iter() Ok(Box::new(Vec::new().into_iter()
@ -158,9 +161,11 @@ where
.map(move |c| { .map(move |c| {
(c.client, SendShipPacket::Message(Message::new(GameMessage::RemoveItemFromFloor(remove_item.clone())))) (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) => { Err(err) => {

Loading…
Cancel
Save