aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server/Packets/CombatLogPackets.h
blob: 7b94d4a922337f83a75fca354f482010678ba180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
/*
 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
 *
 * 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 TRINITYCORE_COMBAT_LOG_PACKETS_H
#define TRINITYCORE_COMBAT_LOG_PACKETS_H

#include "CombatLogPacketsCommon.h"
#include "Optional.h"

struct SpellLogEffect;

namespace WorldPackets
{
    namespace CombatLog
    {
        struct CombatWorldTextViewerInfo
        {
            ObjectGuid ViewerGUID;
            Optional<uint8> ColorType;
            Optional<uint8> ScaleType;
        };

        class SpellNonMeleeDamageLog final : public CombatLogServerPacket
        {
        public:
            explicit SpellNonMeleeDamageLog() : CombatLogServerPacket(SMSG_SPELL_NON_MELEE_DAMAGE_LOG, 60) { }

            WorldPacket const* Write() override;

            ObjectGuid Me;
            ObjectGuid CasterGUID;
            ObjectGuid CastID;
            int32 SpellID = 0;
            Spells::SpellCastVisual Visual;
            int32 Damage = 0;
            int32 OriginalDamage = 0;
            int32 Overkill = -1;
            uint8 SchoolMask = 0;
            int32 ShieldBlock = 0;
            int32 Resisted = 0;
            bool Periodic = false;
            int32 Absorbed = 0;
            int32 Flags = 0;
            // Optional<SpellNonMeleeDamageLogDebugInfo> DebugInfo;
            Optional<Spells::ContentTuningParams> ContentTuning;
            std::vector<CombatWorldTextViewerInfo> WorldTextViewers;
            std::vector<Spells::SpellSupportInfo> Supporters;
        };

        class EnvironmentalDamageLog final : public CombatLogServerPacket
        {
        public:
            explicit EnvironmentalDamageLog() : CombatLogServerPacket(SMSG_ENVIRONMENTAL_DAMAGE_LOG, 23) { }

            WorldPacket const* Write() override;

            ObjectGuid Victim;
            uint8 Type = 0; ///< @see enum EnviromentalDamage
            int32 Amount = 0;
            int32 Resisted = 0;
            int32 Absorbed = 0;
        };

        class SpellExecuteLog final : public CombatLogServerPacket
        {
        public:
            explicit SpellExecuteLog() : CombatLogServerPacket(SMSG_SPELL_EXECUTE_LOG, 16 + 4 + 4 + 1) { }

            WorldPacket const* Write() override;

            ObjectGuid Caster;
            int32 SpellID = 0;
            std::vector<SpellLogEffect> const* Effects = nullptr;
        };

        class SpellHealLog final : public CombatLogServerPacket
        {
        public:
            explicit SpellHealLog() : CombatLogServerPacket(SMSG_SPELL_HEAL_LOG, 16 + 16 + 4 * 5 + 1) { }

            WorldPacket const* Write() override;

            ObjectGuid CasterGUID;
            ObjectGuid TargetGUID;
            int32 SpellID       = 0;
            int32 Health        = 0;
            int32 OriginalHeal  = 0;
            int32 OverHeal      = 0;
            int32 Absorbed      = 0;
            bool Crit           = false;
            Optional<float> CritRollMade;
            Optional<float> CritRollNeeded;
            Optional<Spells::ContentTuningParams> ContentTuning;
            std::vector<Spells::SpellSupportInfo> Supporters;
        };

        struct PeriodicalAuraLogEffectDebugInfo
        {
            float CritRollMade = 0.0f;
            float CritRollNeeded = 0.0f;
        };

        struct PeriodicAuraLogEffect
        {
            int32 Effect              = 0;
            int32 Amount              = 0;
            int32 OriginalDamage      = 0;
            int32 OverHealOrKill      = 0;
            int32 SchoolMaskOrPower   = 0;
            int32 AbsorbedOrAmplitude = 0;
            int32 Resisted            = 0;
            bool Crit                 = false;
            Optional<PeriodicalAuraLogEffectDebugInfo> DebugInfo;
            Optional<Spells::ContentTuningParams> ContentTuning;
            std::vector<Spells::SpellSupportInfo> Supporters;
        };

        class SpellPeriodicAuraLog final : public CombatLogServerPacket
        {
        public:
            explicit SpellPeriodicAuraLog() : CombatLogServerPacket(SMSG_SPELL_PERIODIC_AURA_LOG, 16 + 16 + 4 + 4 + 1) { }

            WorldPacket const* Write() override;

            ObjectGuid TargetGUID;
            ObjectGuid CasterGUID;
            int32 SpellID = 0;
            std::vector<PeriodicAuraLogEffect> Effects;
        };

        class SpellInterruptLog final : public ServerPacket
        {
        public:
            explicit SpellInterruptLog() : ServerPacket(SMSG_SPELL_INTERRUPT_LOG, 16 + 16 + 4 + 4) { }

            WorldPacket const* Write() override;

            ObjectGuid Caster;
            ObjectGuid Victim;
            int32 InterruptedSpellID = 0;
            int32 SpellID = 0;
        };

        struct SpellDispellData
        {
            int32 SpellID = 0;
            bool Harmful = false;
            Optional<int32> Rolled;
            Optional<int32> Needed;
        };

        class SpellDispellLog : public ServerPacket
        {
        public:
            explicit SpellDispellLog() : ServerPacket(SMSG_SPELL_DISPELL_LOG, 1 + 16 + 16 + 4 + 4 + 20) { }

            WorldPacket const* Write() override;

            std::vector<SpellDispellData> DispellData;
            ObjectGuid CasterGUID;
            ObjectGuid TargetGUID;
            int32 DispelledBySpellID = 0;
            bool IsBreak = false;
            bool IsSteal = false;
        };

        class SpellEnergizeLog final : public CombatLogServerPacket
        {
        public:
            explicit SpellEnergizeLog() : CombatLogServerPacket(SMSG_SPELL_ENERGIZE_LOG, 16 + 16 + 4 + 4 + 4 + 1) { }

            WorldPacket const* Write() override;

            ObjectGuid CasterGUID;
            ObjectGuid TargetGUID;
            int32 SpellID = 0;
            int8 Type = 0;
            int32 Amount = 0;
            int32 OverEnergize = 0;
        };

        class TC_GAME_API SpellInstakillLog final : public ServerPacket
        {
        public:
            explicit SpellInstakillLog() : ServerPacket(SMSG_SPELL_INSTAKILL_LOG, 16 + 16 + 4) { }

            WorldPacket const* Write() override;

            ObjectGuid Target;
            ObjectGuid Caster;
            int32 SpellID = 0;
        };

        struct SpellLogMissDebug
        {
            float HitRoll = 0.0f;
            float HitRollNeeded = 0.0f;
        };

        struct SpellLogMissEntry
        {
            SpellLogMissEntry(ObjectGuid const& victim, uint8 missReason) : Victim(victim), MissReason(missReason) { }

            ObjectGuid Victim;
            uint8 MissReason = 0;
            Optional<SpellLogMissDebug> Debug;
        };

        class SpellMissLog final : public ServerPacket
        {
        public:
            explicit SpellMissLog() : ServerPacket(SMSG_SPELL_MISS_LOG) { }

            WorldPacket const* Write() override;

            int32 SpellID = 0;
            ObjectGuid Caster;
            std::vector<SpellLogMissEntry> Entries;
        };

        class ProcResist final : public ServerPacket
        {
        public:
            explicit ProcResist() : ServerPacket(SMSG_PROC_RESIST, 16 + 4 + 4 + 4 + 16) { }

            WorldPacket const* Write() override;

            ObjectGuid Caster;
            ObjectGuid Target;
            int32 SpellID = 0;
            Optional<float> Rolled;
            Optional<float> Needed;
        };

        class SpellOrDamageImmune final : public ServerPacket
        {
        public:
            explicit SpellOrDamageImmune() : ServerPacket(SMSG_SPELL_OR_DAMAGE_IMMUNE, 16 + 1 + 4 + 16) { }

            WorldPacket const* Write() override;

            ObjectGuid CasterGUID;
            ObjectGuid VictimGUID;
            uint32 SpellID = 0;
            bool IsPeriodic = false;
        };

        class SpellDamageShield final : public CombatLogServerPacket
        {
        public:
            explicit SpellDamageShield() : CombatLogServerPacket(SMSG_SPELL_DAMAGE_SHIELD, 4 + 16 + 4 + 4 + 16 + 4 + 4 + 1) { }

            WorldPacket const* Write() override;

            ObjectGuid Attacker;
            ObjectGuid Defender;
            int32 SpellID = 0;
            int32 TotalDamage = 0;
            int32 OriginalDamage = 0;
            int32 OverKill = 0;
            int32 SchoolMask = 0;
            int32 LogAbsorbed = 0;
        };

        struct SubDamage
        {
            int32 SchoolMask = 0;
            float FDamage = 0.0f; // Float damage (Most of the time equals to Damage)
            int32 Damage = 0;
            int32 Absorbed = 0;
            int32 Resisted = 0;
        };

        struct UnkAttackerState
        {
            uint32 State1 = 0;
            float State2 = 0.0f;
            float State3 = 0.0f;
            float State4 = 0.0f;
            float State5 = 0.0f;
            float State6 = 0.0f;
            float State7 = 0.0f;
            float State8 = 0.0f;
            float State9 = 0.0f;
            float State10 = 0.0f;
            float State11 = 0.0f;
            uint32 State12 = 0;
        };

        class AttackerStateUpdate final : public CombatLogServerPacket
        {
        public:
            explicit AttackerStateUpdate() : CombatLogServerPacket(SMSG_ATTACKER_STATE_UPDATE, 70) { }

            WorldPacket const* Write() override;

            uint32 HitInfo = 0; // Flags
            ObjectGuid AttackerGUID;
            ObjectGuid VictimGUID;
            int32 Damage = 0;
            int32 OriginalDamage = 0;
            int32 OverDamage = -1; // (damage - health) or -1 if unit is still alive
            Optional<SubDamage> SubDmg;
            uint8 VictimState = 0;
            uint32 AttackerState = 0;
            uint32 MeleeSpellID = 0;
            int32 BlockAmount = 0;
            int32 RageGained = 0;
            UnkAttackerState UnkState;
            float Unk = 0.0f;
            Spells::ContentTuningParams ContentTuning;
        };

        class SpellAbsorbLog final : public CombatLogServerPacket
        {
        public:
            explicit SpellAbsorbLog() : CombatLogServerPacket(SMSG_SPELL_ABSORB_LOG, 100) { }

            WorldPacket const* Write() override;

            ObjectGuid Attacker;
            ObjectGuid Victim;
            ObjectGuid Caster;
            int32 AbsorbedSpellID = 0;
            int32 AbsorbSpellID = 0;
            int32 Absorbed = 0;
            int32 OriginalDamage = 0;
            bool Crit = false;
            std::vector<Spells::SpellSupportInfo> Supporters;
        };

        class SpellHealAbsorbLog final : public ServerPacket
        {
        public:
            explicit SpellHealAbsorbLog() : ServerPacket(SMSG_SPELL_HEAL_ABSORB_LOG, 100) { }

            WorldPacket const* Write() override;

            ObjectGuid Healer;
            ObjectGuid Target;
            ObjectGuid AbsorbCaster;
            int32 AbsorbSpellID = 0;
            int32 AbsorbedSpellID = 0;
            int32 Absorbed = 0;
            int32 OriginalHeal = 0;
            Optional<Spells::ContentTuningParams> ContentTuning;
        };
    }
}

#endif // TRINITYCORE_COMBAT_LOG_PACKETS_H