More work on commands, still needs some work but most should be working now.
This commit is contained in:
@@ -95,7 +95,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = Global.AccountMgr.CreateAccount(accountName, password, email);
|
||||
AccountOpResult result = Global.AccountMgr.CreateAccount(accountName, password, email ?? "");
|
||||
switch (result)
|
||||
{
|
||||
case AccountOpResult.Ok:
|
||||
@@ -105,7 +105,7 @@ namespace Game.Chat
|
||||
Log.outInfo(LogFilter.Player, "Account: {0} (IP: {1}) Character:[{2}] (GUID: {3}) created Account {4} (Email: '{5}')",
|
||||
handler.GetSession().GetAccountId(), handler.GetSession().GetRemoteAddress(),
|
||||
handler.GetSession().GetPlayer().GetName(), handler.GetSession().GetPlayer().GetGUID().ToString(),
|
||||
accountName, email);
|
||||
accountName, email ?? "");
|
||||
}
|
||||
break;
|
||||
case AccountOpResult.NameTooLong:
|
||||
|
||||
@@ -27,12 +27,8 @@ namespace Game.Chat.Commands
|
||||
class AchievementCommand
|
||||
{
|
||||
[Command("add", CypherStrings.CommandAchievementAddHelp, RBACPermissions.CommandAchievementAdd)]
|
||||
static bool HandleAchievementAddCommand(CommandHandler handler, uint achievemntId)
|
||||
static bool HandleAchievementAddCommand(CommandHandler handler, AchievementRecord achievementEntry)
|
||||
{
|
||||
AchievementRecord achievementEntry = CliDB.AchievementStorage.LookupByKey(achievemntId);
|
||||
if (achievementEntry == null)
|
||||
return false;
|
||||
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
|
||||
@@ -453,7 +453,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("instancespawn", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugInstanceSpawns(CommandHandler handler, string optArg)
|
||||
static bool HandleDebugInstanceSpawns(CommandHandler handler, [VariantArg(typeof(uint), typeof(string))] object optArg)
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
if (player == null)
|
||||
@@ -461,10 +461,10 @@ namespace Game.Chat
|
||||
|
||||
bool explain = false;
|
||||
uint groupID = 0;
|
||||
if (optArg.Equals("explain", StringComparison.OrdinalIgnoreCase))
|
||||
if (optArg is string && (optArg as string).Equals("explain", StringComparison.OrdinalIgnoreCase))
|
||||
explain = true;
|
||||
else
|
||||
groupID = uint.Parse(optArg);
|
||||
groupID = (uint)optArg;
|
||||
|
||||
if (groupID != 0 && Global.ObjectMgr.GetSpawnGroupData(groupID) == null)
|
||||
{
|
||||
@@ -786,6 +786,36 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("pvp warmode", RBACPermissions.CommandDebug, true)]
|
||||
static bool HandleDebugWarModeBalanceCommand(CommandHandler handler, string command, int? rewardValue)
|
||||
{
|
||||
// USAGE: .debug pvp fb <alliance|horde|neutral|off> [pct]
|
||||
// neutral Sets faction balance off.
|
||||
// alliance Set faction balance to alliance.
|
||||
// horde Set faction balance to horde.
|
||||
// off Reset the faction balance and use the calculated value of it
|
||||
switch (command)
|
||||
{
|
||||
case "alliance":
|
||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Alliance, rewardValue.GetValueOrDefault(0));
|
||||
break;
|
||||
case "horde":
|
||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Horde, rewardValue.GetValueOrDefault(0));
|
||||
break;
|
||||
case "neutral":
|
||||
Global.WorldMgr.SetForcedWarModeFactionBalanceState(TeamId.Neutral);
|
||||
break;
|
||||
case "off":
|
||||
Global.WorldMgr.DisableForcedWarModeFactionBalanceState();
|
||||
break;
|
||||
default:
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("questreset", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugQuestResetCommand(CommandHandler handler, string arg)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("info", RBACPermissions.CommandGobjectInfo)]
|
||||
static bool HandleGameObjectInfoCommand(CommandHandler handler, string isGuid, uint data)
|
||||
static bool HandleGameObjectInfoCommand(CommandHandler handler, [OptionalArg] string isGuid, ulong data)
|
||||
{
|
||||
GameObject thisGO = null;
|
||||
GameObjectData spawnData = null;
|
||||
@@ -137,7 +137,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
entry = data;
|
||||
entry = (uint)data;
|
||||
}
|
||||
|
||||
GameObjectTemplate gameObjectInfo = Global.ObjectMgr.GetGameObjectTemplate(entry);
|
||||
|
||||
@@ -442,7 +442,7 @@ namespace Game.Chat.Commands
|
||||
}
|
||||
|
||||
[Command("respawns", RBACPermissions.CommandListRespawns)]
|
||||
static bool HandleListRespawnsCommand(CommandHandler handler, uint range)
|
||||
static bool HandleListRespawnsCommand(CommandHandler handler, uint? range)
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Map map = player.GetMap();
|
||||
@@ -454,8 +454,8 @@ namespace Game.Chat.Commands
|
||||
string zoneName = GetZoneName(zoneId, locale);
|
||||
for (SpawnObjectType type = 0; type < SpawnObjectType.NumSpawnTypes; type++)
|
||||
{
|
||||
if (range != 0)
|
||||
handler.SendSysMessage(CypherStrings.ListRespawnsRange, type, range);
|
||||
if (range.HasValue)
|
||||
handler.SendSysMessage(CypherStrings.ListRespawnsRange, type, range.Value);
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.ListRespawnsZone, type, zoneName, zoneId);
|
||||
|
||||
@@ -473,9 +473,9 @@ namespace Game.Chat.Commands
|
||||
if (edata != null)
|
||||
{
|
||||
respawnZoneId = map.GetZoneId(PhasingHandler.EmptyPhaseShift, edata.SpawnPoint);
|
||||
if (range != 0)
|
||||
if (range.HasValue)
|
||||
{
|
||||
if (!player.IsInDist(edata.SpawnPoint, range))
|
||||
if (!player.IsInDist(edata.SpawnPoint, range.Value))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
@@ -615,9 +615,9 @@ namespace Game.Chat.Commands
|
||||
aura.GetCasterGUID().ToString());
|
||||
}
|
||||
|
||||
for (ushort i = 0; i < (int)AuraType.Total; ++i)
|
||||
for (AuraType auraType = 0; auraType < AuraType.Total; ++auraType)
|
||||
{
|
||||
var auraList = unit.GetAuraEffectsByType((AuraType)i);
|
||||
var auraList = unit.GetAuraEffectsByType(auraType);
|
||||
if (auraList.Empty())
|
||||
continue;
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace Game.Chat.Commands
|
||||
if (!sizeLogged)
|
||||
{
|
||||
sizeLogged = true;
|
||||
handler.SendSysMessage(CypherStrings.CommandTargetListauratype, auraList.Count, i);
|
||||
handler.SendSysMessage(CypherStrings.CommandTargetListauratype, auraList.Count, auraType);
|
||||
}
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandTargetAurasimple, effect.GetId(), effect.GetEffIndex(), effect.GetAmount());
|
||||
|
||||
@@ -31,9 +31,8 @@ namespace Game.Chat
|
||||
class TeleCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandTele)]
|
||||
static bool HandleTeleCommand(CommandHandler handler, string name)
|
||||
static bool HandleTeleCommand(CommandHandler handler, GameTele tele)
|
||||
{
|
||||
var tele = Global.ObjectMgr.GetGameTele(name);
|
||||
if (tele == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTeleNotfound);
|
||||
@@ -71,7 +70,7 @@ namespace Game.Chat
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
if (Global.ObjectMgr.GetGameTele(name) != null)
|
||||
if (Global.ObjectMgr.GetGameTeleExactName(name) != null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTpAlreadyexist);
|
||||
return false;
|
||||
@@ -100,9 +99,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("del", RBACPermissions.CommandTeleDel, true)]
|
||||
static bool HandleTeleDelCommand(CommandHandler handler, string name)
|
||||
static bool HandleTeleDelCommand(CommandHandler handler, GameTele tele)
|
||||
{
|
||||
var tele = Global.ObjectMgr.GetGameTele(name);
|
||||
if (tele == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTeleNotfound);
|
||||
@@ -115,9 +113,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("group", RBACPermissions.CommandTeleGroup)]
|
||||
static bool HandleTeleGroupCommand(CommandHandler handler, string name)
|
||||
static bool HandleTeleGroupCommand(CommandHandler handler, GameTele tele)
|
||||
{
|
||||
var tele = Global.ObjectMgr.GetGameTele(name);
|
||||
if (tele == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTeleNotfound);
|
||||
@@ -240,7 +237,7 @@ namespace Game.Chat
|
||||
class TeleNameCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandTeleName, true)]
|
||||
static bool HandleTeleNameCommand(CommandHandler handler, PlayerIdentifier player, string where)
|
||||
static bool HandleTeleNameCommand(CommandHandler handler, [OptionalArg] PlayerIdentifier player, [VariantArg(typeof(GameTele), typeof(string))] object where)
|
||||
{
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
@@ -249,7 +246,7 @@ namespace Game.Chat
|
||||
|
||||
Player target = player.GetConnectedPlayer();
|
||||
|
||||
if (where.Equals("home", StringComparison.OrdinalIgnoreCase)) // References target's homebind
|
||||
if (where is string && where.Equals("$home")) // References target's homebind
|
||||
{
|
||||
if (target)
|
||||
target.TeleportTo(target.GetHomebind());
|
||||
@@ -272,10 +269,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele tele = Global.ObjectMgr.GetGameTele(where);
|
||||
if (tele == null)
|
||||
return false;
|
||||
|
||||
GameTele tele = where as GameTele;
|
||||
return DoNameTeleport(handler, player, tele.mapId, new Position(tele.posX, tele.posY, tele.posZ, tele.orientation), tele.name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user