コード例 #1
0
        public override void Action(CommandCaller player, string input, string[] args)
        {
            //try{
            string     itemName;
            ActionItem item;
            string     literal;

            ActionContext.Default.Caster = player.Player;
            for (int i = 0; i < args.Length; i++)
            {
                mod.Logger.Info($"parsing \'{args[i]}\'");
                itemName = args[i].Split('.')[0];
                item     = Jailbreak.GetAction(itemName);
                if (item.hasLiteral)
                {
                    literal = args[i].Substring(itemName.Length + 1);
                    item    = Jailbreak.CreateNew(item);
                    item.ApplyLiteral(literal);
                    mod.Logger.Info($"set literal of {item} to {literal}");
                }
                ActionContext.Default.lastReturn = item.Execute(0) ?? ActionContext.Default.lastReturn;
            }

            /*}catch (Exception e){
             *  Main.NewText(e.Message);
             * }*/
        }
コード例 #2
0
        public override void Action(CommandCaller player, string input, string[] args)
        {
            //try{
            string     itemName;
            ActionItem item;
            string     literal;

            ActionContext.Default.Caster = player.Player;
            int i = 0;

            if (args[0] == "+=")
            {
                i++;
            }
            else
            {
                TestItem.actions = new List <ActionItem>()
                {
                };
            }

            for (; i < args.Length; i++)
            {
                mod.Logger.Info($"parsing \'{args[i]}\'");
                itemName = args[i].Split('.')[0];
                item     = Jailbreak.GetAction(itemName);
                if (item.hasLiteral)
                {
                    literal = args[i].Substring(itemName.Length + 1);
                    item    = Jailbreak.CreateNew(item);
                    item.ApplyLiteral(literal);
                    mod.Logger.Info($"set literal of {item} to {literal}");
                }
                TestItem.actions.Add(item);
            }

            /*}catch (Exception e){
             *  Main.NewText(e.Message);
             * }*/
        }