From b84462fd6fb5e667b3f2394c4605be7ab5f81004 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 13 Jul 2025 08:42:56 -0400 Subject: [PATCH] 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. --- src/bin/kawari-world.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/bin/kawari-world.rs b/src/bin/kawari-world.rs index 6a981bb..cc18960 100644 --- a/src/bin/kawari-world.rs +++ b/src/bin/kawari-world.rs @@ -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!");