/// <summary> /// Adds an Item with the specified amount. /// </summary> /// <param name="name"></param> /// <param name="amount"></param> public void AddItem(string name, int amount) { string[] strArray = new string[] { name, amount.ToString() }; ConsoleSystem.Arg arg = new ConsoleSystem.Arg(""); arg.Args = strArray; arg.SetUser(this.player.PlayerClient.netUser); inv.give(ref arg); }
public void AddItem(string name, int amount) { Contract.Requires(!string.IsNullOrEmpty(name)); Contract.Requires(amount >= 0); string[] strArray = new string[] { name, amount.ToString() }; ConsoleSystem.Arg arg = new ConsoleSystem.Arg(""); arg.Args = strArray; arg.SetUser(this.player.PlayerClient.netUser); inv.give(ref arg); }
public void CallMethod(Fougerite.Player player, string knobname, string methodname, string argstr = "") { if (player == null || string.IsNullOrEmpty(knobname) || string.IsNullOrEmpty(methodname)) { Logger.LogDebug("[Knobs.CallMethod] usage: CallMethod(Fougerite.Player player, string knobname, string methodname, string argstr)"); } else if (_knobs.Contains(knobname.ToLowerInvariant())) { string command = string.Format("{0}.{1}", knobname, methodname); ConsoleSystem.Arg arg = new ConsoleSystem.Arg(command); arg.SetUser(player.PlayerClient.netUser); arg.ArgsStr = argstr; if (arg.Invalid) { Logger.LogError(string.Format("[Knobs.CallMethod] invalid: {0} {1}", command, argstr)); return; } ConsoleSystem.RunCommand(ref arg, true); } else { Logger.LogDebug(string.Format("[Knobs.CallMethod] No such knob: {0}", knobname)); } }