@@ -57,11 +57,8 @@ class mod_zone_difficulty_unitscript : public UnitScript
57
57
continue ;
58
58
59
59
if (sZoneDifficulty ->IsDebugInfoEnabled && target)
60
- {
61
60
if (Player* player = target->ToPlayer ()) // Pointless check? Perhaps.
62
- if (player->GetSession ())
63
- ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Base Value: {}" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , eff->GetAmount ());
64
- }
61
+ ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Base Value: {}" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , eff->GetAmount ());
65
62
66
63
int32 absorb = eff->GetAmount ();
67
64
uint32 phaseMask = target->GetPhaseMask ();
@@ -71,16 +68,12 @@ class mod_zone_difficulty_unitscript : public UnitScript
71
68
{
72
69
Map* map = target->GetMap ();
73
70
if (sZoneDifficulty ->HasNormalMode (mode))
74
- {
75
71
absorb = eff->GetAmount () * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].AbsorbNerfPct ;
76
- }
72
+
77
73
if (sZoneDifficulty ->HasMythicmode (mode) && sZoneDifficulty ->MythicmodeInstanceData [target->GetMap ()->GetInstanceId ()])
78
74
{
79
- if (map->IsRaid () ||
80
- (map->IsHeroic () && map->IsDungeon ()))
81
- {
75
+ if (map->IsRaid () || (map->IsHeroic () && map->IsDungeon ()))
82
76
absorb = eff->GetAmount () * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].AbsorbNerfPctHard ;
83
- }
84
77
}
85
78
}
86
79
else if (sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].Enabled > 0 && nerfInDuel)
@@ -95,16 +88,12 @@ class mod_zone_difficulty_unitscript : public UnitScript
95
88
{
96
89
// Check if the mode of instance and SpellNerfOverride match
97
90
if (sZoneDifficulty ->OverrideModeMatches (target->GetMap ()->GetInstanceId (), spellInfo->Id , mapId))
98
- {
99
91
absorb = eff->GetAmount () * sZoneDifficulty ->SpellNerfOverrides [spellInfo->Id ][mapId].NerfPct ;
100
- }
101
92
}
102
93
else if (sZoneDifficulty ->SpellNerfOverrides [spellInfo->Id ].find (0 ) != sZoneDifficulty ->SpellNerfOverrides [spellInfo->Id ].end ())
103
94
{
104
95
if (sZoneDifficulty ->OverrideModeMatches (target->GetMap ()->GetInstanceId (), spellInfo->Id , mapId))
105
- {
106
96
absorb = eff->GetAmount () * sZoneDifficulty ->SpellNerfOverrides [spellInfo->Id ][0 ].NerfPct ;
107
- }
108
97
}
109
98
}
110
99
@@ -184,17 +173,11 @@ class mod_zone_difficulty_unitscript : public UnitScript
184
173
{
185
174
Map* map = target->GetMap ();
186
175
if (sZoneDifficulty ->HasNormalMode (mode))
187
- {
188
176
heal = heal * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].HealingNerfPct ;
189
- }
177
+
190
178
if (sZoneDifficulty ->HasMythicmode (mode) && sZoneDifficulty ->MythicmodeInstanceData [map->GetInstanceId ()])
191
- {
192
- if (map->IsRaid () ||
193
- (map->IsHeroic () && map->IsDungeon ()))
194
- {
179
+ if (map->IsRaid () || (map->IsHeroic () && map->IsDungeon ()))
195
180
heal = heal * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].HealingNerfPctHard ;
196
- }
197
- }
198
181
}
199
182
else if (sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].Enabled > 0 && nerfInDuel)
200
183
{
@@ -210,9 +193,7 @@ class mod_zone_difficulty_unitscript : public UnitScript
210
193
return ;
211
194
212
195
if (!sZoneDifficulty ->MythicmodeInNormalDungeons && !target->GetMap ()->IsRaidOrHeroicDungeon ())
213
- {
214
196
return ;
215
- }
216
197
217
198
bool isDot = false ;
218
199
@@ -221,9 +202,7 @@ class mod_zone_difficulty_unitscript : public UnitScript
221
202
for (auto const & eff : spellInfo->GetEffects ())
222
203
{
223
204
if (eff.ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE || eff.ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE_PERCENT)
224
- {
225
205
isDot = true ;
226
- }
227
206
}
228
207
}
229
208
@@ -232,10 +211,8 @@ class mod_zone_difficulty_unitscript : public UnitScript
232
211
233
212
// Disclaimer: also affects disables boss adds buff.
234
213
if (sConfigMgr ->GetOption <bool >(" ModZoneDifficulty.SpellBuff.OnlyBosses" , false ))
235
- {
236
214
if (attacker->ToCreature () && !attacker->ToCreature ()->IsDungeonBoss ())
237
215
return ;
238
- }
239
216
240
217
if (sZoneDifficulty ->IsValidNerfTarget (target))
241
218
{
@@ -244,63 +221,45 @@ class mod_zone_difficulty_unitscript : public UnitScript
244
221
int32 matchingPhase = sZoneDifficulty ->GetLowestMatchingPhase (mapId, phaseMask);
245
222
246
223
if (sZoneDifficulty ->IsDebugInfoEnabled && attacker)
247
- {
248
224
if (Player* player = attacker->ToPlayer ())
249
225
ChatHandler (player->GetSession ()).PSendSysMessage (" A dot tick will be altered. Pre Nerf Value: {}" , damage);
250
- }
251
226
252
227
if (sZoneDifficulty ->ShouldNerfMap (mapId) && matchingPhase != -1 )
253
228
{
254
229
int8 mode = sZoneDifficulty ->NerfInfo [mapId][matchingPhase].Enabled ;
255
230
Map* map = target->GetMap ();
231
+
256
232
if (sZoneDifficulty ->HasNormalMode (mode))
257
- {
258
233
damage = damage * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPct ;
259
- }
234
+
260
235
if (sZoneDifficulty ->HasMythicmode (mode) && sZoneDifficulty ->MythicmodeInstanceData [map->GetInstanceId ()])
261
- {
262
- if (map->IsRaid () ||
263
- (map->IsHeroic () && map->IsDungeon ()))
264
- {
236
+ if (map->IsRaid () || (map->IsHeroic () && map->IsDungeon ()))
265
237
damage = damage * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPctHard ;
266
- }
267
- }
268
238
}
269
239
else if (sZoneDifficulty ->ShouldNerfInDuels (target))
270
240
{
271
241
if (sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].Enabled > 0 )
272
- {
273
242
damage = damage * sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].SpellDamageBuffPct ;
274
- }
275
243
}
276
244
277
245
if (sZoneDifficulty ->IsDebugInfoEnabled && attacker)
278
- {
279
246
if (Player* player = attacker->ToPlayer ())
280
247
ChatHandler (player->GetSession ()).PSendSysMessage (" A dot tick was altered. Post Nerf Value: {}" , damage);
281
- }
282
248
}
283
249
}
284
250
285
251
void ModifySpellDamageTaken (Unit* target, Unit* attacker, int32& damage, SpellInfo const * spellInfo) override
286
252
{
287
253
if (!sZoneDifficulty ->IsEnabled )
288
- {
289
254
return ;
290
- }
255
+
291
256
if (!sZoneDifficulty ->MythicmodeInNormalDungeons && !target->GetMap ()->IsRaidOrHeroicDungeon ())
292
- {
293
257
return ;
294
- }
295
258
296
259
// Disclaimer: also affects disables boss adds buff.
297
260
if (sConfigMgr ->GetOption <bool >(" ModZoneDifficulty.SpellBuff.OnlyBosses" , false ))
298
- {
299
261
if (attacker->ToCreature () && !attacker->ToCreature ()->IsDungeonBoss ())
300
- {
301
262
return ;
302
- }
303
- }
304
263
305
264
if (sZoneDifficulty ->IsValidNerfTarget (target))
306
265
{
@@ -334,11 +293,8 @@ class mod_zone_difficulty_unitscript : public UnitScript
334
293
{
335
294
if (Player* player = target->ToPlayer ()) // Pointless check? Perhaps.
336
295
{
337
- if (player->GetSession ())
338
- {
339
- ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Before Nerf Value: {} ({} Normal Mode)" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , damage, sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPct );
340
- ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Before Nerf Value: {} ({} Mythic Mode)" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , damage, sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPctHard );
341
- }
296
+ ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Before Nerf Value: {} ({} Normal Mode)" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , damage, sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPct );
297
+ ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Before Nerf Value: {} ({} Mythic Mode)" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , damage, sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPctHard );
342
298
}
343
299
}
344
300
}
@@ -347,59 +303,38 @@ class mod_zone_difficulty_unitscript : public UnitScript
347
303
{
348
304
int8 mode = sZoneDifficulty ->NerfInfo [mapId][matchingPhase].Enabled ;
349
305
Map* map = target->GetMap ();
306
+
350
307
if (sZoneDifficulty ->HasNormalMode (mode))
351
- {
352
308
damage = damage * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPct ;
353
- }
309
+
354
310
if (sZoneDifficulty ->HasMythicmode (mode) && sZoneDifficulty ->MythicmodeInstanceData [map->GetInstanceId ()])
355
- {
356
- if (map->IsRaid () ||
357
- (map->IsHeroic () && map->IsDungeon ()))
358
- {
311
+ if (map->IsRaid () || (map->IsHeroic () && map->IsDungeon ()))
359
312
damage = damage * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].SpellDamageBuffPctHard ;
360
- }
361
- }
362
313
}
363
314
else if (sZoneDifficulty ->ShouldNerfInDuels (target))
364
315
{
365
316
if (sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].Enabled > 0 )
366
- {
367
317
damage = damage * sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].SpellDamageBuffPct ;
368
- }
369
318
}
370
319
371
320
if (sZoneDifficulty ->IsDebugInfoEnabled && target)
372
- {
373
321
if (Player* player = target->ToPlayer ()) // Pointless check? Perhaps.
374
- {
375
- if (player->GetSession ())
376
- {
377
- ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Post Nerf Value: {}" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , damage);
378
- }
379
- }
380
- }
322
+ ChatHandler (player->GetSession ()).PSendSysMessage (" Spell: {} ({}) Post Nerf Value: {}" , spellInfo->SpellName [player->GetSession ()->GetSessionDbcLocale ()], spellInfo->Id , damage);
381
323
}
382
324
}
383
325
384
326
void ModifyMeleeDamage (Unit* target, Unit* attacker, uint32& damage) override
385
327
{
386
328
if (!sZoneDifficulty ->IsEnabled )
387
- {
388
329
return ;
389
- }
330
+
390
331
if (!sZoneDifficulty ->MythicmodeInNormalDungeons && !target->GetMap ()->IsRaidOrHeroicDungeon ())
391
- {
392
332
return ;
393
- }
394
333
395
334
// Disclaimer: also affects disables boss adds buff.
396
335
if (sConfigMgr ->GetOption <bool >(" ModZoneDifficulty.MeleeBuff.OnlyBosses" , false ))
397
- {
398
336
if (attacker->ToCreature () && !attacker->ToCreature ()->IsDungeonBoss ())
399
- {
400
337
return ;
401
- }
402
- }
403
338
404
339
if (sZoneDifficulty ->IsValidNerfTarget (target))
405
340
{
@@ -410,25 +345,18 @@ class mod_zone_difficulty_unitscript : public UnitScript
410
345
{
411
346
int8 mode = sZoneDifficulty ->NerfInfo [mapId][matchingPhase].Enabled ;
412
347
Map* map = target->GetMap ();
348
+
413
349
if (sZoneDifficulty ->HasNormalMode (mode))
414
- {
415
350
damage = damage * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].MeleeDamageBuffPct ;
416
- }
351
+
417
352
if (sZoneDifficulty ->HasMythicmode (mode) && sZoneDifficulty ->MythicmodeInstanceData [target->GetMap ()->GetInstanceId ()])
418
- {
419
- if (map->IsRaid () ||
420
- (map->IsHeroic () && map->IsDungeon ()))
421
- {
353
+ if (map->IsRaid () || (map->IsHeroic () && map->IsDungeon ()))
422
354
damage = damage * sZoneDifficulty ->NerfInfo [mapId][matchingPhase].MeleeDamageBuffPctHard ;
423
- }
424
- }
425
355
}
426
356
else if (sZoneDifficulty ->ShouldNerfInDuels (target))
427
357
{
428
358
if (sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].Enabled > 0 )
429
- {
430
359
damage = damage * sZoneDifficulty ->NerfInfo [DUEL_INDEX][0 ].MeleeDamageBuffPct ;
431
- }
432
360
}
433
361
}
434
362
}
@@ -438,36 +366,21 @@ class mod_zone_difficulty_unitscript : public UnitScript
438
366
*/
439
367
void OnUnitEnterCombat (Unit* unit, Unit* /* victim*/ ) override
440
368
{
441
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: OnUnitEnterCombat for unit {}", unit->GetEntry());
442
369
if (sZoneDifficulty ->MythicmodeInstanceData .find (unit->GetInstanceId ()) == sZoneDifficulty ->MythicmodeInstanceData .end ())
443
- {
444
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Instance is not in mythic mode.");
445
370
return ;
446
- }
371
+
447
372
if (!sZoneDifficulty ->MythicmodeInstanceData [unit->GetInstanceId ()])
448
- {
449
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: InstanceId not found in mythic mode list.");
450
373
return ;
451
- }
452
374
453
375
if (Creature* creature = unit->ToCreature ())
454
- {
455
376
if (creature->IsTrigger ())
456
- {
457
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: Creature is a trigger.");
458
377
return ;
459
- }
460
- }
461
378
462
379
uint32 entry = unit->GetEntry ();
463
380
if (sZoneDifficulty ->MythicmodeAI .find (entry) == sZoneDifficulty ->MythicmodeAI .end ())
464
- {
465
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: No HarmodeAI found for creature with entry {}", entry);
466
381
return ;
467
- }
468
382
469
383
unit->m_Events .CancelEventGroup (EVENT_GROUP);
470
- // LOG_INFO("module", "MOD-ZONE-DIFFICULTY: OnUnitEnterCombat checks passed for unit {}", unit->GetEntry());
471
384
472
385
uint32 i = 0 ;
473
386
for (ZoneDifficultyHAI& data : sZoneDifficulty ->MythicmodeAI [entry])
0 commit comments