mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/PacketIO: updated totem packets (#23634)
(cherry picked from commit 5c813f6f02)
# Conflicts:
# src/server/game/Entities/Totem/Totem.cpp
# src/server/game/Handlers/SpellHandler.cpp
# src/server/game/Server/Protocol/Opcodes.cpp
# src/server/game/Server/WorldSession.h
This commit is contained in:
@@ -19,12 +19,11 @@
|
||||
#include "Totem.h"
|
||||
#include "Group.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "TotemPackets.h"
|
||||
|
||||
Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner, false)
|
||||
{
|
||||
@@ -60,12 +59,12 @@ void Totem::InitStats(uint32 duration)
|
||||
uint32 slot = m_Properties->Slot;
|
||||
if (slot >= SUMMON_SLOT_TOTEM_FIRE && slot < MAX_TOTEM_SLOT)
|
||||
{
|
||||
WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4);
|
||||
data << uint8(m_Properties->Slot - 1);
|
||||
data << uint64(GetGUID());
|
||||
data << uint32(duration);
|
||||
data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
||||
GetOwner()->ToPlayer()->SendDirectMessage(&data);
|
||||
WorldPackets::Totem::TotemCreated data;
|
||||
data.Totem = GetGUID();
|
||||
data.Slot = slot - SUMMON_SLOT_TOTEM_FIRE;
|
||||
data.Duration = duration;
|
||||
data.SpellID = GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||
owner->SendDirectMessage(data.Write());
|
||||
}
|
||||
|
||||
// set display id depending on caster's race
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Totem.h"
|
||||
#include "TotemPackets.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
@@ -556,17 +557,15 @@ void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
|
||||
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
|
||||
void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& totemDestroyed)
|
||||
{
|
||||
// ignore for remote control state
|
||||
if (_player->GetUnitBeingMoved() != _player)
|
||||
return;
|
||||
|
||||
uint8 slotId;
|
||||
uint8 slotId = totemDestroyed.Slot;
|
||||
slotId += SUMMON_SLOT_TOTEM_FIRE;
|
||||
|
||||
recvPacket >> slotId;
|
||||
|
||||
++slotId;
|
||||
if (slotId >= MAX_TOTEM_SLOT)
|
||||
return;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "QueryPackets.h"
|
||||
#include "QuestPackets.h"
|
||||
#include "SpellPackets.h"
|
||||
#include "TotemPackets.h"
|
||||
#include "WorldStatePackets.h"
|
||||
|
||||
#endif // AllPackets_h__
|
||||
|
||||
33
src/server/game/Server/Packets/TotemPackets.cpp
Normal file
33
src/server/game/Server/Packets/TotemPackets.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
|
||||
*
|
||||
* 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"
|
||||
|
||||
void WorldPackets::Totem::TotemDestroyed::Read()
|
||||
{
|
||||
_worldPacket >> Slot;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Totem::TotemCreated::Write()
|
||||
{
|
||||
_worldPacket << Slot;
|
||||
_worldPacket << Totem;
|
||||
_worldPacket << Duration;
|
||||
_worldPacket << SpellID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
54
src/server/game/Server/Packets/TotemPackets.h
Normal file
54
src/server/game/Server/Packets/TotemPackets.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2019 TrinityCore <https://www.trinitycore.org/>
|
||||
*
|
||||
* 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 TotemDestroyed final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TotemDestroyed(WorldPacket&& packet) : ClientPacket(CMSG_TOTEM_DESTROYED, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
|
||||
class TotemCreated final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TotemCreated() : ServerPacket(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint8 Slot = 0;
|
||||
ObjectGuid Totem;
|
||||
uint32 Duration = 0;
|
||||
uint32 SpellID = 0;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // TotemPackets_h__
|
||||
@@ -92,6 +92,10 @@ namespace WorldPackets
|
||||
{
|
||||
class QueryQuestInfo;
|
||||
}
|
||||
namespace Totem
|
||||
{
|
||||
class TotemDestroyed;
|
||||
}
|
||||
}
|
||||
|
||||
enum AccountDataType
|
||||
@@ -828,7 +832,7 @@ class TC_GAME_API WorldSession
|
||||
|
||||
void HandleSetActionBarToggles(WorldPacket& recvData);
|
||||
|
||||
void HandleTotemDestroyed(WorldPacket& recvData);
|
||||
void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& totemDestroyed);
|
||||
void HandleDismissCritter(WorldPacket& recvData);
|
||||
|
||||
//Battleground
|
||||
|
||||
Reference in New Issue
Block a user