|
@ -65,7 +65,7 @@ pub fn guildcard_send(id: ClientId, |
|
|
class: client.character.char_class.into(),
|
|
|
class: client.character.char_class.into(),
|
|
|
}),
|
|
|
}),
|
|
|
};
|
|
|
};
|
|
|
send_to_client(id, target as u8, msg, &client_location)
|
|
|
|
|
|
|
|
|
send_to_client(id, target as u8, msg, client_location)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
pub async fn request_item<EG>(id: ClientId,
|
|
|
pub async fn request_item<EG>(id: ClientId,
|
|
@ -110,7 +110,7 @@ where |
|
|
};
|
|
|
};
|
|
|
let client = clients.get_mut(&area_client.client).ok_or(ShipError::ClientNotFound(area_client.client))?;
|
|
|
let client = clients.get_mut(&area_client.client).ok_or(ShipError::ClientNotFound(area_client.client))?;
|
|
|
let floor_item = item_manager.enemy_drop_item_on_local_floor(entity_gateway, &client.character, item_drop).await?;
|
|
|
let floor_item = item_manager.enemy_drop_item_on_local_floor(entity_gateway, &client.character, item_drop).await?;
|
|
|
let item_drop_msg = builder::message::item_drop(request_item.client, request_item.target, &floor_item)?;
|
|
|
|
|
|
|
|
|
let item_drop_msg = builder::message::item_drop(request_item.client, request_item.target, floor_item)?;
|
|
|
|
|
|
|
|
|
item_drop_packets.push((area_client.client, SendShipPacket::Message(Message::new(GameMessage::ItemDrop(item_drop_msg)))));
|
|
|
item_drop_packets.push((area_client.client, SendShipPacket::Message(Message::new(GameMessage::ItemDrop(item_drop_msg)))));
|
|
|
}
|
|
|
}
|
|
@ -135,7 +135,7 @@ where |
|
|
|
|
|
|
|
|
// TODO: should not need to fetch the item here to construct this packet
|
|
|
// TODO: should not need to fetch the item here to construct this packet
|
|
|
let (item, floor_type) = item_manager.get_floor_item_by_id(&client.character, ClientItemId(pickup_item.item_id))?;
|
|
|
let (item, floor_type) = item_manager.get_floor_item_by_id(&client.character, ClientItemId(pickup_item.item_id))?;
|
|
|
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 = match item {
|
|
|
let create_item = match item {
|
|
|
FloorItem::Individual(individual_floor_item) => Some(builder::message::create_item(area_client, item.item_id(), &individual_floor_item.item)?),
|
|
|
FloorItem::Individual(individual_floor_item) => Some(builder::message::create_item(area_client, item.item_id(), &individual_floor_item.item)?),
|
|
|
FloorItem::Stacked(stacked_floor_item) => Some(builder::message::create_item(area_client, item.item_id(), &item::ItemDetail::Tool(stacked_floor_item.tool))?),
|
|
|
FloorItem::Stacked(stacked_floor_item) => Some(builder::message::create_item(area_client, item.item_id(), &item::ItemDetail::Tool(stacked_floor_item.tool))?),
|
|
@ -216,7 +216,7 @@ EG: EntityGateway |
|
|
};
|
|
|
};
|
|
|
let client = clients.get_mut(&area_client.client).ok_or(ShipError::ClientNotFound(area_client.client))?;
|
|
|
let client = clients.get_mut(&area_client.client).ok_or(ShipError::ClientNotFound(area_client.client))?;
|
|
|
let floor_item = item_manager.enemy_drop_item_on_local_floor(entity_gateway, &client.character, item_drop).await?; // TODO: unwrap
|
|
|
let floor_item = item_manager.enemy_drop_item_on_local_floor(entity_gateway, &client.character, item_drop).await?; // TODO: unwrap
|
|
|
let item_drop_msg = builder::message::item_drop(box_drop_request.client, box_drop_request.target, &floor_item)?;
|
|
|
|
|
|
|
|
|
let item_drop_msg = builder::message::item_drop(box_drop_request.client, box_drop_request.target, floor_item)?;
|
|
|
item_drop_packets.push((area_client.client, SendShipPacket::Message(Message::new(GameMessage::ItemDrop(item_drop_msg)))))
|
|
|
item_drop_packets.push((area_client.client, SendShipPacket::Message(Message::new(GameMessage::ItemDrop(item_drop_msg)))))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -233,7 +233,7 @@ pub async fn send_bank_list(id: ClientId, |
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
|
|
|
let bank_items = item_manager.get_character_bank(&client.character)?;
|
|
|
let bank_items = item_manager.get_character_bank(&client.character)?;
|
|
|
|
|
|
|
|
|
let bank_items_pkt = builder::message::bank_item_list(&bank_items, client.character.bank_meseta);
|
|
|
|
|
|
|
|
|
let bank_items_pkt = builder::message::bank_item_list(bank_items, client.character.bank_meseta);
|
|
|
Ok(Box::new(vec![(id, SendShipPacket::BankItemList(bank_items_pkt))].into_iter()))
|
|
|
Ok(Box::new(vec![(id, SendShipPacket::BankItemList(bank_items_pkt))].into_iter()))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
@ -278,7 +278,7 @@ where |
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
else {
|
|
|
let item_added_to_inventory = item_manager.player_withdraws_item(entity_gateway, &client.character, ClientItemId(bank_interaction.item_id), bank_interaction.item_amount as usize).await?;
|
|
|
let item_added_to_inventory = item_manager.player_withdraws_item(entity_gateway, &client.character, ClientItemId(bank_interaction.item_id), bank_interaction.item_amount as usize).await?;
|
|
|
let item_created = builder::message::create_withdrawn_inventory_item(area_client, &item_added_to_inventory)?;
|
|
|
|
|
|
|
|
|
let item_created = builder::message::create_withdrawn_inventory_item(area_client, item_added_to_inventory)?;
|
|
|
vec![SendShipPacket::Message(Message::new(GameMessage::CreateItem(item_created)))]
|
|
|
vec![SendShipPacket::Message(Message::new(GameMessage::CreateItem(item_created)))]
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
@ -358,18 +358,12 @@ where |
|
|
},
|
|
|
},
|
|
|
SHOP_OPTION_TOOL => {
|
|
|
SHOP_OPTION_TOOL => {
|
|
|
let item = client.tool_shop.get(buy_item.shop_index as usize).ok_or(ShipError::ShopError)?;
|
|
|
let item = client.tool_shop.get(buy_item.shop_index as usize).ok_or(ShipError::ShopError)?;
|
|
|
let remove = match item {
|
|
|
|
|
|
ToolShopItem::Tech(_) => true,
|
|
|
|
|
|
_ => false,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
let remove = matches!(item, ToolShopItem::Tech(_));
|
|
|
(item, remove)
|
|
|
(item, remove)
|
|
|
},
|
|
|
},
|
|
|
SHOP_OPTION_ARMOR => {
|
|
|
SHOP_OPTION_ARMOR => {
|
|
|
let item = client.armor_shop.get(buy_item.shop_index as usize).ok_or(ShipError::ShopError)?;
|
|
|
let item = client.armor_shop.get(buy_item.shop_index as usize).ok_or(ShipError::ShopError)?;
|
|
|
let remove = match item {
|
|
|
|
|
|
ArmorShopItem::Unit(_) => true,
|
|
|
|
|
|
_ => false,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
let remove = matches!(item, ArmorShopItem::Unit(_));
|
|
|
(item, remove)
|
|
|
(item, remove)
|
|
|
},
|
|
|
},
|
|
|
_ => {
|
|
|
_ => {
|
|
|