Beispiel #1
0
        internal override Queue <TermCmd> HandleCommands(Queue <TermCmd> cmds)
        {
            //dict.Add(new Regex(@"ID\?"), "ID,2,5454");
            //dict.Add(new Regex(@"CON\?"), "CON,dadosbladebbs.dyndns.org,23");


            Queue <TermCmd> returnQ = new Queue <TermCmd>();

            while (cmds.Count > 0)
            {
                TermCmd c = cmds.Dequeue();
                if (c is TermStringDataCmd)
                {
                    string msg = (c as TermStringDataCmd).GetValue();
                    Console.WriteLine(msg);
                    if (Regex.Match(msg, @"\*Combat Engaged\*").Success)
                    {
                        idleTimer.Stop();
                        isIdle = false;
                        this.m_controller.m_sessionForm.SetCombat(true);
                    }
                    else if (Regex.Match(msg, @"\*Combat Off\*").Success)
                    {
                        idleTimer.Start();
                        isIdle = true;
                        this.m_controller.m_sessionForm.SetCombat(false);
                    }
                    else if (Regex.Match(msg, @"ID\?").Success)
                    {
                        this.m_controller.Send("ID,2,42");
                    }
                }
            }
            return(returnQ);
        }
Beispiel #2
0
        internal override Queue <TermCmd> HandleCommands(Queue <TermCmd> cmds)
        {
            Queue <TermCmd> returnQ = new Queue <TermCmd>();

            while (cmds.Count > 0)
            {
                TermCmd c = cmds.Dequeue();
                if (c is TermStringDataCmd)
                {
                    string msg = (c as TermStringDataCmd).GetValue();
                    Console.WriteLine(msg);
                    foreach (Regex r in this.LogonStrings_Regex.Keys)
                    {
                        Match m = r.Match(msg);
                        if (m.Success)
                        {
                            string rsp = this.LogonStrings_Regex[r];
                            this.m_controller.Send(rsp);
                            this.LogonSuccess[r] = true;
                        }
                    }
                }
                returnQ.Enqueue(c);
            }
            if (LogonComplete)
            {
                this.m_controller.SetMenuState();
            }
            return(returnQ);
        }
Beispiel #3
0
 //execute each command in the queue on the screen buffer, then redraw the screen
 internal void HandleCommands(Queue <TermCmd> queue)
 {
     heartbeat.Stop();
     lock (this.grid)
     {
         while (queue.Count > 0)
         {
             TermCmd cmd = queue.Dequeue();
             if (cmd is TermStringDataCmd)
             {
             }
             cmd.DoCommand(this.grid);
         }
     }
     //cross thread invoke
     this.Invoke(refresh);
     heartbeat.Start();
 }
Beispiel #4
0
        internal override Queue <TermCmd> HandleCommands(Queue <TermCmd> cmds)
        {
            Queue <TermCmd> returnQ = new Queue <TermCmd>();

            while (cmds.Count > 0)
            {
                TermCmd c = cmds.Dequeue();
                if (c is TermStringDataCmd)
                {
                    string msg = (c as TermStringDataCmd).GetValue();
                    Console.WriteLine(msg);
                    if (Regex.Match(msg, @"\(N\)onstop, \(Q\)uit, or \(C\)ontinue\?").Success)
                    {
                        this.m_controller.Send("N");
                    }
                    else
                    {
                        foreach (Regex r in this.MenuStrings_Regex.Keys)
                        {
                            Match m = r.Match(msg);
                            if (m.Success)
                            {
                                string rsp = this.MenuStrings_Regex[r];
                                this.m_controller.Send(rsp);
                                this.MMudMenuSuccess[r] = true;
                            }
                        }
                    }
                }
                returnQ.Enqueue(c);
            }
            if (GameMenuComplete)
            {
                if (this.m_controller.SessionData.EnterGameEnabled)
                {
                    this.m_controller.Send("e" + ((char)0x0d).ToString());
                    this.m_controller.SetEnteringGameState();
                }
            }
            return(returnQ);
        }
Beispiel #5
0
        //hit e at the game menu
        //this states figures out if we go to in game or in char page or in creation
        internal override Queue <TermCmd> HandleCommands(Queue <TermCmd> cmds)
        {
            Queue <TermCmd> returnQ = new Queue <TermCmd>();

            while (cmds.Count > 0)
            {
                TermCmd c = cmds.Dequeue();
                if (c is TermStringDataCmd)
                {
                    string msg = (c as TermStringDataCmd).GetValue();
                    Console.WriteLine(msg);
                    if (Regex.Match(msg, @"\(N\)onstop, \(Q\)uit, or \(C\)ontinue\?").Success)
                    {
                        this.m_controller.Send("N");
                    }
                    else
                    {
                        foreach (Regex r in this.MMudCharCreationStrings_Regex.Keys)
                        {
                            Match m = r.Match(msg);
                            if (m.Success)
                            {
                                string rsp = this.MMudCharCreationStrings_Regex[r];
                                this.m_controller.Send(rsp);
                                this.MMudCharCreationSuccess[r] = true;
                            }
                        }

                        foreach (Regex r in this.MMudCharPageStrings_Regex.Keys)
                        {
                            Match m = r.Match(msg);
                            if (m.Success)
                            {
                                string rsp = this.MMudCharPageStrings_Regex[r];
                                this.m_controller.Send(rsp);
                                this.MMudCharPageSuccess[r] = true;
                            }
                        }

                        foreach (Regex r in this.MMudEnterGameStrings_Regex.Keys)
                        {
                            Match m = r.Match(msg);
                            if (m.Success)
                            {
                                string rsp = this.MMudEnterGameStrings_Regex[r];
                                this.m_controller.Send(rsp);
                                this.MMudEnterGameSuccess[r] = true;
                            }
                        }
                    }
                }
                returnQ.Enqueue(c);
            }

            if (this.IsCreation)
            {
                //do nothing
            }
            else if (this.IsCharPage)
            {
                //do nothing
            }
            else if (this.IsInGame)
            {
                this.m_controller.SetInGameState();
            }
            return(returnQ);
        }