TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SpellMgr.cpp File Reference
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "ObjectMgr.h"
#include "SpellAuraDefines.h"
#include "SharedDefines.h"
#include "DBCStores.h"
#include "Chat.h"
#include "BattlegroundMgr.h"
#include "BattlefieldWG.h"
#include "BattlefieldMgr.h"
#include "Player.h"
+ Include dependency graph for SpellMgr.cpp:

Typedefs

typedef std::vector
< SpellEffectEntry const * > 
SpellEffectVector
 

Functions

bool IsPrimaryProfessionSkill (uint32 skill)
 
bool IsWeaponSkill (uint32 skill)
 
bool IsPartOfSkillLine (uint32 skillId, uint32 spellId)
 
DiminishingGroup GetDiminishingReturnsGroupForSpell (SpellInfo const *spellproto)
 
DiminishingReturnsType GetDiminishingReturnsGroupType (DiminishingGroup group)
 
DiminishingLevels GetDiminishingReturnsMaxLevel (DiminishingGroup group)
 
int32 GetDiminishingReturnsLimitDuration (SpellInfo const *spellproto)
 
bool LoadPetDefaultSpells_helper (CreatureTemplate const *cInfo, PetDefaultSpellsEntry &petDefSpells)
 

Variables

PetFamilySpellsStore sPetFamilySpellsStore
 

Typedef Documentation

typedef std::vector<SpellEffectEntry const*> SpellEffectVector

Function Documentation

DiminishingGroup GetDiminishingReturnsGroupForSpell ( SpellInfo const spellproto)
56 {
57  if (spellproto->IsPositive())
58  return DIMINISHING_NONE;
59 
60  for (SpellEffectInfo const* effect: spellproto->GetEffectsForDifficulty(DIFFICULTY_NONE))
61  {
62  if (effect && effect->ApplyAuraName == SPELL_AURA_MOD_TAUNT)
63  return DIMINISHING_TAUNT;
64  }
65 
66  // Explicit Diminishing Groups
67  switch (spellproto->SpellFamilyName)
68  {
70  {
71  // Entrapment -- 135373
72  if (spellproto->SpellIconID == 20 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39588)
73  return DIMINISHING_ROOT;
74 
75  // Intimidation -- 24394
76  if (spellproto->SpellIconID == 166 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 2816)
77  return DIMINISHING_STUN;
78  // Pulverize (Primal Earth Elemental) -- 118345
79  if (spellproto->SpellIconID == 4507 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39877)
80  return DIMINISHING_STUN;
81  // Static Charge (Capacitor Totem) -- 118905
82  if (spellproto->SpellIconID == 54 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 24442)
83  return DIMINISHING_STUN;
84  // Remorseless Winter -- 115001
85  if (spellproto->SpellIconID == 5744 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 23514)
86  return DIMINISHING_STUN;
87 
88  // Gorefiend's Grasp -- 108199
89  if (spellproto->SpellIconID == 5743 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 28937)
91  break;
92  }
93  case SPELLFAMILY_MAGE:
94  {
95  // Frostjaw -- 102051
96  if (spellproto->SpellFamilyFlags[2] & 0x40000)
97  return DIMINISHING_SILENCE;
98 
99  // Frost Nova -- 122
100  if (spellproto->SpellFamilyFlags[0] & 0x40)
101  return DIMINISHING_ROOT;
102  // Ice Ward -- 111340
103  if (spellproto->SpellFamilyFlags[0] & 0x80000 && spellproto->SpellFamilyFlags[2] & 0x2000)
104  return DIMINISHING_ROOT;
105  // Freeze (Water Elemental) -- 33395
106  if (spellproto->SpellFamilyFlags[2] & 0x200)
107  return DIMINISHING_ROOT;
108 
109  // Deep Freeze -- 44572
110  if (spellproto->SpellFamilyFlags[1] & 0x100000)
111  return DIMINISHING_STUN;
112 
113  // Dragon's Breath -- 31661
114  if (spellproto->SpellFamilyFlags[0] & 0x800000)
116  // Polymorph -- 118
117  if (spellproto->SpellFamilyFlags[0] & 0x1000000)
119  // Ring of Frost -- 82691
120  if (spellproto->SpellFamilyFlags[2] & 0x40)
122  // Ice Nova -- 157997
123  if (spellproto->SpellFamilyFlags[2] & 0x800000)
125  break;
126  }
127  case SPELLFAMILY_WARRIOR:
128  {
129  // Shockwave -- 132168
130  if (spellproto->SpellFamilyFlags[1] & 0x8000)
131  return DIMINISHING_STUN;
132  // Storm Bolt -- 132169
133  if (spellproto->SpellFamilyFlags[2] & 0x1000)
134  return DIMINISHING_STUN;
135 
136  // Intimidating Shout -- 5246
137  if (spellproto->SpellFamilyFlags[0] & 0x40000)
138  return DIMINISHING_DISORIENT;
139 
140  // Hamstring -- 1715, 8 seconds in PvP (6.0)
141  if (spellproto->SpellFamilyFlags[0] & 0x2)
142  return DIMINISHING_LIMITONLY;
143  break;
144  }
145  case SPELLFAMILY_WARLOCK:
146  {
147  // Mortal Coil -- 6789
148  if (spellproto->SpellFamilyFlags[0] & 0x80000)
150  // Banish -- 710
151  if (spellproto->SpellFamilyFlags[1] & 0x8000000)
153  // Blood Horror -- 137143, no flags (17986)
154  if (spellproto->SpellIconID == 6447 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 26758)
156 
157  // Fear -- 118699
158  if (spellproto->SpellFamilyFlags[1] & 0x400)
159  return DIMINISHING_DISORIENT;
160  // Howl of Terror -- 5484
161  if (spellproto->SpellFamilyFlags[1] & 0x8)
162  return DIMINISHING_DISORIENT;
163 
164  // Shadowfury -- 30283
165  if (spellproto->SpellFamilyFlags[1] & 0x1000)
166  return DIMINISHING_STUN;
167  // Summon Infernal -- 22703
168  if (spellproto->SpellFamilyFlags[0] & 0x1000)
169  return DIMINISHING_STUN;
170  break;
171  }
173  {
174  // Fellash -- 115770
175  // Whiplash -- 6360
176  if (spellproto->SpellFamilyFlags[0] & 0x8000000)
178 
179  // Mesmerize (Shivarra pet) -- 115268
180  // Seduction (Succubus pet) -- 6358
181  if (spellproto->SpellFamilyFlags[0] & 0x2000000)
182  return DIMINISHING_DISORIENT;
183 
184  // Axe Toss (Felguard pet) -- 89766
185  if (spellproto->SpellFamilyFlags[1] & 0x4)
186  return DIMINISHING_STUN;
187  break;
188  }
189  case SPELLFAMILY_DRUID:
190  {
191  // Maim -- 22570
192  if (spellproto->SpellFamilyFlags[1] & 0x80)
193  return DIMINISHING_STUN;
194  // Mighty Bash -- 5211
195  if (spellproto->SpellFamilyFlags[0] & 0x2000)
196  return DIMINISHING_STUN;
197  // Rake -- 163505 -- no flags on the stun, 20490
198  if (spellproto->SpellIconID == 494 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38283)
199  return DIMINISHING_STUN;
200 
201  // Incapacitating Roar -- 99, no flags on the stun, 14
202  if (spellproto->SpellIconID == 960 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38528)
204 
205  // Cyclone -- 33786
206  if (spellproto->SpellFamilyFlags[1] & 0x20)
207  return DIMINISHING_DISORIENT;
208 
209  // Glyph of Fae Silence -- 114238, no flags on the silence, 15035
210  if (spellproto->SpellIconID == 957 && spellproto->SchoolMask == 8)
211  return DIMINISHING_SILENCE;
212 
213  // Typhoon -- 61391
214  if (spellproto->SpellFamilyFlags[1] & 0x1000000)
216  // Ursol's Vortex -- 127797, no flags on the effect, 16921
217  if (spellproto->SpellIconID == 5784 && spellproto->SchoolMask == 8)
219 
220  // Entangling Roots -- 339
221  if (spellproto->SpellFamilyFlags[0] & 0x200)
222  return DIMINISHING_ROOT;
223  // Mass Entanglement -- 102359, no flags on the root, 13535
224  if (spellproto->SpellIconID == 5782 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38269)
225  return DIMINISHING_ROOT;
226 
227  // Faerie Fire -- 770, 20 seconds in PvP (6.0)
228  if (spellproto->SpellFamilyFlags[0] & 0x400)
229  return DIMINISHING_LIMITONLY;
230  break;
231  }
232  case SPELLFAMILY_ROGUE:
233  {
234  // Cheap Shot -- 1833
235  if (spellproto->SpellFamilyFlags[0] & 0x400)
236  return DIMINISHING_STUN;
237  // Kidney Shot -- 408
238  if (spellproto->SpellFamilyFlags[0] & 0x200000)
239  return DIMINISHING_STUN;
240 
241  // Gouge -- 1776
242  if (spellproto->SpellFamilyFlags[0] & 0x8)
244  // Sap -- 6770
245  if (spellproto->SpellFamilyFlags[0] & 0x80)
247 
248  // Blind -- 2094
249  if (spellproto->SpellFamilyFlags[0] & 0x1000000)
250  return DIMINISHING_DISORIENT;
251 
252  // Garrote -- 1330
253  if (spellproto->SpellFamilyFlags[1] & 0x20000000)
254  return DIMINISHING_SILENCE;
255  break;
256  }
257  case SPELLFAMILY_HUNTER:
258  {
259  // Glyph of Explosive Trap -- 149575 maybe? @todo
260  // return DIMINISHING_AOE_KNOCKBACK;
261 
262  // Charge (Tenacity pet) -- 53148, no flags (5526)
263  if (spellproto->SpellIconID == 1559 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39480)
264  return DIMINISHING_ROOT;
265  // Narrow Escape -- 136634, no flags (17964)
266  if (spellproto->SpellIconID == 3342 && spellproto->SchoolMask == 8)
267  return DIMINISHING_ROOT;
268 
269  // Binding Shot -- 117526, no flags (15581)
270  if (spellproto->SpellIconID == 4612 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 6859)
271  return DIMINISHING_STUN;
272 
273  // Freezing Trap -- 3355
274  if (spellproto->SpellFamilyFlags[0] & 0x8)
276  // Wyvern Sting -- 19386
277  if (spellproto->SpellFamilyFlags[1] & 0x1000)
279  break;
280  }
281  case SPELLFAMILY_PALADIN:
282  {
283  // Repentance -- 20066
284  if (spellproto->SpellFamilyFlags[0] & 0x4)
286 
287  // Turn Evil -- 10326
288  if (spellproto->SpellFamilyFlags[1] & 0x800000)
289  return DIMINISHING_DISORIENT;
290 
291  // Avenger's Shield -- 31935
292  if (spellproto->SpellFamilyFlags[0] & 0x4000)
293  return DIMINISHING_SILENCE;
294 
295  // Fist of Justice -- 105593
296  // Hammer of Justice -- 853
297  if (spellproto->SpellFamilyFlags[0] & 0x800)
298  return DIMINISHING_STUN;
299  // Holy Wrath -- 119072
300  if (spellproto->SpellFamilyFlags[1] & 0x200000)
301  return DIMINISHING_STUN;
302  break;
303  }
304  case SPELLFAMILY_SHAMAN:
305  {
306  // Hex -- 51514
307  if (spellproto->SpellFamilyFlags[1] & 0x8000)
309 
310  // Thunderstorm -- 51490
311  if (spellproto->SpellFamilyFlags[1] & 0x2000)
313  // Earthgrab Totem -- 64695
314  if (spellproto->SpellFamilyFlags[2] & 0x4000)
315  return DIMINISHING_ROOT;
316  // Frost Shock (with Frozen Power) -- 63685, no flags (6918)
317  if (spellproto->SpellIconID == 193 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39876)
318  return DIMINISHING_ROOT;
319  break;
320  }
322  {
323  // Strangulate -- 47476
324  if (spellproto->SpellFamilyFlags[0] & 0x200)
325  return DIMINISHING_SILENCE;
326 
327  // Chains of Ice (with Chilblains) -- 96294, no flags (13020)
328  if (spellproto->SpellIconID == 180 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 20135)
329  return DIMINISHING_ROOT;
330 
331  // Asphyxiate -- 108194
332  if (spellproto->SpellFamilyFlags[2] & 0x100000)
333  return DIMINISHING_STUN;
334  // Gnaw (Ghoul) -- 91800, no flags (12511)
335  if (spellproto->SpellIconID == 3010 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38760)
336  return DIMINISHING_STUN;
337  // Monstrous Blow (Ghoul w/ Dark Transformation active) -- 91797, no flags (12510)
338  if (spellproto->SpellIconID == 15 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38761)
339  return DIMINISHING_STUN;
340  break;
341  }
342  case SPELLFAMILY_PRIEST:
343  {
344  // Glyph of Mind Blast -- 87194, no flags (10092)
345  if (spellproto->SpellIconID == 2114 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 38927)
346  return DIMINISHING_ROOT;
347  // Void Tendrils -- 114404, no flags (15067)
348  if (spellproto->SpellIconID == 5816 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 25199)
349  return DIMINISHING_ROOT;
350 
351  // Dominate Mind -- 605
352  if (spellproto->SpellFamilyFlags[0] & 0x20000 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39068)
354  // Holy Word: Chastise -- 88625
355  if (spellproto->SpellFamilyFlags[2] & 0x20)
357  // Psychic Horror -- 64044
358  if (spellproto->SpellFamilyFlags[2] & 0x2000)
360 
361  // Psychic Scream -- 8122
362  if (spellproto->SpellFamilyFlags[0] & 0x10000)
363  return DIMINISHING_DISORIENT;
364 
365  // Silence -- 15487
366  if (spellproto->SpellFamilyFlags[1] & 0x200000 && spellproto->SchoolMask == 32)
367  return DIMINISHING_SILENCE;
368  break;
369  }
370  case SPELLFAMILY_MONK:
371  {
372  // Disable -- 116706, no flags (15483)
373  if (spellproto->SpellIconID == 23 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39984)
374  return DIMINISHING_ROOT;
375 
376  // Charging Ox Wave -- 119392
377  if (spellproto->SpellFamilyFlags[1] & 0x10000)
378  return DIMINISHING_STUN;
379  // Fists of Fury -- 120086
380  if (spellproto->SpellFamilyFlags[1] & 0x800000 && !(spellproto->SpellFamilyFlags[2] & 0x8))
381  return DIMINISHING_STUN;
382  // Leg Sweep -- 119381
383  if (spellproto->SpellFamilyFlags[1] & 0x200)
384  return DIMINISHING_STUN;
385 
386  // Glyph of Breath of Fire -- 123393, no flags (16504)
387  if (spellproto->SpellIconID == 15 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 25408)
389  // Paralysis -- 115078
390  if (spellproto->SpellFamilyFlags[2] & 0x800000)
392  // Ring of Peace -- 137460, no flags (18006)
393  if (spellproto->SpellIconID == 7195 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 39999)
395  break;
396  }
397  default:
398  break;
399  }
400 
401  return DIMINISHING_NONE;
402 }
Definition: SharedDefines.h:4375
Definition: DBCEnums.h:404
Definition: SharedDefines.h:4633
Definition: SharedDefines.h:4371
Definition: SharedDefines.h:4376
Definition: SharedDefines.h:4638
Definition: SharedDefines.h:4628
Definition: SharedDefines.h:4632
Definition: SharedDefines.h:4379
Definition: SharedDefines.h:4626
Definition: SharedDefines.h:4377
Definition: SharedDefines.h:4634
Definition: SharedDefines.h:4629
Definition: SharedDefines.h:4378
Definition: SharedDefines.h:4631
Definition: SpellInfo.h:238
Definition: SpellAuraDefines.h:71
Definition: SharedDefines.h:4630
Definition: SharedDefines.h:4374
Definition: SharedDefines.h:4623
Definition: SharedDefines.h:4372
Definition: SharedDefines.h:4627
Definition: SharedDefines.h:4373
Definition: SharedDefines.h:4643
Definition: SharedDefines.h:4642

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DiminishingReturnsType GetDiminishingReturnsGroupType ( DiminishingGroup  group)
405 {
406  switch (group)
407  {
408  case DIMINISHING_TAUNT:
409  case DIMINISHING_STUN:
410  return DRTYPE_ALL;
412  case DIMINISHING_NONE:
413  return DRTYPE_NONE;
414  default:
415  return DRTYPE_PLAYER;
416  }
417 }
Definition: SharedDefines.h:4364
Definition: SharedDefines.h:4363
Definition: SharedDefines.h:4371
Definition: SharedDefines.h:4365
Definition: SharedDefines.h:4379
Definition: SharedDefines.h:4378
Definition: SharedDefines.h:4373

+ Here is the caller graph for this function:

int32 GetDiminishingReturnsLimitDuration ( SpellInfo const spellproto)
433 {
434  // Explicit diminishing duration
435  switch (spellproto->SpellFamilyName)
436  {
437  case SPELLFAMILY_DRUID:
438  {
439  // Faerie Fire - 20 seconds in PvP (6.0)
440  if (spellproto->SpellFamilyFlags[0] & 0x400)
441  return 20 * IN_MILLISECONDS;
442  break;
443  }
444  case SPELLFAMILY_HUNTER:
445  {
446  // Binding Shot - 3 seconds in PvP (6.0)
447  if (spellproto->SpellIconID == 4612 && spellproto->GetSpellVisual(DIFFICULTY_NONE) == 6859)
448  return 3 * IN_MILLISECONDS;
449  // Wyvern Sting - 6 seconds in PvP (6.0)
450  if (spellproto->SpellFamilyFlags[1] & 0x1000)
451  return 6 * IN_MILLISECONDS;
452  break;
453  }
454  case SPELLFAMILY_MONK:
455  {
456  // Paralysis - 4 seconds in PvP regardless of if they are facing you (6.0)
457  if (spellproto->SpellFamilyFlags[2] & 0x800000)
458  return 4 * IN_MILLISECONDS;
459  break;
460  }
461  default:
462  break;
463  }
464 
465  return 8 * IN_MILLISECONDS;
466 }
Definition: DBCEnums.h:404
Definition: SharedDefines.h:4632
Definition: SharedDefines.h:4630
Definition: Common.h:103
Definition: SharedDefines.h:4642

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

DiminishingLevels GetDiminishingReturnsMaxLevel ( DiminishingGroup  group)
420 {
421  switch (group)
422  {
423  case DIMINISHING_TAUNT:
426  return DIMINISHING_LEVEL_2;
427  default:
429  }
430 }
Definition: SharedDefines.h:4877
Definition: SharedDefines.h:4377
Definition: SharedDefines.h:4881
Definition: SharedDefines.h:4378
Definition: SharedDefines.h:4879

+ Here is the caller graph for this function:

bool IsPartOfSkillLine ( uint32  skillId,
uint32  spellId 
)
46 {
47  SkillLineAbilityMapBounds skillBounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId);
48  for (SkillLineAbilityMap::const_iterator itr = skillBounds.first; itr != skillBounds.second; ++itr)
49  if (itr->second->SkillLine == skillId)
50  return true;
51 
52  return false;
53 }
std::pair< SkillLineAbilityMap::const_iterator, SkillLineAbilityMap::const_iterator > SkillLineAbilityMapBounds
Definition: SpellMgr.h:549
#define sSpellMgr
Definition: SpellMgr.h:756

+ Here is the caller graph for this function:

bool IsPrimaryProfessionSkill ( uint32  skill)
34 {
35  SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill);
36  return pSkill && pSkill->CategoryID == SKILL_CATEGORY_PROFESSION;
37 }
Definition: DBCStructure.h:952
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
Definition: SharedDefines.h:4151
int32 CategoryID
Definition: DBCStructure.h:955

+ Here is the caller graph for this function:

bool IsWeaponSkill ( uint32  skill)
40 {
41  SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill);
42  return pSkill && pSkill->CategoryID == SKILL_CATEGORY_WEAPON;
43 }
Definition: DBCStructure.h:952
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
Definition: SharedDefines.h:4146
int32 CategoryID
Definition: DBCStructure.h:955
bool LoadPetDefaultSpells_helper ( CreatureTemplate const cInfo,
PetDefaultSpellsEntry petDefSpells 
)
2462 {
2463  // skip empty list;
2464  bool have_spell = false;
2465  for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
2466  {
2467  if (petDefSpells.spellid[j])
2468  {
2469  have_spell = true;
2470  break;
2471  }
2472  }
2473  if (!have_spell)
2474  return false;
2475 
2476  // remove duplicates with levelupSpells if any
2477  if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : NULL)
2478  {
2479  for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
2480  {
2481  if (!petDefSpells.spellid[j])
2482  continue;
2483 
2484  for (PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr)
2485  {
2486  if (itr->second == petDefSpells.spellid[j])
2487  {
2488  petDefSpells.spellid[j] = 0;
2489  break;
2490  }
2491  }
2492  }
2493  }
2494 
2495  // skip empty list;
2496  have_spell = false;
2497  for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
2498  {
2499  if (petDefSpells.spellid[j])
2500  {
2501  have_spell = true;
2502  break;
2503  }
2504  }
2505 
2506  return have_spell;
2507 }
#define MAX_CREATURE_SPELL_DATA_SLOT
Definition: SpellMgr.h:559
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 spellid[MAX_CREATURE_SPELL_DATA_SLOT]
Definition: SpellMgr.h:563
#define sSpellMgr
Definition: SpellMgr.h:756
std::multimap< uint32, uint32 > PetLevelupSpellSet
Definition: SpellMgr.h:554
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

Variable Documentation

PetFamilySpellsStore sPetFamilySpellsStore