Created
January 11, 2012 20:05
-
-
Save fredimachado/1596502 to your computer and use it in GitHub Desktop.
Implement spell disables in Arenas and/or Battlegrounds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp | |
index d7a769d..977d6ca 100755 | |
--- a/src/server/game/Conditions/DisableMgr.cpp | |
+++ b/src/server/game/Conditions/DisableMgr.cpp | |
@@ -283,6 +283,18 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags | |
if ((spellFlags & SPELL_DISABLE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || | |
(unit->GetTypeId() == TYPEID_UNIT && ((unit->ToCreature()->isPet() && spellFlags & SPELL_DISABLE_PET) || spellFlags & SPELL_DISABLE_CREATURE))) | |
{ | |
+ if (spellFlags & (SPELL_DISABLE_ARENAS | SPELL_DISABLE_BATTLEGROUNDS)) | |
+ { | |
+ if (MapEntry const* mapEntry = sMapStore.LookupEntry(unit->GetMapId())) | |
+ { | |
+ if (spellFlags & SPELL_DISABLE_ARENAS && mapEntry->IsBattleArena()) | |
+ return true; // Current map is Arena and this spell is disabled here | |
+ | |
+ if (spellFlags & SPELL_DISABLE_BATTLEGROUNDS && mapEntry->IsBattleground()) | |
+ return true; // Current map is a Battleground and this spell is disabled here | |
+ } | |
+ } | |
+ | |
if (spellFlags & SPELL_DISABLE_MAP) | |
{ | |
std::set<uint32> const& mapIds = itr->second.params[0]; | |
diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h | |
index 0f9310a..5a2f7da 100755 | |
--- a/src/server/game/Conditions/DisableMgr.h | |
+++ b/src/server/game/Conditions/DisableMgr.h | |
@@ -42,8 +42,11 @@ enum SpellDisableTypes | |
SPELL_DISABLE_DEPRECATED_SPELL = 0x8, | |
SPELL_DISABLE_MAP = 0x10, | |
SPELL_DISABLE_AREA = 0x20, | |
+ SPELL_DISABLE_ARENAS = 0x40, | |
+ SPELL_DISABLE_BATTLEGROUNDS = 0x80, | |
MAX_SPELL_DISABLE_TYPE = ( SPELL_DISABLE_PLAYER | SPELL_DISABLE_CREATURE | SPELL_DISABLE_PET | | |
- SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA), | |
+ SPELL_DISABLE_DEPRECATED_SPELL | SPELL_DISABLE_MAP | SPELL_DISABLE_AREA | | |
+ SPELL_DISABLE_ARENAS | SPELL_DISABLE_BATTLEGROUNDS), | |
}; | |
enum VmapDisableTypes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment