示例#1
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            if (!levelplusConfig.Instance.CommandsEnabled)
            {
                Main.NewText("Enable commands in the Level+ config to use this command.");
                return;
            }
            ushort id;

            if (!ushort.TryParse(args[0], out _))
            {
                id = CommandUtilities.GetStatID(args[0]);
                if (id == 10)
                {
                    Main.NewText("Invalid stat name.");
                    return;
                }
            }
            else
            {
                id = ushort.Parse(args[0]);
            }
            levelplusModPlayer player = caller.Player.GetModPlayer <levelplusModPlayer>();

            if (args.Length == 1)
            {
                player.SetInvestmentToParticularAmount(id);
            }
            else
            {
                player.SetInvestmentToParticularAmount(id, ushort.Parse(args[1]));
            }
        }
示例#2
0
        public override void Action(CommandCaller caller, string input, string[] args)
        {
            ushort id;

            if (!ushort.TryParse(args[0], out _))
            {
                id = CommandUtilities.GetStatID(args[0]);
                if (id == 10)
                {
                    Main.NewText("Invalid stat name.");
                    return;
                }
            }
            else
            {
                id = ushort.Parse(args[0]);
            }
            levelplusModPlayer player = caller.Player.GetModPlayer <levelplusModPlayer>();

            if (args.Length == 1)
            {
                player.InvestParticularAmount(id);
            }
            else
            {
                player.InvestParticularAmount(id, ushort.Parse(args[1]));
            }
        }