예제 #1
0
        public override bool Init(YamLikeCommand cmd)
        {
            if (cmd.SubCommand == null || cmd.SubCommand.Count == 0)
            {
                return(false);
            }

            if (cmd.UnnamedParams == null || cmd.UnnamedParams.Count == 0)
            {
                return(false);
            }

            List <uint> tmpSpells = new List <uint>();

            foreach (var q in cmd.UnnamedParams)
            {
                uint spellId = 0;
                if (uint.TryParse(q, out spellId))
                {
                    tmpSpells.Add(spellId);
                }
            }

            if (tmpSpells.Count == 0)
            {
                return(false);
            }

            foreach (var s in tmpSpells)
            {
                spells.Add(s);
            }

            return(base.Init(cmd));
        }
예제 #2
0
        public virtual bool Init(YamLikeCommand cmd)
        {
            if (cmd.SubCommand == null || cmd.SubCommand.Count == 0)
            {
                return(false);
            }

            List <IDrawCommand> tmp = new List <IDrawCommand>();

            foreach (var c in cmd.SubCommand)
            {
                IDrawCommand drawingCmd = CommandDrawingFactoryEx.create(c);
                if (drawingCmd == null)
                {
                    continue;
                }

                tmp.Add(drawingCmd);
            }

            if (tmp.Count == 0)
            {
                return(false);
            }

            this.Commands.AddRange(tmp);

            return(true);
        }
예제 #3
0
        public override bool Init(YamLikeConfig.Command cmd)
        {
            cmd.tryGet("before", out this.Before);
            cmd.tryGet("duration", out this.Duration);
            cmd.tryGet("after", out this.After);

            return(base.Init(cmd));
        }
예제 #4
0
        public override bool Init(YamLikeCommand cmd)
        {
            if (!cmd.tryGet("zone", out this.zoneId))
            {
                return(false);
            }

            return(base.Init(cmd));
        }
예제 #5
0
        public override bool Init(YamLikeCommand cmd)
        {
            if (cmd.has("color"))
            {
                this.Color = cmd["color"].ParseColor(this.Color);
            }

            return(base.Init(cmd));
        }
예제 #6
0
        public static IDrawCommand create(YamLikeCommand cmd)
        {
            if (!initDone)
            {
                init();
                initDone = true;
            }

            return(factory.create(cmd));
        }
예제 #7
0
        public override bool Init(YamLikeConfig.Command cmd)
        {
            if (!base.Init(cmd))
            {
                return(false);
            }

            if (cmd.UnnamedParams != null && cmd.UnnamedParams.Count > 0)
            {
                this.Text = cmd[0];
            }

            return(true);
        }
예제 #8
0
        public IDrawCommand create(YamLikeCommand cmd)
        {
            if (cmd == null || string.IsNullOrWhiteSpace(cmd.Name))
            {
                return(null);
            }

            string shortName = cmd.Name.Trim().ToLower();

            if (!_table.ContainsKey(shortName))
            {
                return(null);
            }

            return(_table[shortName](cmd));
        }
예제 #9
0
        //public void fillComplexDrawCommand(ref ComplexDrawCommand complex, YamLikeConfig.Command cmd)
        //{
        //    if (cmd.SubCommand == null || cmd.SubCommand.Count == 0)
        //        return;

        //    foreach(var c in cmd.SubCommand)
        //    {
        //        IDrawCommand drawingCmd = CommandDrawingFactory.create(c);
        //        if (drawingCmd == null)
        //            continue;

        //        if (complex == null)
        //        {
        //            complex = new ComplexDrawCommand();
        //        }

        //        complex.AddDrawItem(drawingCmd);
        //    }
        //}
        public void fillGameTypeCommand(YamLikeConfig.Command gameTypeCommand)
        {
            uint gameTypeInt = 0;

            if (!uint.TryParse(gameTypeCommand["type"], out gameTypeInt))
            {
                return;
            }

            if (gameTypeCommand["hide"] == "1")
            {
                skipGameType.Add((ff14bot.Enums.GameObjectType)gameTypeInt);
                return;
            }

            ComplexDrawCommand complex = null;

            if (gameTypeCommand.SubCommand == null)
            {
                CustomObjectTypesDrawing[(ff14bot.Enums.GameObjectType)gameTypeInt] = complex;
                return;
            }

            foreach (var c in gameTypeCommand.SubCommand)
            {
                IDrawCommand drawingCmd = CommandDrawingFactoryEx.create(c);
                if (drawingCmd == null)
                {
                    continue;
                }

                if (complex == null)
                {
                    complex = new ComplexDrawCommand();
                }

                complex.AddDrawItem(drawingCmd);
            }

            CustomObjectTypesDrawing[(ff14bot.Enums.GameObjectType)gameTypeInt] = complex;
        }
예제 #10
0
        public override bool Init(YamLikeConfig.Command cmd)
        {
            if (!base.Init(cmd))
            {
                return(false);
            }

            if (cmd.has("fadeout") && cmd["fadeout"] == "1")
            {
                useFadeOut = true;
            }

            if (cmd.has("length"))
            {
                int tmp;
                if (cmd.tryGet("length", out tmp))
                {
                    maxPointCount = tmp;
                }
            }

            if (cmd.has("interval"))
            {
                int tmp;
                if (cmd.tryGet("interval", out tmp))
                {
                    pointIntervalMsc = tmp;
                }
            }

            if (cmd.has("distance"))
            {
                float tmp;
                if (cmd.tryGet("distance", out tmp))
                {
                    distanceSquare = tmp;
                }
            }

            return(true);
        }
예제 #11
0
        public void fillNpcCommand(YamLikeConfig.Command npcCommand)
        {
            if (npcCommand.UnnamedParams == null)
            {
                return;
            }

            List <uint> npcIdList = new List <uint>();

            foreach (var npcIdStr in npcCommand.UnnamedParams)
            {
                uint npcId = 0;
                if (!uint.TryParse(npcIdStr, out npcId))
                {
                    continue;
                }

                npcIdList.Add(npcId);
            }

            if (npcIdList.Count == 0)
            {
                return;
            }

            if (npcCommand["hide"] == "1")
            {
                foreach (uint npcId in npcIdList)
                {
                    skipObjects.Add(npcId);
                }

                return;
            }

            ComplexDrawCommand complex = null;

            if (npcCommand.SubCommand != null)
            {
                foreach (var c in npcCommand.SubCommand)
                {
                    IDrawCommand drawingCmd = CommandDrawingFactoryEx.create(c);
                    if (drawingCmd == null)
                    {
                        continue;
                    }

                    if (complex == null)
                    {
                        complex = new ComplexDrawCommand();
                    }

                    complex.AddDrawItem(drawingCmd);
                }
            }

            foreach (uint npcId in npcIdList)
            {
                NpcDrawing[npcId] = complex;
            }
        }
예제 #12
0
        public void parseTopLevelCommand(YamLikeConfig.Command cmd)
        {
            string cmdName = cmd.Name;

            if (string.IsNullOrWhiteSpace(cmdName))
            {
                return;
            }

            if (cmd["skip"] == "1")
            {
                return;
            }

            bool hasSkipCommand = cmd.SubCommand != null && cmd.SubCommand.Any(c1 => c1.Name != null && c1.Name.ToLower() == "skip");

            if (hasSkipCommand)
            {
                return;
            }

            cmdName = cmdName.ToLower();

            switch (cmdName)
            {
            case "self":
                SelfDrawing.Init(cmd);
                //fillComplexDrawCommand(ref SelfDrawing, cmd);
                return;

            case "target":
                TargetDrawing.Init(cmd);
                //fillComplexDrawCommand(ref TargetDrawing, cmd);
                return;

            case "hostile":
                HostileDrawing.Init(cmd);
                //fillComplexDrawCommand(ref HostileDrawing, cmd);
                return;

            case "all":
                AllDrawing.Init(cmd);
                //fillComplexDrawCommand(ref AllDrawing, cmd);
                return;

            case "gametype":
                fillGameTypeCommand(cmd);
                return;

            case "npc":
                fillNpcCommand(cmd);
                return;

            case "gather":
                GatherNode gather = CommandDrawingFactoryEx.create(cmd) as GatherNode;
                if (gather != null)
                {
                    GatherNodes.Add(gather);
                }
                //fillGatherMap(cmd);
                return;
            }
        }
예제 #13
0
        public virtual bool Init(YamLikeConfig.Command cmd)
        {
            Vector3 vec3;
            float   tmpF;

            if (cmd.has("XYZ"))
            {
                if (cmd["XYZ"].TryParse(out vec3))
                {
                    this.Center    = vec3;
                    this.FixCenter = true;
                }
            }

            if (cmd.has("xyz"))
            {
                if (cmd["xyz"].TryParse(out vec3))
                {
                    this.Center    = vec3;
                    this.FixCenter = true;
                }
            }

            if (cmd.has("center"))
            {
                if (cmd["center"].TryParse(out vec3))
                {
                    this.Center    = vec3;
                    this.FixCenter = true;
                }
            }

            if (cmd.tryGet("heading", out tmpF))
            {
                this.Heading    = tmpF;
                this.FixHeading = true;
            }

            if (cmd.tryGet("headingOffset", out tmpF))
            {
                this.HeadingOffset = tmpF;
            }

            if (cmd.tryGet("offset", out tmpF))
            {
                this.HeadingOffset = tmpF;
            }

            if (cmd.tryGet("r1", out tmpF))
            {
                this.R1 = tmpF;
            }

            if (cmd.tryGet("radius", out tmpF))
            {
                this.R1 = tmpF;
            }

            if (cmd.tryGet("Radius", out tmpF))
            {
                this.R1 = tmpF;
            }

            if (cmd.tryGet("radiusIn", out tmpF))
            {
                this.R1 = tmpF;
            }

            if (cmd.tryGet("width", out tmpF))
            {
                this.R1 = tmpF;
            }

            if (cmd.tryGet("r2", out tmpF))
            {
                this.R2 = tmpF;
            }

            if (cmd.tryGet("radiusOut", out tmpF))
            {
                this.R2 = tmpF;
            }

            if (cmd.tryGet("length", out tmpF))
            {
                this.R2 = tmpF;
            }

            System.Drawing.Color tmpColor;
            if (cmd.tryGet("c1", out tmpColor))
            {
                this.C1 = tmpColor;
            }

            if (cmd.tryGet("color", out tmpColor))
            {
                this.C1 = tmpColor;
            }

            if (cmd.tryGet("colorIn", out tmpColor))
            {
                this.C1 = tmpColor;
            }

            if (cmd.tryGet("c2", out tmpColor))
            {
                this.C2 = tmpColor;
            }

            if (cmd.tryGet("colorOut", out tmpColor))
            {
                this.C2 = tmpColor;
            }

            if (cmd.tryGet("rangecolor", out tmpColor))
            {
                this.C2 = tmpColor;
            }

            if (cmd.tryGet("point", out tmpColor))
            {
                this.C2 = tmpColor;
            }

            if (cmd.tryGet("angle", out tmpF))
            {
                this.Angle = tmpF;
            }

            if (cmd.tryGet("angleOffset", out tmpF))
            {
                this.AngleOffset = tmpF;
            }

            if (cmd.has("format"))
            {
                this.Text = cmd["format"];
            }

            if (cmd.has("spell_location") && cmd["spell_location"] == "1")
            {
                this.UseSpellLocation = true;
            }

            if (cmd.has("target_location") && cmd["target_location"] == "1")
            {
                this.UseTargetLocation = true;
            }

            return(true);
        }