public void OnCommand(GameClient client, string[] args) { if (IsSpammingCommand(client.Player, "cmdhelp")) { return; } ePrivLevel privilegeLevel = (ePrivLevel)client.Account.PrivLevel; bool isCommand = true; if (args.Length > 1) { try { privilegeLevel = (ePrivLevel)Convert.ToUInt32(args[1]); } catch (Exception) { isCommand = false; } } if (isCommand) { string[] commandList = GetCommandList(privilegeLevel); DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Cmdhelp.PlvlCommands", privilegeLevel.ToString())); foreach (string command in commandList) { DisplayMessage(client, command); } } else { string command = args[1]; if (command[0] != '&') { command = "&" + command; } ScriptMgr.GameCommand gameCommand = ScriptMgr.GetCommand(command); if (gameCommand == null) { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Cmdhelp.NoCommand", command)); } else { DisplayMessage(client, LanguageMgr.GetTranslation(client.Account.Language, "Scripts.Players.Cmdhelp.Usage", command)); foreach (string usage in gameCommand.Usage) { DisplayMessage(client, usage); } } } }
/// <summary> /// Constructs a new ExecuteCommandEventArgs /// </summary> /// <param name="source">the source that executed the command</param> /// <param name="command">the command which was executed.</param> /// <param name="pars">the pars given!</param> public ExecuteCommandEventArgs(GamePlayer source, ScriptMgr.GameCommand command, string[] pars) { this.source = source; this.command = command; this.pars = pars; }
public static void COMMAND_LOG(string command, string[] parsed = null, ScriptMgr.GameCommand gameCommand = null) { Log.Info($"\nDEV_COMMAND || Command:{command}\nParsed{parsed?.ToString() ?? string.Empty}\nGame Command:{gameCommand?.ToString() ?? string.Empty}"); }