TrinityCore
CombatLogPacketsCommon.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef CombatLogPacketsCommon_h__
19#define CombatLogPacketsCommon_h__
20
21#include "ObjectGuid.h"
22#include "Packet.h"
23
24class Spell;
25class Unit;
26
27namespace WorldPackets
28{
29 namespace Spells
30 {
32 {
33 SpellLogPowerData(int32 powerType, int32 amount, int32 cost) : PowerType(powerType), Amount(amount), Cost(cost) { }
34
38 };
39
41 {
46 std::vector<SpellLogPowerData> PowerData;
47
48 void Initialize(Unit const* unit);
49 void Initialize(Spell const* spell);
50 };
51
53 {
55 {
61 };
62
64 {
67 };
68
71 float PlayerItemLevel = 0;
72 float TargetItemLevel = 0;
81
82 template<class T, class U>
83 bool GenerateDataForUnits(T* attacker, U* target);
84 };
85
87 {
90 };
91
93 {
97 float Percentage = 0.0f;
98 };
99
100 ByteBuffer& operator<<(ByteBuffer& data, SpellCastLogData const& spellCastLogData);
101 ByteBuffer& operator<<(ByteBuffer& data, ContentTuningParams const& contentTuningParams);
103 ByteBuffer& operator<<(ByteBuffer& data, SpellCastVisual const& visual);
104 ByteBuffer& operator<<(ByteBuffer& data, SpellSupportInfo const& supportInfo);
105 }
106
107 namespace CombatLog
108 {
110 {
111 public:
112 CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT)
113 : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { }
114
115 WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; }
116 WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; }
117
119
120 protected:
121 template<typename T>
122 void operator<<(T const& val)
123 {
124 _worldPacket << val;
125 _fullLogPacket << val;
126 }
127
129 {
130 _worldPacket.WriteBit(false);
132 }
133
135 {
138 }
139
140 bool WriteBit(bool bit)
141 {
144 return bit;
145 }
146
147 void WriteBits(uint32 value, uint32 bitCount)
148 {
149 _worldPacket.WriteBits(value, bitCount);
150 _fullLogPacket.WriteBits(value, bitCount);
151 }
152
154
156 };
157 }
158}
159
160#endif // CombatLogPacketsCommon_h__
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int16_t int16
Definition: Define.h:139
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
PowerType
bool WriteBit(bool bit)
Definition: ByteBuffer.h:175
void WriteBits(std::size_t value, int32 bits)
Definition: ByteBuffer.h:203
void FlushBits()
Definition: ByteBuffer.h:155
Definition: Spell.h:255
Definition: Unit.h:627
void WriteBits(uint32 value, uint32 bitCount)
CombatLogServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
WorldPacket _worldPacket
Definition: Packet.h:43
ConnectionType
Definition: Opcodes.h:29
OpcodeServer
Definition: Opcodes.h:901
@ CONNECTION_TYPE_DEFAULT
Definition: Opcodes.h:34
ByteBuffer & operator>>(ByteBuffer &data, SpellCastVisual &visual)
ByteBuffer & operator<<(ByteBuffer &data, SpellCastLogData const &spellCastLogData)
std::vector< SpellLogPowerData > PowerData
SpellLogPowerData(int32 powerType, int32 amount, int32 cost)