diff options
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index db0102f4307..63827c11107 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -29,7 +29,6 @@ #include "BattlegroundMgr.h" #include "CreatureAI.h" #include "MapManager.h" -#include "BattlegroundIC.h" #include "BattlefieldWG.h" #include "BattlefieldMgr.h" #include "Player.h" @@ -358,7 +357,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg if (!spellInfo) return false; - bool need_check_reagents = false; + bool needCheckReagents = false; // check effects for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) @@ -401,7 +400,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg return false; } - need_check_reagents = true; + needCheckReagents = true; break; } case SPELL_EFFECT_LEARN_SPELL: @@ -423,7 +422,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg } } - if (need_check_reagents) + if (needCheckReagents) { for (uint8 j = 0; j < MAX_SPELL_REAGENTS; ++j) { @@ -447,7 +446,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg uint32 SpellMgr::GetSpellDifficultyId(uint32 spellId) const { SpellDifficultySearcherMap::const_iterator i = mSpellDifficultySearcherMap.find(spellId); - return i == mSpellDifficultySearcherMap.end() ? 0 : (*i).second; + return i == mSpellDifficultySearcherMap.end() ? 0 : i->second; } void SpellMgr::SetSpellDifficultyId(uint32 spellId, uint32 id) @@ -1102,7 +1101,13 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if (!player || (auraSpell > 0 && !player->HasAura(auraSpell)) || (auraSpell < 0 && player->HasAura(-auraSpell))) return false; - // Extra conditions -- leaving the possibility add extra conditions... + if (player) + { + if (Battleground* bg = player->GetBattleground()) + return bg->IsSpellAllowed(spellId, player); + } + + // Extra conditions switch (spellId) { case 58600: // No fly Zone - Dalaran @@ -1127,41 +1132,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return false; break; } - case 68719: // Oil Refinery - Isle of Conquest. - case 68720: // Quarry - Isle of Conquest. - { - if (!player || player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground()) - return false; - - uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY; - uint8 nodeState = player->GetTeamId() == TEAM_ALLIANCE ? NODE_STATE_CONTROLLED_A : NODE_STATE_CONTROLLED_H; - - BattlegroundIC* pIC = player->GetBattleground()->ToBattlegroundIC(); - if (pIC->GetNodeState(nodeType) == nodeState) - return true; - - return false; - } case 56618: // Horde Controls Factory Phase Shift case 56617: // Alliance Controls Factory Phase Shift - { - if (!player) - return false; + { + if (!player) + return false; - Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); + Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()); - if (!bf || bf->GetTypeId() != BATTLEFIELD_WG) - return false; + if (!bf || bf->GetTypeId() != BATTLEFIELD_WG) + return false; - // team that controls the workshop in the specified area - uint32 team = bf->GetData(newArea); + // team that controls the workshop in the specified area + uint32 team = bf->GetData(newArea); - if (team == TEAM_HORDE) - return spellId == 56618; - else if (team == TEAM_ALLIANCE) - return spellId == 56617; - } + if (team == TEAM_HORDE) + return spellId == 56618; + else if (team == TEAM_ALLIANCE) + return spellId == 56617; break; + } case 57940: // Essence of Wintergrasp - Northrend case 58045: // Essence of Wintergrasp - Wintergrasp { @@ -1356,6 +1346,7 @@ void SpellMgr::LoadSpellRanks() mSpellInfoMap[addedSpell]->ChainEntry = &mSpellChains[addedSpell]; prevRank = addedSpell; ++itr; + if (itr == rankChain.end()) { mSpellChains[addedSpell].next = NULL; @@ -1616,7 +1607,7 @@ void SpellMgr::LoadSpellTargetPositions() SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); if (!spellInfo) { - TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID); continue; } |
