diff options
author | Aokromes <Aokromes@users.noreply.github.com> | 2019-03-09 16:09:21 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-11-24 21:20:46 +0100 |
commit | 268e0bea184ef8dc8d56c9f4baccb876ed245db4 (patch) | |
tree | b37002276536b881af99fe66988236783ffa5349 | |
parent | 1c44a5dc7a8649d7de1238be2618e3602ede2b75 (diff) |
Core/Disables: Implement SPELL_DISABLE_ARENAS (#23103)
* Core/Disables: Implement SPELL_DISABLE_ARENAS and SPELL_DISABLE_BATTLEGROUNDS
By fredimachado
(cherry picked from commit 73d2e5da37aa23cd439f1048bce9e28d483a4c27)
-rw-r--r-- | sql/updates/world/master/2021_11_24_30_world_2019_03_09_01_world.sql | 2 | ||||
-rw-r--r-- | src/server/game/Conditions/DisableMgr.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Conditions/DisableMgr.h | 5 |
3 files changed, 20 insertions, 2 deletions
diff --git a/sql/updates/world/master/2021_11_24_30_world_2019_03_09_01_world.sql b/sql/updates/world/master/2021_11_24_30_world_2019_03_09_01_world.sql new file mode 100644 index 00000000000..9763c266edb --- /dev/null +++ b/sql/updates/world/master/2021_11_24_30_world_2019_03_09_01_world.sql @@ -0,0 +1,2 @@ +-- +ALTER TABLE `disables` CHANGE `flags` `flags` SMALLINT(5) NOT NULL; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index c0d4e9b8225..1fd71491fcb 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -20,6 +20,7 @@ #include "DatabaseEnv.h" #include "DB2Stores.h" #include "Log.h" +#include "Map.h" #include "ObjectMgr.h" #include "OutdoorPvP.h" #include "Player.h" @@ -84,7 +85,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(); @@ -293,6 +294,18 @@ bool IsDisabledFor(DisableType type, uint32 entry, WorldObject const* ref, uint8 (ref->GetTypeId() == TYPEID_UNIT && ((spellFlags & SPELL_DISABLE_CREATURE) || (ref->ToUnit()->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::unordered_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 75681945e33..158579f988e 100644 --- a/src/server/game/Conditions/DisableMgr.h +++ b/src/server/game/Conditions/DisableMgr.h @@ -47,9 +47,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 |