diff options
3 files changed, 52 insertions, 0 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 918952e1f63..b1dad05c67f 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -19,6 +19,7 @@ #define __BATTLEGROUND_H #include "DBCEnums.h" +#include "Duration.h" #include "ObjectGuid.h" #include "Position.h" #include "SharedDefines.h" @@ -274,6 +275,7 @@ class TC_GAME_API Battleground BattlegroundStatus GetStatus() const { return m_Status; } uint32 GetClientInstanceID() const { return m_ClientInstanceID; } uint32 GetElapsedTime() const { return m_StartTime; } + Milliseconds GetInProgressDuration() const { return (m_Events & BG_STARTING_EVENT_4) ? Milliseconds(m_StartTime - StartDelayTimes[BG_STARTING_EVENT_FIRST]) : 0ms; } uint32 GetRemainingTime() const { return m_EndTime; } uint32 GetMaxPlayers() const; uint32 GetMinPlayers() const; diff --git a/src/server/scripts/Battlegrounds/arena_scripts_generic.cpp b/src/server/scripts/Battlegrounds/arena_scripts_generic.cpp new file mode 100644 index 00000000000..37fa3bbd3c1 --- /dev/null +++ b/src/server/scripts/Battlegrounds/arena_scripts_generic.cpp @@ -0,0 +1,45 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "Battleground.h" +#include "ConditionMgr.h" +#include "Map.h" + +class condition_is_shadow_sight_enabled : public ConditionScript +{ +public: + condition_is_shadow_sight_enabled() : ConditionScript("condition_is_shadow_sight_enabled") { } + + bool OnConditionCheck(Condition const* /*condition*/, ConditionSourceInfo& sourceInfo) override + { + if (!sourceInfo.mConditionMap) + return false; + + if (BattlegroundMap const* bgMap = sourceInfo.mConditionMap->ToBattlegroundMap()) + if (Battleground const* bg = bgMap->GetBG()) + if (bg->GetStatus() >= STATUS_IN_PROGRESS) + return bg->GetInProgressDuration() >= 90s; + + return false; + } +}; + +void AddSC_arena_scripts_generic() +{ + new condition_is_shadow_sight_enabled(); +} diff --git a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp index d4afd1388a8..32e5a42dcdf 100644 --- a/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp +++ b/src/server/scripts/Battlegrounds/battlegrounds_script_loader.cpp @@ -16,6 +16,9 @@ */ // This is where scripts' loading functions should be declared: +// Generic Arena Scripts +void AddSC_arena_scripts_generic(); + // Alterac Valley void AddSC_alterac_valley(); void AddSC_boss_balinda(); @@ -64,6 +67,8 @@ void AddSC_battleground_deephaul_ravine(); // void Add${NameOfDirectory}Scripts() void AddBattlegroundsScripts() { + AddSC_arena_scripts_generic(); + // Alterac Valley AddSC_alterac_valley(); AddSC_boss_balinda(); |