TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CombatLogPackets.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
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 CombatLogPackets_h__
19 #define CombatLogPackets_h__
20 
21 #include "Packet.h"
22 #include "Spell.h"
23 #include "SpellPackets.h"
24 
25 namespace WorldPackets
26 {
27  namespace CombatLog
28  {
30  {
31  public:
32  CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT)
33  : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { }
34 
35  WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; }
36  WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; }
37 
39 
40  protected:
41  template<typename T>
42  void operator<<(T const& val)
43  {
44  _worldPacket << val;
45  _fullLogPacket << val;
46  }
47 
49  {
50  _worldPacket.WriteBit(false);
52  }
53 
54  void FlushBits()
55  {
58  }
59 
60  bool WriteBit(bool bit)
61  {
64  return bit;
65  }
66 
67  void WriteBits(uint32 value, uint32 bitCount)
68  {
69  _worldPacket.WriteBits(value, bitCount);
70  _fullLogPacket.WriteBits(value, bitCount);
71  }
72 
74 
76  };
77 
79  {
80  public:
82 
83  WorldPacket const* Write() override;
84 
90  bool Periodic = 0.0f;
94  // Optional<SpellNonMeleeDamageLogDebugInfo> Debug Info;
95  int32 Flags = 0;
97  };
98 
100  {
101  public:
103 
104  WorldPacket const* Write() override;
105 
107  uint8 Type = 0;
111  };
112 
114  {
115  public:
117  {
119 
120  std::vector<SpellLogEffectPowerDrainParams> PowerDrainTargets;
121  std::vector<SpellLogEffectExtraAttacksParams> ExtraAttacksTargets;
122  std::vector<SpellLogEffectDurabilityDamageParams> DurabilityDamageTargets;
123  std::vector<SpellLogEffectGenericVictimParams> GenericVictimTargets;
124  std::vector<SpellLogEffectTradeSkillItemParams> TradeSkillTargets;
125  std::vector<SpellLogEffectFeedPetParams> FeedPetTargets;
126  };
127 
129 
130  WorldPacket const* Write() override;
131 
134  std::vector<SpellLogEffect> Effects;
135  };
136 
137  class SpellHealLog final : public CombatLogServerPacket
138  {
139  public:
141 
142  WorldPacket const* Write() override;
143 
150  bool Crit = false;
151  bool Multistrike = false;
154  };
155 
157  {
158  public:
160  {
161  float CritRollMade = 0.0f;
162  float CritRollNeeded = 0.0f;
163  };
164 
166  {
173  bool Crit = false;
174  bool Multistrike = false;
176  };
177 
179 
180  WorldPacket const* Write() override;
181 
185  std::vector<SpellLogEffect> Effects;
186  };
187 
188  class SpellInterruptLog final : public ServerPacket
189  {
190  public:
192 
193  WorldPacket const* Write() override;
194 
199  };
200 
202  {
204  bool Harmful = false;
207  };
208 
210  {
211  public:
212  SpellDispellLog() : ServerPacket(SMSG_SPELL_DISPELL_LOG, 1 + 16 + 16 + 4 + 4 + 20) { }
213 
214  WorldPacket const* Write() override;
215 
216  std::vector<SpellDispellData> DispellData;
220  bool IsBreak = false;
221  bool IsSteal = false;
222  };
223 
225  {
226  public:
228 
229  WorldPacket const* Write() override;
230 
234  int32 Type = 0;
236  };
237 
238  class SpellInstakillLog final : public ServerPacket
239  {
240  public:
242 
243  WorldPacket const* Write() override;
244 
248  };
249 
251  {
252  float HitRoll = 0.0f;
253  float HitRollNeeded = 0.0f;
254  };
255 
257  {
258  SpellLogMissEntry(ObjectGuid const& victim, uint8 missReason) : Victim(victim), MissReason(missReason) { }
259 
263  };
264 
265  class SpellMissLog final : public ServerPacket
266  {
267  public:
269 
270  WorldPacket const* Write() override;
271 
274  std::vector<SpellLogMissEntry> Entries;
275  };
276 
277  class ProcResist final : public ServerPacket
278  {
279  public:
280  ProcResist() : ServerPacket(SMSG_PROC_RESIST, 16 + 4 + 4 + 4 + 16) { }
281 
282  WorldPacket const* Write() override;
283 
289  };
290 
291  class SpellOrDamageImmune final : public ServerPacket
292  {
293  public:
295 
296  WorldPacket const* Write() override;
297 
301  bool IsPeriodic = false;
302  };
303 
305  {
306  public:
307  SpellDamageShield() : CombatLogServerPacket(SMSG_SPELL_DAMAGE_SHIELD, 4 + 16 + 4 + 4 + 16 + 4 + 4 + 1) { }
308 
309  WorldPacket const* Write() override;
310 
318  };
319 
320  struct SubDamage
321  {
323  float FDamage = 0.0f; // Float damage (Most of the time equals to Damage)
327  };
328 
330  {
332  float State2 = 0.0f;
333  float State3 = 0.0f;
334  float State4 = 0.0f;
335  float State5 = 0.0f;
336  float State6 = 0.0f;
337  float State7 = 0.0f;
338  float State8 = 0.0f;
339  float State9 = 0.0f;
340  float State10 = 0.0f;
341  float State11 = 0.0f;
343  };
344 
346  {
347  public:
349 
350  WorldPacket const* Write() override;
351 
352  uint32 HitInfo = 0; // Flags
356  int32 OverDamage = -1; // (damage - health) or -1 if unit is still alive
364  float Unk = 0.0f;
365  };
366  }
367 }
368 
369 #endif // CombatLogPackets_h__
Definition: CombatLogPackets.h:304
int32 TotalDamage
Definition: CombatLogPackets.h:314
int32 Resisted
Definition: CombatLogPackets.h:172
Definition: Opcodes.h:975
Optional< SubDamage > SubDmg
Definition: CombatLogPackets.h:357
float State5
Definition: CombatLogPackets.h:335
int32 Absorbed
Definition: CombatLogPackets.h:149
Definition: Opcodes.h:1545
Definition: Opcodes.h:1531
ObjectGuid CasterGUID
Definition: CombatLogPackets.h:231
Definition: Opcodes.h:1541
Definition: ByteBuffer.h:70
ObjectGuid CasterGUID
Definition: CombatLogPackets.h:92
float State3
Definition: CombatLogPackets.h:333
int32 Resisted
Definition: CombatLogPackets.h:89
Definition: CombatLogPackets.h:209
std::vector< SpellLogEffectExtraAttacksParams > ExtraAttacksTargets
Definition: CombatLogPackets.h:121
int32 SpellID
Definition: CombatLogPackets.h:88
int32 SpellID
Definition: CombatLogPackets.h:286
int32 SchoolMaskOrPower
Definition: CombatLogPackets.h:170
int32 OverKill
Definition: CombatLogPackets.h:315
Definition: CombatLogPackets.h:277
ObjectGuid Target
Definition: CombatLogPackets.h:245
int32 DispelledBySpellID
Definition: CombatLogPackets.h:219
int32 SpellID
Definition: CombatLogPackets.h:233
ObjectGuid TargetGUID
Definition: CombatLogPackets.h:145
ObjectGuid CasterGUID
Definition: CombatLogPackets.h:144
Definition: Opcodes.h:1533
SpellDispellLog()
Definition: CombatLogPackets.h:212
int32 Absorbed
Definition: CombatLogPackets.h:110
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:21
int32 Absorbed
Definition: CombatLogPackets.h:85
ObjectGuid VictimGUID
Definition: CombatLogPackets.h:299
float Unk
Definition: CombatLogPackets.h:364
bool Periodic
Definition: CombatLogPackets.h:90
int32 State12
Definition: CombatLogPackets.h:342
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:181
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:224
Definition: Opcodes.h:1544
bool Multistrike
Definition: CombatLogPackets.h:151
ObjectGuid Me
Definition: CombatLogPackets.h:87
bool Crit
Definition: CombatLogPackets.h:150
ByteBuffer & WriteLogData()
Definition: CombatLogPackets.h:73
int32 InterruptedSpellID
Definition: CombatLogPackets.h:197
int32 Overkill
Definition: CombatLogPackets.h:96
Definition: CombatLogPackets.h:265
int32 SchoolMask
Definition: CombatLogPackets.h:316
Definition: SpellPackets.h:174
int32 SpellID
Definition: CombatLogPackets.h:198
std::vector< SpellDispellData > DispellData
Definition: CombatLogPackets.h:216
float State10
Definition: CombatLogPackets.h:340
void FlushBits()
Definition: ByteBuffer.h:150
uint8 SchoolMask
Definition: CombatLogPackets.h:91
float HitRollNeeded
Definition: CombatLogPackets.h:253
uint8 MissReason
Definition: CombatLogPackets.h:261
int32 BlockAmount
Definition: CombatLogPackets.h:361
Definition: CombatLogPackets.h:345
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:354
void WriteLogDataBit()
Definition: CombatLogPackets.h:48
int32 Health
Definition: CombatLogPackets.h:147
ObjectGuid Victim
Definition: CombatLogPackets.h:196
std::vector< SpellLogEffect > Effects
Definition: CombatLogPackets.h:185
WorldPacket _worldPacket
Definition: Packet.h:43
Definition: CombatLogPackets.h:156
std::vector< SpellLogEffectDurabilityDamageParams > DurabilityDamageTargets
Definition: CombatLogPackets.h:122
Definition: CombatLogPackets.h:320
ObjectGuid AttackerGUID
Definition: CombatLogPackets.h:353
Definition: CombatLogPackets.h:137
SpellMissLog()
Definition: CombatLogPackets.h:268
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
Optional< float > CritRollNeeded
Definition: CombatLogPackets.h:153
ObjectGuid Defender
Definition: CombatLogPackets.h:312
bool Multistrike
Definition: CombatLogPackets.h:174
int32 Resisted
Definition: CombatLogPackets.h:326
int32 OverHealOrKill
Definition: CombatLogPackets.h:169
int32 OverDamage
Definition: CombatLogPackets.h:356
ObjectGuid TargetGUID
Definition: CombatLogPackets.h:232
std::vector< SpellLogMissEntry > Entries
Definition: CombatLogPackets.h:274
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:264
bool IsSteal
Definition: CombatLogPackets.h:221
int32 Amount
Definition: CombatLogPackets.h:108
int32 Damage
Definition: CombatLogPackets.h:93
int32 LogAbsorbed
Definition: CombatLogPackets.h:317
int32 State1
Definition: CombatLogPackets.h:331
Definition: CombatLogPackets.h:201
SpellLogMissEntry(ObjectGuid const &victim, uint8 missReason)
Definition: CombatLogPackets.h:258
SpellPeriodicAuraLog()
Definition: CombatLogPackets.h:178
int32 Resisted
Definition: CombatLogPackets.h:109
ObjectGuid Caster
Definition: CombatLogPackets.h:284
int32 Effect
Definition: CombatLogPackets.h:118
int32 SpellID
Definition: CombatLogPackets.h:133
SpellInterruptLog()
Definition: CombatLogPackets.h:191
Spells::SpellCastLogData LogData
Definition: CombatLogPackets.h:38
int32 Flags
Definition: CombatLogPackets.h:95
SpellNonMeleeDamageLog()
Definition: CombatLogPackets.h:81
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:253
Definition: CombatLogPackets.h:329
Optional< int32 > Rolled
Definition: CombatLogPackets.h:205
Definition: CombatLogPackets.h:113
Definition: CombatLogPackets.h:238
Optional< SpellLogMissDebug > Debug
Definition: CombatLogPackets.h:262
Optional< float > Needed
Definition: CombatLogPackets.h:288
bool IsBreak
Definition: CombatLogPackets.h:220
EnvironmentalDamageLog()
Definition: CombatLogPackets.h:102
OpcodeServer
Definition: Opcodes.h:725
Definition: Opcodes.h:1539
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:280
Definition: Packet.h:46
Definition: Opcodes.h:1546
std::vector< SpellLogEffectFeedPetParams > FeedPetTargets
Definition: CombatLogPackets.h:125
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:235
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
void operator<<(T const &val)
Definition: CombatLogPackets.h:42
Definition: Opcodes.h:1385
int32 Amount
Definition: CombatLogPackets.h:168
std::vector< SpellLogEffectPowerDrainParams > PowerDrainTargets
Definition: CombatLogPackets.h:120
WorldPacket _fullLogPacket
Definition: CombatLogPackets.h:75
int32 MeleeSpellID
Definition: CombatLogPackets.h:360
bool Harmful
Definition: CombatLogPackets.h:204
ObjectGuid CasterGUID
Definition: CombatLogPackets.h:183
boost::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Common.h:170
int32 ShieldBlock
Definition: CombatLogPackets.h:86
Definition: CombatLogPackets.h:291
ObjectGuid VictimGUID
Definition: CombatLogPackets.h:354
VictimState
Definition: Unit.h:333
Definition: CombatLogPackets.h:29
Optional< PeriodicalAuraLogEffectDebugInfo > DebugInfo
Definition: CombatLogPackets.h:175
float State2
Definition: CombatLogPackets.h:332
Definition: CombatLogPackets.h:99
WorldPacket const * GetFullLogPacket() const
Definition: CombatLogPackets.h:35
Definition: Opcodes.h:755
Definition: BattlegroundMgr.h:57
int32 AbsorbedOrAmplitude
Definition: CombatLogPackets.h:171
void FlushBits()
Definition: CombatLogPackets.h:54
float FDamage
Definition: CombatLogPackets.h:323
Optional< float > Rolled
Definition: CombatLogPackets.h:287
Definition: CombatLogPackets.h:250
int32 RageGained
Definition: CombatLogPackets.h:362
UnkAttackerState UnkState
Definition: CombatLogPackets.h:363
int32 Effect
Definition: CombatLogPackets.h:167
Definition: CombatLogPackets.h:188
SpellHealLog()
Definition: CombatLogPackets.h:140
int32 SpellID
Definition: CombatLogPackets.h:146
int32 Damage
Definition: CombatLogPackets.h:324
ObjectGuid CasterGUID
Definition: CombatLogPackets.h:298
AttackerStateUpdate()
Definition: CombatLogPackets.h:348
SpellOrDamageImmune()
Definition: CombatLogPackets.h:294
std::vector< SpellLogEffectTradeSkillItemParams > TradeSkillTargets
Definition: CombatLogPackets.h:124
ObjectGuid TargetGUID
Definition: CombatLogPackets.h:218
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:171
ObjectGuid Victim
Definition: CombatLogPackets.h:260
int32 AttackerState
Definition: CombatLogPackets.h:359
HitInfo
Definition: Unit.h:346
Definition: Opcodes.h:1542
bool WriteBit(bool bit)
Definition: CombatLogPackets.h:60
ObjectGuid Attacker
Definition: CombatLogPackets.h:311
float State6
Definition: CombatLogPackets.h:336
int32 SpellID
Definition: CombatLogPackets.h:313
uint8_t uint8
Definition: Define.h:152
int32 SpellID
Definition: CombatLogPackets.h:247
ObjectGuid Caster
Definition: CombatLogPackets.h:195
float State11
Definition: CombatLogPackets.h:341
int32 OverHeal
Definition: CombatLogPackets.h:148
SpellInstakillLog()
Definition: CombatLogPackets.h:241
ObjectGuid Target
Definition: CombatLogPackets.h:285
ObjectGuid Caster
Definition: CombatLogPackets.h:246
SpellDamageShield()
Definition: CombatLogPackets.h:307
Definition: CombatLogPackets.h:78
WorldPacket const * GetBasicLogPacket() const
Definition: CombatLogPackets.h:36
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:42
float HitRoll
Definition: CombatLogPackets.h:252
const FieldDescriptor value
Definition: descriptor.h:1522
int32 Amount
Definition: CombatLogPackets.h:235
ObjectGuid Caster
Definition: CombatLogPackets.h:132
std::vector< SpellLogEffect > Effects
Definition: CombatLogPackets.h:134
Definition: ObjectGuid.h:189
int32 SpellID
Definition: CombatLogPackets.h:184
float State4
Definition: CombatLogPackets.h:334
int32 SchoolMask
Definition: CombatLogPackets.h:322
uint32 SpellID
Definition: CombatLogPackets.h:300
bool IsPeriodic
Definition: CombatLogPackets.h:301
Definition: Opcodes.h:1535
void WriteBits(uint32 value, uint32 bitCount)
Definition: CombatLogPackets.h:67
Definition: CombatLogPackets.h:256
int32 Damage
Definition: CombatLogPackets.h:355
int32 Absorbed
Definition: CombatLogPackets.h:325
SpellExecuteLog()
Definition: CombatLogPackets.h:128
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:111
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:197
ObjectGuid Caster
Definition: CombatLogPackets.h:273
std::vector< SpellLogEffectGenericVictimParams > GenericVictimTargets
Definition: CombatLogPackets.h:123
int32 SpellID
Definition: CombatLogPackets.h:272
float State9
Definition: CombatLogPackets.h:339
Type
Type of JSON value.
Definition: rapidjson.h:642
int32 SpellID
Definition: CombatLogPackets.h:203
Optional< float > CritRollMade
Definition: CombatLogPackets.h:152
Definition: Opcodes.h:1540
ObjectGuid TargetGUID
Definition: CombatLogPackets.h:182
ObjectGuid CasterGUID
Definition: CombatLogPackets.h:217
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:56
Definition: CombatLogPackets.h:224
CombatLogServerPacket(OpcodeServer opcode, size_t initialSize=200, ConnectionType connection=CONNECTION_TYPE_DEFAULT)
Definition: CombatLogPackets.h:32
Definition: WorldPacket.h:26
ObjectGuid Victim
Definition: CombatLogPackets.h:106
float State8
Definition: CombatLogPackets.h:338
ProcResist()
Definition: CombatLogPackets.h:280
Optional< int32 > Needed
Definition: CombatLogPackets.h:206
WorldPacket const * Write() override
Definition: CombatLogPackets.cpp:137
ConnectionType
Definition: Opcodes.h:29
Definition: Opcodes.h:35
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198
float State7
Definition: CombatLogPackets.h:337
SpellEnergizeLog()
Definition: CombatLogPackets.h:227
Definition: Opcodes.h:1534