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 TRINITYCORE_COMBAT_LOG_PACKETS_COMMON_H
19#define TRINITYCORE_COMBAT_LOG_PACKETS_COMMON_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 {
66 };
67
69 {
72 };
73
76 float PlayerItemLevel = 0;
77 float TargetItemLevel = 0;
87 int32 TargetHealingContentTuningID = 0; // direct heal only, not periodic
89
90 template<class T, class U>
91 bool GenerateDataForUnits(T* attacker, U* target);
92 };
93
95 {
98 };
99
101 {
105 float AmountPortion = 0.0f;
106 };
107
108 ByteBuffer& operator<<(ByteBuffer& data, SpellCastLogData const& spellCastLogData);
109 ByteBuffer& operator<<(ByteBuffer& data, ContentTuningParams const& contentTuningParams);
111 ByteBuffer& operator<<(ByteBuffer& data, SpellCastVisual const& visual);
112 ByteBuffer& operator<<(ByteBuffer& data, SpellSupportInfo const& supportInfo);
113 }
114
115 namespace CombatLog
116 {
118 {
119 public:
120 CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT)
121 : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { }
122
123 WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; }
124 WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; }
125
127
128 protected:
129 template <ByteBufferNumeric T>
130 void operator<<(T val)
131 {
132 _worldPacket << val;
133 _fullLogPacket << val;
134 }
135
136 template <typename T> requires (!ByteBufferNumeric<T>)
137 void operator<<(T const& val)
138 {
139 _worldPacket << val;
140 _fullLogPacket << val;
141 }
142
144 {
145 _worldPacket.WriteBit(false);
147 }
148
150 {
153 }
154
156
158 };
159 }
160}
161
162#endif // TRINITYCORE_COMBAT_LOG_PACKETS_COMMON_H
uint8_t uint8
Definition: Define.h:150
int64_t int64
Definition: Define.h:143
int16_t int16
Definition: Define.h:145
int8_t int8
Definition: Define.h:146
int32_t int32
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:148
Spells
Definition: PlayerAI.cpp:32
PowerType
bool WriteBit(bool bit)
Definition: ByteBuffer.h:158
void FlushBits()
Definition: ByteBuffer.h:141
Definition: Spell.h:262
Definition: Unit.h:632
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:962
@ 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)