Core/Packets: converted CMSG_TOTEM_DESTROYED to packet class and added packet class for SMSG_TOTEM_CREATED
This commit is contained in:
1 parent
1993440a96
commit
4e9a7ec5e4
5 files changed
+101
-12
No files matched your search
@@ -39,6 +39,7 @@
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellPackets.h"
|
||||
#include "Totem.h"
|
||||
#include "TotemPackets.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
@@ -415,26 +416,20 @@ void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
|
||||
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
|
||||
void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& packet)
|
||||
{
|
||||
// ignore for remote control state
|
||||
if (_player->IsCharming())
|
||||
return;
|
||||
|
||||
uint8 slotId;
|
||||
uint64 guid;
|
||||
recvPacket >> slotId;
|
||||
recvPacket >> guid;
|
||||
|
||||
++slotId;
|
||||
if (slotId >= MAX_TOTEM_SLOT)
|
||||
if (packet.Slot +1 >= MAX_TOTEM_SLOT)
|
||||
return;
|
||||
|
||||
if (!_player->m_SummonSlot[slotId])
|
||||
if (!_player->m_SummonSlot[packet.Slot + 1])
|
||||
return;
|
||||
|
||||
Creature* totem = ObjectAccessor::GetCreature(*GetPlayer(), _player->m_SummonSlot[slotId]);
|
||||
if (totem && totem->IsTotem() && totem->GetGUID() == guid)
|
||||
Creature* totem = ObjectAccessor::GetCreature(*GetPlayer(), _player->m_SummonSlot[packet.Slot + 1]);
|
||||
if (totem && totem->IsTotem() && totem->GetGUID() == packet.TotemGUID)
|
||||
totem->ToTotem()->UnSummon();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "SpellPackets.h"
|
||||
#include "SystemPackets.h"
|
||||
#include "TicketPackets.h"
|
||||
#include "TotemPackets.h"
|
||||
#include "TradePackets.h"
|
||||
#include "VehiclePackets.h"
|
||||
#include "WhoPackets.h"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "TotemPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::Totem::TotemCreated::Write()
|
||||
{
|
||||
_worldPacket << uint8(Slot);
|
||||
_worldPacket << Totem;
|
||||
_worldPacket << int32(Duration);
|
||||
_worldPacket << int32(SpellID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Totem::TotemDestroyed::Read()
|
||||
{
|
||||
_worldPacket >> Slot;
|
||||
_worldPacket >> TotemGUID;
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TotemPackets_h__
|
||||
#define TotemPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Totem
|
||||
{
|
||||
class TotemCreated final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TotemCreated() : ServerPacket(SMSG_TOTEM_CREATED, 8 + 4 + 4 + 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Totem;
|
||||
int32 SpellID = 0;
|
||||
int32 Duration = 0;
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
|
||||
class TotemDestroyed final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TotemDestroyed(WorldPacket&& packet) : ClientPacket(CMSG_TOTEM_DESTROYED, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid TotemGUID;
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // TotemPackets_h__
|
||||
@@ -234,6 +234,11 @@ namespace WorldPackets
|
||||
class Complaint;
|
||||
}
|
||||
|
||||
namespace Totem
|
||||
{
|
||||
class TotemDestroyed;
|
||||
}
|
||||
|
||||
namespace Trade
|
||||
{
|
||||
class AcceptTrade;
|
||||
@@ -1061,7 +1066,7 @@ class TC_GAME_API WorldSession
|
||||
|
||||
void HandleSetActionBarToggles(WorldPacket& recvData);
|
||||
|
||||
void HandleTotemDestroyed(WorldPacket& recvData);
|
||||
void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& packet);
|
||||
void HandleDismissCritter(WorldPacket& recvData);
|
||||
|
||||
//Battleground
|
||||
|
||||
Reference in new issue
Block a user