diff options
Diffstat (limited to 'src/game/SpellMgr.cpp')
-rw-r--r-- | src/game/SpellMgr.cpp | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 5ff242537d0..0ec0de4903d 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2437,11 +2437,24 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) return true; } -bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id) +uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id) { // normal case - if( spellInfo->AreaId > 0 && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id ) - return false; + if( spellInfo->AreaGroupId > 0) + { + bool found = false; + + AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(spellInfo->AreaGroupId); + if(groupEntry) + { + for (uint8 i=0; i<7; i++) + if( groupEntry->AreaId[i] == zone_id || groupEntry->AreaId[i] == area_id ) + found = true; + } + + if(!found) + return SPELL_FAILED_INCORRECT_AREA; + } // elixirs (all area dependent elixirs have family SPELLFAMILY_POTION, use this for speedup) if(spellInfo->SpellFamilyName==SPELLFAMILY_POTION) @@ -2451,24 +2464,24 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z if(mask & ELIXIR_BATTLE_MASK) { if(spellInfo->Id==45373) // Bloodberry Elixir - return zone_id==4075; + return zone_id==4075 ? 0 : SPELL_FAILED_REQUIRES_AREA; } if(mask & ELIXIR_UNSTABLE_MASK) { // in the Blade's Edge Mountains Plateaus and Gruul's Lair. - return zone_id ==3522 || map_id==565; + return zone_id ==3522 || map_id==565 ? 0 : SPELL_FAILED_INCORRECT_AREA; } if(mask & ELIXIR_SHATTRATH_MASK) { // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau if(zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075) - return true; + return 0; MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if(!mapEntry) - return false; + return SPELL_FAILED_INCORRECT_AREA; - return mapEntry->multimap_id==206; + return mapEntry->multimap_id==206 ? 0 : SPELL_FAILED_INCORRECT_AREA; } // elixirs not have another limitations @@ -2484,25 +2497,28 @@ bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 z { MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if(!mapEntry) - return false; + return SPELL_FAILED_INCORRECT_AREA; - return mapEntry->multimap_id==206; + return mapEntry->multimap_id==206 ? 0 : SPELL_FAILED_REQUIRES_AREA; } case 41617: // Cenarion Mana Salve case 41619: // Cenarion Healing Salve { MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); if(!mapEntry) - return false; + return SPELL_FAILED_INCORRECT_AREA; - return mapEntry->multimap_id==207; + return mapEntry->multimap_id==207 ? 0 : SPELL_FAILED_REQUIRES_AREA; } case 40216: // Dragonmaw Illusion case 42016: // Dragonmaw Illusion - return area_id == 3759 || area_id == 3966 || area_id == 3939; + return area_id == 3759 || area_id == 3966 || area_id == 3939 ? 0 : SPELL_FAILED_INCORRECT_AREA; + case 51721: // Dominion Over Acherus + case 54055: // Dominion Over Acherus + return area_id == 4281 || area_id == 4342 ? 0 : SPELL_FAILED_INCORRECT_AREA; } - return true; + return 0; } void SpellMgr::LoadSkillLineAbilityMap() |