From ec2c99d17542914190e64c46678f051545d3beb9 Mon Sep 17 00:00:00 2001 From: Emagi Date: Wed, 28 May 2025 14:33:34 -0400 Subject: [PATCH] Fix equip/unequip with calculations causing a potential watchdog --- source/WorldServer/Commands/Commands.cpp | 1 + source/WorldServer/LuaFunctions.cpp | 5 ++++- source/WorldServer/client.cpp | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/WorldServer/Commands/Commands.cpp b/source/WorldServer/Commands/Commands.cpp index 46c54ad..671d9fc 100644 --- a/source/WorldServer/Commands/Commands.cpp +++ b/source/WorldServer/Commands/Commands.cpp @@ -7221,6 +7221,7 @@ void Commands::Command_Inventory(Client* client, Seperator* sep, EQ2_RemoteComma } client->UnequipItem(index, bag_id, to_slot, appearance_equip); + client->GetPlayer()->CalculateBonuses(); } else if(sep->arg[2][0] && strncasecmp("swap_equip", sep->arg[0], 10) == 0 && sep->IsNumber(1) && sep->IsNumber(2)) { diff --git a/source/WorldServer/LuaFunctions.cpp b/source/WorldServer/LuaFunctions.cpp index bc15e34..1e73dc0 100644 --- a/source/WorldServer/LuaFunctions.cpp +++ b/source/WorldServer/LuaFunctions.cpp @@ -7066,7 +7066,10 @@ int EQ2Emu_lua_UnequipSlot(lua_State* state) { } else{ Client* client = ((Player*)spawn)->GetClient(); - client->UnequipItem(item->details.index); + if(client) { + client->UnequipItem(item->details.index); + client->GetPlayer()->CalculateBonuses(); + } } } } diff --git a/source/WorldServer/client.cpp b/source/WorldServer/client.cpp index 898b6c9..4c3a9c8 100644 --- a/source/WorldServer/client.cpp +++ b/source/WorldServer/client.cpp @@ -8066,7 +8066,6 @@ void Client::UnequipItem(int16 index, sint32 bag_id, int8 to_slot, int8 appearan } GetPlayer()->UpdateWeapons(); - GetPlayer()->CalculateBonuses(); EQ2Packet* characterSheetPackets = GetPlayer()->GetPlayerInfo()->serialize(GetVersion()); QueuePacket(characterSheetPackets); }