aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAokromes <Aokromes@users.noreply.github.com>2019-03-09 16:09:21 +0100
committerGiacomo Pozzoni <giacomopoz@gmail.com>2019-03-09 16:09:21 +0100
commit73d2e5da37aa23cd439f1048bce9e28d483a4c27 (patch)
tree5a18ef97dfe5becb5f9896a6d8a684f01a05459c /src
parent0ea2b26f864661feb5de214c007c3d589fdd0e35 (diff)
Core/Disables: Implement SPELL_DISABLE_ARENAS (#23103)
* Core/Disables: Implement SPELL_DISABLE_ARENAS and SPELL_DISABLE_BATTLEGROUNDS By fredimachado
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Conditions/DisableMgr.cpp15
-rw-r--r--src/server/game/Conditions/DisableMgr.h5
2 files changed, 18 insertions, 2 deletions
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 72f01c0e35c..d939db03255 100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -21,6 +21,7 @@
#include "Creature.h"
#include "DatabaseEnv.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
#include "Player.h"
@@ -81,7 +82,7 @@ void LoadDisables()
}
uint32 entry = fields[1].GetUInt32();
- uint8 flags = fields[2].GetUInt8();
+ uint16 flags = fields[2].GetUInt16();
std::string params_0 = fields[3].GetString();
std::string params_1 = fields[4].GetString();
@@ -317,6 +318,18 @@ bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const* ref, uint8
(ref->GetTypeId() == TYPEID_UNIT && ((spellFlags & SPELL_DISABLE_CREATURE) || (ref->ToCreature()->IsPet() && (spellFlags & SPELL_DISABLE_PET)))) ||
(ref->GetTypeId() == TYPEID_GAMEOBJECT && (spellFlags & SPELL_DISABLE_GAMEOBJECT)))
{
+ if (spellFlags & (SPELL_DISABLE_ARENAS | SPELL_DISABLE_BATTLEGROUNDS))
+ {
+ if (Map const* map = ref->GetMap())
+ {
+ if (spellFlags & SPELL_DISABLE_ARENAS && map->IsBattleArena())
+ return true; // Current map is Arena and this spell is disabled here
+
+ if (spellFlags & SPELL_DISABLE_BATTLEGROUNDS && map->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 1c313a27eab..25da1114a6d 100644
--- a/src/server/game/Conditions/DisableMgr.h
+++ b/src/server/game/Conditions/DisableMgr.h
@@ -46,9 +46,12 @@ enum SpellDisableTypes
SPELL_DISABLE_AREA = 0x20,
SPELL_DISABLE_LOS = 0x40,
SPELL_DISABLE_GAMEOBJECT = 0x80,
+ SPELL_DISABLE_ARENAS = 0x100,
+ SPELL_DISABLE_BATTLEGROUNDS = 0x200,
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_LOS | SPELL_DISABLE_GAMEOBJECT )
+ SPELL_DISABLE_LOS | SPELL_DISABLE_GAMEOBJECT | SPELL_DISABLE_ARENAS |
+ SPELL_DISABLE_BATTLEGROUNDS),
};
enum MMapDisableTypes