From 102497309334e42e1fed1e1030d4645a3fd4858f Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 9 Oct 2021 23:29:00 +0200 Subject: [PATCH] Fix equipping weapon not updating current spell Fixes #3074 --- Source/msg.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index 4c298116c..b2c14e0ac 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1534,17 +1534,21 @@ DWORD OnBreakObject(const TCmd *pCmd, int pnum) DWORD OnChangePlayerItems(const TCmd *pCmd, int pnum) { const auto &message = *reinterpret_cast(pCmd); + auto &player = Players[pnum]; + + if (message.bLoc >= NUM_INVLOC) + return sizeof(message); + + auto bodyLocation = static_cast(message.bLoc); if (gbBufferMsgs == 1) { SendPacket(pnum, &message, sizeof(message)); - } else if (pnum != MyPlayerId && message.bLoc < NUM_INVLOC && message.wIndx <= IDI_LAST) { - auto &player = Players[pnum]; - auto bodyLocation = static_cast(message.bLoc); - + } else if (pnum != MyPlayerId && message.wIndx <= IDI_LAST) { CheckInvSwap(player, bodyLocation, message.wIndx, message.wCI, message.dwSeed, message.bId != 0, message.dwBuff); - player.ReadySpellFromEquipment(bodyLocation); } + player.ReadySpellFromEquipment(bodyLocation); + return sizeof(message); }