OregonCore  revision be9e804-git
Your Favourite TBC server
SpellMgr Class Reference

#include <SpellMgr.h>

Public Member Functions

 SpellMgr ()
 
 ~SpellMgr ()
 
uint64 GetSpellAffectMask (uint16 spellId, uint8 effectId) const
 
bool IsAffectedBySpell (SpellEntry const *spellInfo, uint32 spellId, uint8 effectId, uint64 familyFlags) const
 
bool IsPositionTarget (uint32 target)
 
SpellThreatEntry const * GetSpellThreatEntry (uint32 spellID) const
 
SpellProcEventEntry const * GetSpellProcEvent (uint32 spellId) const
 
SpellEnchantProcEntry const * GetSpellEnchantProcEvent (uint32 enchId) const
 
SpellTargetPosition const * GetSpellTargetPosition (uint32 spell_id) const
 
SpellChainNode const * GetSpellChainNode (uint32 spell_id) const
 
uint32 GetSpellRequired (uint32 spell_id) const
 
uint32 GetFirstSpellInChain (uint32 spell_id) const
 
uint32 GetNextSpellInChain (uint32 spell_id) const
 
uint32 GetPrevSpellInChain (uint32 spell_id) const
 
SpellsRequiringSpellMap const & GetSpellsRequiringSpell () const
 
uint8 GetSpellRank (uint32 spell_id) const
 
uint32 GetLastSpellInChain (uint32 spell_id) const
 
uint8 IsHighRankOfSpell (uint32 spell1, uint32 spell2) const
 
bool IsRankSpellDueToSpell (SpellEntry const *spellInfo_1, uint32 spellId_2) const
 
SpellLearnSkillNode const * GetSpellLearnSkill (uint32 spell_id) const
 
bool IsSpellLearnSpell (uint32 spell_id) const
 
SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell (uint32 spell_id) const
 
SpellLearnSpellMap::const_iterator GetEndSpellLearnSpell (uint32 spell_id) const
 
bool IsSpellLearnToSpell (uint32 spell_id1, uint32 spell_id2) const
 
SkillLineAbilityMap::const_iterator GetBeginSkillLineAbilityMap (uint32 spell_id) const
 
SkillLineAbilityMap::const_iterator GetEndSkillLineAbilityMap (uint32 spell_id) const
 
PetAura const * GetPetAura (uint32 spell_id)
 
uint32 GetSpellCustomAttr (uint32 spell_id) const
 
const std::vector< int32 > * GetSpellLinked (int32 spell_id) const
 
const SpellDummyConditionEntryGetSpellDummyCondition (uint32 spellId, uint32 effIndex) const
 
void LoadSpellAffects ()
 
void LoadSpellGroups ()
 
void LoadSpellProcEvents ()
 
void LoadSpellTargetPositions ()
 
void LoadSpellThreats ()
 
void LoadSpellEnchantProcData ()
 
void LoadSpellDummyCondition ()
 
void LoadSpellGroupStackRules ()
 

Static Public Member Functions

static bool IsSpellProcEventCanTriggeredBy (SpellProcEventEntry const *spellProcEvent, uint32 EventProcFlag, SpellEntry const *procSpell, uint32 procFlags, uint32 procExtra, bool active)
 
static bool canStackSpellRanks (SpellEntry const *spellInfo)
 
static SpellMgrInstance ()
 

Public Attributes

SpellEffectTargetTypes EffectTargetType [TOTAL_SPELL_EFFECTS]
 
SpellSelectTargetTypes SpellTargetType [TOTAL_SPELL_TARGETS]
 

Private Attributes

SpellChainMap mSpellChains
 
SpellsRequiringSpellMap mSpellsReqSpell
 
SpellRequiredMap mSpellReq
 
SpellLearnSkillMap mSpellLearnSkills
 
SpellLearnSpellMap mSpellLearnSpells
 
SpellTargetPositionMap mSpellTargetPositions
 
SpellThreatMap mSpellThreatMap
 
SpellAffectMap mSpellAffectMap
 
SpellSpellGroupMap mSpellSpellGroup
 
SpellGroupSpellMap mSpellGroupSpell
 
SpellProcEventMap mSpellProcEventMap
 
SkillLineAbilityMap mSkillLineAbilityMap
 
SpellPetAuraMap mSpellPetAuraMap
 
SpellCustomAttribute mSpellCustomAttr
 
SpellLinkedMap mSpellLinkedMap
 
SpellGroupStackMap mSpellGroupStack
 
SpellEnchantProcEventMap mSpellEnchantProcEventMap
 
SpellDummyConditionMap mSpellDummyConditionMap
 

IsNoStackSpellDueToSpell

Determines whether a spell can stack, based on parameters of another spell

Parameters
spellId_1Spell to compare
spellId_2Spell we are comparing to
sameCasterAre these spells casted by the same entity?
bool IsNoStackSpellDueToSpell (uint32 spellId_1, uint32 spellId_2, bool sameCaster) const
 
SpellEntry const * SelectAuraRankForPlayerLevel (SpellEntry const *spellInfo, uint32 playerLevel) const
 
bool IsPrimaryProfessionFirstRankSpell (uint32 spellId) const
 
SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds (uint32 spell_id) const
 
bool IsSpellMemberOfSpellGroup (uint32 spellid, SpellGroup groupid) const
 
SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds (SpellGroup group_id) const
 
void GetSetOfSpellsInSpellGroup (SpellGroup group_id, std::set< uint32 > &foundSpells) const
 
void GetSetOfSpellsInSpellGroup (SpellGroup group_id, std::set< uint32 > &foundSpells, std::set< SpellGroup > &usedGroups) const
 
SpellGroupStackRule CheckSpellGroupStackRules (uint32 spellInfo1, uint32 spellInfo2) const
 
void LoadSpellChains ()
 
void LoadSpellRequired ()
 
void LoadSpellLearnSkills ()
 
void LoadSpellLearnSpells ()
 
void LoadSkillLineAbilityMap ()
 
void LoadSpellPetAuras ()
 
void LoadSpellCustomAttr ()
 
void LoadSpellCustomCooldowns ()
 
void LoadSpellLinked ()
 
static bool IsProfessionSpell (uint32 spellId)
 
static bool IsPrimaryProfessionSpell (uint32 spellId)
 
static bool IsSpellValid (SpellEntry const *spellInfo, Player *pl=NULL, bool msg=true)
 

Detailed Description

Definition at line 924 of file SpellMgr.h.

Constructor & Destructor Documentation

SpellMgr::SpellMgr ( )

Definition at line 30 of file SpellMgr.cpp.

References EffectTargetType, IsAreaEffectTarget, SPELL_EFFECT_ADD_FARSIGHT, SPELL_EFFECT_APPLY_AREA_AURA_ENEMY, SPELL_EFFECT_APPLY_AREA_AURA_FRIEND, SPELL_EFFECT_APPLY_AREA_AURA_OWNER, SPELL_EFFECT_APPLY_AREA_AURA_PARTY, SPELL_EFFECT_APPLY_AREA_AURA_PET, SPELL_EFFECT_BLOCK, SPELL_EFFECT_DISENCHANT, SPELL_EFFECT_ENCHANT_ITEM, SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY, SPELL_EFFECT_FEED_PET, SPELL_EFFECT_PARRY, SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_EFFECT_PROFICIENCY, SPELL_EFFECT_PROSPECTING, SPELL_EFFECT_SKILL, SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_DEAD_PET, SPELL_EFFECT_SUMMON_OBJECT_SLOT1, SPELL_EFFECT_SUMMON_OBJECT_SLOT2, SPELL_EFFECT_SUMMON_OBJECT_SLOT3, SPELL_EFFECT_SUMMON_OBJECT_SLOT4, SPELL_EFFECT_SUMMON_OBJECT_WILD, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_TRADE_SKILL, SPELL_EFFECT_TRANS_DOOR, SPELL_EFFECT_TRIGGER_MISSILE, SPELL_EFFECT_TRIGGER_SPELL_2, SPELL_REQUIRE_CASTER, SPELL_REQUIRE_DEST, SPELL_REQUIRE_ITEM, SPELL_REQUIRE_NONE, SPELL_REQUIRE_UNIT, SpellTargetType, TARGET_DEST_CASTER_BACK, TARGET_DEST_CASTER_BACK_LEFT, TARGET_DEST_CASTER_BACK_RIGHT, TARGET_DEST_CASTER_FRONT, TARGET_DEST_CASTER_FRONT_LEAP, TARGET_DEST_CASTER_FRONT_LEFT, TARGET_DEST_CASTER_FRONT_RIGHT, TARGET_DEST_CASTER_LEFT, TARGET_DEST_CASTER_RADIUS, TARGET_DEST_CASTER_RANDOM, TARGET_DEST_CASTER_RIGHT, TARGET_DEST_CHANNEL, TARGET_DEST_DEST, TARGET_DEST_DEST_BACK, TARGET_DEST_DEST_BACK_LEFT, TARGET_DEST_DEST_BACK_RIGHT, TARGET_DEST_DEST_FRONT, TARGET_DEST_DEST_FRONT_LEFT, TARGET_DEST_DEST_FRONT_RIGHT, TARGET_DEST_DEST_LEFT, TARGET_DEST_DEST_RANDOM, TARGET_DEST_DEST_RIGHT, TARGET_DEST_DYNOBJ_ALLY, TARGET_DEST_DYNOBJ_ENEMY, TARGET_DEST_DYNOBJ_NONE, TARGET_DEST_TARGET_ANY, TARGET_DEST_TARGET_BACK, TARGET_DEST_TARGET_BACK_LEFT, TARGET_DEST_TARGET_BACK_RIGHT, TARGET_DEST_TARGET_FRONT, TARGET_DEST_TARGET_FRONT_LEFT, TARGET_DEST_TARGET_FRONT_RIGHT, TARGET_DEST_TARGET_LEFT, TARGET_DEST_TARGET_RADIUS, TARGET_DEST_TARGET_RANDOM, TARGET_DEST_TARGET_RIGHT, TARGET_DEST_TRAJ, TARGET_DST_CASTER, TARGET_DST_DB, TARGET_DST_HOME, TARGET_DST_NEARBY_ENTRY, TARGET_DST_TARGET_ENEMY, TARGET_GAMEOBJECT_DEST_AREA, TARGET_GAMEOBJECT_SRC_AREA, TARGET_MINION, TARGET_SRC_CASTER, TARGET_TYPE_AREA_CONE, TARGET_TYPE_AREA_DST, TARGET_TYPE_AREA_SRC, TARGET_TYPE_CHANNEL, TARGET_TYPE_DEFAULT, TARGET_TYPE_DEST_CASTER, TARGET_TYPE_DEST_DEST, TARGET_TYPE_DEST_SPECIAL, TARGET_TYPE_DEST_TARGET, TARGET_TYPE_UNIT_CASTER, TARGET_TYPE_UNIT_NEARBY, TARGET_TYPE_UNIT_TARGET, TARGET_UNIT_AREA_ALLY_DST, TARGET_UNIT_AREA_ALLY_SRC, TARGET_UNIT_AREA_ENEMY_DST, TARGET_UNIT_AREA_ENEMY_SRC, TARGET_UNIT_AREA_ENTRY_DST, TARGET_UNIT_AREA_ENTRY_SRC, TARGET_UNIT_AREA_PARTY_DST, TARGET_UNIT_AREA_PARTY_SRC, TARGET_UNIT_CASTER, TARGET_UNIT_CASTER_FISHING, TARGET_UNIT_CHAINHEAL, TARGET_UNIT_CHANNEL, TARGET_UNIT_CLASS_TARGET, TARGET_UNIT_CONE_ALLY, TARGET_UNIT_CONE_ENEMY, TARGET_UNIT_CONE_ENEMY_UNKNOWN, TARGET_UNIT_CONE_ENTRY, TARGET_UNIT_MASTER, TARGET_UNIT_NEARBY_ALLY, TARGET_UNIT_NEARBY_ENEMY, TARGET_UNIT_NEARBY_ENTRY, TARGET_UNIT_NEARBY_PARTY, TARGET_UNIT_NEARBY_RAID, TARGET_UNIT_PARTY_CASTER, TARGET_UNIT_PARTY_TARGET, TARGET_UNIT_PET, TARGET_UNIT_RAID_CASTER, TARGET_UNIT_TARGET_ALLY, TARGET_UNIT_TARGET_ANY, TARGET_UNIT_TARGET_ENEMY, TARGET_UNIT_TARGET_MINIPET, TARGET_UNIT_TARGET_PARTY, TARGET_UNIT_TARGET_RAID, TOTAL_SPELL_EFFECTS, and TOTAL_SPELL_TARGETS.

31 {
32  for (int i = 0; i < TOTAL_SPELL_EFFECTS; ++i)
33  {
34  switch (i)
35  {
37  case SPELL_EFFECT_SUMMON: //28
39  case SPELL_EFFECT_TRANS_DOOR: //50 summon object
40  case SPELL_EFFECT_SUMMON_PET: //56
41  case SPELL_EFFECT_ADD_FARSIGHT: //72
48  case SPELL_EFFECT_TRIGGER_SPELL_2: //151 ritual of summon
50  break;
51  case SPELL_EFFECT_PARRY: // 0
52  case SPELL_EFFECT_BLOCK: // 0
53  case SPELL_EFFECT_SKILL: // always with dummy 3 as A
54  //case SPELL_EFFECT_LEARN_SPELL: // 0 may be 5 pet
55  case SPELL_EFFECT_TRADE_SKILL: // 0 or 1
56  case SPELL_EFFECT_PROFICIENCY: // 0
58  break;
65  break;
66  //caster must be pushed otherwise no sound
73  break;
74  default:
76  break;
77  }
78  }
79 
80  for (int i = 0; i < TOTAL_SPELL_TARGETS; ++i)
81  {
82  switch (i)
83  {
84  case TARGET_UNIT_CASTER:
86  case TARGET_UNIT_MASTER:
87  case TARGET_UNIT_PET:
91  break;
102  break;
109  break;
116  break;
123  break;
129  break;
130  case TARGET_DST_CASTER:
131  case TARGET_SRC_CASTER:
132  case TARGET_MINION:
145  break;
159  break;
163  case TARGET_DEST_DEST:
164  case TARGET_DEST_TRAJ:
175  break;
176  case TARGET_DST_DB:
177  case TARGET_DST_HOME:
180  break;
181  case TARGET_UNIT_CHANNEL:
182  case TARGET_DEST_CHANNEL:
184  break;
185  default:
187  }
188  }
189 
190  for (int i = 0; i < TOTAL_SPELL_TARGETS; ++i)
191  {
192  switch (i)
193  {
208  IsAreaEffectTarget[i] = true;
209  break;
210  default:
211  IsAreaEffectTarget[i] = false;
212  break;
213  }
214  }
215 }
bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS]
Definition: SpellMgr.cpp:28
SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS]
Definition: SpellMgr.h:1181
#define TOTAL_SPELL_TARGETS
SpellEffectTargetTypes EffectTargetType[TOTAL_SPELL_EFFECTS]
Definition: SpellMgr.h:1180
SpellMgr::~SpellMgr ( )

Definition at line 217 of file SpellMgr.cpp.

References UnitAI::ClearAISpellInfo().

218 {
220 }
static void ClearAISpellInfo()
Definition: UnitAI.cpp:325

Member Function Documentation

bool SpellMgr::canStackSpellRanks ( SpellEntry const *  spellInfo)
static

Checks whether spell should stack in spellbook with its ranks. If spell can stack it means that all its ranks will be shown in the spellbook.

Parameters
spellinfoPointer to the spell entry
Returns
true if spell ranks stack, false otherwise

Definition at line 1514 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::Id, IsProfessionSpell(), MAX_SPELL_EFFECTS, POWER_HEALTH, POWER_MANA, SpellEntry::powerType, SPELL_AURA_MOD_SHAPESHIFT, SPELL_EFFECT_APPLY_AREA_AURA_PARTY, SPELL_EFFECT_APPLY_AURA, SPELLFAMILY_DRUID, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SpellEntry::SpellFamilyFlags, and SpellEntry::SpellFamilyName.

Referenced by Player::AddSpell().

1515 {
1516  if (spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH)
1517  {
1518  // These spells do not cost energy/rage/focus and their cost does not
1519  // change between ranks so we will allow only the highest rank in spellbook
1520 
1521  // One exception - Faerie Fire (feral) need to stack in order to properly show
1522  // up in talent tree otherwise on higher rank it will be seen as not used
1523  if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && spellInfo->SpellFamilyFlags & 0x400)
1524  return true;
1525 
1526  return false;
1527  }
1528 
1529  if (IsProfessionSpell(spellInfo->Id))
1530  return false;
1531 
1532  // All stance spells. if any better way, change it.
1533  for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
1534  {
1535  // Paladin aura Spell
1536  if (spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN
1537  && spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
1538  return false;
1539  // Druid form Spell
1540  if (spellInfo->SpellFamilyName == SPELLFAMILY_DRUID
1541  && spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA
1542  && spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT)
1543  return false;
1544  // Rogue Stealth
1545  if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE
1546  && spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA
1547  && spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT)
1548  return false;
1549  }
1550  return true;
1551 }
static bool IsProfessionSpell(uint32 spellId)
Definition: SpellMgr.cpp:1753
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
SpellGroupStackRule SpellMgr::CheckSpellGroupStackRules ( uint32  spellInfo1,
uint32  spellInfo2 
) const

Definition at line 1708 of file SpellMgr.cpp.

References GetFirstSpellInChain(), GetSpellGroupSpellMapBounds(), GetSpellSpellGroupMapBounds(), IsSpellMemberOfSpellGroup(), mSpellGroupStack, and SPELL_GROUP_STACK_RULE_DEFAULT.

Referenced by IsNoStackSpellDueToSpell().

1709 {
1710  spellid_1 = GetFirstSpellInChain(spellid_1);
1711  spellid_2 = GetFirstSpellInChain(spellid_2);
1712  if (spellid_1 == spellid_2)
1714  // find SpellGroups which are common for both spells
1715  SpellSpellGroupMapBounds spellGroup1 = GetSpellSpellGroupMapBounds(spellid_1);
1716  std::set<SpellGroup> groups;
1717  for (SpellSpellGroupMap::const_iterator itr = spellGroup1.first; itr != spellGroup1.second; ++itr)
1718  {
1719  if (IsSpellMemberOfSpellGroup(spellid_2, itr->second))
1720  {
1721  bool add = true;
1722  SpellGroupSpellMapBounds groupSpell = GetSpellGroupSpellMapBounds(itr->second);
1723  for (SpellGroupSpellMap::const_iterator itr2 = groupSpell.first; itr2 != groupSpell.second; ++itr2)
1724  {
1725  if (itr2->second < 0)
1726  {
1727  SpellGroup currGroup = (SpellGroup)abs(itr2->second);
1728  if (IsSpellMemberOfSpellGroup(spellid_1, currGroup) && IsSpellMemberOfSpellGroup(spellid_2, currGroup))
1729  {
1730  add = false;
1731  break;
1732  }
1733  }
1734  }
1735  if (add)
1736  groups.insert(itr->second);
1737  }
1738  }
1739 
1741 
1742  for (std::set<SpellGroup>::iterator itr = groups.begin(); itr!= groups.end(); ++itr)
1743  {
1744  SpellGroupStackMap::const_iterator found = mSpellGroupStack.find(*itr);
1745  if (found != mSpellGroupStack.end())
1746  rule = found->second;
1747  if (rule)
1748  break;
1749  }
1750  return rule;
1751 }
SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds(SpellGroup group_id) const
Definition: SpellMgr.cpp:1676
std::pair< SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_iterator > SpellGroupSpellMapBounds
Definition: SpellMgr.h:676
SpellGroup
Definition: SpellMgr.h:659
std::pair< SpellSpellGroupMap::const_iterator, SpellSpellGroupMap::const_iterator > SpellSpellGroupMapBounds
Definition: SpellMgr.h:672
uint32 GetFirstSpellInChain(uint32 spell_id) const
Definition: SpellMgr.h:1020
bool IsSpellMemberOfSpellGroup(uint32 spellid, SpellGroup groupid) const
Definition: SpellMgr.cpp:1665
SpellGroupStackRule
Definition: SpellMgr.h:678
SpellGroupStackMap mSpellGroupStack
Definition: SpellMgr.h:1234
SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds(uint32 spell_id) const
Definition: SpellMgr.cpp:1659
SkillLineAbilityMap::const_iterator SpellMgr::GetBeginSkillLineAbilityMap ( uint32  spell_id) const
inline

Definition at line 1142 of file SpellMgr.h.

1143  {
1144  return mSkillLineAbilityMap.lower_bound(spell_id);
1145  }
SkillLineAbilityMap mSkillLineAbilityMap
Definition: SpellMgr.h:1230
SpellLearnSpellMap::const_iterator SpellMgr::GetBeginSpellLearnSpell ( uint32  spell_id) const
inline

Definition at line 1104 of file SpellMgr.h.

Referenced by LoadSpellLearnSpells().

1105  {
1106  return mSpellLearnSpells.lower_bound(spell_id);
1107  }
SpellLearnSpellMap mSpellLearnSpells
Definition: SpellMgr.h:1223
SkillLineAbilityMap::const_iterator SpellMgr::GetEndSkillLineAbilityMap ( uint32  spell_id) const
inline

Definition at line 1147 of file SpellMgr.h.

1148  {
1149  return mSkillLineAbilityMap.upper_bound(spell_id);
1150  }
SkillLineAbilityMap mSkillLineAbilityMap
Definition: SpellMgr.h:1230
SpellLearnSpellMap::const_iterator SpellMgr::GetEndSpellLearnSpell ( uint32  spell_id) const
inline

Definition at line 1109 of file SpellMgr.h.

Referenced by LoadSpellLearnSpells().

1110  {
1111  return mSpellLearnSpells.upper_bound(spell_id);
1112  }
SpellLearnSpellMap mSpellLearnSpells
Definition: SpellMgr.h:1223
uint32 SpellMgr::GetFirstSpellInChain ( uint32  spell_id) const
inline

Definition at line 1020 of file SpellMgr.h.

Referenced by CheckSpellGroupStackRules(), GetSpellSpellGroupMapBounds(), and IsRankSpellDueToSpell().

1021  {
1022  if (SpellChainNode const* node = GetSpellChainNode(spell_id))
1023  return node->first;
1024 
1025  return spell_id;
1026  }
SpellChainNode const * GetSpellChainNode(uint32 spell_id) const
Definition: SpellMgr.h:1002
uint32 SpellMgr::GetLastSpellInChain ( uint32  spell_id) const
inline

Definition at line 1061 of file SpellMgr.h.

Referenced by IsNoStackSpellDueToSpell().

1062  {
1063  if (SpellChainNode const* node = GetSpellChainNode(spell_id))
1064  return node->last;
1065 
1066  return spell_id;
1067  }
SpellChainNode const * GetSpellChainNode(uint32 spell_id) const
Definition: SpellMgr.h:1002
uint32 SpellMgr::GetNextSpellInChain ( uint32  spell_id) const
inline

Definition at line 1028 of file SpellMgr.h.

1029  {
1030  if (SpellChainNode const* node = GetSpellChainNode(spell_id))
1031  if (node->next)
1032  return node->next;
1033 
1034  return 0;
1035  }
SpellChainNode const * GetSpellChainNode(uint32 spell_id) const
Definition: SpellMgr.h:1002
PetAura const* SpellMgr::GetPetAura ( uint32  spell_id)
inline

Definition at line 1152 of file SpellMgr.h.

1153  {
1154  SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find(spell_id);
1155  if (itr != mSpellPetAuraMap.end())
1156  return &itr->second;
1157  else
1158  return NULL;
1159  }
SpellPetAuraMap mSpellPetAuraMap
Definition: SpellMgr.h:1231
uint32 SpellMgr::GetPrevSpellInChain ( uint32  spell_id) const
inline

Definition at line 1037 of file SpellMgr.h.

Referenced by SelectAuraRankForPlayerLevel().

1038  {
1039  if (SpellChainNode const* node = GetSpellChainNode(spell_id))
1040  if (node->prev)
1041  return node->prev;
1042 
1043  return 0;
1044  }
SpellChainNode const * GetSpellChainNode(uint32 spell_id) const
Definition: SpellMgr.h:1002
void SpellMgr::GetSetOfSpellsInSpellGroup ( SpellGroup  group_id,
std::set< uint32 > &  foundSpells 
) const

Definition at line 1681 of file SpellMgr.cpp.

Referenced by GetSetOfSpellsInSpellGroup(), and LoadSpellGroups().

1682 {
1683  std::set<SpellGroup> usedGroups;
1684  GetSetOfSpellsInSpellGroup(group_id, foundSpells, usedGroups);
1685 }
void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set< uint32 > &foundSpells) const
Definition: SpellMgr.cpp:1681
void SpellMgr::GetSetOfSpellsInSpellGroup ( SpellGroup  group_id,
std::set< uint32 > &  foundSpells,
std::set< SpellGroup > &  usedGroups 
) const

Definition at line 1687 of file SpellMgr.cpp.

References GetSetOfSpellsInSpellGroup(), and GetSpellGroupSpellMapBounds().

1688 {
1689  if (usedGroups.find(group_id) != usedGroups.end())
1690  return;
1691  usedGroups.insert(group_id);
1692 
1694  for (SpellGroupSpellMap::const_iterator itr = groupSpell.first; itr != groupSpell.second; ++itr)
1695  {
1696  if (itr->second < 0)
1697  {
1698  SpellGroup currGroup = (SpellGroup)abs(itr->second);
1699  GetSetOfSpellsInSpellGroup(currGroup, foundSpells, usedGroups);
1700  }
1701  else
1702  {
1703  foundSpells.insert(itr->second);
1704  }
1705  }
1706 }
SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds(SpellGroup group_id) const
Definition: SpellMgr.cpp:1676
std::pair< SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_iterator > SpellGroupSpellMapBounds
Definition: SpellMgr.h:676
SpellGroup
Definition: SpellMgr.h:659
void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set< uint32 > &foundSpells) const
Definition: SpellMgr.cpp:1681
uint64 SpellMgr::GetSpellAffectMask ( uint16  spellId,
uint8  effectId 
) const
inline

Definition at line 934 of file SpellMgr.h.

Referenced by IsAffectedBySpell().

935  {
936  SpellAffectMap::const_iterator itr = mSpellAffectMap.find((spellId << 8) + effectId);
937  if (itr != mSpellAffectMap.end())
938  return itr->second;
939  return 0;
940  }
SpellAffectMap mSpellAffectMap
Definition: SpellMgr.h:1226
SpellChainNode const* SpellMgr::GetSpellChainNode ( uint32  spell_id) const
inline

Definition at line 1002 of file SpellMgr.h.

1003  {
1004  SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
1005  if (itr == mSpellChains.end())
1006  return NULL;
1007 
1008  return &itr->second;
1009  }
SpellChainMap mSpellChains
Definition: SpellMgr.h:1219
uint32 SpellMgr::GetSpellCustomAttr ( uint32  spell_id) const
inline

Definition at line 1161 of file SpellMgr.h.

1162  {
1163  if (spell_id >= mSpellCustomAttr.size())
1164  return 0;
1165  else
1166  return mSpellCustomAttr[spell_id];
1167  /*SpellCustomAttrMap::const_iterator itr = mSpellCustomAttrMap.find(spell_id);
1168  if (itr != mSpellCustomAttrMap.end())
1169  return itr->second;
1170  else
1171  return 0;*/
1172  }
SpellCustomAttribute mSpellCustomAttr
Definition: SpellMgr.h:1232
const SpellDummyConditionEntry* SpellMgr::GetSpellDummyCondition ( uint32  spellId,
uint32  effIndex 
) const
inline

Definition at line 1183 of file SpellMgr.h.

1184  {
1185  typedef SpellDummyConditionMap::const_iterator Iterator;
1186  std::pair<Iterator, Iterator> range = mSpellDummyConditionMap.equal_range(spellId);
1187 
1188  for (Iterator it = range.first; it != range.second; it++)
1189  if (it->second.effIndex == effIndex)
1190  return &(it->second);
1191 
1192  return NULL;
1193  }
SpellDummyConditionMap mSpellDummyConditionMap
Definition: SpellMgr.h:1236
SpellEnchantProcEntry const* SpellMgr::GetSpellEnchantProcEvent ( uint32  enchId) const
inline

Definition at line 984 of file SpellMgr.h.

985  {
986  SpellEnchantProcEventMap::const_iterator itr = mSpellEnchantProcEventMap.find(enchId);
987  if (itr != mSpellEnchantProcEventMap.end())
988  return &itr->second;
989  return NULL;
990  }
SpellEnchantProcEventMap mSpellEnchantProcEventMap
Definition: SpellMgr.h:1235
SpellGroupSpellMapBounds SpellMgr::GetSpellGroupSpellMapBounds ( SpellGroup  group_id) const

Definition at line 1676 of file SpellMgr.cpp.

References mSpellGroupSpell.

Referenced by CheckSpellGroupStackRules(), GetSetOfSpellsInSpellGroup(), and LoadSpellGroupStackRules().

1677 {
1678  return mSpellGroupSpell.equal_range(group_id);
1679 }
SpellGroupSpellMap mSpellGroupSpell
Definition: SpellMgr.h:1228
SpellLearnSkillNode const* SpellMgr::GetSpellLearnSkill ( uint32  spell_id) const
inline

Definition at line 1090 of file SpellMgr.h.

1091  {
1092  SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
1093  if (itr != mSpellLearnSkills.end())
1094  return &itr->second;
1095  else
1096  return NULL;
1097  }
SpellLearnSkillMap mSpellLearnSkills
Definition: SpellMgr.h:1222
const std::vector<int32>* SpellMgr::GetSpellLinked ( int32  spell_id) const
inline

Definition at line 1174 of file SpellMgr.h.

1175  {
1176  SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id);
1177  return itr != mSpellLinkedMap.end() ? &(itr->second) : NULL;
1178  }
SpellLinkedMap mSpellLinkedMap
Definition: SpellMgr.h:1233
SpellProcEventEntry const* SpellMgr::GetSpellProcEvent ( uint32  spellId) const
inline

Definition at line 974 of file SpellMgr.h.

975  {
976  SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
977  if (itr != mSpellProcEventMap.end())
978  return &itr->second;
979  return NULL;
980  }
SpellProcEventMap mSpellProcEventMap
Definition: SpellMgr.h:1229
uint8 SpellMgr::GetSpellRank ( uint32  spell_id) const
inline

Definition at line 1053 of file SpellMgr.h.

Referenced by IsPrimaryProfessionFirstRankSpell(), and LoadSpellGroups().

1054  {
1055  if (SpellChainNode const* node = GetSpellChainNode(spell_id))
1056  return node->rank;
1057 
1058  return 0;
1059  }
SpellChainNode const * GetSpellChainNode(uint32 spell_id) const
Definition: SpellMgr.h:1002
uint32 SpellMgr::GetSpellRequired ( uint32  spell_id) const
inline

Definition at line 1011 of file SpellMgr.h.

1012  {
1013  SpellRequiredMap::const_iterator itr = mSpellReq.find(spell_id);
1014  if (itr == mSpellReq.end())
1015  return 0;
1016 
1017  return itr->second;
1018  }
SpellRequiredMap mSpellReq
Definition: SpellMgr.h:1221
SpellSpellGroupMapBounds SpellMgr::GetSpellSpellGroupMapBounds ( uint32  spell_id) const

Definition at line 1659 of file SpellMgr.cpp.

References GetFirstSpellInChain(), and mSpellSpellGroup.

Referenced by CheckSpellGroupStackRules(), and IsSpellMemberOfSpellGroup().

1660 {
1661  spell_id = GetFirstSpellInChain(spell_id);
1662  return mSpellSpellGroup.equal_range(spell_id);
1663 }
SpellSpellGroupMap mSpellSpellGroup
Definition: SpellMgr.h:1227
uint32 GetFirstSpellInChain(uint32 spell_id) const
Definition: SpellMgr.h:1020
SpellsRequiringSpellMap const& SpellMgr::GetSpellsRequiringSpell ( ) const
inline

Definition at line 1046 of file SpellMgr.h.

1047  {
1048  return mSpellsReqSpell;
1049  }
SpellsRequiringSpellMap mSpellsReqSpell
Definition: SpellMgr.h:1220
SpellTargetPosition const* SpellMgr::GetSpellTargetPosition ( uint32  spell_id) const
inline

Definition at line 993 of file SpellMgr.h.

994  {
995  SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
996  if (itr != mSpellTargetPositions.end())
997  return &itr->second;
998  return NULL;
999  }
SpellTargetPositionMap mSpellTargetPositions
Definition: SpellMgr.h:1224
SpellThreatEntry const* SpellMgr::GetSpellThreatEntry ( uint32  spellID) const
inline

Definition at line 958 of file SpellMgr.h.

959  {
960  SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellID);
961  if (itr != mSpellThreatMap.end())
962  return &itr->second;
963  else
964  {
965  uint32 firstSpell = GetFirstSpellInChain(spellID);
966  SpellThreatMap::const_iterator itr = mSpellThreatMap.find(firstSpell);
967  if (itr != mSpellThreatMap.end())
968  return &itr->second;
969  }
970  return NULL;
971  }
uint32 GetFirstSpellInChain(uint32 spell_id) const
Definition: SpellMgr.h:1020
SpellThreatMap mSpellThreatMap
Definition: SpellMgr.h:1225
ACE_UINT32 uint32
Definition: Define.h:71
SpellMgr & SpellMgr::Instance ( )
static

Definition at line 222 of file SpellMgr.cpp.

223 {
224  static SpellMgr spellMgr;
225  return spellMgr;
226 }
bool SpellMgr::IsAffectedBySpell ( SpellEntry const *  spellInfo,
uint32  spellId,
uint8  effectId,
uint64  familyFlags 
) const

Definition at line 1054 of file SpellMgr.cpp.

References GetSpellAffectMask(), SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, and sSpellStore.

1055 {
1056  // false for spellInfo == NULL
1057  if (!spellInfo)
1058  return false;
1059 
1060  SpellEntry const* affect_spell = sSpellStore.LookupEntry(spellId);
1061  // false for affect_spell == NULL
1062  if (!affect_spell)
1063  return false;
1064 
1065  // False if spellFamily not equal
1066  if (affect_spell->SpellFamilyName != spellInfo->SpellFamilyName)
1067  return false;
1068 
1069  // If familyFlags == 0
1070  if (!familyFlags)
1071  {
1072  // Get it from spellAffect table
1073  familyFlags = GetSpellAffectMask(spellId, effectId);
1074  // false if familyFlags == 0
1075  if (!familyFlags)
1076  return false;
1077  }
1078 
1079  // true
1080  if (familyFlags & spellInfo->SpellFamilyFlags)
1081  return true;
1082 
1083  return false;
1084 }
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint64 GetSpellAffectMask(uint16 spellId, uint8 effectId) const
Definition: SpellMgr.h:934
uint32 SpellFamilyName
Definition: DBCStructure.h:760
uint8 SpellMgr::IsHighRankOfSpell ( uint32  spell1,
uint32  spell2 
) const
inline

Definition at line 1069 of file SpellMgr.h.

1070  {
1071  SpellChainMap::const_iterator itr1 = mSpellChains.find(spell1);
1072  SpellChainMap::const_iterator itr2 = mSpellChains.find(spell2);
1073  if (itr1 == mSpellChains.end() || itr2 == mSpellChains.end())
1074  return false;
1075 
1076  if (itr1->second.first == itr2->second.first)
1077  if (itr1->second.rank > itr2->second.rank)
1078  return true;
1079 
1080  return false;
1081  }
SpellChainMap mSpellChains
Definition: SpellMgr.h:1219
bool SpellMgr::IsNoStackSpellDueToSpell ( uint32  spellId_1,
uint32  spellId_2,
bool  sameCaster 
) const

Definition at line 1560 of file SpellMgr.cpp.

References CheckSpellGroupStackRules(), SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::EffectMiscValue, GetLastSpellInChain(), GetSpellSpecific(), SpellEntry::HasAttribute(), SpellEntry::Id, MAX_SPELL_EFFECTS, SPELL_ATTR0_PASSIVE, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOUNTED, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_MANA, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PERIODIC_MANA_LEECH, SPELL_AURA_PERIODIC_TRIGGER_SPELL, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_POWER_BURN_MANA, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_PERSISTENT_AREA_AURA, SPELL_GROUP_STACK_RULE_DEFAULT, SPELL_GROUP_STACK_RULE_EXCLUSIVE, SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER, SPELL_SPECIFIC_ASPECT, SPELL_SPECIFIC_CURSE, SPELL_SPECIFIC_JUDGEMENT, SPELL_SPECIFIC_STING, SPELL_SPECIFIC_WARLOCK_CORRUPTION, SPELLFAMILY_GENERIC, SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, SpellEntry::SpellIconID, and sSpellStore.

1561 {
1562  SpellEntry const* spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
1563  SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
1564 
1565  if (!spellInfo_1 || !spellInfo_2)
1566  return false;
1567 
1568  SpellGroupStackRule stackRule = CheckSpellGroupStackRules(spellInfo_1->Id, spellInfo_2->Id);
1569  if (stackRule)
1570  {
1571  if (stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE)
1572  return true;
1573  if (sameCaster && stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER)
1574  return true;
1575  if (stackRule != SPELL_GROUP_STACK_RULE_DEFAULT)
1576  return false;
1577  }
1578 
1579  if (spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName)
1580  return false;
1581 
1582  if (!sameCaster)
1583  {
1584  // Iterate through effects
1585  for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1586  if (spellInfo_1->Effect[i] == SPELL_EFFECT_APPLY_AURA
1587  || spellInfo_1->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
1588  // not area auras (shaman totem)
1589  switch (spellInfo_1->EffectApplyAuraName[i])
1590  {
1591  // DOT or HOT from different casters will stack
1602  return false;
1603  default:
1604  break;
1605  }
1606  }
1607 
1608  // Iterate through specifics
1609  SpellSpecific spellSpec = GetSpellSpecific(spellId_1);
1610  switch (spellSpec)
1611  {
1612  case SPELL_SPECIFIC_STING:
1613  case SPELL_SPECIFIC_CURSE:
1614  case SPELL_SPECIFIC_ASPECT:
1617  return sameCaster == (spellSpec == GetSpellSpecific(spellId_2));
1618  default:
1619  break;
1620  }
1621 
1622  if (spellInfo_1->SpellFamilyName == SPELLFAMILY_GENERIC)
1623  {
1624  if (spellInfo_1->HasAttribute(SPELL_ATTR0_PASSIVE) && spellInfo_1->SpellIconID == 1)
1625  return false;
1626 
1627  if (spellInfo_1->SpellIconID == spellInfo_2->SpellIconID)
1628  return true;
1629 
1630  if (spellInfo_1->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED && spellInfo_2->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED)
1631  return true;
1632 
1633  if (!(spellInfo_1->EffectApplyAuraName[0] == SPELL_AURA_MOD_POWER_REGEN &&
1634  spellInfo_1->EffectApplyAuraName[1] == SPELL_AURA_PERIODIC_DUMMY))
1635  return false;
1636  }
1637 
1638  // check for class spells
1639  else
1640  {
1641  if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags)
1642  return false;
1643  }
1644 
1645  //use data of highest rank spell(needed for spells which ranks have different effects)
1646  spellInfo_1 = sSpellStore.LookupEntry(GetLastSpellInChain(spellId_1));
1647  spellInfo_2 = sSpellStore.LookupEntry(GetLastSpellInChain(spellId_2));
1648 
1649  //if spells have exactly the same effect they cannot stack
1650  for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1651  if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i]
1652  || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]
1653  || spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura
1654  return false; // need itemtype check? need an example to add that check
1655 
1656  return true;
1657 }
uint32 GetLastSpellInChain(uint32 spell_id) const
Definition: SpellMgr.h:1061
SpellSpecific
Definition: SpellMgr.h:95
SpellGroupStackRule CheckSpellGroupStackRules(uint32 spellInfo1, uint32 spellInfo2) const
Definition: SpellMgr.cpp:1708
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
bool HasAttribute(SpellAttributes attribute) const
Definition: DBCStructure.h:774
uint64 SpellFamilyFlags
Definition: DBCStructure.h:761
uint32 SpellIconID
Definition: DBCStructure.h:745
int32 EffectMiscValue[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:739
SpellGroupStackRule
Definition: SpellMgr.h:678
uint32 SpellFamilyName
Definition: DBCStructure.h:760
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT32 uint32
Definition: Define.h:71
SpellSpecific GetSpellSpecific(uint32 spellId)
Definition: SpellMgr.cpp:396
bool SpellMgr::IsPositionTarget ( uint32  target)
inline

Definition at line 944 of file SpellMgr.h.

References TARGET_TYPE_DEST_CASTER, TARGET_TYPE_DEST_DEST, and TARGET_TYPE_DEST_TARGET.

Referenced by LoadSpellCustomAttr().

945  {
946  switch (SpellTargetType[target])
947  {
951  return true;
952  default:
953  break;
954  }
955  return false;
956  }
SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS]
Definition: SpellMgr.h:1181
bool SpellMgr::IsPrimaryProfessionFirstRankSpell ( uint32  spellId) const

Definition at line 1781 of file SpellMgr.cpp.

References GetSpellRank(), and IsPrimaryProfessionSpell().

1782 {
1783  return IsPrimaryProfessionSpell(spellId) && GetSpellRank(spellId) == 1;
1784 }
static bool IsPrimaryProfessionSpell(uint32 spellId)
Definition: SpellMgr.cpp:1767
uint8 GetSpellRank(uint32 spell_id) const
Definition: SpellMgr.h:1053
bool SpellMgr::IsPrimaryProfessionSpell ( uint32  spellId)
static

Definition at line 1767 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectMiscValue, IsPrimaryProfessionSkill(), SPELL_EFFECT_SKILL, and sSpellStore.

Referenced by IsPrimaryProfessionFirstRankSpell().

1768 {
1769  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
1770  if (!spellInfo)
1771  return false;
1772 
1773  if (spellInfo->Effect[1] != SPELL_EFFECT_SKILL)
1774  return false;
1775 
1776  uint32 skill = spellInfo->EffectMiscValue[1];
1777 
1778  return IsPrimaryProfessionSkill(skill);
1779 }
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
bool IsPrimaryProfessionSkill(uint32 skill)
Definition: SpellMgr.h:813
int32 EffectMiscValue[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:739
ACE_UINT32 uint32
Definition: Define.h:71
bool SpellMgr::IsProfessionSpell ( uint32  spellId)
static

Definition at line 1753 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectMiscValue, IsProfessionSkill(), SPELL_EFFECT_SKILL, and sSpellStore.

Referenced by canStackSpellRanks(), and ObjectMgr::LoadTrainerSpell().

1754 {
1755  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
1756  if (!spellInfo)
1757  return false;
1758 
1759  if (spellInfo->Effect[1] != SPELL_EFFECT_SKILL)
1760  return false;
1761 
1762  uint32 skill = spellInfo->EffectMiscValue[1];
1763 
1764  return IsProfessionSkill(skill);
1765 }
bool IsProfessionSkill(uint32 skill)
Definition: SpellMgr.h:825
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
int32 EffectMiscValue[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:739
ACE_UINT32 uint32
Definition: Define.h:71
bool SpellMgr::IsRankSpellDueToSpell ( SpellEntry const *  spellInfo_1,
uint32  spellId_2 
) const

Definition at line 1499 of file SpellMgr.cpp.

References GetFirstSpellInChain(), SpellEntry::Id, and sSpellStore.

1500 {
1501  SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
1502  if (!spellInfo_1 || !spellInfo_2) return false;
1503  if (spellInfo_1->Id == spellId_2) return false;
1504 
1505  return GetFirstSpellInChain(spellInfo_1->Id) == GetFirstSpellInChain(spellId_2);
1506 }
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 GetFirstSpellInChain(uint32 spell_id) const
Definition: SpellMgr.h:1020
bool SpellMgr::IsSpellLearnSpell ( uint32  spell_id) const
inline

Definition at line 1099 of file SpellMgr.h.

1100  {
1101  return mSpellLearnSpells.count(spell_id) != 0;
1102  }
SpellLearnSpellMap mSpellLearnSpells
Definition: SpellMgr.h:1223
bool SpellMgr::IsSpellLearnToSpell ( uint32  spell_id1,
uint32  spell_id2 
) const
inline

Definition at line 1114 of file SpellMgr.h.

1115  {
1116  SpellLearnSpellMap::const_iterator b = GetBeginSpellLearnSpell(spell_id1);
1117  SpellLearnSpellMap::const_iterator e = GetEndSpellLearnSpell(spell_id1);
1118  for (SpellLearnSpellMap::const_iterator i = b; i != e; ++i)
1119  if (i->second.spell == spell_id2)
1120  return true;
1121  return false;
1122  }
SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell(uint32 spell_id) const
Definition: SpellMgr.h:1104
SpellLearnSpellMap::const_iterator GetEndSpellLearnSpell(uint32 spell_id) const
Definition: SpellMgr.h:1109
bool SpellMgr::IsSpellMemberOfSpellGroup ( uint32  spellid,
SpellGroup  groupid 
) const

Definition at line 1665 of file SpellMgr.cpp.

References GetSpellSpellGroupMapBounds().

Referenced by CheckSpellGroupStackRules().

1666 {
1668  for (SpellSpellGroupMap::const_iterator itr = spellGroup.first; itr != spellGroup.second; ++itr)
1669  {
1670  if (itr->second == groupid)
1671  return true;
1672  }
1673  return false;
1674 }
std::pair< SpellSpellGroupMap::const_iterator, SpellSpellGroupMap::const_iterator > SpellSpellGroupMapBounds
Definition: SpellMgr.h:672
SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds(uint32 spell_id) const
Definition: SpellMgr.cpp:1659
bool SpellMgr::IsSpellProcEventCanTriggeredBy ( SpellProcEventEntry const *  spellProcEvent,
uint32  EventProcFlag,
SpellEntry const *  procSpell,
uint32  procFlags,
uint32  procExtra,
bool  active 
)
static

Definition at line 1147 of file SpellMgr.cpp.

References PROC_EX_CRITICAL_HIT, PROC_EX_EX_TRIGGER_ALWAYS, PROC_EX_INTERNAL_DOT, PROC_EX_INTERNAL_HOT, PROC_EX_NONE, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_PERIODIC, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_TRAP_ACTIVATION, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_FLAG_TAKEN_PERIODIC, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS, SpellProcEventEntry::procEx, SpellProcEventEntry::schoolMask, SpellEntry::SchoolMask, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_POTION, SpellEntry::SpellFamilyFlags, SpellProcEventEntry::spellFamilyMask, SpellProcEventEntry::spellFamilyName, and SpellEntry::SpellFamilyName.

Referenced by Unit::IsTriggeredAtSpellProcEvent().

1148 {
1149  // No extra req need
1150  uint32 procEvent_procEx = PROC_EX_NONE;
1151 
1152  // check prockFlags for condition
1153  if ((procFlags & EventProcFlag) == 0)
1154  return false;
1155 
1156  /* Check Periodic Auras
1157 
1158  * Both hots and dots can trigger if spell has no PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
1159  nor PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
1160 
1161  * Only Hots can trigger if spell has PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
1162 
1163  * Only dots can trigger if spell has both positivity flags or PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
1164 
1165  */
1166 
1167  if (procFlags & PROC_FLAG_DONE_PERIODIC)
1168  {
1169  if (EventProcFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG)
1170  {
1171  if (!(procExtra & PROC_EX_INTERNAL_DOT))
1172  return false;
1173  }
1174  else if (EventProcFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
1175  && !(procExtra & PROC_EX_INTERNAL_HOT))
1176  return false;
1177  }
1178 
1179  if (procFlags & PROC_FLAG_TAKEN_PERIODIC)
1180  {
1181  if (EventProcFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG)
1182  {
1183  if (!(procExtra & PROC_EX_INTERNAL_DOT))
1184  return false;
1185  }
1186  else if (EventProcFlag & PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
1187  && !(procExtra & PROC_EX_INTERNAL_HOT))
1188  return false;
1189  }
1190 
1191  // Always trigger for this
1193  return true;
1194 
1195  if (spellProcEvent) // Exist event data
1196  {
1197  // Store extra req
1198  procEvent_procEx = spellProcEvent->procEx;
1199 
1200  // For melee triggers
1201  if (procSpell == NULL)
1202  {
1203  // Check (if set) for school (melee attack have Normal school)
1204  if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
1205  return false;
1206  }
1207  else // For spells need check school/spell family/family mask
1208  {
1209  // Potions can trigger only if spellfamily given
1210  if (procSpell->SpellFamilyName == SPELLFAMILY_POTION)
1211  {
1212  if (procSpell->SpellFamilyName == spellProcEvent->spellFamilyName)
1213  return true;
1214  return false;
1215  }
1216 
1217  // Check (if set) for school
1218  if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0)
1219  return false;
1220 
1221  // Check (if set) for spellFamilyName
1222  if (spellProcEvent->spellFamilyName && (spellProcEvent->spellFamilyName != procSpell->SpellFamilyName))
1223  return false;
1224 
1225  // spellFamilyName is Ok need check for spellFamilyMask if present
1226  if (spellProcEvent->spellFamilyMask)
1227  {
1228  if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags) == 0)
1229  return false;
1230  active = true; // Spell added manualy -> so its active spell
1231  }
1232  }
1233  }
1234  // potions can trigger only if have spell_proc entry
1235  else if (procSpell && procSpell->SpellFamilyName == SPELLFAMILY_POTION)
1236  return false;
1237 
1238  // Check for extra req (if none) and hit/crit
1239  if (procEvent_procEx == PROC_EX_NONE)
1240  {
1241  // No extra req, so can trigger only for active (damage/healing present) and hit/crit
1242  if ((procExtra & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) && active)
1243  return true;
1244  }
1245  else // Passive spells hits here only if resist/reflect/immune/evade
1246  {
1247  // Exist req for PROC_EX_EX_TRIGGER_ALWAYS
1248  if (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS)
1249  return true;
1250  // Passive spells cant trigger if need hit
1251  if ((procEvent_procEx & PROC_EX_NORMAL_HIT) && !active)
1252  return false;
1253  // Check Extra Requirement like (hit/crit/miss/resist/parry/dodge/block/immune/reflect/absorb and other)
1254  if (procEvent_procEx & procExtra)
1255  return true;
1256  }
1257  return false;
1258 }
ACE_UINT32 uint32
Definition: Define.h:71
bool SpellMgr::IsSpellValid ( SpellEntry const *  spellInfo,
Player pl = NULL,
bool  msg = true 
)
static

Definition at line 2829 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectItemType, SpellEntry::EffectTriggerSpell, ObjectMgr::GetItemTemplate(), SpellEntry::Id, ChatHandler::PSendSysMessage(), SpellEntry::Reagent, sLog, SPELL_EFFECT_CREATE_ITEM, SPELL_EFFECT_LEARN_SPELL, and sSpellStore.

Referenced by Player::AddSpell(), ChatHandler::HandleCastCommand(), ChatHandler::HandleCastDistCommand(), ChatHandler::HandleCastSelfCommand(), ChatHandler::HandleLearnAllCommand(), ChatHandler::HandleLearnAllCraftsCommand(), ChatHandler::HandleLearnAllGMCommand(), ChatHandler::HandleLearnAllMySpellsCommand(), ChatHandler::HandleLearnAllMyTalentsCommand(), ChatHandler::HandleLearnAllRecipesCommand(), ChatHandler::HandleLearnCommand(), ChatHandler::HandlePetLearnCommand(), ObjectMgr::LoadQuests(), and ObjectMgr::LoadTrainerSpell().

2830 {
2831  // not exist
2832  if (!spellInfo)
2833  return false;
2834 
2835  bool need_check_reagents = false;
2836 
2837  // check effects
2838  for (int i = 0; i < 3; ++i)
2839  {
2840  switch (spellInfo->Effect[i])
2841  {
2842  case 0:
2843  continue;
2844 
2845  // craft spell for crafting non-existed item (break client recipes list show)
2847  {
2848  if (!ObjectMgr::GetItemTemplate(spellInfo->EffectItemType[i]))
2849  {
2850  if (msg)
2851  {
2852  if (pl)
2853  ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->EffectItemType[i]);
2854  else
2855  sLog.outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->EffectItemType[i]);
2856  }
2857  return false;
2858  }
2859 
2860  need_check_reagents = true;
2861  break;
2862  }
2864  {
2865  SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]);
2866  if (!IsSpellValid(spellInfo2, pl, msg))
2867  {
2868  if (msg)
2869  {
2870  if (pl)
2871  ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->EffectTriggerSpell[i]);
2872  else
2873  sLog.outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->EffectTriggerSpell[i]);
2874  }
2875  return false;
2876  }
2877  break;
2878  }
2879  }
2880  }
2881 
2882  if (need_check_reagents)
2883  {
2884  for (int j = 0; j < 8; ++j)
2885  {
2886  if (spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemTemplate(spellInfo->Reagent[j]))
2887  {
2888  if (msg)
2889  {
2890  if (pl)
2891  ChatHandler(pl).PSendSysMessage("Craft spell %u has invalid reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
2892  else
2893  sLog.outErrorDb("Craft spell %u has invalid reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
2894  }
2895  return false;
2896  }
2897  }
2898  }
2899 
2900  return true;
2901 }
#define sLog
Log class singleton.
Definition: Log.h:187
static ItemTemplate const * GetItemTemplate(uint32 id)
Definition: ObjectMgr.h:648
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
Definition: Chat.cpp:858
static bool IsSpellValid(SpellEntry const *spellInfo, Player *pl=NULL, bool msg=true)
Definition: SpellMgr.cpp:2829
void SpellMgr::LoadSkillLineAbilityMap ( )

Definition at line 3039 of file SpellMgr.cpp.

References mSkillLineAbilityMap, sLog, SkillLineAbilityEntry::spellId, and sSkillLineAbilityStore.

3040 {
3041  mSkillLineAbilityMap.clear();
3042 
3043  uint32 count = 0;
3044 
3045  for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); i++)
3046  {
3047  SkillLineAbilityEntry const* SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
3048  if (!SkillInfo)
3049  continue;
3050 
3051  mSkillLineAbilityMap.insert(SkillLineAbilityMap::value_type(SkillInfo->spellId, SkillInfo));
3052  ++count;
3053  }
3054 
3055  sLog.outString(">> Loaded %u SkillLineAbility MultiMap", count);
3056 }
#define sLog
Log class singleton.
Definition: Log.h:187
SkillLineAbilityMap mSkillLineAbilityMap
Definition: SpellMgr.h:1230
ACE_UINT32 uint32
Definition: Define.h:71
DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore(SkillLineAbilityfmt)
void SpellMgr::LoadSpellAffects ( )

Definition at line 964 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::EffectItemType, MAX_SPELL_EFFECTS, mSpellAffectMap, Database::Query(), sLog, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_ADD_TARGET_TRIGGER, SPELL_AURA_DUMMY, SPELL_EFFECT_APPLY_AURA, SpellEntry::SpellName, sSpellStore, sWorld, and WorldDatabase.

965 {
966  mSpellAffectMap.clear(); // need for reload case
967 
968  uint32 count = 0;
969 
970  // 0 1 2
971  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, effectId, SpellFamilyMask FROM spell_affect");
972  if (!result)
973  {
974  sLog.outString(">> Loaded %u spell affect definitions", count);
975  return;
976  }
977 
978  do
979  {
980  Field* fields = result->Fetch();
981 
982  uint16 entry = fields[0].GetUInt16();
983  uint8 effectId = fields[1].GetUInt8();
984 
985  SpellEntry const* spellInfo = sSpellStore.LookupEntry(entry);
986 
987  if (!spellInfo)
988  {
989  sLog.outErrorDb("Spell %u listed in spell_affect does not exist", entry);
990  continue;
991  }
992 
993  if (effectId >= 3)
994  {
995  sLog.outErrorDb("Spell %u listed in spell_affect has invalid effect index (%u)", entry, effectId);
996  continue;
997  }
998 
999  if ((spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA) ||
1000  (spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_DUMMY &&
1001  spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_FLAT_MODIFIER &&
1002  spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_PCT_MODIFIER &&
1003  spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER))
1004  {
1005  sLog.outErrorDb("Spell %u listed in spell_affect does not have SPELL_AURA_ADD_FLAT_MODIFIER (%u) or SPELL_AURA_ADD_PCT_MODIFIER (%u) or SPELL_AURA_ADD_TARGET_TRIGGER (%u) for effect index (%u)", entry, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_ADD_TARGET_TRIGGER, effectId);
1006  continue;
1007  }
1008 
1009  uint64 spellAffectMask = fields[2].GetUInt64();
1010 
1011  // Spell.dbc have own data for low part of SpellFamilyMask
1012  if (spellInfo->EffectItemType[effectId])
1013  {
1014  if (spellInfo->EffectItemType[effectId] == spellAffectMask)
1015  {
1016  sLog.outErrorDb("Spell %u listed in spell_affect has redundant (same with EffectItemType%d) data for effect index (%u), skipped.", entry, effectId + 1, effectId);
1017  continue;
1018  }
1019  }
1020 
1021  mSpellAffectMap.insert(SpellAffectMap::value_type((entry << 8) + effectId, spellAffectMask));
1022 
1023  ++count;
1024  }
1025  while (result->NextRow());
1026 
1027  sLog.outString(">> Loaded %u spell affect definitions", count);
1028 
1029  for (uint32 id = 0; id < sSpellStore.GetNumRows(); ++id)
1030  {
1031  SpellEntry const* spellInfo = sSpellStore.LookupEntry(id);
1032  if (!spellInfo)
1033  continue;
1034 
1035  for (int effectId = 0; effectId < MAX_SPELL_EFFECTS; ++effectId)
1036  {
1037  if (spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA ||
1038  (spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_FLAT_MODIFIER &&
1039  spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_PCT_MODIFIER &&
1040  spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER))
1041  continue;
1042 
1043  if (spellInfo->EffectItemType[effectId] != 0)
1044  continue;
1045 
1046  if (mSpellAffectMap.find((id << 8) + effectId) != mSpellAffectMap.end())
1047  continue;
1048 
1049  sLog.outErrorDb("Spell %u (%s) misses spell_affect for effect %u", id, spellInfo->SpellName[sWorld.GetDefaultDbcLocale()], effectId);
1050  }
1051  }
1052 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
char * SpellName[16]
Definition: DBCStructure.h:748
ACE_UINT8 uint8
Definition: Define.h:73
uint32 EffectItemType[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:738
SpellAffectMap mSpellAffectMap
Definition: SpellMgr.h:1226
ACE_UINT64 uint64
Definition: Define.h:70
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
#define sWorld
Definition: World.h:860
ACE_UINT16 uint16
Definition: Define.h:72
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellChains ( )

Definition at line 1890 of file SpellMgr.cpp.

References SpellEntry::DurationIndex, SpellRankEntry::DurationIndex, SkillLineAbilityEntry::forward_spellid, GetTalentSpellPos(), SpellRankValue::Id, SpellEntry::manaCost, SpellRankEntry::ManaCost, mSkillLineAbilityMap, mSpellChains, SpellEntry::procFlags, SpellRankEntry::ProcFlags, SpellEntry::rangeIndex, SpellRankEntry::RangeIndex, SpellEntry::Rank, SpellRankValue::Rank, TalentEntry::RankID, SkillLineAbilityEntry::skillId, SpellRankEntry::SkillId, sLog, SPELLFAMILY_MAGE, SpellEntry::SpellFamilyFlags, SpellRankEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, SpellEntry::SpellIconID, SkillLineAbilityEntry::spellId, SpellEntry::spellLevel, SpellEntry::SpellName, SpellRankEntry::SpellName, SpellEntry::SpellVisual, SpellRankEntry::SpellVisual, sSkillLineAbilityStore, sSpellStore, sTalentStore, sWorld, SpellEntry::TargetAuraState, SpellRankEntry::TargetAuraState, and value.

1891 {
1892  mSpellChains.clear(); // need for reload case
1893 
1894  std::vector<uint32> ChainedSpells;
1895  for (uint32 ability_id = 0; ability_id < sSkillLineAbilityStore.GetNumRows(); ability_id++)
1896  {
1897  SkillLineAbilityEntry const* AbilityInfo = sSkillLineAbilityStore.LookupEntry(ability_id);
1898  if (!AbilityInfo)
1899  continue;
1900  if (AbilityInfo->spellId == 20154) //exception to these rules (not needed in 3.0.3)
1901  continue;
1902  if (!AbilityInfo->forward_spellid)
1903  continue;
1904  ChainedSpells.push_back(AbilityInfo->forward_spellid);
1905  }
1906 
1907  std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry> RankMap;
1908 
1909  for (uint32 ability_id = 0; ability_id < sSkillLineAbilityStore.GetNumRows(); ability_id++)
1910  {
1911  SkillLineAbilityEntry const* AbilityInfo = sSkillLineAbilityStore.LookupEntry(ability_id);
1912  if (!AbilityInfo)
1913  continue;
1914 
1915  //get only spell with lowest ability_id to prevent doubles
1916  uint32 spell_id = AbilityInfo->spellId;
1917  if (spell_id == 20154) //exception to these rules (not needed in 3.0.3)
1918  continue;
1919  bool found = false;
1920  for (uint32 i = 0; i < ChainedSpells.size(); i++)
1921  {
1922  if (ChainedSpells.at(i) == spell_id)
1923  found = true;
1924  }
1925  if (found)
1926  continue;
1927 
1928  if (mSkillLineAbilityMap.lower_bound(spell_id)->second->id != ability_id)
1929  continue;
1930  SpellEntry const* SpellInfo = sSpellStore.LookupEntry(spell_id);
1931  if (!SpellInfo)
1932  continue;
1933  std::string sRank = SpellInfo->Rank[sWorld.GetDefaultDbcLocale()];
1934  if (sRank.empty())
1935  continue;
1936  //exception to polymorph spells-make pig and turtle other chain than sheep
1937  if ((SpellInfo->SpellFamilyName == SPELLFAMILY_MAGE) && (SpellInfo->SpellFamilyFlags & 0x1000000) && (SpellInfo->SpellIconID != 82))
1938  continue;
1939 
1940  SpellRankEntry entry;
1942  entry.SkillId = AbilityInfo->skillId;
1943  entry.SpellName = SpellInfo->SpellName[sWorld.GetDefaultDbcLocale()];
1944  entry.DurationIndex = SpellInfo->DurationIndex;
1945  entry.RangeIndex = SpellInfo->rangeIndex;
1946  entry.ProcFlags = SpellInfo->procFlags;
1947  entry.SpellFamilyFlags = SpellInfo->SpellFamilyFlags;
1948  entry.TargetAuraState = SpellInfo->TargetAuraState;
1949  entry.SpellVisual = SpellInfo->SpellVisual;
1950  entry.ManaCost = SpellInfo->manaCost;
1951 
1952  for (;;)
1953  {
1954  AbilityInfo = mSkillLineAbilityMap.lower_bound(spell_id)->second;
1955  value.Id = spell_id;
1956  value.Rank = SpellInfo->Rank[sWorld.GetDefaultDbcLocale()];
1957  RankMap.insert(std::pair<SpellRankEntry, SpellRankValue>(entry, value));
1958  spell_id = AbilityInfo->forward_spellid;
1959  SpellInfo = sSpellStore.LookupEntry(spell_id);
1960  if (!SpellInfo)
1961  break;
1962  }
1963  }
1964 
1965 
1966  uint32 count = 0;
1967 
1968  for (std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator itr = RankMap.begin(); itr != RankMap.end();)
1969  {
1970  SpellRankEntry entry = itr->first;
1971  //trac errors in extracted data
1972  std::multimap<char const*, std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator> RankErrorMap;
1973  for (std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator itr2 = RankMap.lower_bound(entry); itr2 != RankMap.upper_bound(entry); itr2++)
1974  RankErrorMap.insert(std::pair<char const*, std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator>(itr2->second.Rank, itr2));
1975  for (std::multimap<char const*, std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator>::iterator itr2 = RankErrorMap.begin(); itr2 != RankErrorMap.end();)
1976  {
1977  char const* err_entry = itr2->first;
1978  uint32 rank_count = RankErrorMap.count(itr2->first);
1979  if (rank_count > 1)
1980  for (itr2 = RankErrorMap.lower_bound(err_entry); itr2 != RankErrorMap.upper_bound(err_entry); itr2++)
1981  {
1982  sLog.outDebug("There is a duplicate rank entry (%s) for spell: %u", itr2->first, itr2->second->second.Id);
1983  sLog.outDebug("Spell %u removed from chain data.", itr2->second->second.Id);
1984  RankMap.erase(itr2->second);
1985  itr = RankMap.lower_bound(entry);
1986  }
1987  else
1988  itr2++;
1989  }
1990  //do not proceed for spells with less than 2 ranks
1991  uint32 spell_max_rank = RankMap.count(entry);
1992  if (spell_max_rank < 2)
1993  {
1994  itr = RankMap.upper_bound(entry);
1995  continue;
1996  }
1997 
1998  itr = RankMap.upper_bound(entry);
1999 
2000  //order spells by spells by spellLevel
2001  std::list<uint32> RankedSpells;
2002  uint32 min_spell_lvl = 0;
2003  std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator min_itr;
2004  for (; RankMap.count(entry);)
2005  {
2006  for (std::multimap<SpellRankEntry, SpellRankValue, SpellRankEntry>::iterator itr2 = RankMap.lower_bound(entry); itr2 != RankMap.upper_bound(entry); itr2++)
2007  {
2008  SpellEntry const* SpellInfo = sSpellStore.LookupEntry(itr2->second.Id);
2009  if (SpellInfo->spellLevel < min_spell_lvl || itr2 == RankMap.lower_bound(entry))
2010  {
2011  min_spell_lvl = SpellInfo->spellLevel;
2012  min_itr = itr2;
2013  }
2014  }
2015  RankedSpells.push_back(min_itr->second.Id);
2016  RankMap.erase(min_itr);
2017  }
2018 
2019  //use data from talent.dbc
2020  uint16 talent_id = 0;
2021  for (std::list<uint32>::iterator itr2 = RankedSpells.begin(); itr2 != RankedSpells.end();)
2022  {
2023  if (TalentSpellPos const* TalentPos = GetTalentSpellPos(*itr2))
2024  {
2025  talent_id = TalentPos->talent_id;
2026  RankedSpells.erase(itr2);
2027  itr2 = RankedSpells.begin();
2028  }
2029  else
2030  itr2++;
2031  }
2032  if (talent_id)
2033  {
2034  TalentEntry const* TalentInfo = sTalentStore.LookupEntry(talent_id);
2035  for (uint8 rank = 5; rank; rank--)
2036  {
2037  if (TalentInfo->RankID[rank - 1])
2038  RankedSpells.push_front(TalentInfo->RankID[rank - 1]);
2039  }
2040  }
2041 
2042  count++;
2043 
2044  itr = RankMap.upper_bound(entry);
2045  uint32 spell_rank = 1;
2046  for (std::list<uint32>::iterator itr2 = RankedSpells.begin(); itr2 != RankedSpells.end(); spell_rank++)
2047  {
2048  uint32 spell_id = *itr2;
2049  mSpellChains[spell_id].rank = spell_rank;
2050  mSpellChains[spell_id].first = RankedSpells.front();
2051  mSpellChains[spell_id].last = RankedSpells.back();
2052 
2053  itr2++;
2054 
2055  if (spell_rank < 2)
2056  mSpellChains[spell_id].prev = 0;
2057 
2058  if (spell_id == RankedSpells.back())
2059  mSpellChains[spell_id].next = 0;
2060  else
2061  {
2062  mSpellChains[*itr2].prev = spell_id;
2063  mSpellChains[spell_id].next = *itr2;
2064  }
2065  }
2066  }
2067 
2068  //uncomment these two lines to print yourself list of spell_chains on startup
2069  // for (UNORDERED_MAP<uint32, SpellChainNode>::iterator itr=mSpellChains.begin();itr != mSpellChains.end();itr++)
2070  // sLog.outString("Id: %u, Rank: %d , %s",itr->first,itr->second.rank, sSpellStore.LookupEntry(itr->first)->Rank[sWorld.GetDefaultDbcLocale()]);
2071 
2072  sLog.outString(">> Loaded %u spell chains", count);
2073 }
uint32 spellLevel
Definition: DBCStructure.h:707
uint32 SpellVisual
Definition: SpellMgr.cpp:1863
char const * SpellName
Definition: SpellMgr.cpp:1860
uint32 RangeIndex
Definition: SpellMgr.cpp:1862
uint32 SpellVisual
Definition: DBCStructure.h:743
#define sLog
Log class singleton.
Definition: Log.h:187
SkillLineAbilityMap mSkillLineAbilityMap
Definition: SpellMgr.h:1230
char * Rank[16]
Definition: DBCStructure.h:750
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 rangeIndex
Definition: DBCStructure.h:714
uint32 procFlags
Definition: DBCStructure.h:702
DBCStorage< TalentEntry > sTalentStore(TalentEntryfmt)
char * SpellName[16]
Definition: DBCStructure.h:748
ACE_UINT8 uint8
Definition: Define.h:73
uint32 TargetAuraState
Definition: SpellMgr.cpp:1866
TalentSpellPos const * GetTalentSpellPos(uint32 spellId)
Definition: DBCStores.cpp:589
char const * Rank
Definition: SpellMgr.cpp:1887
uint32 ProcFlags
Definition: SpellMgr.cpp:1864
etc mysql my cnf *Then change max_allowed_packet to a bigger value
uint64 SpellFamilyFlags
Definition: DBCStructure.h:761
uint32 SpellIconID
Definition: DBCStructure.h:745
uint32 DurationIndex
Definition: DBCStructure.h:708
uint32 TargetAuraState
Definition: DBCStructure.h:693
uint32 RankID[5]
Definition: DBCStructure.h:934
uint32 SpellFamilyName
Definition: DBCStructure.h:760
uint32 DurationIndex
Definition: SpellMgr.cpp:1861
SpellChainMap mSpellChains
Definition: SpellMgr.h:1219
#define sWorld
Definition: World.h:860
ACE_UINT16 uint16
Definition: Define.h:72
ACE_UINT32 uint32
Definition: Define.h:71
uint64 SpellFamilyFlags
Definition: SpellMgr.cpp:1865
uint32 manaCost
Definition: DBCStructure.h:710
DBCStorage< SkillLineAbilityEntry > sSkillLineAbilityStore(SkillLineAbilityfmt)
void SpellMgr::LoadSpellCustomAttr ( )

Definition at line 2263 of file SpellMgr.cpp.

References SpellEntry::Attributes, SpellEntry::AttributesEx, SpellEntry::AttributesEx2, SpellEntry::AttributesEx3, SpellEntry::AttributesEx4, SpellEntry::CastingTimeIndex, SpellEntry::Category, SpellEntry::DurationIndex, SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::EffectBasePoints, SpellEntry::EffectImplicitTargetA, SpellEntry::EffectImplicitTargetB, SpellEntry::EffectTriggerSpell, UnitAI::FillAISpellInfo(), FORM_SHADOW, GetSpellStore(), SpellEntry::Id, IN_MILLISECONDS, SpellEntry::InterruptFlags, IsPositionTarget(), ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL, MAX_SPELL_EFFECTS, SpellEntry::MaxAffectedTargets, mSpellCustomAttr, SpellEntry::rangeIndex, SpellEntry::RecoveryTime, SpellEntry::speed, SPEED_CHARGE, SPELL_ATTR0_HEARTBEAT_RESIST_CHECK, SPELL_ATTR0_IMPOSSIBLE_DODGE_PARRY_BLOCK, SPELL_ATTR0_NEGATIVE_1, SPELL_ATTR0_NOT_SHAPESHIFT, SPELL_ATTR0_OUTDOORS_ONLY, SPELL_ATTR0_PASSIVE, SPELL_ATTR1_NOT_BREAK_STEALTH, SPELL_ATTR2_IGNORE_LOS, SPELL_ATTR2_NOT_NEED_SHAPESHIFT, SPELL_ATTR3_CANT_MISS, SPELL_ATTR3_HAS_VISUAL_EFFECT, SPELL_ATTR3_NO_INITIAL_AGGRO, SPELL_ATTR4_NOT_STEALABLE, SPELL_ATTR4_NOT_USABLE_IN_ARENA, SPELL_ATTR_CU_ANY_TARGET, SPELL_ATTR_CU_AURA_CC, SPELL_ATTR_CU_AURA_DOT, SPELL_ATTR_CU_AURA_HOT, SPELL_ATTR_CU_AURA_SPELL, SPELL_ATTR_CU_CAST_BY_ITEM_ONLY, SPELL_ATTR_CU_CHARGE, SPELL_ATTR_CU_CONE_BACK, SPELL_ATTR_CU_CONE_LINE, SPELL_ATTR_CU_DIRECT_DAMAGE, SPELL_ATTR_CU_FIXED_AMOUNT, SPELL_ATTR_CU_IGNORE_ARMOR, SPELL_ATTR_CU_MOVEMENT_IMPAIR, SPELL_ATTR_CU_PICKPOCKET, SPELL_ATTR_CU_SHARE_DAMAGE, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_SPEED_NOT_STACK, SPELL_AURA_MOD_STUN, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_REUSED_BLESSED_LIFE, SPELL_AURA_REUSED_INCREASE_PET_OUTDOOR_SPEED, SPELL_CATEGORY_CONJURED_POTIONS, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_CHARGE, SPELL_EFFECT_DUMMY, SPELL_EFFECT_HEAL, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_EFFECT_PICKPOCKET, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_EFFECT_SELF_RESURRECT, SPELL_EFFECT_TRIGGER_MISSILE, SPELL_EFFECT_TRIGGER_SPELL, SPELL_EFFECT_WEAPON_DAMAGE, SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL, SPELL_EFFECT_WEAPON_PERCENT_DAMAGE, SPELL_INTERRUPT_FLAG_MOVEMENT, SPELLFAMILY_DRUID, SPELLFAMILY_WARRIOR, SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, SpellTargetType, SpellEntry::SpellVisual, sSpellItemEnchantmentStore, sSpellStore, SpellEntry::Stances, SpellEntry::StartRecoveryCategory, SpellEntry::StartRecoveryTime, TARGET_FLAG_DEST_LOCATION, TARGET_FLAG_SOURCE_LOCATION, TARGET_NONE, TARGET_TYPE_UNIT_TARGET, TARGET_UNIT_CASTER, TARGET_UNIT_TARGET_ENEMY, SpellEntry::Targets, and SpellEntry::ToolTip.

2264 {
2265  mSpellCustomAttr.resize(GetSpellStore()->GetNumRows());
2266 
2267  SpellEntry* spellInfo;
2268  for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
2269  {
2270  mSpellCustomAttr[i] = 0;
2271  spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i);
2272  if (!spellInfo)
2273  continue;
2274 
2275  bool auraSpell = true;
2276  for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2277  {
2278  if (spellInfo->Effect[j])
2279  if (spellInfo->Effect[j] != SPELL_EFFECT_APPLY_AURA
2281  //ignore target party for now
2282  {
2283  auraSpell = false;
2284  break;
2285  }
2286  }
2287  if (auraSpell)
2289 
2290  for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2291  {
2292  switch (spellInfo->EffectApplyAuraName[j])
2293  {
2298  break;
2302  break;
2303  case SPELL_AURA_MOD_ROOT:
2306  break;
2307  default:
2308  break;
2309  }
2310 
2311  switch (spellInfo->Effect[j])
2312  {
2318  case SPELL_EFFECT_HEAL:
2320  break;
2321  case SPELL_EFFECT_CHARGE:
2322  if (!spellInfo->speed && !spellInfo->SpellFamilyName)
2323  spellInfo->speed = SPEED_CHARGE;
2325  break;
2328  break;
2330  if (IsPositionTarget(spellInfo->EffectImplicitTargetA[j]) ||
2332  spellInfo->Effect[j] = SPELL_EFFECT_TRIGGER_MISSILE;
2333  break;
2335  // Self-Ressurect spells shouldn't be usable in arenas
2337  break;
2338  }
2339  }
2340 
2341  for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
2342  {
2343  switch (spellInfo->EffectApplyAuraName[j])
2344  {
2347  case SPELL_AURA_MOD_CHARM:
2348  case SPELL_AURA_MOD_FEAR:
2349  case SPELL_AURA_MOD_STUN:
2352  break;
2353  }
2354  }
2355 
2356  for (uint32 j = 0; j < 16; j++)
2357  {
2358  if (spellInfo->ToolTip[j] && *spellInfo->ToolTip[j])
2359  {
2361  break;
2362  }
2363  }
2364 
2365  if (spellInfo->SpellVisual == 3879)
2367 
2368  // Natural Shapeshifter
2369  if (spellInfo->Id == 16834 || spellInfo->Id == 16835)
2370  {
2371  SpellEntry const* baseInfo = sSpellStore.LookupEntry(16833);
2372  spellInfo->DurationIndex = baseInfo->DurationIndex;
2373  }
2374 
2375  switch (spellInfo->Category)
2376  {
2378  // these spells have 2min shared cooldown, But the time doesn't seem to be in dbcs.
2379  // I have really no idea from where client gets the data, perhaps hardcoded like this?
2380  spellInfo->RecoveryTime = 2 * 60 * IN_MILLISECONDS;
2381  spellInfo->StartRecoveryTime = 2 * 60 * IN_MILLISECONDS;
2382  spellInfo->StartRecoveryCategory = 2 * 60 * IN_MILLISECONDS;
2383  break;
2384  }
2385 
2386  switch (i)
2387  {
2388  case 26029: // dark glare
2389  case 37433: // spout
2390  case 43140:
2391  case 43215: // flame breath
2393  break;
2394  case 24340:
2395  case 26558:
2396  case 28884: // Meteor
2397  case 36837:
2398  case 38903:
2399  case 41276: // Meteor
2400  case 26789: // Shard of the Fallen Star
2401  case 31436: // Malevolent Cleave
2402  case 35181: // Dive Bomb
2403  case 40810:
2404  case 43267:
2405  case 43268: // Saber Lash
2406  case 42384: // Brutal Swipe
2407  case 45150: // Meteor Slash
2409  switch (i) // Saber Lash Targets
2410  {
2411  case 40810:
2412  spellInfo->MaxAffectedTargets = 3;
2413  break;
2414  case 43267:
2415  case 43268:
2416  spellInfo->MaxAffectedTargets = 2;
2417  break;
2418  }
2419  break;
2420  case 44978:
2421  case 45001:
2422  case 45002: // Wild Magic
2423  case 45004:
2424  case 45006:
2425  case 45010: // Wild Magic
2426  case 31347: // Doom
2427  case 41635: // Prayer of Mending
2428  case 44869: // Spectral Blast
2429  case 45027: // Revitalize
2430  case 45976: // Muru Portal Channel
2431  case 39365: // Thundering Storm
2432  case 41071: // Raise Dead
2433  case 41172: // Rapid Shot
2434  case 40834: // Agonizing Flames
2435  spellInfo->MaxAffectedTargets = 1;
2436  break;
2437  case 36384: // Skartax Purple Beam
2438  spellInfo->MaxAffectedTargets = 2;
2439  break;
2440  case 41357: // L1 Acane Charge
2441  case 41376: // Spite
2442  case 39992: // Needle Spine
2443  case 29576: // Multi-Shot
2444  case 37790: // Spread Shot
2445  case 45248: // Shadow Blades
2446  case 41303: // Soul Drain
2447  spellInfo->MaxAffectedTargets = 3;
2448  break;
2449  case 38310: // Multi-Shot
2450  spellInfo->MaxAffectedTargets = 4;
2451  break;
2452  case 32205: // Place Burning Blade Pyre
2453  spellInfo->AttributesEx2 |= SPELL_ATTR2_IGNORE_LOS;
2454  break;
2455  case 42005: // Bloodboil
2456  case 38296: // Spitfire Totem
2457  case 37676: // Insidious Whisper
2458  case 46008: // Negative Energy
2459  case 45641: // Fire Bloom
2460  case 5484: // Howl Of Terror
2461  case 46771: // Flame Sear
2462  spellInfo->MaxAffectedTargets = 5;
2463  break;
2464  case 15286: // Vampiric Embrace
2465  case 34914: // Vampiric Touch
2466  spellInfo->Attributes |= SPELL_ATTR0_NOT_SHAPESHIFT;
2468  spellInfo->Stances = FORM_SHADOW;
2469  break;
2470  case 40827: // Sinful Beam
2471  case 40859: // Sinister Beam
2472  case 40860: // Vile Beam
2473  case 40861: // Wicked Beam
2474  spellInfo->MaxAffectedTargets = 10;
2475  break;
2476  case 46841: // Escape to the Isle of Quel'Denas
2477  spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_CASTER;
2478  break;
2479  case 8122:
2480  case 8124:
2481  case 10888:
2482  case 10890: // Psychic Scream
2483  case 12494: // Frostbite
2485  break;
2486  case 38794:
2487  case 33711: //Murmur's Touch
2488  spellInfo->MaxAffectedTargets = 1;
2489  spellInfo->EffectTriggerSpell[0] = 33760;
2490  break;
2491  case 36350: //They Must Burn Bomb Aura (self)
2492  spellInfo->EffectTriggerSpell[0] = 36325; // They Must Burn Bomb Drop (DND)
2493  break;
2494  case 44949: // Whirlwind's offhand attack - @todo remove this (50% weapon damage effect)
2495  spellInfo->Effect[1] = 0;
2496  break;
2497  case 12723: // Sweeping Strikes proc
2500  break;
2501  case 24905: // Moonkin form -> elune's touch
2502  spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER;
2503  break;
2504  case 7922: // Charge stun
2505  case 25274: // Intercept stun
2506  case 2094: // Blind
2507  case 20424: // Seal of Command Trigger
2508  spellInfo->speed = 590.0f; // Minor delay
2509  break;
2510  case 32220: // Judgement of Blood
2511  spellInfo->speed = 5.0f; // Minor delay
2512  break;
2513  case 1833: // Cheap Shot
2514  spellInfo->speed = 1230.0f; // Tiny delay
2515  break;
2516  case 26679: // Deadly Throw
2517  spellInfo->speed = 0; // Instant
2518  break;
2519  case 41013: // Parasitic Shadowfiend Passive
2520  spellInfo->EffectApplyAuraName[0] = 4; // proc debuff, and summon infinite fiends
2521  break;
2522  case 1543: // Flare
2523  spellInfo->speed = 0;
2524  break;
2525  case 27892: // To Anchor 1
2526  case 27928: // To Anchor 1
2527  case 27935: // To Anchor 1
2528  case 27915: // Anchor to Skulls
2529  case 27931: // Anchor to Skulls
2530  case 27937: // Anchor to Skulls
2531  spellInfo->rangeIndex = 13;
2532  break;
2533  case 34580:
2535  break;
2536  case 39384:
2537  spellInfo->Effect[1] = 0; //Delete this effect, could be fixed also by implementing script_targets for each spell effect..
2538  spellInfo->rangeIndex = 16;//1y, don't know why, but with 5y (dbc value) all fields around are effected too, so somethings wrong in range check for those spells propably..
2539  break;
2540  case 6774:
2541  spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO; // slice and dice no longer gives combat or remove stealth
2543  break;
2544  case 29200: // Purify Helboar Meat
2545  spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
2546  spellInfo->EffectImplicitTargetB[0] = 0;
2547  break;
2548  case 35460: // Fury of the Dreghood Elders
2550  break;
2551  case 4073: // Mechanical Dragonling
2552  case 19804: // Arcanite Dragonling
2553  case 12749: // Mithril Mechanical Dragonling
2554  case 13258: // Summon Goblin Bomb
2555  case 13166: // Battle Chicken
2557  break;
2558  case 13279: // Gnomish Death Ray (Dummy Target)
2561  break;
2562  case 31828: // Blessed Life (Rank 1)
2563  case 31829: // Blessed Life (Rank 2)
2564  case 31830: // Blessed Life (Rank 3)
2566  break;
2567  case 39095: // Amplify Damage (Prince Malchaazar)
2569  spellInfo->EffectImplicitTargetB[0] = 0;
2570  break;
2571  case 42389: // Nalorakk's Mangle
2573  spellInfo->EffectImplicitTargetB[1] = 0;
2574  break;
2575  case 29955: // "Arcane Missiles implict correctly target"
2576  spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
2577  break;
2578  case 33206: // "Pain Suppression dispel resistance"
2580  break;
2581  case 19970: // Entangling Roots (Rank 6) -- Nature's Grasp Proc
2582  case 19971: // Entangling Roots (Rank 5) -- Nature's Grasp Proc
2583  case 19972: // Entangling Roots (Rank 4) -- Nature's Grasp Proc
2584  case 19973: // Entangling Roots (Rank 3) -- Nature's Grasp Proc
2585  case 19974: // Entangling Roots (Rank 2) -- Nature's Grasp Proc
2586  case 19975: // Entangling Roots (Rank 1) -- Nature's Grasp Proc
2587  case 27010: // Entangling Roots (Rank 7) -- Nature's Grasp Proc
2588  spellInfo->CastingTimeIndex = 1;
2589  break;
2590  case 19596: // Bestial Swiftness - append additional aura
2592  break;
2593  case 1206: // "REUSE" - we turn it into 30% outdoor movement speed bonus (for Bestial Swiftness)
2594  spellInfo->Effect[0] = SPELL_EFFECT_APPLY_AURA;
2596  spellInfo->EffectBasePoints[0] = 29; // all spells claiming they increase speed by 30% increase it just by 29%
2598  break;
2599  case 31789: // Righteous Defense
2600  spellInfo->EffectTriggerSpell[1] = 31790;
2601  break;
2602  case 47129: // Totemic Beacon
2603  spellInfo->EffectImplicitTargetA[1] = TARGET_NONE;
2604  break;
2605  case 40255: // Molten Flame
2606  // Molten Fire triggers itself, resulting in infinite cycling,
2607  // memory eating and a non-avoidable crash
2608  spellInfo->Effect[1] = 0;
2609  break;
2610  // Explosive Trap - fix initial dmg and proc
2611  case 13812: // rank 1
2612  case 14314: // rank 2
2613  case 14315: // rank 3
2614  case 27026: // rank 4
2616  break;
2617  // Frost Trap & Snake Trap - fix proc
2618  case 13810:
2619  case 45145:
2620  spellInfo->Effect[2] = SPELL_EFFECT_DUMMY;
2622  break;
2623  case 33778: // Lifebloom (rank 1)
2624  case 379: // Earth Shield
2625  case 38395: // Siphon Essence
2626  case 34299: // Improved Leader of the Pack (heal)
2627  case 27813: // Blessed Recovery rank 1
2628  case 27817: // Blessed Recovery rank 2
2629  case 27818: // Blessed Recovery rank 3
2630  case 28880: // Gift of Narru
2632  break;
2633  case 35372: // Protectorate Igniter
2636  break;
2637  case 30298: // Tree Disguise
2639  break;
2640  case 45391: // Vapor Select
2641  spellInfo->AttributesEx3 |= SPELL_ATTR3_CANT_MISS;
2642  spellInfo->MaxAffectedTargets = 1;
2643  break;
2644  case 45399: // Demonic Vapor Trail Periodic
2645  spellInfo->rangeIndex = 2;
2646  break;
2647  case 28730: // Arcane Torrent (mana)
2648  spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER;
2649  break;
2650  case 25046: // Arcane Torrent (energy)
2651  spellInfo->Effect[1] = SPELL_EFFECT_DUMMY;
2652  spellInfo->EffectImplicitTargetA[1] = TARGET_UNIT_CASTER;
2653  break;
2654  case 23505: // Berserking
2655  case 23451: // Speed
2656  spellInfo->Attributes |= SPELL_ATTR0_NEGATIVE_1;
2657  break;
2658  default:
2659  break;
2660  }
2661 
2662  switch (spellInfo->SpellFamilyName)
2663  {
2664  case SPELLFAMILY_WARRIOR:
2665  // Shout
2666  if (spellInfo->SpellFamilyFlags & 0x0000000000020000LL)
2668  break;
2669  case SPELLFAMILY_DRUID:
2670  // Roar
2671  if (spellInfo->SpellFamilyFlags & 0x0000000800000000LL)
2673  // Rake
2674  else if (spellInfo->SpellFamilyFlags & 0x1000LL)
2676  break;
2677  }
2678  }
2679 
2680  /* Fix some weird values in SpellItemEnchantment */
2681  for (uint32 i = 0; i <= 3340; i++)
2682  {
2683  if (SpellItemEnchantmentEntry* ench = const_cast<SpellItemEnchantmentEntry*>(sSpellItemEnchantmentStore.LookupEntry(i)))
2684  {
2685  switch (ench->ID)
2686  {
2687  // Flametongue Weapon
2688  case 5:
2689  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2690  ench->spellid[0] = 8026;
2691  break; // rank 1
2692  case 4:
2693  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2694  ench->spellid[0] = 8028;
2695  break; // rank 2
2696  case 3:
2697  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2698  ench->spellid[0] = 8029;
2699  break; // rank 3
2700  case 523:
2701  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2702  ench->spellid[0] = 10445;
2703  break; // rank 4
2704  case 1665:
2705  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2706  ench->spellid[0] = 16343;
2707  break; // rank 5
2708  case 1666:
2709  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2710  ench->spellid[0] = 16344;
2711  break; // rank 6
2712  case 2634:
2713  ench->type[0] = ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL;
2714  ench->spellid[0] = 25488;
2715  break; // rank 7
2716  }
2717  }
2718  }
2719 
2721 }
uint32 Category
Definition: DBCStructure.h:675
uint32 AttributesEx
Definition: DBCStructure.h:680
DBCStorage< SpellEntry > const * GetSpellStore()
Definition: DBCStores.cpp:776
uint32 MaxAffectedTargets
Definition: DBCStructure.h:762
uint32 EffectTriggerSpell[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:741
uint32 SpellVisual
Definition: DBCStructure.h:743
uint32 Stances
Definition: DBCStructure.h:686
uint32 AttributesEx2
Definition: DBCStructure.h:681
uint32 InterruptFlags
Definition: DBCStructure.h:699
SpellSelectTargetTypes SpellTargetType[TOTAL_SPELL_TARGETS]
Definition: SpellMgr.h:1181
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:729
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
uint32 rangeIndex
Definition: DBCStructure.h:714
Spell is Pickpocket.
Definition: SpellMgr.h:851
uint32 CastingTimeIndex
Definition: DBCStructure.h:696
must ignore armor
Definition: SpellMgr.h:847
uint32 Attributes
Definition: DBCStructure.h:679
ACE_UINT8 uint8
Definition: Define.h:73
uint32 AttributesEx3
Definition: DBCStructure.h:682
uint32 AttributesEx4
Definition: DBCStructure.h:683
uint32 Targets
Definition: DBCStructure.h:688
char * ToolTip[16]
Definition: DBCStructure.h:754
uint32 EffectImplicitTargetB[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:732
SpellCustomAttribute mSpellCustomAttr
Definition: SpellMgr.h:1232
uint64 SpellFamilyFlags
Definition: DBCStructure.h:761
uint32 EffectImplicitTargetA[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:731
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
static void FillAISpellInfo()
Definition: UnitAI.cpp:272
uint32 DurationIndex
Definition: DBCStructure.h:708
approves cast on any target, even when its non-attackable
Definition: SpellMgr.h:850
uint32 RecoveryTime
Definition: DBCStructure.h:697
ignore bonus healing/damage
Definition: SpellMgr.h:849
uint32 SpellFamilyName
Definition: DBCStructure.h:760
#define SPEED_CHARGE
Definition: MotionMaster.h:80
bool IsPositionTarget(uint32 target)
Definition: SpellMgr.h:944
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
related to movement impiaring effects
Definition: SpellMgr.h:846
uint32 StartRecoveryTime
Definition: DBCStructure.h:758
ACE_UINT32 uint32
Definition: Define.h:71
must be cast from item, never directly
Definition: SpellMgr.h:848
uint32 StartRecoveryCategory
Definition: DBCStructure.h:757
void SpellMgr::LoadSpellCustomCooldowns ( )

Definition at line 2723 of file SpellMgr.cpp.

References GetSpellStore(), Database::Query(), SpellEntry::RecoveryTime, sLog, and WorldDatabase.

2724 {
2725  uint32 count = 0;
2726  SpellEntry* spellInfo;
2727 
2728  // 0 1
2729  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spellid, cooldown FROM spell_cooldown");
2730  if (!result)
2731  {
2732  sLog.outString(">> Loaded %u custom spell cooldowns", count);
2733  return;
2734  }
2735 
2736  do
2737  {
2738  Field* fields = result->Fetch();
2739 
2740  int32 spellid = fields[0].GetInt32();
2741  uint32 cooldown = fields[1].GetUInt32();
2742 
2743  spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(spellid);
2744  if (!spellInfo)
2745  {
2746  sLog.outErrorDb("Spell %i listed in spell_cooldown does not exist", spellid);
2747  continue;
2748  }
2749 
2750  if (spellid > 0 && cooldown > 0)
2751  spellInfo->RecoveryTime = cooldown;
2752 
2753  ++count;
2754  }
2755  while (result->NextRow());
2756 
2757  sLog.outString(">> Loaded %u custom spell cooldowns", count);
2758 }
DBCStorage< SpellEntry > const * GetSpellStore()
Definition: DBCStores.cpp:776
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
ACE_INT32 int32
Definition: Define.h:67
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
uint32 RecoveryTime
Definition: DBCStructure.h:697
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellDummyCondition ( )

Definition at line 1466 of file SpellMgr.cpp.

References SpellDummyConditionEntry::bitMaskCondition, SpellDummyConditionEntry::condition, SpellDummyConditionEntry::conditions, SpellDummyConditionEntry::data, SpellDummyConditionEntry::effIndex, SpellDummyConditionEntry::entry, mSpellDummyConditionMap, Database::PQuery(), sLog, and WorldDatabase.

1467 {
1468  // 0 1 2 3 4 5 6 7 8 9 10 11 12
1469  if (QueryResult_AutoPtr result = WorldDatabase.PQuery("SELECT entry, effIndex, bitMaskCondition, condition0, data0, condition1, data1, condition2, data2, condition3, data3, condition4, data4 FROM spell_dummy_condition ORDER BY entry ASC"))
1470  {
1471  Field* field;
1472  SpellDummyConditionEntry sdcEntry;
1473 
1474  do
1475  {
1476  field = result->Fetch();
1477 
1478  sdcEntry.entry = field[0].GetUInt32();
1479  sdcEntry.effIndex = SpellEffIndex(field[1].GetUInt32());
1480  sdcEntry.bitMaskCondition = field[2].GetUInt32();
1481 
1482  for (uint32 i = 0; i < 5; i++) // 5 condition - data pairs
1483  {
1484  sdcEntry.conditions[i].condition = static_cast<SpellDummyCondition>(field[3 + i * 2].GetUInt32());
1485  sdcEntry.conditions[i].data = field[4 + i * 2].GetInt32();
1486  }
1487 
1488  mSpellDummyConditionMap.insert( std::pair<uint32, SpellDummyConditionEntry>(sdcEntry.entry, sdcEntry) );
1489  }
1490  while (result->NextRow());
1491 
1492  sLog.outString(">> Loaded %llu spell dummy conditions", result->GetRowCount());
1493  return;
1494  }
1495 
1496  sLog.outString(">> Loaded 0 spell dummy conditions");
1497 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
QueryResult_AutoPtr PQuery(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:400
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
SpellDummyConditionMap mSpellDummyConditionMap
Definition: SpellMgr.h:1236
SpellEffIndex effIndex
Definition: SpellMgr.h:911
SpellEffIndex
Definition: SharedDefines.h:24
SpellDummyCondition
Definition: SpellMgr.h:888
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
struct SpellDummyConditionEntry::@257 conditions[5]
SpellDummyCondition condition
Definition: SpellMgr.h:916
void SpellMgr::LoadSpellEnchantProcData ( )

Definition at line 1424 of file SpellMgr.cpp.

References SpellEnchantProcEntry::customChance, mSpellEnchantProcEventMap, SpellEnchantProcEntry::PPMChance, SpellEnchantProcEntry::procEx, Database::Query(), sLog, sSpellItemEnchantmentStore, and WorldDatabase.

1425 {
1426  mSpellEnchantProcEventMap.clear(); // need for reload case
1427 
1428  uint32 count = 0;
1429 
1430  // 0 1 2 3
1431  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
1432  if (!result)
1433  {
1434  sLog.outString(">> Loaded %u spell enchant proc event conditions", count);
1435  return;
1436  }
1437 
1438  do
1439  {
1440  Field* fields = result->Fetch();
1441 
1442  uint32 enchantId = fields[0].GetUInt32();
1443 
1444  SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
1445  if (!ench)
1446  {
1447  sLog.outErrorDb("Enchancment %u listed in spell_enchant_proc_data does not exist", enchantId);
1448  continue;
1449  }
1450 
1452 
1453  spe.customChance = fields[1].GetUInt32();
1454  spe.PPMChance = fields[2].GetFloat();
1455  spe.procEx = fields[3].GetUInt32();
1456 
1457  mSpellEnchantProcEventMap[enchantId] = spe;
1458 
1459  ++count;
1460  }
1461  while (result->NextRow());
1462 
1463  sLog.outString(">> Loaded %u enchant proc data definitions", count);
1464 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
SpellEnchantProcEventMap mSpellEnchantProcEventMap
Definition: SpellMgr.h:1235
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore(SpellItemEnchantmentfmt)
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellGroups ( )

Definition at line 1260 of file SpellMgr.cpp.

References GetSetOfSpellsInSpellGroup(), GetSpellRank(), mSpellGroupSpell, mSpellSpellGroup, Database::Query(), sLog, SPELL_GROUP_CORE_RANGE_MAX, sSpellStore, and WorldDatabase.

1261 {
1262  mSpellSpellGroup.clear(); // need for reload case
1263  mSpellGroupSpell.clear();
1264 
1265  uint32 count = 0;
1266 
1267  // 0 1
1268  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
1269  if ( !result )
1270  {
1271  sLog.outString( ">> Loaded %u spell group definitions", count );
1272  return;
1273  }
1274 
1275  std::set<uint32> groups;
1276 
1277  do
1278  {
1279  Field* fields = result->Fetch();
1280 
1281  uint32 group_id = fields[0].GetUInt32();
1282  if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX)
1283  {
1284  sLog.outErrorDb("SpellGroup id %u listed in `spell_groups` is in core range, but is not defined in core!", group_id);
1285  continue;
1286  }
1287  int32 spell_id = fields[1].GetInt32();
1288 
1289  groups.insert(std::set<uint32>::value_type(group_id));
1290  mSpellGroupSpell.insert(SpellGroupSpellMap::value_type((SpellGroup)group_id, spell_id));
1291 
1292  }
1293  while ( result->NextRow() );
1294 
1295  for (SpellGroupSpellMap::iterator itr = mSpellGroupSpell.begin(); itr != mSpellGroupSpell.end() ; )
1296  {
1297  if (itr->second < 0)
1298  {
1299  if (groups.find(abs(itr->second)) == groups.end())
1300  {
1301  sLog.outErrorDb("SpellGroup id %u listed in `spell_groups` does not exist", abs(itr->second));
1302  mSpellGroupSpell.erase(itr++);
1303  }
1304  else
1305  ++itr;
1306  }
1307  else
1308  {
1309  SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->second);
1310 
1311  if (!spellInfo)
1312  {
1313  sLog.outErrorDb("Spell %u listed in `spell_group` does not exist", itr->second);
1314  mSpellGroupSpell.erase(itr++);
1315  }
1316  else if (GetSpellRank(itr->second) > 1)
1317  {
1318  sLog.outErrorDb("Spell %u listed in `spell_group` is not first rank of spell", itr->second);
1319  mSpellGroupSpell.erase(itr++);
1320  }
1321  else
1322  ++itr;
1323  }
1324  }
1325 
1326  for (std::set<uint32>::iterator groupItr = groups.begin() ; groupItr != groups.end() ; ++groupItr)
1327  {
1328  std::set<uint32> spells;
1329  GetSetOfSpellsInSpellGroup(SpellGroup(*groupItr), spells);
1330 
1331  for (std::set<uint32>::iterator spellItr = spells.begin() ; spellItr != spells.end() ; ++spellItr)
1332  {
1333  ++count;
1334  mSpellSpellGroup.insert(SpellSpellGroupMap::value_type(*spellItr, SpellGroup(*groupItr)));
1335  }
1336  }
1337 
1338  sLog.outString( ">> Loaded %u spell group definitions", count );
1339 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
SpellSpellGroupMap mSpellSpellGroup
Definition: SpellMgr.h:1227
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
ACE_INT32 int32
Definition: Define.h:67
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
SpellGroup
Definition: SpellMgr.h:659
uint8 GetSpellRank(uint32 spell_id) const
Definition: SpellMgr.h:1053
void GetSetOfSpellsInSpellGroup(SpellGroup group_id, std::set< uint32 > &foundSpells) const
Definition: SpellMgr.cpp:1681
SpellGroupSpellMap mSpellGroupSpell
Definition: SpellMgr.h:1228
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellGroupStackRules ( )

Definition at line 1341 of file SpellMgr.cpp.

References GetSpellGroupSpellMapBounds(), mSpellGroupStack, Database::Query(), sLog, SPELL_GROUP_STACK_RULE_MAX, and WorldDatabase.

1342 {
1343  mSpellGroupStack.clear(); // need for reload case
1344 
1345  uint32 count = 0;
1346 
1347  // 0 1
1348  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
1349  if ( !result )
1350  {
1351  sLog.outString( ">> Loaded %u spell group stack rules", count );
1352  return;
1353  }
1354 
1355  do
1356  {
1357  Field* fields = result->Fetch();
1358 
1359  uint32 group_id = fields[0].GetUInt32();
1360  uint8 stack_rule = fields[1].GetUInt32();
1361  if (stack_rule >= SPELL_GROUP_STACK_RULE_MAX)
1362  {
1363  sLog.outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule);
1364  continue;
1365  }
1366 
1368 
1369  if (spellGroup.first == spellGroup.second)
1370  {
1371  sLog.outErrorDb("SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id);
1372  continue;
1373  }
1374 
1375  mSpellGroupStack[(SpellGroup)group_id] = (SpellGroupStackRule)stack_rule;
1376 
1377  ++count;
1378  }
1379  while ( result->NextRow() );
1380 
1381  sLog.outString( ">> Loaded %u spell group stack rules", count );
1382 }
#define SPELL_GROUP_STACK_RULE_MAX
Definition: SpellMgr.h:685
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
SpellGroupSpellMapBounds GetSpellGroupSpellMapBounds(SpellGroup group_id) const
Definition: SpellMgr.cpp:1676
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
std::pair< SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_iterator > SpellGroupSpellMapBounds
Definition: SpellMgr.h:676
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
SpellGroup
Definition: SpellMgr.h:659
ACE_UINT8 uint8
Definition: Define.h:73
SpellGroupStackRule
Definition: SpellMgr.h:678
SpellGroupStackMap mSpellGroupStack
Definition: SpellMgr.h:1234
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellLearnSkills ( )

Definition at line 2075 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectBasePoints, SpellEntry::EffectMiscValue, MAX_SPELL_EFFECTS, SpellLearnSkillNode::maxvalue, mSpellLearnSkills, SpellLearnSkillNode::skill, SKILL_RIDING, sLog, SPELL_EFFECT_SKILL, sSpellStore, and SpellLearnSkillNode::value.

2076 {
2077  mSpellLearnSkills.clear(); // need for reload case
2078 
2079  // search auto-learned skills and add its to map also for use in unlearn spells/talents
2080  uint32 dbc_count = 0;
2081  for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
2082  {
2083  SpellEntry const* entry = sSpellStore.LookupEntry(spell);
2084 
2085  if (!entry)
2086  continue;
2087 
2088  for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
2089  {
2090  if (entry->Effect[i] == SPELL_EFFECT_SKILL)
2091  {
2092  SpellLearnSkillNode dbc_node;
2093  dbc_node.skill = entry->EffectMiscValue[i];
2094  if (dbc_node.skill != SKILL_RIDING)
2095  dbc_node.value = 1;
2096  else
2097  dbc_node.value = (entry->EffectBasePoints[i] + 1) * 75;
2098  dbc_node.maxvalue = (entry->EffectBasePoints[i] + 1) * 75;
2099 
2100  mSpellLearnSkills[spell] = dbc_node;
2101  ++dbc_count;
2102  break;
2103  }
2104  }
2105  }
2106 
2107  sLog.outString(">> Loaded %u Spell Learn Skills from DBC", dbc_count);
2108 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:729
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
SpellLearnSkillMap mSpellLearnSkills
Definition: SpellMgr.h:1222
int32 EffectMiscValue[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:739
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellLearnSpells ( )

Definition at line 2110 of file SpellMgr.cpp.

References SpellLearnSpellNode::autoLearned, SpellEntry::Effect, SpellEntry::EffectTriggerSpell, GetBeginSpellLearnSpell(), GetEndSpellLearnSpell(), MAX_SPELL_EFFECTS, mSpellLearnSpells, Database::Query(), sLog, SpellLearnSpellNode::spell, SPELL_EFFECT_LEARN_SPELL, sSpellStore, and WorldDatabase.

2111 {
2112  mSpellLearnSpells.clear(); // need for reload case
2113 
2114  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SpellID FROM spell_learn_spell");
2115  if (!result)
2116  {
2117 
2118  sLog.outString(">> Loaded 0 spell learn spells");
2119  sLog.outErrorDb("spell_learn_spell table is empty!");
2120  return;
2121  }
2122 
2123  uint32 count = 0;
2124 
2125  do
2126  {
2127  Field* fields = result->Fetch();
2128 
2129  uint32 spell_id = fields[0].GetUInt32();
2130 
2131  SpellLearnSpellNode node;
2132  node.spell = fields[1].GetUInt32();
2133  node.autoLearned = false;
2134 
2135  if (!sSpellStore.LookupEntry(spell_id))
2136  {
2137  sLog.outErrorDb("Spell %u listed in spell_learn_spell does not exist", spell_id);
2138  continue;
2139  }
2140 
2141  if (!sSpellStore.LookupEntry(node.spell))
2142  {
2143  sLog.outErrorDb("Spell %u listed in spell_learn_spell does not exist", node.spell);
2144  continue;
2145  }
2146 
2147  mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell_id, node));
2148 
2149  ++count;
2150  }
2151  while (result->NextRow());
2152 
2153  // search auto-learned spells and add its to map also for use in unlearn spells/talents
2154  uint32 dbc_count = 0;
2155  for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
2156  {
2157  SpellEntry const* entry = sSpellStore.LookupEntry(spell);
2158 
2159  if (!entry)
2160  continue;
2161 
2162  for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
2163  {
2164  if (entry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
2165  {
2166  SpellLearnSpellNode dbc_node;
2167  dbc_node.spell = entry->EffectTriggerSpell[i];
2168  dbc_node.autoLearned = true;
2169 
2170  SpellLearnSpellMap::const_iterator db_node_begin = GetBeginSpellLearnSpell(spell);
2171  SpellLearnSpellMap::const_iterator db_node_end = GetEndSpellLearnSpell(spell);
2172 
2173  bool found = false;
2174  for (SpellLearnSpellMap::const_iterator itr = db_node_begin; itr != db_node_end; ++itr)
2175  {
2176  if (itr->second.spell == dbc_node.spell)
2177  {
2178  sLog.outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in spell_learn_spell is redundant, please fix DB.",
2179  spell, dbc_node.spell);
2180  found = true;
2181  break;
2182  }
2183  }
2184 
2185  if (!found) // add new spell-spell pair if not found
2186  {
2187  mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell, dbc_node));
2188  ++dbc_count;
2189  }
2190  }
2191  }
2192  }
2193 
2194  sLog.outString(">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count);
2195 }
uint32 EffectTriggerSpell[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:741
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
SpellLearnSpellMap::const_iterator GetBeginSpellLearnSpell(uint32 spell_id) const
Definition: SpellMgr.h:1104
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
SpellLearnSpellMap mSpellLearnSpells
Definition: SpellMgr.h:1223
SpellLearnSpellMap::const_iterator GetEndSpellLearnSpell(uint32 spell_id) const
Definition: SpellMgr.h:1109
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellLinked ( )

Definition at line 2760 of file SpellMgr.cpp.

References mSpellCustomAttr, mSpellLinkedMap, Database::Query(), sLog, SPELL_ATTR_CU_LINK_AURA, SPELL_ATTR_CU_LINK_CAST, SPELL_ATTR_CU_LINK_HIT, SPELL_ATTR_CU_LINK_REMOVE, SPELL_LINKED_MAX_SPELLS, sSpellStore, and WorldDatabase.

2761 {
2762  mSpellLinkedMap.clear(); // need for reload case
2763  uint32 count = 0;
2764 
2765  // 0 1 2
2766  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
2767  if (!result)
2768  {
2769  sLog.outString(">> Loaded %u linked spells", count);
2770  return;
2771  }
2772 
2773  do
2774  {
2775  Field* fields = result->Fetch();
2776 
2777  int32 trigger = fields[0].GetInt32();
2778  int32 effect = fields[1].GetInt32();
2779  int32 type = fields[2].GetInt32();
2780 
2781  SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(trigger));
2782  if (!spellInfo)
2783  {
2784  sLog.outErrorDb("Spell Trigger %i listed in spell_linked_spell does not exist", trigger);
2785  continue;
2786  }
2787  spellInfo = sSpellStore.LookupEntry(abs(effect));
2788  if (!spellInfo)
2789  {
2790  sLog.outErrorDb("Spell Effect %i listed in spell_linked_spell does not exist", effect);
2791  continue;
2792  }
2793 
2794  if (trigger > 0)
2795  {
2796  switch (type)
2797  {
2798  case 0:
2800  break;
2801  case 1:
2803  break;
2804  case 2:
2806  break;
2807  }
2808  }
2809  else
2811 
2812  if (type) //we will find a better way when more types are needed
2813  {
2814  if (trigger > 0)
2815  trigger += SPELL_LINKED_MAX_SPELLS * type;
2816  else
2817  trigger -= SPELL_LINKED_MAX_SPELLS * type;
2818  }
2819  mSpellLinkedMap[trigger].push_back(effect);
2820 
2821  ++count;
2822  }
2823  while (result->NextRow());
2824 
2825  sLog.outString(">> Loaded %u linked spells", count);
2826 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
ACE_INT32 int32
Definition: Define.h:67
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
SpellCustomAttribute mSpellCustomAttr
Definition: SpellMgr.h:1232
SpellLinkedMap mSpellLinkedMap
Definition: SpellMgr.h:1233
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
#define SPELL_LINKED_MAX_SPELLS
Definition: SpellMgr.h:117
void SpellMgr::LoadSpellPetAuras ( )

Definition at line 2197 of file SpellMgr.cpp.

References SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::EffectBaseDice, SpellEntry::EffectBasePoints, SpellEntry::EffectImplicitTargetA, MAX_SPELL_EFFECTS, mSpellPetAuraMap, Database::Query(), sLog, SPELL_AURA_DUMMY, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_DUMMY, sSpellStore, TARGET_UNIT_PET, and WorldDatabase.

2198 {
2199  mSpellPetAuraMap.clear(); // need for reload case
2200 
2201  uint32 count = 0;
2202 
2203  // 0 1 2
2204  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell, pet, aura FROM spell_pet_auras");
2205  if (!result)
2206  {
2207  sLog.outString(">> Loaded %u spell pet auras", count);
2208  return;
2209  }
2210 
2211 
2212  do
2213  {
2214  Field* fields = result->Fetch();
2215 
2216  uint16 spell = fields[0].GetUInt16();
2217  uint16 pet = fields[1].GetUInt16();
2218  uint16 aura = fields[2].GetUInt16();
2219 
2220  SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find(spell);
2221  if (itr != mSpellPetAuraMap.end())
2222  itr->second.AddAura(pet, aura);
2223  else
2224  {
2225  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
2226  if (!spellInfo)
2227  {
2228  sLog.outErrorDb("Spell %u listed in spell_pet_auras does not exist", spell);
2229  continue;
2230  }
2231  int i = 0;
2232  for (; i < MAX_SPELL_EFFECTS; ++i)
2233  if ((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
2234  spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DUMMY) ||
2235  spellInfo->Effect[i] == SPELL_EFFECT_DUMMY)
2236  break;
2237 
2238  if (i == 3)
2239  {
2240  sLog.outError("Spell %u listed in spell_pet_auras does not have dummy aura or dummy effect", spell);
2241  continue;
2242  }
2243 
2244  SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(aura);
2245  if (!spellInfo2)
2246  {
2247  sLog.outErrorDb("Aura %u listed in spell_pet_auras does not exist", aura);
2248  continue;
2249  }
2250 
2251  PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_PET, spellInfo->EffectBasePoints[i] + spellInfo->EffectBaseDice[i]);
2252  mSpellPetAuraMap[spell] = pa;
2253  }
2254 
2255  ++count;
2256  }
2257  while (result->NextRow());
2258 
2259  sLog.outString(">> Loaded %u spell pet auras", count);
2260 }
SpellPetAuraMap mSpellPetAuraMap
Definition: SpellMgr.h:1231
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
int32 EffectBaseDice[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:726
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:729
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
uint32 EffectImplicitTargetA[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:731
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT16 uint16
Definition: Define.h:72
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellProcEvents ( )

Definition at line 1086 of file SpellMgr.cpp.

References SpellProcEventEntry::cooldown, SpellProcEventEntry::customChance, mSpellProcEventMap, SpellProcEventEntry::ppmRate, SpellProcEventEntry::procEx, SpellProcEventEntry::procFlags, SpellEntry::procFlags, Database::Query(), SpellProcEventEntry::schoolMask, sLog, SpellProcEventEntry::spellFamilyMask, SpellProcEventEntry::spellFamilyName, sSpellStore, and WorldDatabase.

1087 {
1088  mSpellProcEventMap.clear(); // need for reload case
1089 
1090  uint32 count = 0;
1091 
1092  // 0 1 2 3 4 5 6 7 8
1093  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
1094  if (!result)
1095  {
1096  sLog.outString(">> Loaded %u spell proc event conditions", count);
1097  return;
1098  }
1099 
1100  uint32 customProc = 0;
1101  do
1102  {
1103  Field* fields = result->Fetch();
1104 
1105  uint16 entry = fields[0].GetUInt16();
1106 
1107  const SpellEntry* spell = sSpellStore.LookupEntry(entry);
1108  if (!spell)
1109  {
1110  sLog.outErrorDb("Spell %u listed in spell_proc_event does not exist", entry);
1111  continue;
1112  }
1113 
1114  SpellProcEventEntry spe;
1115 
1116  spe.schoolMask = fields[1].GetUInt32();
1117  spe.spellFamilyName = fields[2].GetUInt32();
1118  spe.spellFamilyMask = fields[3].GetUInt64();
1119  spe.procFlags = fields[4].GetUInt32();
1120  spe.procEx = fields[5].GetUInt32();
1121  spe.ppmRate = fields[6].GetFloat();
1122  spe.customChance = fields[7].GetFloat();
1123  spe.cooldown = fields[8].GetUInt32();
1124 
1125  mSpellProcEventMap[entry] = spe;
1126 
1127  if (spell->procFlags == 0)
1128  {
1129  if (spe.procFlags == 0)
1130  {
1131  sLog.outErrorDb("Spell %u listed in spell_proc_event probally not triggered spell", entry);
1132  continue;
1133  }
1134  customProc++;
1135  }
1136  ++count;
1137  }
1138  while (result->NextRow());
1139 
1140  if (customProc)
1141  sLog.outString(">> Loaded %u custom spell proc event conditions +%u custom", count, customProc);
1142  else
1143  sLog.outString(">> Loaded %u spell proc event conditions", count);
1144 }
uint32 spellFamilyName
Definition: SpellMgr.h:639
SpellProcEventMap mSpellProcEventMap
Definition: SpellMgr.h:1229
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 procFlags
Definition: DBCStructure.h:702
uint64 spellFamilyMask
Definition: SpellMgr.h:640
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT16 uint16
Definition: Define.h:72
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellRequired ( )

Definition at line 1826 of file SpellMgr.cpp.

References mSpellReq, mSpellsReqSpell, Database::Query(), sLog, and WorldDatabase.

1827 {
1828  mSpellsReqSpell.clear(); // need for reload case
1829  mSpellReq.clear(); // need for reload case
1830 
1831  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT spell_id, req_spell from spell_required");
1832 
1833  if (!result)
1834  {
1835  sLog.outString(">> Loaded 0 spell required records");
1836  sLog.outErrorDb("spell_required table is empty!");
1837  return;
1838  }
1839  uint32 rows = 0;
1840 
1841  do
1842  {
1843  Field* fields = result->Fetch();
1844 
1845  uint32 spell_id = fields[0].GetUInt32();
1846  uint32 spell_req = fields[1].GetUInt32();
1847 
1848  mSpellsReqSpell.insert (std::pair<uint32, uint32>(spell_req, spell_id));
1849  mSpellReq[spell_id] = spell_req;
1850  ++rows;
1851  }
1852  while (result->NextRow());
1853 
1854  sLog.outString(">> Loaded %u spell required records", rows);
1855 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
SpellRequiredMap mSpellReq
Definition: SpellMgr.h:1221
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
SpellsRequiringSpellMap mSpellsReqSpell
Definition: SpellMgr.h:1220
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellTargetPositions ( )

Definition at line 887 of file SpellMgr.cpp.

References SpellEntry::EffectImplicitTargetA, SpellEntry::EffectImplicitTargetB, MAX_SPELL_EFFECTS, mSpellTargetPositions, Database::Query(), sLog, sMapStore, sSpellStore, TARGET_DST_DB, SpellTargetPosition::target_mapId, SpellTargetPosition::target_Orientation, SpellTargetPosition::target_X, SpellTargetPosition::target_Y, SpellTargetPosition::target_Z, and WorldDatabase.

888 {
889  mSpellTargetPositions.clear(); // need for reload case
890 
891  uint32 count = 0;
892 
893  // 0 1 2 3 4 5
894  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
895  if (!result)
896  {
897 
898 
899 
900  sLog.outString(">> Loaded %u spell target coordinates", count);
901  return;
902  }
903 
904 
905  do
906  {
907  Field* fields = result->Fetch();
908 
909 
910  uint32 Spell_ID = fields[0].GetUInt32();
911 
913 
914  st.target_mapId = fields[1].GetUInt32();
915  st.target_X = fields[2].GetFloat();
916  st.target_Y = fields[3].GetFloat();
917  st.target_Z = fields[4].GetFloat();
918  st.target_Orientation = fields[5].GetFloat();
919 
920  MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId);
921  if (!mapEntry)
922  {
923  sLog.outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in Map.dbc.", Spell_ID, st.target_mapId);
924  continue;
925  }
926 
927  if (st.target_X == 0 && st.target_Y == 0 && st.target_Z == 0)
928  {
929  sLog.outErrorDb("Spell (ID:%u) target coordinates not provided.", Spell_ID);
930  continue;
931  }
932 
933  SpellEntry const* spellInfo = sSpellStore.LookupEntry(Spell_ID);
934  if (!spellInfo)
935  {
936  sLog.outErrorDb("Spell (ID:%u) listed in spell_target_position does not exist.", Spell_ID);
937  continue;
938  }
939 
940  bool found = false;
941  for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
942  {
943  if (spellInfo->EffectImplicitTargetA[i] == TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i] == TARGET_DST_DB)
944  {
945  found = true;
946  break;
947  }
948  }
949  if (!found)
950  {
951  sLog.outErrorDb("Spell (Id: %u) listed in spell_target_position does not have target TARGET_DST_DB (17).", Spell_ID);
952  continue;
953  }
954 
955  mSpellTargetPositions[Spell_ID] = st;
956  ++count;
957 
958  }
959  while (result->NextRow());
960 
961  sLog.outString(">> Loaded %u spell teleport coordinates", count);
962 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
SpellTargetPositionMap mSpellTargetPositions
Definition: SpellMgr.h:1224
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectImplicitTargetB[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:732
uint32 EffectImplicitTargetA[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:731
float target_Orientation
Definition: SpellMgr.h:722
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT32 uint32
Definition: Define.h:71
void SpellMgr::LoadSpellThreats ( )

Definition at line 1384 of file SpellMgr.cpp.

References SpellThreatEntry::apPctMod, SpellThreatEntry::flatMod, mSpellThreatMap, SpellThreatEntry::pctMod, Database::Query(), sLog, sSpellStore, and WorldDatabase.

1385 {
1386  mSpellThreatMap.clear(); // need for reload case
1387 
1388  uint32 count = 0;
1389 
1390  // 0 1 2 3
1391  QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
1392 
1393  if (!result)
1394  {
1395  sLog.outString( ">> Loaded %u aggro generating spells", count);
1396  return;
1397  }
1398 
1399  do
1400  {
1401  Field* fields = result->Fetch();
1402 
1403  uint32 entry = fields[0].GetUInt32();
1404 
1405  if (!sSpellStore.LookupEntry(entry))
1406  {
1407  sLog.outErrorDb("Spell %u listed in `spell_threat` does not exist", entry);
1408  continue;
1409  }
1410 
1411  SpellThreatEntry ste;
1412  ste.flatMod = fields[1].GetInt16();
1413  ste.pctMod = fields[2].GetFloat();
1414  ste.apPctMod = fields[3].GetFloat();
1415 
1416  mSpellThreatMap[entry] = ste;
1417  count++;
1418  }
1419  while (result->NextRow());
1420 
1421  sLog.outString(">> Loaded %u SpellThreatEntries.", count);
1422 }
DatabaseType WorldDatabase
Accessor to the world database.
Definition: Main.cpp:53
Definition: Field.h:24
#define sLog
Log class singleton.
Definition: Log.h:187
QueryResult_AutoPtr Query(const char *sql)
Definition: Database.cpp:383
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
SpellThreatMap mSpellThreatMap
Definition: SpellMgr.h:1225
ACE_Refcounted_Auto_Ptr< QueryResult, ACE_Null_Mutex > QueryResult_AutoPtr
Definition: QueryResult.h:113
ACE_UINT32 uint32
Definition: Define.h:71
SpellEntry const * SpellMgr::SelectAuraRankForPlayerLevel ( SpellEntry const *  spellInfo,
uint32  playerLevel 
) const

Definition at line 1786 of file SpellMgr.cpp.

References SpellEntry::Effect, GetPrevSpellInChain(), SpellEntry::Id, IsPassiveSpell(), IsPositiveEffect(), SPELL_EFFECT_APPLY_AREA_AURA_PARTY, SPELL_EFFECT_APPLY_AURA, SpellEntry::spellLevel, and sSpellStore.

1787 {
1788  // ignore passive spells
1789  if (IsPassiveSpell(spellInfo->Id))
1790  return spellInfo;
1791 
1792  bool needRankSelection = false;
1793  for (int i = 0; i < 3; i++)
1794  {
1795  if (IsPositiveEffect(spellInfo->Id, i) && (
1796  spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
1797  spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY
1798  ))
1799  {
1800  needRankSelection = true;
1801  break;
1802  }
1803  }
1804 
1805  // not required
1806  if (!needRankSelection)
1807  return spellInfo;
1808 
1809  for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId))
1810  {
1811  SpellEntry const* nextSpellInfo = sSpellStore.LookupEntry(nextSpellId);
1812  if (!nextSpellInfo)
1813  break;
1814 
1815  // if found appropriate level
1816  if (playerLevel + 10 >= nextSpellInfo->spellLevel)
1817  return nextSpellInfo;
1818 
1819  // one rank less then
1820  }
1821 
1822  // not found
1823  return NULL;
1824 }
uint32 spellLevel
Definition: DBCStructure.h:707
uint32 GetPrevSpellInChain(uint32 spell_id) const
Definition: SpellMgr.h:1037
bool IsPassiveSpell(uint32 spellId)
Definition: SpellMgr.cpp:278
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
Definition: SpellMgr.cpp:561
ACE_UINT32 uint32
Definition: Define.h:71

Member Data Documentation

SpellEffectTargetTypes SpellMgr::EffectTargetType[TOTAL_SPELL_EFFECTS]

Definition at line 1180 of file SpellMgr.h.

Referenced by SpellMgr().

SkillLineAbilityMap SpellMgr::mSkillLineAbilityMap
private

Definition at line 1230 of file SpellMgr.h.

Referenced by LoadSkillLineAbilityMap(), and LoadSpellChains().

SpellAffectMap SpellMgr::mSpellAffectMap
private

Definition at line 1226 of file SpellMgr.h.

Referenced by LoadSpellAffects().

SpellChainMap SpellMgr::mSpellChains
private

Definition at line 1219 of file SpellMgr.h.

Referenced by LoadSpellChains().

SpellCustomAttribute SpellMgr::mSpellCustomAttr
private

Definition at line 1232 of file SpellMgr.h.

Referenced by LoadSpellCustomAttr(), and LoadSpellLinked().

SpellDummyConditionMap SpellMgr::mSpellDummyConditionMap
private

Definition at line 1236 of file SpellMgr.h.

Referenced by LoadSpellDummyCondition().

SpellEnchantProcEventMap SpellMgr::mSpellEnchantProcEventMap
private

Definition at line 1235 of file SpellMgr.h.

Referenced by LoadSpellEnchantProcData().

SpellGroupSpellMap SpellMgr::mSpellGroupSpell
private

Definition at line 1228 of file SpellMgr.h.

Referenced by GetSpellGroupSpellMapBounds(), and LoadSpellGroups().

SpellGroupStackMap SpellMgr::mSpellGroupStack
private

Definition at line 1234 of file SpellMgr.h.

Referenced by CheckSpellGroupStackRules(), and LoadSpellGroupStackRules().

SpellLearnSkillMap SpellMgr::mSpellLearnSkills
private

Definition at line 1222 of file SpellMgr.h.

Referenced by LoadSpellLearnSkills().

SpellLearnSpellMap SpellMgr::mSpellLearnSpells
private

Definition at line 1223 of file SpellMgr.h.

Referenced by LoadSpellLearnSpells().

SpellLinkedMap SpellMgr::mSpellLinkedMap
private

Definition at line 1233 of file SpellMgr.h.

Referenced by LoadSpellLinked().

SpellPetAuraMap SpellMgr::mSpellPetAuraMap
private

Definition at line 1231 of file SpellMgr.h.

Referenced by LoadSpellPetAuras().

SpellProcEventMap SpellMgr::mSpellProcEventMap
private

Definition at line 1229 of file SpellMgr.h.

Referenced by LoadSpellProcEvents().

SpellRequiredMap SpellMgr::mSpellReq
private

Definition at line 1221 of file SpellMgr.h.

Referenced by LoadSpellRequired().

SpellSpellGroupMap SpellMgr::mSpellSpellGroup
private

Definition at line 1227 of file SpellMgr.h.

Referenced by GetSpellSpellGroupMapBounds(), and LoadSpellGroups().

SpellsRequiringSpellMap SpellMgr::mSpellsReqSpell
private

Definition at line 1220 of file SpellMgr.h.

Referenced by LoadSpellRequired().

SpellTargetPositionMap SpellMgr::mSpellTargetPositions
private

Definition at line 1224 of file SpellMgr.h.

Referenced by LoadSpellTargetPositions().

SpellThreatMap SpellMgr::mSpellThreatMap
private

Definition at line 1225 of file SpellMgr.h.

Referenced by LoadSpellThreats().

SpellSelectTargetTypes SpellMgr::SpellTargetType[TOTAL_SPELL_TARGETS]

Definition at line 1181 of file SpellMgr.h.

Referenced by LoadSpellCustomAttr(), and SpellMgr().


The documentation for this class was generated from the following files: