Fixes most commands.
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Game.Chat
|
||||
[CommandGroup("account")]
|
||||
class AccountCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandAccount)]
|
||||
[Command("", CypherStrings.CommandAccountHelp, RBACPermissions.CommandAccount)]
|
||||
static bool HandleAccountCommand(CommandHandler handler)
|
||||
{
|
||||
if (handler.GetSession() == null)
|
||||
@@ -68,7 +68,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("addon", RBACPermissions.CommandAccountAddon)]
|
||||
[Command("addon", CypherStrings.CommandAccAddonHelp, RBACPermissions.CommandAccountAddon)]
|
||||
static bool HandleAccountAddonCommand(CommandHandler handler, byte expansion)
|
||||
{
|
||||
if (expansion > WorldConfig.GetIntValue(WorldCfg.Expansion))
|
||||
@@ -86,7 +86,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("create", RBACPermissions.CommandAccountCreate, true)]
|
||||
[Command("create", CypherStrings.CommandAccCreateHelp, RBACPermissions.CommandAccountCreate, true)]
|
||||
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, string email)
|
||||
{
|
||||
if (accountName.Contains("@"))
|
||||
@@ -128,7 +128,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("delete", RBACPermissions.CommandAccountDelete, true)]
|
||||
[Command("delete", CypherStrings.CommandAccDeleteHelp, RBACPermissions.CommandAccountDelete, true)]
|
||||
static bool HandleAccountDeleteCommand(CommandHandler handler, string accountName)
|
||||
{
|
||||
uint accountId = Global.AccountMgr.GetId(accountName);
|
||||
@@ -161,7 +161,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("email", RBACPermissions.CommandAccountEmail)]
|
||||
[Command("email", CypherStrings.CommandAccEmailHelp, RBACPermissions.CommandAccountEmail)]
|
||||
static bool HandleAccountEmailCommand(CommandHandler handler, string oldEmail, string password, string email, string emailConfirm)
|
||||
{
|
||||
if (!Global.AccountMgr.CheckEmail(handler.GetSession().GetAccountId(), oldEmail))
|
||||
@@ -220,7 +220,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("password", RBACPermissions.CommandAccountPassword)]
|
||||
[Command("password", CypherStrings.CommandAccPasswordHelp, RBACPermissions.CommandAccountPassword)]
|
||||
static bool HandleAccountPasswordCommand(CommandHandler handler, string oldPassword, string newPassword, string confirmPassword, string confirmEmail)
|
||||
{
|
||||
// First, we check config. What security type (sec type) is it ? Depending on it, the command branches out
|
||||
@@ -277,12 +277,10 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[CommandGroup("lock")]
|
||||
class AccountLockCommands
|
||||
{
|
||||
[Command("country", RBACPermissions.CommandAccountLockCountry)]
|
||||
[Command("country", CypherStrings.CommandAccLockCountryHelp, RBACPermissions.CommandAccountLockCountry)]
|
||||
static bool HandleAccountLockCountryCommand(CommandHandler handler, bool state)
|
||||
{
|
||||
if (state)
|
||||
@@ -320,7 +318,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("ip", RBACPermissions.CommandAccountLockIp)]
|
||||
[Command("ip", CypherStrings.CommandAccLockIpHelp, RBACPermissions.CommandAccountLockIp)]
|
||||
static bool HandleAccountLockIpCommand(CommandHandler handler, bool state)
|
||||
{
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.UPD_ACCOUNT_LOCK);
|
||||
@@ -346,31 +344,31 @@ namespace Game.Chat
|
||||
[CommandGroup("onlinelist")]
|
||||
class AccountOnlineListCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandAccountOnlineList, true)]
|
||||
[Command("", CypherStrings.CommandAccOnlinelistHelp, RBACPermissions.CommandAccountOnlineList, true)]
|
||||
static bool HandleAccountOnlineListCommand(CommandHandler handler)
|
||||
{
|
||||
return HandleAccountOnlineListCommandWithParameters(handler, null, null, null, null);
|
||||
}
|
||||
|
||||
[Command("ip", RBACPermissions.CommandAccountOnlineList, true)]
|
||||
[Command("ip", CypherStrings.CommandAccOnlinelistHelp, RBACPermissions.CommandAccountOnlineList, true)]
|
||||
static bool HandleAccountOnlineListWithIpFilterCommand(CommandHandler handler, string ipAddress)
|
||||
{
|
||||
return HandleAccountOnlineListCommandWithParameters(handler, ipAddress, null, null, null);
|
||||
}
|
||||
|
||||
[Command("limit", RBACPermissions.CommandAccountOnlineList, true)]
|
||||
[Command("limit", CypherStrings.CommandAccOnlinelistHelp, RBACPermissions.CommandAccountOnlineList, true)]
|
||||
static bool HandleAccountOnlineListWithLimitCommand(CommandHandler handler, uint limit)
|
||||
{
|
||||
return HandleAccountOnlineListCommandWithParameters(handler, null, limit, null, null);
|
||||
}
|
||||
|
||||
[Command("map", RBACPermissions.CommandAccountOnlineList, true)]
|
||||
[Command("map", CypherStrings.CommandAccOnlinelistHelp, RBACPermissions.CommandAccountOnlineList, true)]
|
||||
static bool HandleAccountOnlineListWithMapFilterCommand(CommandHandler handler, uint mapId)
|
||||
{
|
||||
return HandleAccountOnlineListCommandWithParameters(handler, null, null, mapId, null);
|
||||
}
|
||||
|
||||
[Command("zone", RBACPermissions.CommandAccountOnlineList, true)]
|
||||
[Command("zone", CypherStrings.CommandAccOnlinelistHelp, RBACPermissions.CommandAccountOnlineList, true)]
|
||||
static bool HandleAccountOnlineListWithZoneFilterCommand(CommandHandler handler, uint zoneId)
|
||||
{
|
||||
return HandleAccountOnlineListCommandWithParameters(handler, null, null, null, zoneId);
|
||||
@@ -442,7 +440,7 @@ namespace Game.Chat
|
||||
[CommandGroup("set")]
|
||||
class AccountSetCommands
|
||||
{
|
||||
[Command("addon", RBACPermissions.CommandAccountSetAddon, true)]
|
||||
[Command("addon", CypherStrings.CommandAccSetAddonHelp, RBACPermissions.CommandAccountSetAddon, true)]
|
||||
static bool HandleAccountSetAddonCommand(CommandHandler handler, string accountName, byte expansion)
|
||||
{
|
||||
uint accountId;
|
||||
@@ -488,13 +486,13 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("gmlevel", RBACPermissions.CommandAccountSetSecLevel, true)]
|
||||
[Command("gmlevel", CypherStrings.CommandAccSetSeclevelHelp, RBACPermissions.CommandAccountSetSecLevel, true)]
|
||||
static bool HandleAccountSetGmLevelCommand(CommandHandler handler, string accountName, byte securityLevel, int realmId = -1)
|
||||
{
|
||||
return HandleAccountSetSecLevelCommand(handler, accountName, securityLevel, realmId);
|
||||
}
|
||||
|
||||
[Command("password", RBACPermissions.CommandAccountSetPassword, true)]
|
||||
[Command("password", CypherStrings.CommandAccSetPasswordHelp, RBACPermissions.CommandAccountSetPassword, true)]
|
||||
static bool HandleAccountSetPasswordCommand(CommandHandler handler, string accountName, string password, string confirmPassword)
|
||||
{
|
||||
uint targetAccountId = Global.AccountMgr.GetId(accountName);
|
||||
@@ -535,7 +533,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("seclevel", RBACPermissions.CommandAccountSetSecLevel, true)]
|
||||
[Command("seclevel", CypherStrings.CommandAccSetSeclevelHelp, RBACPermissions.CommandAccountSetSecLevel, true)]
|
||||
static bool HandleAccountSetSecLevelCommand(CommandHandler handler, string accountName, byte securityLevel, int? realmId)
|
||||
{
|
||||
uint accountId;
|
||||
@@ -615,7 +613,7 @@ namespace Game.Chat
|
||||
[CommandGroup("sec")]
|
||||
class SetSecCommands
|
||||
{
|
||||
[Command("email", RBACPermissions.CommandAccountSetSecEmail, true)]
|
||||
[Command("email", CypherStrings.CommandAccSetSecEmailHelp, RBACPermissions.CommandAccountSetSecEmail, true)]
|
||||
static bool HandleAccountSetEmailCommand(CommandHandler handler, string accountName, string email, string confirmEmail)
|
||||
{
|
||||
uint targetAccountId = Global.AccountMgr.GetId(accountName);
|
||||
@@ -657,7 +655,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("regmail", RBACPermissions.CommandAccountSetSecRegmail, true)]
|
||||
[Command("regmail", CypherStrings.CommandAccSetSecRegmailHelp, RBACPermissions.CommandAccountSetSecRegmail, true)]
|
||||
static bool HandleAccountSetRegEmailCommand(CommandHandler handler, string accountName, string email, string confirmEmail)
|
||||
{
|
||||
uint targetAccountId = Global.AccountMgr.GetId(accountName);
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Game.Chat.Commands
|
||||
[CommandGroup("achievement")]
|
||||
class AchievementCommand
|
||||
{
|
||||
[Command("add", RBACPermissions.CommandAchievementAdd)]
|
||||
[Command("add", CypherStrings.CommandAchievementAddHelp, RBACPermissions.CommandAchievementAdd)]
|
||||
static bool HandleAchievementAddCommand(CommandHandler handler, uint achievemntId)
|
||||
{
|
||||
AchievementRecord achievementEntry = CliDB.AchievementStorage.LookupByKey(achievemntId);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Game.Chat
|
||||
class ArenaCommands
|
||||
{
|
||||
[Command("create", RBACPermissions.CommandArenaCreate, true)]
|
||||
static bool HandleArenaCreateCommand(CommandHandler handler, string captainName, string name, ArenaTypes type)
|
||||
static bool HandleArenaCreateCommand(CommandHandler handler, PlayerIdentifier captain, string name, ArenaTypes type)
|
||||
{
|
||||
if (Global.ArenaTeamMgr.GetArenaTeamByName(name) != null)
|
||||
{
|
||||
@@ -33,7 +33,6 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
var captain = PlayerIdentifier.ParseFromString(captainName);
|
||||
if (captain == null)
|
||||
captain = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (captain == null)
|
||||
@@ -115,7 +114,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("captain", RBACPermissions.CommandArenaCaptain)]
|
||||
static bool HandleArenaCaptainCommand(CommandHandler handler, uint teamId, string targetName)
|
||||
static bool HandleArenaCaptainCommand(CommandHandler handler, uint teamId, PlayerIdentifier target)
|
||||
{
|
||||
ArenaTeam arena = Global.ArenaTeamMgr.GetArenaTeamById(teamId);
|
||||
if (arena == null)
|
||||
@@ -130,7 +129,6 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
var target = PlayerIdentifier.ParseFromString(targetName);
|
||||
if (target == null)
|
||||
target = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (target == null)
|
||||
|
||||
@@ -31,14 +31,13 @@ namespace Game.Chat
|
||||
class CharacterCommands
|
||||
{
|
||||
[Command("titles", RBACPermissions.CommandCharacterTitles, true)]
|
||||
static bool HandleCharacterTitlesCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleCharacterTitlesCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null || !player.IsConnected())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotExistOrOffline);
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -78,19 +77,18 @@ namespace Game.Chat
|
||||
|
||||
//rename characters
|
||||
[Command("rename", RBACPermissions.CommandCharacterRename, true)]
|
||||
static bool HandleCharacterRenameCommand(CommandHandler handler, string playerName, string newName)
|
||||
static bool HandleCharacterRenameCommand(CommandHandler handler, PlayerIdentifier player, string newName)
|
||||
{
|
||||
var playerIdentifier = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (playerIdentifier == null && !newName.IsEmpty())
|
||||
if (player == null && !newName.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (playerIdentifier == null)
|
||||
playerIdentifier = PlayerIdentifier.FromTarget(handler);
|
||||
if (playerIdentifier == null)
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTarget(handler);
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
// check online security
|
||||
if (handler.HasLowerSecurity(null, playerIdentifier.GetGUID()))
|
||||
if (handler.HasLowerSecurity(null, player.GetGUID()))
|
||||
return false;
|
||||
|
||||
if (!newName.IsEmpty())
|
||||
@@ -101,7 +99,7 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ObjectManager.CheckPlayerName(newName, playerIdentifier.IsConnected() ? playerIdentifier.GetConnectedPlayer().GetSession().GetSessionDbcLocale() : Global.WorldMgr.GetDefaultDbcLocale(), true) != ResponseCodes.CharNameSuccess)
|
||||
if (ObjectManager.CheckPlayerName(newName, player.IsConnected() ? player.GetConnectedPlayer().GetSession().GetSessionDbcLocale() : Global.WorldMgr.GetDefaultDbcLocale(), true) != ResponseCodes.CharNameSuccess)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
return false;
|
||||
@@ -128,10 +126,10 @@ namespace Game.Chat
|
||||
|
||||
// Remove declined name from db
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.DEL_CHAR_DECLINED_NAME);
|
||||
stmt.AddValue(0, playerIdentifier.GetGUID().GetCounter());
|
||||
stmt.AddValue(0, player.GetGUID().GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
|
||||
Player target = playerIdentifier.GetConnectedPlayer();
|
||||
Player target = player.GetConnectedPlayer();
|
||||
if (target != null)
|
||||
{
|
||||
target.SetName(newName);
|
||||
@@ -143,26 +141,26 @@ namespace Game.Chat
|
||||
{
|
||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_NAME_BY_GUID);
|
||||
stmt.AddValue(0, newName);
|
||||
stmt.AddValue(1, playerIdentifier.GetGUID().GetCounter());
|
||||
stmt.AddValue(1, player.GetGUID().GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
}
|
||||
|
||||
Global.CharacterCacheStorage.UpdateCharacterData(playerIdentifier.GetGUID(), newName);
|
||||
Global.CharacterCacheStorage.UpdateCharacterData(player.GetGUID(), newName);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.RenamePlayerWithNewName, playerIdentifier.GetName(), newName);
|
||||
handler.SendSysMessage(CypherStrings.RenamePlayerWithNewName, player.GetName(), newName);
|
||||
|
||||
if (session != null)
|
||||
{
|
||||
Player player = session.GetPlayer();
|
||||
if (player)
|
||||
Log.outCommand(session.GetAccountId(), "GM {0} (Account: {1}) forced rename {2} to player {3} (Account: {4})", player.GetName(), session.GetAccountId(), newName, player.GetName(), Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(player.GetGUID()));
|
||||
Player sessionPlayer = session.GetPlayer();
|
||||
if (sessionPlayer)
|
||||
Log.outCommand(session.GetAccountId(), "GM {0} (Account: {1}) forced rename {2} to player {3} (Account: {4})", sessionPlayer.GetName(), session.GetAccountId(), newName, sessionPlayer.GetName(), Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(sessionPlayer.GetGUID()));
|
||||
}
|
||||
else
|
||||
Log.outCommand(0, "CONSOLE forced rename '{0}' to '{1}' ({2})", playerIdentifier.GetName(), newName, playerIdentifier.GetGUID().ToString());
|
||||
Log.outCommand(0, "CONSOLE forced rename '{0}' to '{1}' ({2})", player.GetName(), newName, player.GetGUID().ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
Player target = playerIdentifier.GetConnectedPlayer();
|
||||
Player target = player.GetConnectedPlayer();
|
||||
if (target != null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.RenamePlayer, handler.GetNameLink(target));
|
||||
@@ -171,14 +169,14 @@ namespace Game.Chat
|
||||
else
|
||||
{
|
||||
// check offline security
|
||||
if (handler.HasLowerSecurity(null, playerIdentifier.GetGUID()))
|
||||
if (handler.HasLowerSecurity(null, player.GetGUID()))
|
||||
return false;
|
||||
|
||||
handler.SendSysMessage(CypherStrings.RenamePlayerGuid, handler.PlayerLink(playerIdentifier.GetName()), playerIdentifier.GetGUID().ToString());
|
||||
handler.SendSysMessage(CypherStrings.RenamePlayerGuid, handler.PlayerLink(player.GetName()), player.GetGUID().ToString());
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ADD_AT_LOGIN_FLAG);
|
||||
stmt.AddValue(0, (ushort)AtLoginFlags.Rename);
|
||||
stmt.AddValue(1, playerIdentifier.GetGUID().GetCounter());
|
||||
stmt.AddValue(1, player.GetGUID().GetCounter());
|
||||
DB.Characters.Execute(stmt);
|
||||
}
|
||||
}
|
||||
@@ -187,9 +185,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("level", RBACPermissions.CommandCharacterLevel, true)]
|
||||
static bool HandleCharacterLevelCommand(CommandHandler handler, string playerName, short newlevel)
|
||||
static bool HandleCharacterLevelCommand(CommandHandler handler, PlayerIdentifier player, short newlevel)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
@@ -236,9 +233,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("customize", RBACPermissions.CommandCharacterCustomize, true)]
|
||||
static bool HandleCharacterCustomizeCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleCharacterCustomizeCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTarget(handler);
|
||||
if (player == null)
|
||||
@@ -263,15 +259,14 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("changeaccount", RBACPermissions.CommandCharacterChangeaccount, true)]
|
||||
static bool HandleCharacterChangeAccountCommand(CommandHandler handler, string playerName, string newAccountName)
|
||||
static bool HandleCharacterChangeAccountCommand(CommandHandler handler, PlayerIdentifier player, AccountIdentifier newAccount)
|
||||
{
|
||||
var playerIdentifier = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (playerIdentifier == null)
|
||||
playerIdentifier = PlayerIdentifier.FromTarget(handler);
|
||||
if (playerIdentifier == null)
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTarget(handler);
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(playerIdentifier.GetGUID());
|
||||
CharacterCacheEntry characterInfo = Global.CharacterCacheStorage.GetCharacterCacheByGuid(player.GetGUID());
|
||||
if (characterInfo == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
@@ -279,7 +274,6 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
uint oldAccountId = characterInfo.AccountId;
|
||||
var newAccount = AccountIdentifier.ParseFromString(newAccountName);
|
||||
|
||||
// nothing to do :)
|
||||
if (newAccount.GetID() == oldAccountId)
|
||||
@@ -295,29 +289,29 @@ namespace Game.Chat
|
||||
}
|
||||
}
|
||||
|
||||
Player onlinePlayer = playerIdentifier.GetConnectedPlayer();
|
||||
Player onlinePlayer = player.GetConnectedPlayer();
|
||||
if (onlinePlayer != null)
|
||||
onlinePlayer.GetSession().KickPlayer("HandleCharacterChangeAccountCommand GM Command transferring character to another account");
|
||||
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_ACCOUNT_BY_GUID);
|
||||
stmt.AddValue(0, newAccount.GetID());
|
||||
stmt.AddValue(1, playerIdentifier.GetGUID().GetCounter());
|
||||
stmt.AddValue(1, player.GetGUID().GetCounter());
|
||||
DB.Characters.DirectExecute(stmt);
|
||||
|
||||
Global.WorldMgr.UpdateRealmCharCount(oldAccountId);
|
||||
Global.WorldMgr.UpdateRealmCharCount(newAccount.GetID());
|
||||
|
||||
Global.CharacterCacheStorage.UpdateCharacterAccountId(playerIdentifier.GetGUID(), newAccount.GetID());
|
||||
Global.CharacterCacheStorage.UpdateCharacterAccountId(player.GetGUID(), newAccount.GetID());
|
||||
|
||||
handler.SendSysMessage(CypherStrings.ChangeAccountSuccess, playerIdentifier.GetName(), newAccount.GetName());
|
||||
handler.SendSysMessage(CypherStrings.ChangeAccountSuccess, player.GetName(), newAccount.GetName());
|
||||
|
||||
string logString = $"changed ownership of player {playerIdentifier.GetName()} ({playerIdentifier.GetGUID()}) from account {oldAccountId} to account {newAccount.GetID()}";
|
||||
string logString = $"changed ownership of player {player.GetName()} ({player.GetGUID()}) from account {oldAccountId} to account {newAccount.GetID()}";
|
||||
WorldSession session = handler.GetSession();
|
||||
if (session != null)
|
||||
{
|
||||
Player player = session.GetPlayer();
|
||||
if (player != null)
|
||||
Log.outCommand(session.GetAccountId(), $"GM {player.GetName()} (Account: {session.GetAccountId()}) {logString}");
|
||||
Player sessionPlayer = session.GetPlayer();
|
||||
if (sessionPlayer != null)
|
||||
Log.outCommand(session.GetAccountId(), $"GM {sessionPlayer.GetName()} (Account: {session.GetAccountId()}) {logString}");
|
||||
}
|
||||
else
|
||||
Log.outCommand(0, $"{handler.GetCypherString(CypherStrings.Console)} {logString}");
|
||||
@@ -325,9 +319,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("changefaction", RBACPermissions.CommandCharacterChangefaction, true)]
|
||||
static bool HandleCharacterChangeFactionCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleCharacterChangeFactionCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTarget(handler);
|
||||
if (player == null)
|
||||
@@ -352,9 +345,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("changerace", RBACPermissions.CommandCharacterChangerace, true)]
|
||||
static bool HandleCharacterChangeRaceCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleCharacterChangeRaceCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTarget(handler);
|
||||
if (player == null)
|
||||
@@ -379,9 +371,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("reputation", RBACPermissions.CommandCharacterReputation, true)]
|
||||
static bool HandleCharacterReputationCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleCharacterReputationCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null || !player.IsConnected())
|
||||
@@ -429,11 +420,10 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("erase", RBACPermissions.CommandCharacterErase, true)]
|
||||
static bool HandleCharacterEraseCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleCharacterEraseCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
uint accountId;
|
||||
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
Player target = player?.GetConnectedPlayer();
|
||||
if (target != null)
|
||||
{
|
||||
@@ -498,7 +488,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("restore", RBACPermissions.CommandCharacterDeletedRestore, true)]
|
||||
static bool HandleCharacterDeletedRestoreCommand(CommandHandler handler, string needle, string newCharName, string accountName)
|
||||
static bool HandleCharacterDeletedRestoreCommand(CommandHandler handler, string needle, string newCharName, AccountIdentifier newAccount)
|
||||
{
|
||||
List<DeletedInfo> foundList = new();
|
||||
if (!GetDeletedCharacterInfoList(foundList, needle))
|
||||
@@ -529,7 +519,6 @@ namespace Game.Chat
|
||||
// update name
|
||||
delInfo.name = newCharName;
|
||||
|
||||
var newAccount = AccountIdentifier.ParseFromString(accountName);
|
||||
// if new account provided update deleted info
|
||||
if (newAccount != null)
|
||||
{
|
||||
@@ -683,9 +672,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandNonGroup("levelup", RBACPermissions.CommandLevelup)]
|
||||
static bool HandleLevelUpCommand(CommandHandler handler, string playerName, short level)
|
||||
static bool HandleLevelUpCommand(CommandHandler handler, PlayerIdentifier player, short level)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
@@ -736,6 +724,52 @@ namespace Game.Chat
|
||||
[CommandGroup("pdump")]
|
||||
class PdumpCommand
|
||||
{
|
||||
[Command("copy", RBACPermissions.CommandPdumpCopy, true)]
|
||||
static bool HandlePDumpCopyCommand(CommandHandler handler, string playerName, string accountName, string characterName, ulong? characterGUID)
|
||||
{
|
||||
/*
|
||||
std::string name;
|
||||
if (!ValidatePDumpTarget(handler, name, characterName, characterGUID))
|
||||
return false;
|
||||
|
||||
std::string dump;
|
||||
switch (PlayerDumpWriter().WriteDumpToString(dump, player.GetGUID().GetCounter()))
|
||||
{
|
||||
case DUMP_SUCCESS:
|
||||
break;
|
||||
case DUMP_CHARACTER_DELETED:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_DELETED_CHAR);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
case DUMP_FILE_OPEN_ERROR: // this error code should not happen
|
||||
default:
|
||||
handler->PSendSysMessage(LANG_COMMAND_EXPORT_FAILED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (PlayerDumpReader().LoadDumpFromString(dump, account, name, characterGUID.value_or(0)))
|
||||
{
|
||||
case DUMP_SUCCESS:
|
||||
break;
|
||||
case DUMP_TOO_MANY_CHARS:
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL, account.GetName().c_str(), account.GetID());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
case DUMP_FILE_OPEN_ERROR: // this error code should not happen
|
||||
case DUMP_FILE_BROKEN: // this error code should not happen
|
||||
default:
|
||||
handler->PSendSysMessage(LANG_COMMAND_IMPORT_FAILED);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ToDo: use a new trinity_string for this commands
|
||||
handler->PSendSysMessage(LANG_COMMAND_IMPORT_SUCCESS);
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("load", RBACPermissions.CommandPdumpLoad, true)]
|
||||
static bool HandlePDumpLoadCommand(CommandHandler handler, string fileName, string accountName, string characterName, ulong? characterGuid)
|
||||
{
|
||||
|
||||
@@ -1082,31 +1082,28 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("worldstate", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugUpdateWorldStateCommand(CommandHandler handler, uint variable, uint value)
|
||||
[Command("warden force", RBACPermissions.CommandDebug, true)]
|
||||
static bool HandleDebugWardenForce(CommandHandler handler, ushort[] checkIds)
|
||||
{
|
||||
handler.GetPlayer().SendUpdateWorldState(variable, value);
|
||||
/*if (checkIds.Empty())
|
||||
return false;
|
||||
|
||||
Warden warden = handler.GetSession().GetWarden();
|
||||
if (warden == null)
|
||||
{
|
||||
handler.SendSysMessage("Warden system is not enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t const nQueued = warden->DEBUG_ForceSpecificChecks(checkIds);
|
||||
handler->PSendSysMessage("%zu/%zu checks queued for your Warden, they should be sent over the next few minutes (depending on settings)", nQueued, checkIds.size());*/
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("worldstate", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugWorldStateCommand(CommandHandler handler, uint worldStateId, uint? value)
|
||||
static bool HandleDebugUpdateWorldStateCommand(CommandHandler handler, uint variable, uint value)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (target == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value.HasValue)
|
||||
{
|
||||
Global.WorldMgr.SetWorldState(worldStateId, value.Value);
|
||||
target.SendUpdateWorldState(worldStateId, value.Value);
|
||||
}
|
||||
else
|
||||
handler.SendSysMessage($"Worldstate {worldStateId} actual value : {Global.WorldMgr.GetWorldState(worldStateId)}");
|
||||
|
||||
handler.GetPlayer().SendUpdateWorldState(variable, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1143,8 +1140,18 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[CommandGroup("asan")]
|
||||
class DebugAsanCommands
|
||||
{
|
||||
[Command("memoryleak", RBACPermissions.CommandDebug, true)]
|
||||
static bool HandleDebugMemoryLeak(CommandHandler handler) { return true; }
|
||||
|
||||
[Command("outofbounds", RBACPermissions.CommandDebug, true)]
|
||||
static bool HandleDebugOutOfBounds(CommandHandler handler) { return true; }
|
||||
}
|
||||
|
||||
[CommandGroup("play")]
|
||||
class PlayCommands
|
||||
class DebugPlayCommands
|
||||
{
|
||||
[Command("cinematic", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugPlayCinematicCommand(CommandHandler handler, uint cinematicId)
|
||||
@@ -1233,7 +1240,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandGroup("pvp")]
|
||||
class PvpCommands
|
||||
class DebugPvpCommands
|
||||
{
|
||||
[Command("warmode", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugWarModeFactionBalanceCommand(CommandHandler handler, string command, int rewardValue = 0)
|
||||
@@ -1267,7 +1274,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandGroup("send")]
|
||||
class SendCommands
|
||||
class DebugSendCommands
|
||||
{
|
||||
[Command("buyerror", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugSendBuyErrorCommand(CommandHandler handler, BuyResult error)
|
||||
@@ -1315,7 +1322,7 @@ namespace Game.Chat
|
||||
[Command("opcode", RBACPermissions.CommandDebug)]
|
||||
static bool HandleDebugSendOpcodeCommand(CommandHandler handler)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCmd);
|
||||
handler.SendSysMessage(CypherStrings.CmdInvalid);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1381,6 +1388,28 @@ namespace Game.Chat
|
||||
}
|
||||
}
|
||||
|
||||
[CommandGroup("warden")]
|
||||
class DebugWardenCommands
|
||||
{
|
||||
[Command("force", RBACPermissions.CommandDebug, true)]
|
||||
static bool HandleDebugWardenForce(CommandHandler handler, ushort[] checkIds)
|
||||
{
|
||||
/*if (checkIds.Empty())
|
||||
return false;
|
||||
|
||||
Warden warden = handler.GetSession().GetWarden();
|
||||
if (warden == null)
|
||||
{
|
||||
handler.SendSysMessage("Warden system is not enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t const nQueued = warden->DEBUG_ForceSpecificChecks(checkIds);
|
||||
handler->PSendSysMessage("%zu/%zu checks queued for your Warden, they should be sent over the next few minutes (depending on settings)", nQueued, checkIds.size());*/
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleDebugGuidLimitsMap(CommandHandler handler, Map map)
|
||||
{
|
||||
handler.SendSysMessage($"Map Id: {map.GetId()} Name: '{map.GetMapName()}' Instance Id: {map.GetInstanceId()} Highest Guid Creature: {map.GenerateLowGuid(HighGuid.Creature)} GameObject: {map.GetMaxLowGuid(HighGuid.GameObject)}");
|
||||
|
||||
@@ -185,10 +185,10 @@ namespace Game.Chat
|
||||
handler.SendSysMessage(CypherStrings.GoinfoName, name);
|
||||
handler.SendSysMessage(CypherStrings.GoinfoSize, gameObjectInfo.size);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.ObjectInfoAIInfo, gameObjectInfo.AIName, Global.ObjectMgr.GetScriptName(gameObjectInfo.ScriptId));
|
||||
handler.SendSysMessage(CypherStrings.ObjectinfoAiInfo, gameObjectInfo.AIName, Global.ObjectMgr.GetScriptName(gameObjectInfo.ScriptId));
|
||||
var ai = thisGO != null ? thisGO.GetAI() : null;
|
||||
if (ai != null)
|
||||
handler.SendSysMessage(CypherStrings.ObjectInfoAIType, nameof(ai));
|
||||
handler.SendSysMessage(CypherStrings.ObjectinfoAiType, nameof(ai));
|
||||
|
||||
GameObjectDisplayInfoRecord modelInfo = CliDB.GameObjectDisplayInfoStorage.LookupByKey(displayId);
|
||||
if (modelInfo != null)
|
||||
|
||||
@@ -120,12 +120,11 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("level", RBACPermissions.CommandCharacterLevel, true)]
|
||||
static bool HandleGroupLevelCommand(CommandHandler handler, string playerName, short level)
|
||||
static bool HandleGroupLevelCommand(CommandHandler handler, PlayerIdentifier player, short level)
|
||||
{
|
||||
if (level < 1)
|
||||
return false;
|
||||
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
|
||||
@@ -128,9 +128,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("rank", RBACPermissions.CommandGuildRank, true)]
|
||||
static bool HandleGuildRankCommand(CommandHandler handler, string playerName, byte rank)
|
||||
static bool HandleGuildRankCommand(CommandHandler handler, PlayerIdentifier player, byte rank)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
|
||||
@@ -29,10 +29,8 @@ namespace Game.Chat
|
||||
class InstanceCommands
|
||||
{
|
||||
[Command("getbossstate", RBACPermissions.CommandInstanceGetBossState)]
|
||||
static bool HandleInstanceGetBossStateCommand(CommandHandler handler, uint encounterId, string playerName)
|
||||
static bool HandleInstanceGetBossStateCommand(CommandHandler handler, uint encounterId, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
|
||||
// Character name must be provided when using this from console.
|
||||
if (player == null || handler.GetSession() == null)
|
||||
{
|
||||
@@ -140,10 +138,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("setbossstate", RBACPermissions.CommandInstanceSetBossState)]
|
||||
static bool HandleInstanceSetBossStateCommand(CommandHandler handler, uint encounterId, EncounterState state, string playerName)
|
||||
static bool HandleInstanceSetBossStateCommand(CommandHandler handler, uint encounterId, EncounterState state, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
|
||||
// Character name must be provided when using this from console.
|
||||
if (player == null || handler.GetSession() == null)
|
||||
{
|
||||
|
||||
@@ -28,9 +28,8 @@ namespace Game.Chat
|
||||
class LFGCommands
|
||||
{
|
||||
[Command("player", RBACPermissions.CommandLfgPlayer, true)]
|
||||
static bool HandleLfgPlayerInfoCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleLfgPlayerInfoCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
@@ -47,9 +46,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("group", RBACPermissions.CommandLfgGroup, true)]
|
||||
static bool HandleLfgGroupInfoCommand(CommandHandler handler, string playerName)
|
||||
static bool HandleLfgGroupInfoCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Game.Chat.Commands
|
||||
[CommandGroup("learn")]
|
||||
class LearnCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandLearn)]
|
||||
[Command("", CypherStrings.CommandLearnHelp, RBACPermissions.CommandLearn)]
|
||||
static bool HandleLearnCommand(CommandHandler handler, uint spellId, string allRanksStr)
|
||||
{
|
||||
Player targetPlayer = handler.GetSelectedPlayerOrSelf();
|
||||
@@ -69,7 +69,7 @@ namespace Game.Chat.Commands
|
||||
[CommandGroup("all")]
|
||||
class LearnAllCommands
|
||||
{
|
||||
[Command("blizzard", RBACPermissions.CommandLearnAllGm)]
|
||||
[Command("blizzard", CypherStrings.CommandLearnAllBlizzardHelp, RBACPermissions.CommandLearnAllGm)]
|
||||
static bool HandleLearnAllGMCommand(CommandHandler handler)
|
||||
{
|
||||
foreach (var skillSpell in Global.SpellMgr.GetSkillLineAbilityMapBounds((uint)SkillType.Internal))
|
||||
@@ -85,7 +85,7 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("debug", RBACPermissions.CommandLearn)]
|
||||
[Command("debug", CypherStrings.CommandLearnAllDebugHelp, RBACPermissions.CommandLearn)]
|
||||
static bool HandleLearnDebugSpellsCommand(CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
@@ -99,10 +99,9 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("crafts", RBACPermissions.CommandLearnAllCrafts)]
|
||||
static bool HandleLearnAllCraftsCommand(CommandHandler handler, string playerName)
|
||||
[Command("crafts", CypherStrings.CommandLearnAllCraftsHelp, RBACPermissions.CommandLearnAllCrafts)]
|
||||
static bool HandleLearnAllCraftsCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null || !player.IsConnected())
|
||||
@@ -117,10 +116,9 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("default", RBACPermissions.CommandLearnAllDefault)]
|
||||
static bool HandleLearnAllDefaultCommand(CommandHandler handler, string playerName)
|
||||
[Command("default", CypherStrings.CommandLearnAllDefaultHelp, RBACPermissions.CommandLearnAllDefault)]
|
||||
static bool HandleLearnAllDefaultCommand(CommandHandler handler, PlayerIdentifier player)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null || !player.IsConnected())
|
||||
@@ -135,7 +133,7 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("languages", RBACPermissions.CommandLearnAllLang)]
|
||||
[Command("languages", CypherStrings.CommandLearnAllLanguagesHelp, RBACPermissions.CommandLearnAllLang)]
|
||||
static bool HandleLearnAllLangCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
Global.LanguageMgr.ForEachLanguage((_, languageDesc) =>
|
||||
@@ -150,7 +148,7 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("recipes", RBACPermissions.CommandLearnAllRecipes)]
|
||||
[Command("recipes", CypherStrings.CommandLearnAllRecipesHelp, RBACPermissions.CommandLearnAllRecipes)]
|
||||
static bool HandleLearnAllRecipesCommand(CommandHandler handler, string namePart)
|
||||
{
|
||||
// Learns all recipes of specified profession and sets skill to max
|
||||
@@ -212,7 +210,7 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("talents", RBACPermissions.CommandLearnAllTalents)]
|
||||
[Command("talents", CypherStrings.CommandLearnAllTalentsHelp, RBACPermissions.CommandLearnAllTalents)]
|
||||
static bool HandleLearnAllMyTalentsCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
@@ -241,7 +239,7 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("pettalents", RBACPermissions.CommandLearnMyPetTalents)]
|
||||
[Command("pettalents", CypherStrings.CommandLearnAllPettalentHelp, RBACPermissions.CommandLearnMyPetTalents)]
|
||||
static bool HandleLearnAllMyPetTalentsCommand(CommandHandler handler, StringArguments args) { return true; }
|
||||
|
||||
static void HandleLearnSkillRecipesHelper(Player player, uint skillId)
|
||||
@@ -278,7 +276,7 @@ namespace Game.Chat.Commands
|
||||
[CommandGroup("my")]
|
||||
class LearnAllMyCommands
|
||||
{
|
||||
[Command("quests", RBACPermissions.CommandLearnAllMySpells)]
|
||||
[Command("quests", CypherStrings.CommandLearnMyQuestsHelp, RBACPermissions.CommandLearnAllMySpells)]
|
||||
static bool HandleLearnMyQuestsCommand(CommandHandler handler)
|
||||
{
|
||||
Player player = handler.GetPlayer();
|
||||
@@ -290,7 +288,7 @@ namespace Game.Chat.Commands
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("trainer", RBACPermissions.CommandLearnAllMySpells)]
|
||||
[Command("trainer", CypherStrings.CommandLearnMyTrainerHelp, RBACPermissions.CommandLearnAllMySpells)]
|
||||
static bool HandleLearnMySpellsCommand(CommandHandler handler)
|
||||
{
|
||||
ChrClassesRecord classEntry = CliDB.ChrClassesStorage.LookupByKey(handler.GetPlayer().GetClass());
|
||||
@@ -329,7 +327,7 @@ namespace Game.Chat.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[CommandNonGroup("unlearn", RBACPermissions.CommandUnlearn)]
|
||||
[CommandNonGroup("unlearn", CypherStrings.CommandUnlearnHelp, RBACPermissions.CommandUnlearn)]
|
||||
static bool HandleUnLearnCommand(CommandHandler handler, uint spellId, string allRanksStr)
|
||||
{
|
||||
Player target = handler.GetSelectedPlayer();
|
||||
|
||||
@@ -644,7 +644,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandGroup("item")]
|
||||
class ItemCommandGroup
|
||||
class LookupItemCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandLookupItem, true)]
|
||||
static bool HandleLookupItemCommand(CommandHandler handler, string namePart)
|
||||
@@ -708,14 +708,76 @@ namespace Game.Chat
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("set", RBACPermissions.CommandLookupItemset, true)]
|
||||
static bool HandleLookupItemSetCommand(CommandHandler handler, string namePart)
|
||||
{
|
||||
if (namePart.IsEmpty())
|
||||
return false;
|
||||
|
||||
bool found = false;
|
||||
uint count = 0;
|
||||
uint maxResults = WorldConfig.GetUIntValue(WorldCfg.MaxResultsLookupCommands);
|
||||
|
||||
// Search in ItemSet.dbc
|
||||
foreach (var (id, set) in CliDB.ItemSetStorage)
|
||||
{
|
||||
Locale locale = handler.GetSessionDbcLocale();
|
||||
string name = set.Name[locale];
|
||||
if (name.IsEmpty())
|
||||
continue;
|
||||
|
||||
if (!name.Equals(namePart, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
locale = Locale.enUS;
|
||||
for (; locale < Locale.Total; ++locale)
|
||||
{
|
||||
if (locale == handler.GetSessionDbcLocale())
|
||||
continue;
|
||||
|
||||
name = set.Name[locale];
|
||||
if (name.IsEmpty())
|
||||
continue;
|
||||
|
||||
if (name.Equals(namePart, StringComparison.OrdinalIgnoreCase))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (locale < Locale.Total)
|
||||
{
|
||||
if (maxResults != 0 && count++ == maxResults)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandLookupMaxResults, maxResults);
|
||||
return true;
|
||||
}
|
||||
|
||||
// send item set in "id - [namedlink locale]" format
|
||||
if (handler.GetSession())
|
||||
handler.SendSysMessage(CypherStrings.ItemsetListChat, id, id, name, "");
|
||||
else
|
||||
handler.SendSysMessage(CypherStrings.ItemsetListConsole, id, name, "");
|
||||
|
||||
if (!found)
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
handler.SendSysMessage(CypherStrings.CommandNoitemsetfound);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandGroup("map")]
|
||||
class MapCommandGroup
|
||||
class LookupMapCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandLookupMap, true)]
|
||||
[Command("map", RBACPermissions.CommandLookupMap, true)]
|
||||
static bool HandleLookupMapCommand(CommandHandler handler, string namePart)
|
||||
{
|
||||
if (namePart.IsEmpty())
|
||||
return false;
|
||||
|
||||
uint counter = 0;
|
||||
|
||||
// search in Map.dbc
|
||||
@@ -785,7 +847,7 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("", RBACPermissions.CommandLookupMap, true)]
|
||||
[Command("id", RBACPermissions.CommandLookupMapId, true)]
|
||||
static bool HandleLookupMapIdCommand(CommandHandler handler, uint id)
|
||||
{
|
||||
var mapInfo = CliDB.MapStorage.LookupByKey(id);
|
||||
@@ -834,7 +896,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandGroup("player")]
|
||||
class PlayerCommandGroup
|
||||
class LookupPlayerCommands
|
||||
{
|
||||
[Command("ip", RBACPermissions.CommandLookupPlayerIp)]
|
||||
static bool HandleLookupPlayerIpCommand(CommandHandler handler, string ip, int limit = -1)
|
||||
@@ -922,7 +984,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandGroup("quest")]
|
||||
class QuestCommandGroup
|
||||
class LookupQuestCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandLookupQuest, true)]
|
||||
static bool HandleLookupQuestCommand(CommandHandler handler, string namePart)
|
||||
@@ -1134,7 +1196,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandGroup("spell")]
|
||||
class SpellCommandGroup
|
||||
class LookupSpellCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandLookupSpell)]
|
||||
static bool HandleLookupSpellCommand(CommandHandler handler, string namePart)
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("testarea", RBACPermissions.CommandMmapTestarea)]
|
||||
static bool TestArea(CommandHandler handler, StringArguments args)
|
||||
static bool TestArea(CommandHandler handler)
|
||||
{
|
||||
float radius = 40.0f;
|
||||
WorldObject obj = handler.GetPlayer();
|
||||
|
||||
@@ -34,236 +34,6 @@ namespace Game.Chat
|
||||
{
|
||||
class MiscCommands
|
||||
{
|
||||
[CommandNonGroup("additem", RBACPermissions.CommandAdditem)]
|
||||
static bool HandleAddItemCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
uint itemId = 0;
|
||||
|
||||
if (args[0] == '[') // [name] manual form
|
||||
{
|
||||
string itemName = args.NextString("]");
|
||||
|
||||
if (!string.IsNullOrEmpty(itemName))
|
||||
{
|
||||
var record = CliDB.ItemSparseStorage.Values.FirstOrDefault(itemSparse =>
|
||||
{
|
||||
for (Locale i = 0; i < Locale.Total; ++i)
|
||||
if (itemName == itemSparse.Display[i])
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (record == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandCouldnotfind, itemName);
|
||||
return false;
|
||||
}
|
||||
itemId = record.Id;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
|
||||
{
|
||||
string idStr = handler.ExtractKeyFromLink(args, "Hitem");
|
||||
if (string.IsNullOrEmpty(idStr))
|
||||
return false;
|
||||
|
||||
if (!uint.TryParse(idStr, out itemId))
|
||||
return false;
|
||||
}
|
||||
|
||||
int count = args.NextInt32();
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
|
||||
List<uint> bonusListIDs = new();
|
||||
var bonuses = args.NextString();
|
||||
var context = args.NextString();
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (!bonuses.IsEmpty())
|
||||
{
|
||||
var tokens = new StringArray(bonuses, ';');
|
||||
for (var i = 0; i < tokens.Length; ++i)
|
||||
{
|
||||
if (uint.TryParse(tokens[i], out uint id))
|
||||
bonusListIDs.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
ItemContext itemContext = ItemContext.None;
|
||||
if (!context.IsEmpty())
|
||||
{
|
||||
itemContext = context.ToEnum<ItemContext>();
|
||||
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
||||
{
|
||||
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(itemId, itemContext);
|
||||
bonusListIDs.AddRange(contextBonuses);
|
||||
}
|
||||
}
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
playerTarget = player;
|
||||
|
||||
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemId);
|
||||
if (itemTemplate == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandItemidinvalid, itemId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Subtract
|
||||
if (count < 0)
|
||||
{
|
||||
uint destroyedItemCount = playerTarget.DestroyItemCount(itemId, (uint)-count, true, false);
|
||||
|
||||
if (destroyedItemCount > 0)
|
||||
{
|
||||
// output the amount of items successfully destroyed
|
||||
handler.SendSysMessage(CypherStrings.Removeitem, itemId, destroyedItemCount, handler.GetNameLink(playerTarget));
|
||||
|
||||
// check to see if we were unable to destroy all of the amount requested.
|
||||
uint unableToDestroyItemCount = (uint)(-count - destroyedItemCount);
|
||||
if (unableToDestroyItemCount > 0)
|
||||
{
|
||||
// output message for the amount of items we couldn't destroy
|
||||
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, unableToDestroyItemCount, handler.GetNameLink(playerTarget));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// failed to destroy items of the amount requested
|
||||
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, -count, handler.GetNameLink(playerTarget));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Adding items
|
||||
uint noSpaceForCount = 0;
|
||||
|
||||
// check space and find places
|
||||
List<ItemPosCount> dest = new();
|
||||
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, (uint)count, out noSpaceForCount);
|
||||
if (msg != InventoryResult.Ok) // convert to possible store amount
|
||||
count -= (int)noSpaceForCount;
|
||||
|
||||
if (count == 0 || dest.Empty()) // can't add any
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, itemId, noSpaceForCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerTarget.StoreNewItem(dest, itemId, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(itemId), null, itemContext, bonusListIDs);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
{
|
||||
foreach (var posCount in dest)
|
||||
{
|
||||
Item item1 = player.GetItemByPos(posCount.pos);
|
||||
if (item1)
|
||||
item1.SetBinding(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 0 && item)
|
||||
{
|
||||
player.SendNewItem(item, (uint)count, false, true);
|
||||
handler.SendSysMessage(CypherStrings.Additem, itemId, count, handler.GetNameLink(playerTarget));
|
||||
if (player != playerTarget)
|
||||
playerTarget.SendNewItem(item, (uint)count, true, false);
|
||||
}
|
||||
|
||||
if (noSpaceForCount > 0)
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, itemId, noSpaceForCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[CommandNonGroup("additem set", RBACPermissions.CommandAdditemset)]
|
||||
static bool HandleAddItemSetCommand(CommandHandler handler, uint itemSetId, string bonuses, string context)
|
||||
{
|
||||
// prevent generation all items with itemset field value '0'
|
||||
if (itemSetId == 0)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoItemsFromItemsetFound, itemSetId);
|
||||
return false;
|
||||
}
|
||||
|
||||
List<uint> bonusListIDs = new();
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (!bonuses.IsEmpty())
|
||||
{
|
||||
var tokens = new StringArray(bonuses, ';');
|
||||
for (var i = 0; i < tokens.Length; ++i)
|
||||
{
|
||||
if (uint.TryParse(tokens[i], out uint id))
|
||||
bonusListIDs.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
ItemContext itemContext = ItemContext.None;
|
||||
if (!context.IsEmpty())
|
||||
itemContext = context.ToEnum<ItemContext>();
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
playerTarget = player;
|
||||
|
||||
Log.outDebug(LogFilter.Server, Global.ObjectMgr.GetCypherString(CypherStrings.Additemset), itemSetId);
|
||||
|
||||
bool found = false;
|
||||
var its = Global.ObjectMgr.GetItemTemplates();
|
||||
foreach (var template in its)
|
||||
{
|
||||
if (template.Value.GetItemSet() != itemSetId)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
List<ItemPosCount> dest = new();
|
||||
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, template.Value.GetId(), 1);
|
||||
if (msg == InventoryResult.Ok)
|
||||
{
|
||||
List<uint> bonusListIDsForItem = new(bonusListIDs); // copy, bonuses for each depending on context might be different for each item
|
||||
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
||||
{
|
||||
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(template.Value.GetId(), itemContext);
|
||||
bonusListIDsForItem.AddRange(contextBonuses);
|
||||
}
|
||||
|
||||
Item item = playerTarget.StoreNewItem(dest, template.Value.GetId(), true, 0, null, itemContext, bonusListIDsForItem);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
item.SetBinding(false);
|
||||
|
||||
player.SendNewItem(item, 1, false, true);
|
||||
if (player != playerTarget)
|
||||
playerTarget.SendNewItem(item, 1, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendEquipError(msg, null, null, template.Value.GetId());
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, template.Value.GetId(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNoitemsetfound, itemSetId);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Teleport to Player
|
||||
[CommandNonGroup("appear", RBACPermissions.CommandAppear)]
|
||||
static bool HandleAppearCommand(CommandHandler handler, StringArguments args)
|
||||
@@ -468,7 +238,7 @@ namespace Game.Chat
|
||||
[CommandNonGroup("commands", RBACPermissions.CommandCommands, true)]
|
||||
static bool HandleCommandsCommand(CommandHandler handler)
|
||||
{
|
||||
handler.ShowHelpForCommand(CommandManager.GetCommands(), "");
|
||||
ChatCommandNode.SendCommandHelpFor(handler, "");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -683,32 +453,32 @@ namespace Game.Chat
|
||||
switch (guidHigh)
|
||||
{
|
||||
case HighGuid.Player:
|
||||
{
|
||||
obj = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, guidLow));
|
||||
if (!obj)
|
||||
{
|
||||
obj = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, guidLow));
|
||||
if (!obj)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
}
|
||||
break;
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid.Creature:
|
||||
{
|
||||
obj = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
obj = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNocreaturefound);
|
||||
}
|
||||
break;
|
||||
handler.SendSysMessage(CypherStrings.CommandNocreaturefound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid.GameObject:
|
||||
{
|
||||
obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNogameobjectfound);
|
||||
}
|
||||
break;
|
||||
handler.SendSysMessage(CypherStrings.CommandNogameobjectfound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -835,32 +605,32 @@ namespace Game.Chat
|
||||
switch (guidHigh)
|
||||
{
|
||||
case HighGuid.Player:
|
||||
{
|
||||
obj = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, guidLow));
|
||||
if (!obj)
|
||||
{
|
||||
obj = Global.ObjAccessor.FindPlayer(ObjectGuid.Create(HighGuid.Player, guidLow));
|
||||
if (!obj)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
}
|
||||
break;
|
||||
handler.SendSysMessage(CypherStrings.PlayerNotFound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid.Creature:
|
||||
{
|
||||
obj = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
obj = handler.GetCreatureFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNocreaturefound);
|
||||
}
|
||||
break;
|
||||
handler.SendSysMessage(CypherStrings.CommandNocreaturefound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HighGuid.GameObject:
|
||||
{
|
||||
obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
obj = handler.GetObjectFromPlayerMapByDbGuid(guidLow);
|
||||
if (!obj)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNogameobjectfound);
|
||||
}
|
||||
break;
|
||||
handler.SendSysMessage(CypherStrings.CommandNogameobjectfound);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -963,18 +733,11 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[CommandNonGroup("help", RBACPermissions.CommandHelp, true)]
|
||||
static bool HandleHelpCommand(CommandHandler handler, string cmdArg)
|
||||
static bool HandleHelpCommand(CommandHandler handler, string cmd)
|
||||
{
|
||||
if (cmdArg.IsEmpty())
|
||||
{
|
||||
handler.ShowHelpForCommand(CommandManager.GetCommands(), "help");
|
||||
handler.ShowHelpForCommand(CommandManager.GetCommands(), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!handler.ShowHelpForCommand(CommandManager.GetCommands(), cmdArg))
|
||||
handler.SendSysMessage(CypherStrings.NoHelpCmd);
|
||||
}
|
||||
ChatCommandNode.SendCommandHelpFor(handler, cmd);
|
||||
if (cmd.IsEmpty())
|
||||
ChatCommandNode.SendCommandHelpFor(handler, "help");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1242,12 +1005,11 @@ namespace Game.Chat
|
||||
|
||||
// mute player for the specified duration
|
||||
[CommandNonGroup("mute", RBACPermissions.CommandMute, true)]
|
||||
static bool HandleMuteCommand(CommandHandler handler, string playerName, uint muteTime, string muteReason)
|
||||
static bool HandleMuteCommand(CommandHandler handler, PlayerIdentifier player, uint muteTime, string muteReason)
|
||||
{
|
||||
if (muteReason.IsEmpty())
|
||||
muteReason = handler.GetCypherString(CypherStrings.NoReason);
|
||||
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTarget(handler);
|
||||
if (player == null)
|
||||
@@ -1417,7 +1179,7 @@ namespace Game.Chat
|
||||
|
||||
[CommandNonGroup("pinfo", RBACPermissions.CommandPinfo, true)]
|
||||
static bool HandlePInfoCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
{
|
||||
// Define ALL the player variables!
|
||||
Player target;
|
||||
ObjectGuid targetGuid;
|
||||
@@ -1589,10 +1351,10 @@ namespace Game.Chat
|
||||
if (handler.HasPermission(RBACPermissions.CommandsPinfoCheckPersonalData) && // RBAC Perm. 48, Role 39
|
||||
(!handler.GetSession() || handler.GetSession().GetSecurity() >= (AccountTypes)security))
|
||||
{
|
||||
eMail = result0.Read <string>(2);
|
||||
regMail = result0.Read <string>(3);
|
||||
lastIp = result0.Read <string>(4);
|
||||
lastLogin = result0.Read <string>(5);
|
||||
eMail = result0.Read<string>(2);
|
||||
regMail = result0.Read<string>(3);
|
||||
lastIp = result0.Read<string>(4);
|
||||
lastLogin = result0.Read<string>(5);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1601,12 +1363,12 @@ namespace Game.Chat
|
||||
lastIp = handler.GetCypherString(CypherStrings.Unauthorized);
|
||||
lastLogin = handler.GetCypherString(CypherStrings.Unauthorized);
|
||||
}
|
||||
muteTime = (long)result0.Read <ulong>(6);
|
||||
muteReason = result0.Read <string>(7);
|
||||
muteBy = result0.Read <string>(8);
|
||||
failedLogins = result0.Read <uint>(9);
|
||||
locked = result0.Read <byte>(10);
|
||||
OS = result0.Read <string>(11);
|
||||
muteTime = (long)result0.Read<ulong>(6);
|
||||
muteReason = result0.Read<string>(7);
|
||||
muteBy = result0.Read<string>(8);
|
||||
failedLogins = result0.Read<uint>(9);
|
||||
locked = result0.Read<byte>(10);
|
||||
OS = result0.Read<string>(11);
|
||||
}
|
||||
|
||||
// Creates a chat link to the character. Returns nameLink
|
||||
@@ -2332,7 +2094,7 @@ namespace Game.Chat
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.WeatherDisabled);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
uint zoneid = player.GetZoneId();
|
||||
@@ -2348,4 +2110,399 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandGroup("additem")]
|
||||
class MiscAddItemCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandAdditem)]
|
||||
static bool HandleAddItemCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
uint itemId = 0;
|
||||
|
||||
if (args[0] == '[') // [name] manual form
|
||||
{
|
||||
string itemName = args.NextString("]");
|
||||
|
||||
if (!string.IsNullOrEmpty(itemName))
|
||||
{
|
||||
var record = CliDB.ItemSparseStorage.Values.FirstOrDefault(itemSparse =>
|
||||
{
|
||||
for (Locale i = 0; i < Locale.Total; ++i)
|
||||
if (itemName == itemSparse.Display[i])
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (record == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandCouldnotfind, itemName);
|
||||
return false;
|
||||
}
|
||||
itemId = record.Id;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
|
||||
{
|
||||
string idStr = handler.ExtractKeyFromLink(args, "Hitem");
|
||||
if (string.IsNullOrEmpty(idStr))
|
||||
return false;
|
||||
|
||||
if (!uint.TryParse(idStr, out itemId))
|
||||
return false;
|
||||
}
|
||||
|
||||
int count = args.NextInt32();
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
|
||||
List<uint> bonusListIDs = new();
|
||||
var bonuses = args.NextString();
|
||||
var context = args.NextString();
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (!bonuses.IsEmpty())
|
||||
{
|
||||
var tokens = new StringArray(bonuses, ';');
|
||||
for (var i = 0; i < tokens.Length; ++i)
|
||||
{
|
||||
if (uint.TryParse(tokens[i], out uint id))
|
||||
bonusListIDs.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
ItemContext itemContext = ItemContext.None;
|
||||
if (!context.IsEmpty())
|
||||
{
|
||||
itemContext = context.ToEnum<ItemContext>();
|
||||
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
||||
{
|
||||
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(itemId, itemContext);
|
||||
bonusListIDs.AddRange(contextBonuses);
|
||||
}
|
||||
}
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
playerTarget = player;
|
||||
|
||||
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemId);
|
||||
if (itemTemplate == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandItemidinvalid, itemId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Subtract
|
||||
if (count < 0)
|
||||
{
|
||||
uint destroyedItemCount = playerTarget.DestroyItemCount(itemId, (uint)-count, true, false);
|
||||
|
||||
if (destroyedItemCount > 0)
|
||||
{
|
||||
// output the amount of items successfully destroyed
|
||||
handler.SendSysMessage(CypherStrings.Removeitem, itemId, destroyedItemCount, handler.GetNameLink(playerTarget));
|
||||
|
||||
// check to see if we were unable to destroy all of the amount requested.
|
||||
uint unableToDestroyItemCount = (uint)(-count - destroyedItemCount);
|
||||
if (unableToDestroyItemCount > 0)
|
||||
{
|
||||
// output message for the amount of items we couldn't destroy
|
||||
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, unableToDestroyItemCount, handler.GetNameLink(playerTarget));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// failed to destroy items of the amount requested
|
||||
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, -count, handler.GetNameLink(playerTarget));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Adding items
|
||||
uint noSpaceForCount = 0;
|
||||
|
||||
// check space and find places
|
||||
List<ItemPosCount> dest = new();
|
||||
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, (uint)count, out noSpaceForCount);
|
||||
if (msg != InventoryResult.Ok) // convert to possible store amount
|
||||
count -= (int)noSpaceForCount;
|
||||
|
||||
if (count == 0 || dest.Empty()) // can't add any
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, itemId, noSpaceForCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerTarget.StoreNewItem(dest, itemId, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(itemId), null, itemContext, bonusListIDs);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
{
|
||||
foreach (var posCount in dest)
|
||||
{
|
||||
Item item1 = player.GetItemByPos(posCount.pos);
|
||||
if (item1)
|
||||
item1.SetBinding(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 0 && item)
|
||||
{
|
||||
player.SendNewItem(item, (uint)count, false, true);
|
||||
handler.SendSysMessage(CypherStrings.Additem, itemId, count, handler.GetNameLink(playerTarget));
|
||||
if (player != playerTarget)
|
||||
playerTarget.SendNewItem(item, (uint)count, true, false);
|
||||
}
|
||||
|
||||
if (noSpaceForCount > 0)
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, itemId, noSpaceForCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("set", RBACPermissions.CommandAdditemset)]
|
||||
static bool HandleAddItemSetCommand(CommandHandler handler, uint itemSetId, string bonuses, string context)
|
||||
{
|
||||
// prevent generation all items with itemset field value '0'
|
||||
if (itemSetId == 0)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoItemsFromItemsetFound, itemSetId);
|
||||
return false;
|
||||
}
|
||||
|
||||
List<uint> bonusListIDs = new();
|
||||
|
||||
// semicolon separated bonuslist ids (parse them after all arguments are extracted by strtok!)
|
||||
if (!bonuses.IsEmpty())
|
||||
{
|
||||
var tokens = new StringArray(bonuses, ';');
|
||||
for (var i = 0; i < tokens.Length; ++i)
|
||||
{
|
||||
if (uint.TryParse(tokens[i], out uint id))
|
||||
bonusListIDs.Add(id);
|
||||
}
|
||||
}
|
||||
|
||||
ItemContext itemContext = ItemContext.None;
|
||||
if (!context.IsEmpty())
|
||||
itemContext = context.ToEnum<ItemContext>();
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = handler.GetSelectedPlayer();
|
||||
if (!playerTarget)
|
||||
playerTarget = player;
|
||||
|
||||
Log.outDebug(LogFilter.Server, Global.ObjectMgr.GetCypherString(CypherStrings.Additemset), itemSetId);
|
||||
|
||||
bool found = false;
|
||||
var its = Global.ObjectMgr.GetItemTemplates();
|
||||
foreach (var template in its)
|
||||
{
|
||||
if (template.Value.GetItemSet() != itemSetId)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
List<ItemPosCount> dest = new();
|
||||
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, template.Value.GetId(), 1);
|
||||
if (msg == InventoryResult.Ok)
|
||||
{
|
||||
List<uint> bonusListIDsForItem = new(bonusListIDs); // copy, bonuses for each depending on context might be different for each item
|
||||
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
||||
{
|
||||
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(template.Value.GetId(), itemContext);
|
||||
bonusListIDsForItem.AddRange(contextBonuses);
|
||||
}
|
||||
|
||||
Item item = playerTarget.StoreNewItem(dest, template.Value.GetId(), true, 0, null, itemContext, bonusListIDsForItem);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
item.SetBinding(false);
|
||||
|
||||
player.SendNewItem(item, 1, false, true);
|
||||
if (player != playerTarget)
|
||||
playerTarget.SendNewItem(item, 1, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.SendEquipError(msg, null, null, template.Value.GetId());
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, template.Value.GetId(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNoitemsetfound, itemSetId);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("to", RBACPermissions.CommandAdditemset)]
|
||||
static bool HandleAddItemToCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
Player player = handler.GetSession().GetPlayer();
|
||||
Player playerTarget = null;
|
||||
if (!handler.ExtractPlayerTarget(args, out playerTarget))
|
||||
return false;
|
||||
|
||||
StringArguments tailArgs = new StringArguments(args.NextString(""));
|
||||
if (tailArgs.Empty())
|
||||
return false;
|
||||
|
||||
uint itemId = 0;
|
||||
|
||||
if (tailArgs[0] == '[') // [name] manual form
|
||||
{
|
||||
string itemNameStr = tailArgs.NextString("]");
|
||||
|
||||
if (!itemNameStr.IsEmpty())
|
||||
{
|
||||
string itemName = itemNameStr.Substring(1);
|
||||
var itr = CliDB.ItemSparseStorage.Values.FirstOrDefault(sparse =>
|
||||
{
|
||||
for (Locale i = Locale.enUS; i < Locale.Total; ++i)
|
||||
if (itemName == sparse.Display[i])
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (itr == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandCouldnotfind, itemName);
|
||||
return false;
|
||||
}
|
||||
|
||||
itemId = itr.Id;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else // item_id or [name] Shift-click form |color|Hitem:item_id:0:0:0|h[name]|h|r
|
||||
{
|
||||
string id = handler.ExtractKeyFromLink(tailArgs, "Hitem");
|
||||
if (id.IsEmpty())
|
||||
return false;
|
||||
itemId = uint.Parse(id);
|
||||
}
|
||||
|
||||
string ccount = tailArgs.NextString();
|
||||
|
||||
int count = 1;
|
||||
if (!ccount.IsEmpty())
|
||||
count = int.Parse(ccount);
|
||||
|
||||
if (count == 0)
|
||||
count = 1;
|
||||
|
||||
List<uint> bonusListIDs = new();
|
||||
string bonuses = tailArgs.NextString();
|
||||
|
||||
string context = tailArgs.NextString();
|
||||
|
||||
ItemContext itemContext = ItemContext.None;
|
||||
if (!context.IsEmpty())
|
||||
{
|
||||
itemContext = context.ToEnum<ItemContext>();
|
||||
if (itemContext != ItemContext.None && itemContext < ItemContext.Max)
|
||||
{
|
||||
var contextBonuses = Global.DB2Mgr.GetDefaultItemBonusTree(itemId, itemContext);
|
||||
bonusListIDs.AddRange(contextBonuses);
|
||||
}
|
||||
}
|
||||
|
||||
// semicolon separated bonuslist ids
|
||||
if (!bonuses.IsEmpty())
|
||||
{
|
||||
foreach (var token in bonuses.Split(';', StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
if (uint.TryParse(token, out uint bonusListId))
|
||||
bonusListIDs.Add(bonusListId);
|
||||
}
|
||||
}
|
||||
|
||||
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemId);
|
||||
if (itemTemplate == null)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandItemidinvalid, itemId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Subtract
|
||||
if (count < 0)
|
||||
{
|
||||
uint destroyedItemCount = playerTarget.DestroyItemCount(itemId, (uint)-count, true, false);
|
||||
|
||||
if (destroyedItemCount > 0)
|
||||
{
|
||||
// output the amount of items successfully destroyed
|
||||
handler.SendSysMessage(CypherStrings.Removeitem, itemId, destroyedItemCount, handler.GetNameLink(playerTarget));
|
||||
|
||||
// check to see if we were unable to destroy all of the amount requested.
|
||||
uint unableToDestroyItemCount = (uint)(-count - destroyedItemCount);
|
||||
if (unableToDestroyItemCount > 0)
|
||||
{
|
||||
// output message for the amount of items we couldn't destroy
|
||||
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, unableToDestroyItemCount, handler.GetNameLink(playerTarget));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// failed to destroy items of the amount requested
|
||||
handler.SendSysMessage(CypherStrings.RemoveitemFailure, itemId, -count, handler.GetNameLink(playerTarget));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Adding items
|
||||
uint noSpaceForCount = 0;
|
||||
|
||||
// check space and find places
|
||||
List<ItemPosCount> dest = new();
|
||||
InventoryResult msg = playerTarget.CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemId, (uint)count, out noSpaceForCount);
|
||||
if (msg != InventoryResult.Ok) // convert to possible store amount
|
||||
count -= (int)noSpaceForCount;
|
||||
|
||||
if (count == 0 || dest.Empty()) // can't add any
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, itemId, noSpaceForCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = playerTarget.StoreNewItem(dest, itemId, true, ItemEnchantmentManager.GenerateItemRandomBonusListId(itemId), null, itemContext, bonusListIDs);
|
||||
|
||||
// remove binding (let GM give it to another player later)
|
||||
if (player == playerTarget)
|
||||
{
|
||||
foreach (var itemPostCount in dest)
|
||||
{
|
||||
Item item1 = player.GetItemByPos(itemPostCount.pos);
|
||||
if (item1 != null)
|
||||
item1.SetBinding(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (count > 0 && item)
|
||||
{
|
||||
player.SendNewItem(item, (uint)count, false, true);
|
||||
if (player != playerTarget)
|
||||
playerTarget.SendNewItem(item, (uint)count, true, false);
|
||||
}
|
||||
|
||||
if (noSpaceForCount > 0)
|
||||
handler.SendSysMessage(CypherStrings.ItemCannotCreate, itemId, noSpaceForCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -674,6 +674,35 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("xp", RBACPermissions.CommandModifyXp)]
|
||||
static bool HandleModifyXPCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
int xp = args.NextInt32();
|
||||
|
||||
if (xp < 1)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
return false;
|
||||
|
||||
// we can run the command
|
||||
target.GiveXP((uint)xp, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
[CommandNonGroup("morph", RBACPermissions.CommandMorph)]
|
||||
static bool HandleModifyMorphCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
@@ -711,35 +740,6 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("xp", RBACPermissions.CommandModifyXp)]
|
||||
static bool HandleModifyXPCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
if (args.Empty())
|
||||
return false;
|
||||
|
||||
int xp = args.NextInt32();
|
||||
|
||||
if (xp < 1)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.BadValue);
|
||||
return false;
|
||||
}
|
||||
|
||||
Player target = handler.GetSelectedPlayerOrSelf();
|
||||
if (!target)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.NoCharSelected);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handler.HasLowerSecurity(target, ObjectGuid.Empty))
|
||||
return false;
|
||||
|
||||
// we can run the command
|
||||
target.GiveXP((uint)xp, null);
|
||||
return true;
|
||||
}
|
||||
|
||||
[CommandGroup("speed")]
|
||||
class ModifySpeed
|
||||
{
|
||||
|
||||
@@ -149,11 +149,11 @@ namespace Game.Chat
|
||||
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoArmor, target.GetArmor());
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoPosition, target.GetPositionX(), target.GetPositionY(), target.GetPositionZ());
|
||||
handler.SendSysMessage(CypherStrings.ObjectInfoAIInfo, target.GetAIName(), target.GetScriptName());
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoReactState, target.GetReactState());
|
||||
handler.SendSysMessage(CypherStrings.ObjectinfoAiInfo, target.GetAIName(), target.GetScriptName());
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoReactstate, target.GetReactState());
|
||||
var ai = target.GetAI();
|
||||
if (ai != null)
|
||||
handler.SendSysMessage(CypherStrings.ObjectInfoAIType, nameof(ai));
|
||||
handler.SendSysMessage(CypherStrings.ObjectinfoAiType, nameof(ai));
|
||||
handler.SendSysMessage(CypherStrings.NpcinfoFlagsExtra, cInfo.FlagsExtra);
|
||||
foreach (uint value in Enum.GetValues(typeof(CreatureFlagsExtra)))
|
||||
if (cInfo.FlagsExtra.HasAnyFlag((CreatureFlagsExtra)value))
|
||||
@@ -331,43 +331,43 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootHeader, creatureTarget.GetName(), creatureTarget.GetEntry());
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootMoney, loot.gold / MoneyConstants.Gold, (loot.gold % MoneyConstants.Gold) / MoneyConstants.Silver, loot.gold % MoneyConstants.Silver);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootHeader, creatureTarget.GetName(), creatureTarget.GetEntry());
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootMoney, loot.gold / MoneyConstants.Gold, (loot.gold % MoneyConstants.Gold) / MoneyConstants.Silver, loot.gold % MoneyConstants.Silver);
|
||||
|
||||
if (all.Equals("all", StringComparison.OrdinalIgnoreCase)) // nonzero from strcmp <. not equal
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootLabel, "Standard items", loot.items.Count);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootLabel, "Standard items", loot.items.Count);
|
||||
foreach (LootItem item in loot.items)
|
||||
if (!item.is_looted)
|
||||
_ShowLootEntry(handler, item.itemid, item.count);
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootLabel, "Quest items", loot.quest_items.Count);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootLabel, "Quest items", loot.quest_items.Count);
|
||||
foreach (LootItem item in loot.quest_items)
|
||||
if (!item.is_looted)
|
||||
_ShowLootEntry(handler, item.itemid, item.count);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootLabel, "Standard items", loot.items.Count);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootLabel, "Standard items", loot.items.Count);
|
||||
foreach (LootItem item in loot.items)
|
||||
if (!item.is_looted && !item.freeforall && item.conditions.Empty())
|
||||
_ShowLootEntry(handler, item.itemid, item.count);
|
||||
|
||||
if (!loot.GetPlayerQuestItems().Empty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootLabel2, "Per-player quest items");
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootLabel2, "Per-player quest items");
|
||||
_IterateNotNormalLootMap(handler, loot.GetPlayerQuestItems(), loot.quest_items);
|
||||
}
|
||||
|
||||
if (!loot.GetPlayerFFAItems().Empty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootLabel2, "FFA items per allowed player");
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootLabel2, "FFA items per allowed player");
|
||||
_IterateNotNormalLootMap(handler, loot.GetPlayerFFAItems(), loot.items);
|
||||
}
|
||||
|
||||
if (!loot.GetPlayerNonQuestNonFFAConditionalItems().Empty())
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootLabel2, "Per-player conditional items");
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootLabel2, "Per-player conditional items");
|
||||
_IterateNotNormalLootMap(handler, loot.GetPlayerNonQuestNonFFAConditionalItems(), loot.items);
|
||||
}
|
||||
}
|
||||
@@ -548,7 +548,7 @@ namespace Game.Chat
|
||||
if (itemTemplate != null)
|
||||
name = itemTemplate.GetName(handler.GetSessionDbcLocale());
|
||||
|
||||
handler.SendSysMessage(alternateString ? CypherStrings.CommandNpcShowLootEntry2 : CypherStrings.CommandNpcShowLootEntry,
|
||||
handler.SendSysMessage(alternateString ? CypherStrings.CommandNpcShowlootEntry2 : CypherStrings.CommandNpcShowlootEntry,
|
||||
itemCount, ItemConst.ItemQualityColors[(int)(itemTemplate != null ? itemTemplate.GetQuality() : ItemQuality.Poor)], itemId, name, itemId);
|
||||
}
|
||||
static void _IterateNotNormalLootMap(CommandHandler handler, MultiMap<ObjectGuid, NotNormalLootItem> map, List<LootItem> items)
|
||||
@@ -561,7 +561,7 @@ namespace Game.Chat
|
||||
var list = map[key];
|
||||
|
||||
Player player = Global.ObjAccessor.FindConnectedPlayer(key);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowLootSublabel, player ? player.GetName() : $"Offline player (GUID {key})", list.Count);
|
||||
handler.SendSysMessage(CypherStrings.CommandNpcShowlootSublabel, player ? player.GetName() : $"Offline player (GUID {key})", list.Count);
|
||||
|
||||
foreach (var it in list)
|
||||
{
|
||||
|
||||
@@ -63,9 +63,8 @@ namespace Game.Chat.Commands
|
||||
class RbacAccountCommands
|
||||
{
|
||||
[Command("deny", RBACPermissions.CommandRbacAccPermDeny, true)]
|
||||
static bool HandleRBACPermDenyCommand(CommandHandler handler, string accountName, uint permId, int? realmId)
|
||||
static bool HandleRBACPermDenyCommand(CommandHandler handler, AccountIdentifier account, uint permId, int? realmId)
|
||||
{
|
||||
var account = AccountIdentifier.ParseFromString(accountName);
|
||||
if (account == null)
|
||||
account = AccountIdentifier.FromTarget(handler);
|
||||
if (account == null)
|
||||
@@ -107,9 +106,8 @@ namespace Game.Chat.Commands
|
||||
}
|
||||
|
||||
[Command("grant", RBACPermissions.CommandRbacAccPermGrant, true)]
|
||||
static bool HandleRBACPermGrantCommand(CommandHandler handler, string accountName, uint permId, int? realmId)
|
||||
static bool HandleRBACPermGrantCommand(CommandHandler handler, AccountIdentifier account, uint permId, int? realmId)
|
||||
{
|
||||
var account = AccountIdentifier.ParseFromString(accountName);
|
||||
if (account == null)
|
||||
account = AccountIdentifier.FromTarget(handler);
|
||||
if (account == null)
|
||||
@@ -151,9 +149,8 @@ namespace Game.Chat.Commands
|
||||
}
|
||||
|
||||
[Command("list", RBACPermissions.CommandRbacAccPermList, true)]
|
||||
static bool HandleRBACPermListCommand(CommandHandler handler, string accountName)
|
||||
static bool HandleRBACPermListCommand(CommandHandler handler, AccountIdentifier account)
|
||||
{
|
||||
var account = AccountIdentifier.ParseFromString(accountName);
|
||||
if (account == null)
|
||||
account = AccountIdentifier.FromTarget(handler);
|
||||
if (account == null)
|
||||
@@ -203,9 +200,8 @@ namespace Game.Chat.Commands
|
||||
}
|
||||
|
||||
[Command("revoke", RBACPermissions.CommandRbacAccPermRevoke, true)]
|
||||
static bool HandleRBACPermRevokeCommand(CommandHandler handler, string accountName, uint permId, int? realmId)
|
||||
static bool HandleRBACPermRevokeCommand(CommandHandler handler, AccountIdentifier account, uint permId, int? realmId)
|
||||
{
|
||||
var account = AccountIdentifier.ParseFromString(accountName);
|
||||
if (account == null)
|
||||
account = AccountIdentifier.FromTarget(handler);
|
||||
if (account == null)
|
||||
|
||||
@@ -849,6 +849,17 @@ namespace Game.Chat
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("spell_script_names", RBACPermissions.CommandReloadSpellScriptNames, true)]
|
||||
static bool HandleReloadSpellScriptNamesCommand(CommandHandler handler)
|
||||
{
|
||||
Log.outInfo(LogFilter.Misc, "Reloading spell_script_names table...");
|
||||
Global.ObjectMgr.LoadSpellScriptNames();
|
||||
//Global.ScriptMgr.NotifyScriptIDUpdate();
|
||||
Global.ObjectMgr.ValidateSpellScripts();
|
||||
handler.SendGlobalGMSysMessage("Spell scripts reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("spell_target_position", RBACPermissions.CommandReloadSpellTargetPosition, true)]
|
||||
static bool HandleReloadSpellTargetPositionCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
|
||||
@@ -26,20 +26,20 @@ namespace Game.Chat
|
||||
class ServerCommands
|
||||
{
|
||||
[Command("corpses", RBACPermissions.CommandServerCorpses, true)]
|
||||
static bool HandleServerCorpsesCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerCorpsesCommand(CommandHandler handler)
|
||||
{
|
||||
Global.WorldMgr.RemoveOldCorpses();
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("debug", RBACPermissions.CommandServerCorpses, true)]
|
||||
static bool HandleServerDebugCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerDebugCommand(CommandHandler handler)
|
||||
{
|
||||
return false;//todo fix me
|
||||
}
|
||||
|
||||
[Command("exit", RBACPermissions.CommandServerExit, true)]
|
||||
static bool HandleServerExitCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerExitCommand(CommandHandler handler)
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandExit);
|
||||
Global.WorldMgr.StopNow(ShutdownExitCode.Shutdown);
|
||||
@@ -47,7 +47,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("info", RBACPermissions.CommandServerInfo, true)]
|
||||
static bool HandleServerInfoCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerInfoCommand(CommandHandler handler)
|
||||
{
|
||||
uint playersNum = Global.WorldMgr.GetPlayerCount();
|
||||
uint maxPlayersNum = Global.WorldMgr.GetMaxPlayerCount();
|
||||
@@ -70,7 +70,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("motd", RBACPermissions.CommandServerMotd, true)]
|
||||
static bool HandleServerMotdCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerMotdCommand(CommandHandler handler)
|
||||
{
|
||||
string motd = "";
|
||||
foreach (var line in Global.WorldMgr.GetMotd())
|
||||
@@ -240,7 +240,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("cancel", RBACPermissions.CommandServerIdlerestartCancel, true)]
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler)
|
||||
{
|
||||
uint timer = Global.WorldMgr.ShutdownCancel();
|
||||
if (timer != 0)
|
||||
@@ -259,7 +259,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("cancel", RBACPermissions.CommandServerIdleshutdownCancel, true)]
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler)
|
||||
{
|
||||
uint timer = Global.WorldMgr.ShutdownCancel();
|
||||
if (timer != 0)
|
||||
@@ -279,7 +279,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("cancel", RBACPermissions.CommandServerRestartCancel, true)]
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler)
|
||||
{
|
||||
uint timer = Global.WorldMgr.ShutdownCancel();
|
||||
if (timer != 0)
|
||||
@@ -305,7 +305,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("cancel", RBACPermissions.CommandServerShutdownCancel, true)]
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerShutDownCancelCommand(CommandHandler handler)
|
||||
{
|
||||
uint timer = Global.WorldMgr.ShutdownCancel();
|
||||
if (timer != 0)
|
||||
@@ -353,7 +353,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("motd", RBACPermissions.CommandServerSetMotd, true)]
|
||||
static bool SetMotd(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerSetMotdCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
Global.WorldMgr.SetMotd(args.NextString(""));
|
||||
handler.SendSysMessage(CypherStrings.MotdNew, args.GetString());
|
||||
@@ -361,7 +361,7 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("closed", RBACPermissions.CommandServerSetClosed, true)]
|
||||
static bool SetClosed(CommandHandler handler, StringArguments args)
|
||||
static bool HandleServerSetClosedCommand(CommandHandler handler, StringArguments args)
|
||||
{
|
||||
string arg1 = args.NextString();
|
||||
if (arg1.Equals("on", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Game.Chat
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.SendSysMessage(CypherStrings.CommandTpAddedError);
|
||||
handler.SendSysMessage(CypherStrings.CommandTpAddedErr);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -240,9 +240,8 @@ namespace Game.Chat
|
||||
class TeleNameCommands
|
||||
{
|
||||
[Command("", RBACPermissions.CommandTeleName, true)]
|
||||
static bool HandleTeleNameCommand(CommandHandler handler, string playerName, string where)
|
||||
static bool HandleTeleNameCommand(CommandHandler handler, PlayerIdentifier player, string where)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
player = PlayerIdentifier.FromTargetOrSelf(handler);
|
||||
if (player == null)
|
||||
@@ -284,9 +283,8 @@ namespace Game.Chat
|
||||
class TeleNameNpcCommands
|
||||
{
|
||||
[Command("guid", RBACPermissions.CommandTeleName, true)]
|
||||
static bool HandleTeleNameNpcSpawnIdCommand(CommandHandler handler, string playerName, ulong spawnId)
|
||||
static bool HandleTeleNameNpcSpawnIdCommand(CommandHandler handler, PlayerIdentifier player, ulong spawnId)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
@@ -303,9 +301,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("id", RBACPermissions.CommandTeleName, true)]
|
||||
static bool HandleTeleNameNpcIdCommand(CommandHandler handler, string playerName, uint creatureId)
|
||||
static bool HandleTeleNameNpcIdCommand(CommandHandler handler, PlayerIdentifier player, uint creatureId)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
@@ -336,9 +333,8 @@ namespace Game.Chat
|
||||
}
|
||||
|
||||
[Command("name", RBACPermissions.CommandTeleName, true)]
|
||||
static bool HandleTeleNameNpcNameCommand(CommandHandler handler, string playerName, string name)
|
||||
static bool HandleTeleNameNpcNameCommand(CommandHandler handler, PlayerIdentifier player, string name)
|
||||
{
|
||||
var player = PlayerIdentifier.ParseFromString(playerName);
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user