d17f487a13
Port From (https://github.com/TrinityCore/TrinityCore/commit/c8b0d4e6d83faa3476756fde1f16c72e876ab990)
110 lines
3.6 KiB
C#
110 lines
3.6 KiB
C#
/*
|
|
* Copyright (C) 2012-2020 CypherCore <http://github.com/CypherCore>
|
|
*
|
|
* 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 3 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/>.
|
|
*/
|
|
|
|
using Framework.Constants;
|
|
using Framework.IO;
|
|
using Game.BattleFields;
|
|
|
|
namespace Game.Chat
|
|
{
|
|
[CommandGroup("bf", RBACPermissions.CommandBf)]
|
|
class BattleFieldCommands
|
|
{
|
|
[Command("enable", RBACPermissions.CommandBfEnable)]
|
|
static bool HandleBattlefieldEnable(CommandHandler handler, uint battleId)
|
|
{
|
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
|
if (bf == null)
|
|
return false;
|
|
|
|
if (bf.IsEnabled())
|
|
{
|
|
bf.ToggleBattlefield(false);
|
|
if (battleId == 1)
|
|
handler.SendGlobalGMSysMessage("Wintergrasp is disabled");
|
|
}
|
|
else
|
|
{
|
|
bf.ToggleBattlefield(true);
|
|
if (battleId == 1)
|
|
handler.SendGlobalGMSysMessage("Wintergrasp is enabled");
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
[Command("start", RBACPermissions.CommandBfStart)]
|
|
static bool HandleBattlefieldStart(CommandHandler handler, uint battleId)
|
|
{
|
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
|
if (bf == null)
|
|
return false;
|
|
|
|
bf.StartBattle();
|
|
|
|
if (battleId == 1)
|
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command start used)");
|
|
|
|
return true;
|
|
}
|
|
|
|
[Command("stop", RBACPermissions.CommandBfStop)]
|
|
static bool HandleBattlefieldEnd(CommandHandler handler, uint battleId)
|
|
{
|
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
|
if (bf == null)
|
|
return false;
|
|
|
|
bf.EndBattle(true);
|
|
|
|
if (battleId == 1)
|
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
|
|
|
|
return true;
|
|
}
|
|
|
|
[Command("switch", RBACPermissions.CommandBfSwitch)]
|
|
static bool HandleBattlefieldSwitch(CommandHandler handler, uint battleId)
|
|
{
|
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
|
if (bf == null)
|
|
return false;
|
|
|
|
bf.EndBattle(false);
|
|
if (battleId == 1)
|
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
|
|
|
|
return true;
|
|
}
|
|
|
|
[Command("timer", RBACPermissions.CommandBfTimer)]
|
|
static bool HandleBattlefieldTimer(CommandHandler handler, uint battleId, uint time)
|
|
{
|
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
|
if (bf == null)
|
|
return false;
|
|
|
|
bf.SetTimer(time * Time.InMilliseconds);
|
|
bf.SendInitWorldStatesToAll();
|
|
if (battleId == 1)
|
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|