1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-07-17 10:47:44 +00:00

Send equip item updates again

This was lost in the inventory refactoring because it was only
handled by ZoneConnection::send_inventory, but it needs to happen
elsewhere now.
This commit is contained in:
Joshua Goins 2025-07-13 08:42:56 -04:00
parent fe4d0d2344
commit b84462fd6f

View file

@ -6,7 +6,7 @@ use kawari::RECEIVE_BUFFER_SIZE;
use kawari::common::Position;
use kawari::common::{GameData, timestamp_secs};
use kawari::config::get_config;
use kawari::inventory::{Item, ItemOperationKind};
use kawari::inventory::{ContainerType, Item, ItemOperationKind};
use kawari::ipc::chat::{ServerChatIpcData, ServerChatIpcSegment};
use kawari::ipc::zone::{
ActorControlCategory, ActorControlSelf, PlayerEntry, PlayerSpawn, PlayerStatus, SocialList,
@ -811,6 +811,28 @@ async fn client_loop(
connection.player_data.inventory.process_action(action);
// if updated equipped items, we have to process that
if action.src_storage_id == ContainerType::Equipped || action.dst_storage_id == ContainerType::Equipped {
let main_weapon_id;
let model_ids;
{
let mut game_data = connection.gamedata.lock().unwrap();
let inventory = &connection.player_data.inventory;
main_weapon_id = inventory.get_main_weapon_id(&mut game_data);
model_ids = inventory.get_model_ids(&mut game_data);
}
connection.handle
.send(ToServer::Equip(
connection.id,
connection.player_data.actor_id,
main_weapon_id,
model_ids,
))
.await;
}
if action.operation_type == ItemOperationKind::Discard {
tracing::info!("Player is discarding from their inventory!");