From 4e2ac8f680d93f1277cadcab1fdb293a066b9538 Mon Sep 17 00:00:00 2001
From: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
Date: Mon, 18 Aug 2025 20:27:50 +0200
Subject: [PATCH] Core/Player: updated packet handler of CMSG_TOTEM_DESTROYED
to use the new SummonInfo API to destroy totem slot summons
*this allows other classes to cancel their summons if they go into the totem slots as well (e.g. Paladin Consecration, DK ghouls)
---
src/server/game/Handlers/SpellHandler.cpp | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index f92da7b84f..322d58d9ec 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -15,12 +15,11 @@
* with this program. If not, see .
*/
-#include "WorldSession.h"
#include "Archaeology.h"
#include "Common.h"
#include "Config.h"
-#include "DatabaseEnv.h"
#include "DBCStores.h"
+#include "DatabaseEnv.h"
#include "GameClient.h"
#include "GameObject.h"
#include "GameObjectAI.h"
@@ -39,10 +38,12 @@
#include "SpellCastRequest.h"
#include "SpellMgr.h"
#include "SpellPackets.h"
+#include "SummonInfo.h"
#include "Totem.h"
#include "TotemPackets.h"
#include "World.h"
#include "WorldPacket.h"
+#include "WorldSession.h"
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
{
@@ -423,15 +424,15 @@ void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& pac
if (_player->IsCharming())
return;
- if (packet.Slot +1 >= MAX_TOTEM_SLOT)
+ SummonPropertiesSlot slot = static_cast(packet.Slot + 1);
+ if (slot < SummonPropertiesSlot::Totem1 || slot > SummonPropertiesSlot::Totem4)
return;
- if (!_player->m_SummonSlot[packet.Slot + 1])
+ SummonInfo* summonInfo = _player->GetSummonInSlot(slot);
+ if (!summonInfo)
return;
- Creature* totem = ObjectAccessor::GetCreature(*GetPlayer(), _player->m_SummonSlot[packet.Slot + 1]);
- if (totem && totem->IsTotem() && totem->GetGUID() == packet.TotemGUID)
- totem->ToTotem()->UnSummon();
+ summonInfo->GetSummonedCreature()->DespawnOrUnsummon();
}
void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/)