aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellMgr.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-10-17 01:52:40 -0300
committerjoschiwald <joschiwald.trinity@gmail.com>2017-10-03 20:53:49 +0200
commit2d75d8071bb6d85987bdc5d88ed2271822fcbcfd (patch)
tree01389c522f87cdff0be720bf66f9d0ca804beb90 /src/server/game/Spells/SpellMgr.cpp
parent4d5eacd3af8406e41f6f335355b1f860f2323ee1 (diff)
Core/Globals: compute aura diminishing return info at startup and cache it
Core/Entities: Save diminish return on an array instead of a linked list (cherry picked from commit 9b0fa51022fba3d5ece96dd0ac8399be01ea5b0f)
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
-rw-r--r--src/server/game/Spells/SpellMgr.cpp394
1 files changed, 15 insertions, 379 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index f1bf941759e..ae6f9a26850 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -57,385 +57,6 @@ bool IsPartOfSkillLine(uint32 skillId, uint32 spellId)
return false;
}
-DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto)
-{
- if (spellproto->IsPositive())
- return DIMINISHING_NONE;
-
- if (spellproto->HasAura(DIFFICULTY_NONE, SPELL_AURA_MOD_TAUNT))
- return DIMINISHING_TAUNT;
-
- switch (spellproto->Id)
- {
- case 64803: // Entrapment
- case 135373: // Entrapment
- return DIMINISHING_ROOT;
- case 24394: // Intimidation
- return DIMINISHING_STUN;
- case 118345: // Pulverize (Primal Earth Elemental)
- return DIMINISHING_STUN;
- case 118905: // Static Charge (Capacitor Totem)
- return DIMINISHING_STUN;
- case 108199: // Gorefiend's Grasp
- return DIMINISHING_AOE_KNOCKBACK;
- default:
- break;
- }
-
- // Explicit Diminishing Groups
- switch (spellproto->SpellFamilyName)
- {
- case SPELLFAMILY_GENERIC:
- break;
- case SPELLFAMILY_MAGE:
- {
- // Frostjaw -- 102051
- if (spellproto->SpellFamilyFlags[2] & 0x40000)
- return DIMINISHING_SILENCE;
-
- // Frost Nova -- 122
- if (spellproto->SpellFamilyFlags[0] & 0x40)
- return DIMINISHING_ROOT;
- // Ice Ward -- 111340
- if (spellproto->SpellFamilyFlags[0] & 0x80000 && spellproto->SpellFamilyFlags[2] & 0x2000)
- return DIMINISHING_ROOT;
- // Freeze (Water Elemental) -- 33395
- if (spellproto->SpellFamilyFlags[2] & 0x200)
- return DIMINISHING_ROOT;
-
- // Deep Freeze -- 44572
- if (spellproto->SpellFamilyFlags[1] & 0x100000)
- return DIMINISHING_STUN;
-
- // Dragon's Breath -- 31661
- if (spellproto->SpellFamilyFlags[0] & 0x800000)
- return DIMINISHING_INCAPACITATE;
- // Polymorph -- 118
- if (spellproto->SpellFamilyFlags[0] & 0x1000000)
- return DIMINISHING_INCAPACITATE;
- // Ring of Frost -- 82691
- if (spellproto->SpellFamilyFlags[2] & 0x40)
- return DIMINISHING_INCAPACITATE;
- // Ice Nova -- 157997
- if (spellproto->SpellFamilyFlags[2] & 0x800000)
- return DIMINISHING_INCAPACITATE;
- break;
- }
- case SPELLFAMILY_WARRIOR:
- {
- // Shockwave -- 132168
- if (spellproto->SpellFamilyFlags[1] & 0x8000)
- return DIMINISHING_STUN;
- // Storm Bolt -- 132169
- if (spellproto->SpellFamilyFlags[2] & 0x1000)
- return DIMINISHING_STUN;
-
- // Intimidating Shout -- 5246
- if (spellproto->SpellFamilyFlags[0] & 0x40000)
- return DIMINISHING_DISORIENT;
-
- // Hamstring -- 1715, 8 seconds in PvP (6.0)
- if (spellproto->SpellFamilyFlags[0] & 0x2)
- return DIMINISHING_LIMITONLY;
- break;
- }
- case SPELLFAMILY_WARLOCK:
- {
- // Mortal Coil -- 6789
- if (spellproto->SpellFamilyFlags[0] & 0x80000)
- return DIMINISHING_INCAPACITATE;
- // Banish -- 710
- if (spellproto->SpellFamilyFlags[1] & 0x8000000)
- return DIMINISHING_INCAPACITATE;
-
- // Fear -- 118699
- if (spellproto->SpellFamilyFlags[1] & 0x400)
- return DIMINISHING_DISORIENT;
- // Howl of Terror -- 5484
- if (spellproto->SpellFamilyFlags[1] & 0x8)
- return DIMINISHING_DISORIENT;
-
- // Shadowfury -- 30283
- if (spellproto->SpellFamilyFlags[1] & 0x1000)
- return DIMINISHING_STUN;
- // Summon Infernal -- 22703
- if (spellproto->SpellFamilyFlags[0] & 0x1000)
- return DIMINISHING_STUN;
- break;
- }
- case SPELLFAMILY_WARLOCK_PET:
- {
- // Fellash -- 115770
- // Whiplash -- 6360
- if (spellproto->SpellFamilyFlags[0] & 0x8000000)
- return DIMINISHING_AOE_KNOCKBACK;
-
- // Mesmerize (Shivarra pet) -- 115268
- // Seduction (Succubus pet) -- 6358
- if (spellproto->SpellFamilyFlags[0] & 0x2000000)
- return DIMINISHING_DISORIENT;
-
- // Axe Toss (Felguard pet) -- 89766
- if (spellproto->SpellFamilyFlags[1] & 0x4)
- return DIMINISHING_STUN;
- break;
- }
- case SPELLFAMILY_DRUID:
- {
- // Maim -- 22570
- if (spellproto->SpellFamilyFlags[1] & 0x80)
- return DIMINISHING_STUN;
- // Mighty Bash -- 5211
- if (spellproto->SpellFamilyFlags[0] & 0x2000)
- return DIMINISHING_STUN;
- // Rake -- 163505 -- no flags on the stun
- if (spellproto->Id == 163505)
- return DIMINISHING_STUN;
-
- // Incapacitating Roar -- 99, no flags on the stun, 14
- if (spellproto->SpellFamilyFlags[1] & 0x1)
- return DIMINISHING_INCAPACITATE;
-
- // Cyclone -- 33786
- if (spellproto->SpellFamilyFlags[1] & 0x20)
- return DIMINISHING_DISORIENT;
-
- // Typhoon -- 61391
- if (spellproto->SpellFamilyFlags[1] & 0x1000000)
- return DIMINISHING_AOE_KNOCKBACK;
- // Ursol's Vortex -- 118283, no family flags
- if (spellproto->Id == 118283)
- return DIMINISHING_AOE_KNOCKBACK;
-
- // Entangling Roots -- 339
- if (spellproto->SpellFamilyFlags[0] & 0x200)
- return DIMINISHING_ROOT;
- // Mass Entanglement -- 102359
- if (spellproto->SpellFamilyFlags[2] & 0x4)
- return DIMINISHING_ROOT;
-
- // Faerie Fire -- 770, 20 seconds in PvP (6.0)
- if (spellproto->SpellFamilyFlags[0] & 0x400)
- return DIMINISHING_LIMITONLY;
- break;
- }
- case SPELLFAMILY_ROGUE:
- {
- // Cheap Shot -- 1833
- if (spellproto->SpellFamilyFlags[0] & 0x400)
- return DIMINISHING_STUN;
- // Kidney Shot -- 408
- if (spellproto->SpellFamilyFlags[0] & 0x200000)
- return DIMINISHING_STUN;
-
- // Gouge -- 1776
- if (spellproto->SpellFamilyFlags[0] & 0x8)
- return DIMINISHING_INCAPACITATE;
- // Sap -- 6770
- if (spellproto->SpellFamilyFlags[0] & 0x80)
- return DIMINISHING_INCAPACITATE;
-
- // Blind -- 2094
- if (spellproto->SpellFamilyFlags[0] & 0x1000000)
- return DIMINISHING_DISORIENT;
-
- // Garrote -- 1330
- if (spellproto->SpellFamilyFlags[1] & 0x20000000)
- return DIMINISHING_SILENCE;
- break;
- }
- case SPELLFAMILY_HUNTER:
- {
- // Charge (Tenacity pet) -- 53148, no flags
- if (spellproto->Id == 53148)
- return DIMINISHING_ROOT;
- // Narrow Escape -- 136634, no flags
- if (spellproto->Id == 136634)
- return DIMINISHING_ROOT;
-
- // Binding Shot -- 117526, no flags
- if (spellproto->Id == 117526)
- return DIMINISHING_STUN;
-
- // Freezing Trap -- 3355
- if (spellproto->SpellFamilyFlags[0] & 0x8)
- return DIMINISHING_INCAPACITATE;
- // Wyvern Sting -- 19386
- if (spellproto->SpellFamilyFlags[1] & 0x1000)
- return DIMINISHING_INCAPACITATE;
- break;
- }
- case SPELLFAMILY_PALADIN:
- {
- // Repentance -- 20066
- if (spellproto->SpellFamilyFlags[0] & 0x4)
- return DIMINISHING_INCAPACITATE;
-
- // Turn Evil -- 10326
- if (spellproto->SpellFamilyFlags[1] & 0x800000)
- return DIMINISHING_DISORIENT;
-
- // Avenger's Shield -- 31935
- if (spellproto->SpellFamilyFlags[0] & 0x4000)
- return DIMINISHING_SILENCE;
-
- // Fist of Justice -- 105593
- // Hammer of Justice -- 853
- if (spellproto->SpellFamilyFlags[0] & 0x800)
- return DIMINISHING_STUN;
- // Holy Wrath -- 119072
- if (spellproto->SpellFamilyFlags[1] & 0x200000)
- return DIMINISHING_STUN;
- break;
- }
- case SPELLFAMILY_SHAMAN:
- {
- // Hex -- 51514
- if (spellproto->SpellFamilyFlags[1] & 0x8000)
- return DIMINISHING_INCAPACITATE;
-
- // Thunderstorm -- 51490
- if (spellproto->SpellFamilyFlags[1] & 0x2000)
- return DIMINISHING_AOE_KNOCKBACK;
-
- // Earthgrab Totem -- 64695
- if (spellproto->SpellFamilyFlags[2] & 0x4000)
- return DIMINISHING_ROOT;
- break;
- }
- case SPELLFAMILY_DEATHKNIGHT:
- {
- // Strangulate -- 47476
- if (spellproto->SpellFamilyFlags[0] & 0x200)
- return DIMINISHING_SILENCE;
-
- // Asphyxiate -- 108194
- if (spellproto->SpellFamilyFlags[2] & 0x100000)
- return DIMINISHING_STUN;
- // Gnaw (Ghoul) -- 91800, no flags
- if (spellproto->Id == 91800)
- return DIMINISHING_STUN;
- // Monstrous Blow (Ghoul w/ Dark Transformation active) -- 91797
- if (spellproto->Id == 91797)
- return DIMINISHING_STUN;
- break;
- }
- case SPELLFAMILY_PRIEST:
- {
- // Dominate Mind -- 605
- if (spellproto->SpellFamilyFlags[0] & 0x20000 && spellproto->GetSpellVisual() == 39068)
- return DIMINISHING_INCAPACITATE;
- // Holy Word: Chastise -- 88625
- if (spellproto->SpellFamilyFlags[2] & 0x20)
- return DIMINISHING_INCAPACITATE;
- // Psychic Horror -- 64044
- if (spellproto->SpellFamilyFlags[2] & 0x2000)
- return DIMINISHING_INCAPACITATE;
-
- // Psychic Scream -- 8122
- if (spellproto->SpellFamilyFlags[0] & 0x10000)
- return DIMINISHING_DISORIENT;
-
- // Silence -- 15487
- if (spellproto->SpellFamilyFlags[1] & 0x200000 && spellproto->SchoolMask == 32)
- return DIMINISHING_SILENCE;
- break;
- }
- case SPELLFAMILY_MONK:
- {
- // Disable -- 116706, no flags
- if (spellproto->Id == 116706)
- return DIMINISHING_ROOT;
-
- // Charging Ox Wave -- 119392
- if (spellproto->SpellFamilyFlags[1] & 0x10000)
- return DIMINISHING_STUN;
- // Fists of Fury -- 120086
- if (spellproto->SpellFamilyFlags[1] & 0x800000 && !(spellproto->SpellFamilyFlags[2] & 0x8))
- return DIMINISHING_STUN;
- // Leg Sweep -- 119381
- if (spellproto->SpellFamilyFlags[1] & 0x200)
- return DIMINISHING_STUN;
-
- // Incendiary Breath (honor talent) -- 202274, no flags
- if (spellproto->Id == 202274)
- return DIMINISHING_INCAPACITATE;
- // Paralysis -- 115078
- if (spellproto->SpellFamilyFlags[2] & 0x800000)
- return DIMINISHING_INCAPACITATE;
- break;
- }
- default:
- break;
- }
-
- return DIMINISHING_NONE;
-}
-
-DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
-{
- switch (group)
- {
- case DIMINISHING_TAUNT:
- case DIMINISHING_STUN:
- return DRTYPE_ALL;
- case DIMINISHING_LIMITONLY:
- case DIMINISHING_NONE:
- return DRTYPE_NONE;
- default:
- return DRTYPE_PLAYER;
- }
-}
-
-DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
-{
- switch (group)
- {
- case DIMINISHING_TAUNT:
- return DIMINISHING_LEVEL_TAUNT_IMMUNE;
- case DIMINISHING_AOE_KNOCKBACK:
- return DIMINISHING_LEVEL_2;
- default:
- return DIMINISHING_LEVEL_IMMUNE;
- }
-}
-
-int32 GetDiminishingReturnsLimitDuration(SpellInfo const* spellproto)
-{
- // Explicit diminishing duration
- switch (spellproto->SpellFamilyName)
- {
- case SPELLFAMILY_DRUID:
- {
- // Faerie Fire - 20 seconds in PvP (6.0)
- if (spellproto->SpellFamilyFlags[0] & 0x400)
- return 20 * IN_MILLISECONDS;
- break;
- }
- case SPELLFAMILY_HUNTER:
- {
- // Binding Shot - 3 seconds in PvP (6.0)
- if (spellproto->Id == 117526)
- return 3 * IN_MILLISECONDS;
- // Wyvern Sting - 6 seconds in PvP (6.0)
- if (spellproto->SpellFamilyFlags[1] & 0x1000)
- return 6 * IN_MILLISECONDS;
- break;
- }
- case SPELLFAMILY_MONK:
- {
- // Paralysis - 4 seconds in PvP regardless of if they are facing you (6.0)
- if (spellproto->SpellFamilyFlags[2] & 0x800000)
- return 4 * IN_MILLISECONDS;
- break;
- }
- default:
- break;
- }
-
- return 8 * IN_MILLISECONDS;
-}
-
SpellMgr::SpellMgr() { }
SpellMgr::~SpellMgr()
@@ -3779,6 +3400,21 @@ void SpellMgr::LoadSpellInfoSpellSpecificAndAuraState()
TC_LOG_INFO("server.loading", ">> Loaded SpellInfo SpellSpecific and AuraState in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
+void SpellMgr::LoadSpellInfoDiminishing()
+{
+ uint32 oldMSTime = getMSTime();
+
+ for (SpellInfo* spellInfo : mSpellInfoMap)
+ {
+ if (!spellInfo)
+ continue;
+
+ spellInfo->_LoadSpellDiminishInfo();
+ }
+
+ TC_LOG_INFO("server.loading", ">> Loaded SpellInfo diminishing infos in %u ms", GetMSTimeDiffToNow(oldMSTime));
+}
+
void SpellMgr::LoadPetFamilySpellsStore()
{
std::unordered_map<uint32, SpellLevelsEntry const*> levelsBySpell;