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(int8 powerType, int32 amount, int32 cost) : PowerType(powerType), Amount(amount), Cost(cost) { }
34
38 };
39
41 {
48 std::vector<SpellLogPowerData> PowerData;
49
50 void Initialize(Unit const* unit);
51 void Initialize(Spell const* spell);
52 };
53
55 {
57 {
63 };
64
66 {
69 };
70
73 float PlayerItemLevel = 0;
74 float TargetItemLevel = 0;
83
84 template<class T, class U>
85 bool GenerateDataForUnits(T* attacker, U* target);
86 };
87
89 {
92 };
93
95 {
99 float AmountPortion = 0.0f;
100 };
101
102 ByteBuffer& operator<<(ByteBuffer& data, SpellCastLogData const& spellCastLogData);
103 ByteBuffer& operator<<(ByteBuffer& data, ContentTuningParams const& contentTuningParams);
105 ByteBuffer& operator<<(ByteBuffer& data, SpellCastVisual const& visual);
106 ByteBuffer& operator<<(ByteBuffer& data, SpellSupportInfo const& supportInfo);
107 }
108
109 namespace CombatLog
110 {
112 {
113 public:
114 CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT)
115 : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { }
116
117 WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; }
118 WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; }
119
121
122 protected:
123 template<typename T>
124 void operator<<(T const& val)
125 {
126 _worldPacket << val;
127 _fullLogPacket << val;
128 }
129
131 {
132 _worldPacket.WriteBit(false);
134 }
135
137 {
140 }
141
142 bool WriteBit(bool bit)
143 {
146 return bit;
147 }
148
149 void WriteBits(uint32 value, uint32 bitCount)
150 {
151 _worldPacket.WriteBits(value, bitCount);
152 _fullLogPacket.WriteBits(value, bitCount);
153 }
154
156
158 };
159 }
160}
161
162#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:169
void FlushBits()
Definition: ByteBuffer.h:149
void WriteBits(uint64 value, int32 bits)
Definition: ByteBuffer.h:197
Definition: Spell.h:262
Definition: Unit.h:630
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:31
OpcodeServer
Definition: Opcodes.h:952
@ CONNECTION_TYPE_DEFAULT
Definition: Opcodes.h:36
ByteBuffer & operator>>(ByteBuffer &data, SpellCastVisual &visual)
ByteBuffer & operator<<(ByteBuffer &data, SpellCastLogData const &spellCastLogData)
std::vector< SpellLogPowerData > PowerData
SpellLogPowerData(int8 powerType, int32 amount, int32 cost)