Exemple #1
0
        internal string Gen()
        {
            AegisBody ab = p.Parse();

            foreach (AegisItem ai in ab.Items)
            {
                Type tp = ai.GetType();

                if (tp == typeof(AegisNpc))
                {
                    GenNpc((AegisNpc)ai);
                }
                else if (tp == typeof(AegisUnknown))
                {
                    GenUnk((AegisUnknown)ai);
                }
                else if (tp == typeof(AegisWarp))
                {
                    GenWarp((AegisWarp)ai);
                }
                else if (tp == typeof(AegisHiddenWarp))
                {
                    GenHWarp((AegisHiddenWarp)ai);
                }
                else if (tp == typeof(AegisTrader))
                {
                    GenTrader((AegisTrader)ai);
                }
                else if (tp == typeof(AegisPutMob))
                {
                    GenMonster((AegisPutMob)ai);
                }
                else if (tp == typeof(AegisPutBoss))
                {
                    GenBoss((AegisPutBoss)ai);
                }
                else
                {
                    throw new Exception();
                }
            }

            return(sw);
        }
Exemple #2
0
        internal AegisBody Parse()
        {
            var ab = new AegisBody();

            PushNode(ab);
            while (true)
            {
                if (tk.Type == TokenType.EOF)
                {
                    break;
                }
                else if (tk.Type == TokenType.npc)
                {
                    curNode.Items.Add(MatchNpc());
                }
                else if (tk.Type == TokenType.trader)
                {
                    curNode.Items.Add(MatchTrader());
                }
                else if (tk.Type == TokenType.warp)
                {
                    curNode.Items.Add(MatchWarp());
                }
                else if (tk.Type == TokenType.putmob)
                {
                    curNode.Items.Add(MatchPutM());
                }
                else if (tk.Type == TokenType.putboss)
                {
                    curNode.Items.Add(MatchPutB());
                }
                else if (tk.Type == TokenType.hiddenwarp)
                {
                    curNode.Items.Add(MatchHiddenWarp());
                }
                else if (tk.Type == TokenType.arenaguide)
                {
                    curNode.Items.Add(MatchArenaGuide());
                }
                else if (tk.Type == TokenType.NewLine)
                {
                    Match(TokenType.NewLine);
                }
                else
                {
                    if (tk.Value != "")
                    {
                        Error.Errors.Add("Unexpected " + tk.Type + " - '" + tk.Value + "' at " + tk.Line.ToString() +
                                         ":" + tk.Col.ToString());
                    }
                    else
                    {
                        Error.Errors.Add("Unexpected " + tk.Type + " at " + tk.Line.ToString() + ":" + tk.Col.ToString());
                    }
                    throw new Exception();
                }
            }
            ab = (AegisBody)PopNode();

            return(ab);
        }