Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool IsSpellAllowedInLocation(SpellEntry const *spellInfo,uint32 map_id,uint32 zone_id,uint32 area_id)
- {
- // normal case
- if (spellInfo->AreaId && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id)
- return false;
- // elixirs (all area dependent elixirs have family SPELLFAMILY_POTION, use this for speedup)
- if (spellInfo->SpellFamilyName==SPELLFAMILY_POTION)
- {
- if (uint32 mask = spellmgr.GetSpellElixirMask(spellInfo->Id))
- {
- if (mask & ELIXIR_BATTLE_MASK)
- {
- switch (spellInfo->Id)
- {
- case 45373:
- return true;
- default: if (zone_id==4075)// Bloodberry Elixir
- return true;
- }
- }
- if (mask & ELIXIR_UNSTABLE_MASK)
- {
- // in the Blade's Edge Mountains Plateaus and Gruul's Lair.
- switch(spellInfo->Id)
- {
- case 40567:
- case 40572:
- case 40568:
- case 40573:
- case 40576:
- case 40575:
- return true;
- default: return zone_id ==3522 || map_id==565;
- }
- }
- if (mask & ELIXIR_SHATTRATH_MASK)
- {
- // in Tempest Keep, Serpentshrine Cavern, Caverns of Time: Mount Hyjal, Black Temple, Sunwell Plateau
- switch(spellInfo->Id)
- {
- case 41608:
- case 46839:
- case 41609:
- case 41610:
- case 46837:
- case 41611:
- return true;
- default:
- if (zone_id ==3607 || map_id==534 || map_id==564 || zone_id==4075)
- return true;
- }
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- return mapEntry->multimap_id==206;
- }
- // elixirs not have another limitations
- return true;
- }
- }
- // special cases zone check (maps checked by multimap common id)
- switch (spellInfo->Id)
- {
- case 23333: // Warsong Flag
- case 23335: // Silverwing Flag
- case 46392: // Focused Assault
- case 46393: // Brutal Assault
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- if (!mapEntry->IsBattleGround())
- return false;
- if (zone_id == 3277)
- return true;
- return false;
- }
- case 34976: // Netherstorm Flag
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- if (!mapEntry->IsBattleGround())
- return false;
- if (zone_id == 3820)
- return true;
- return false;
- }
- case 32307: // Warmaul Ogre Banner
- return area_id == 3610; // return true if area_id is 3610
- case 32724: // Gold Team (Alliance)
- case 32725: // Green Team (Alliance)
- case 32727: // Arena Preparation
- case 35774: // Gold Team (Horde)
- case 35775: // Green Team (Horde)
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- //the follow code doesn't work.
- //if(!mapEntry->IsBattleArena())
- // return false;
- //this is the working code, HACK
- if (zone_id == 3702 || zone_id == 3968 || zone_id == 3698)
- return true;
- return false;
- }
- case 41618: // Bottled Nethergon Energy
- case 41620: // Bottled Nethergon Vapor
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- return mapEntry->multimap_id == 206;
- }
- case 41617: // Cenarion Mana Salve
- case 41619: // Cenarion Healing Salve
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- return mapEntry->multimap_id == 207;
- }
- case 40216: // Dragonmaw Illusion
- case 42016: // Dragonmaw Illusion
- return area_id == 3759 || area_id == 3966 || area_id == 3939;
- case 2584: // Waiting to Resurrect
- case 22011: // Spirit Heal Channel
- case 22012: // Spirit Heal
- //case 24171: // Resurrection Impact Visual
- case 42792: // Recently Dropped Flag
- case 43681: // Inactive
- case 44535: // Spirit Heal (mana)
- case 44521: // Preparation
- {
- MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
- if (!mapEntry)
- return false;
- if (!mapEntry->IsBattleGround())
- return false;
- }
- case 45374:
- return zone_id==4075;
- // Torment of the Worgen
- case 30564:
- case 30731:
- // Redemption of the Fallen
- case 30553:
- // Wrath of the Titans
- case 30610:
- // Legacy of the Mountain King
- case 30559:
- return true;
- default:
- return map_id==532;
- }
- return true;
- }
Add Comment
Please, Sign In to add comment