コード例 #1
0
        public override CommandReply Action(CommandCaller caller, string[] args)
        {
            int buffType = 0;
            int length   = 0;

            if (!int.TryParse(args[0], out buffType))
            {
                buffType = CommandUtils.GetBuffType(args[0]);
            }

            if (buffType == 0 || buffType >= BuffLoader.BuffCount)
            {
                throw new UsageException("Unknown buff type: " + buffType);
            }

            if (args.Length > 1)
            {
                if (!int.TryParse(args[1], out length))
                {
                    length = DEFAULT_LENGTH;
                }
            }

            caller.Player.AddBuff(buffType, length);
            return(new CommandReply("Added buff type " + buffType + "!"));
        }
コード例 #2
0
        public override CommandReply Action(CommandCaller caller, string[] args)
        {
            int buffType = 0;

            if (!int.TryParse(args[0], out buffType))
            {
                buffType = CommandUtils.GetBuffType(args[0]);
            }

            if (buffType == 0 || buffType >= BuffLoader.BuffCount)
            {
                throw new UsageException($"Unknown buff type: {buffType}");
            }

            caller.Player.ClearBuff(buffType);
            return(new CommandReply($"Cleared buff type {buffType}!"));
        }