Scripts/Commands: Convert argument parsing of bf commands to new system
Port From (https://github.com/TrinityCore/TrinityCore/commit/c8b0d4e6d83faa3476756fde1f16c72e876ab990)
This commit is contained in:
@@ -25,24 +25,22 @@ namespace Game.Chat
|
|||||||
class BattleFieldCommands
|
class BattleFieldCommands
|
||||||
{
|
{
|
||||||
[Command("enable", RBACPermissions.CommandBfEnable)]
|
[Command("enable", RBACPermissions.CommandBfEnable)]
|
||||||
static bool HandleBattlefieldEnable(CommandHandler handler, StringArguments args)
|
static bool HandleBattlefieldEnable(CommandHandler handler, uint battleId)
|
||||||
{
|
{
|
||||||
uint battleid = args.NextUInt32();
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
||||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleid);
|
|
||||||
|
|
||||||
if (bf == null)
|
if (bf == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bf.IsEnabled())
|
if (bf.IsEnabled())
|
||||||
{
|
{
|
||||||
bf.ToggleBattlefield(false);
|
bf.ToggleBattlefield(false);
|
||||||
if (battleid == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp is disabled");
|
handler.SendGlobalGMSysMessage("Wintergrasp is disabled");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bf.ToggleBattlefield(true);
|
bf.ToggleBattlefield(true);
|
||||||
if (battleid == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp is enabled");
|
handler.SendGlobalGMSysMessage("Wintergrasp is enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,69 +48,59 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Command("start", RBACPermissions.CommandBfStart)]
|
[Command("start", RBACPermissions.CommandBfStart)]
|
||||||
static bool HandleBattlefieldStart(CommandHandler handler, StringArguments args)
|
static bool HandleBattlefieldStart(CommandHandler handler, uint battleId)
|
||||||
{
|
{
|
||||||
uint battleid = args.NextUInt32();
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
||||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleid);
|
|
||||||
|
|
||||||
if (bf == null)
|
if (bf == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bf.StartBattle();
|
bf.StartBattle();
|
||||||
|
|
||||||
if (battleid == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp (Command start used)");
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command start used)");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("stop", RBACPermissions.CommandBfStop)]
|
[Command("stop", RBACPermissions.CommandBfStop)]
|
||||||
static bool HandleBattlefieldEnd(CommandHandler handler, StringArguments args)
|
static bool HandleBattlefieldEnd(CommandHandler handler, uint battleId)
|
||||||
{
|
{
|
||||||
uint battleid = args.NextUInt32();
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
||||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleid);
|
|
||||||
|
|
||||||
if (bf == null)
|
if (bf == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bf.EndBattle(true);
|
bf.EndBattle(true);
|
||||||
|
|
||||||
if (battleid == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command stop used)");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("switch", RBACPermissions.CommandBfSwitch)]
|
[Command("switch", RBACPermissions.CommandBfSwitch)]
|
||||||
static bool HandleBattlefieldSwitch(CommandHandler handler, StringArguments args)
|
static bool HandleBattlefieldSwitch(CommandHandler handler, uint battleId)
|
||||||
{
|
{
|
||||||
uint battleid = args.NextUInt32();
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
||||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleid);
|
|
||||||
|
|
||||||
if (bf == null)
|
if (bf == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bf.EndBattle(false);
|
bf.EndBattle(false);
|
||||||
if (battleid == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command switch used)");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("timer", RBACPermissions.CommandBfTimer)]
|
[Command("timer", RBACPermissions.CommandBfTimer)]
|
||||||
static bool HandleBattlefieldTimer(CommandHandler handler, StringArguments args)
|
static bool HandleBattlefieldTimer(CommandHandler handler, uint battleId, uint time)
|
||||||
{
|
{
|
||||||
uint battleid = args.NextUInt32();
|
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleId);
|
||||||
BattleField bf = Global.BattleFieldMgr.GetBattlefieldByBattleId(battleid);
|
|
||||||
|
|
||||||
if (bf == null)
|
if (bf == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint time = args.NextUInt32();
|
|
||||||
|
|
||||||
bf.SetTimer(time * Time.InMilliseconds);
|
bf.SetTimer(time * Time.InMilliseconds);
|
||||||
bf.SendInitWorldStatesToAll();
|
bf.SendInitWorldStatesToAll();
|
||||||
if (battleid == 1)
|
if (battleId == 1)
|
||||||
handler.SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
handler.SendGlobalGMSysMessage("Wintergrasp (Command timer used)");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user