Esempio n. 1
0
        public D2GS(String character, String account, UInt32 chickenLife, UInt32 potLife)
        {
            //ConnectedToGs = false;
            m_d2gsConnection = new D2gsConnection();
            m_d2gsReader = new D2gsReader(ref m_d2gsConnection, character);
            m_d2gsHandler = new D2gsHandler(ref m_d2gsConnection);
            m_gsPing = new GameServerPing(ref m_d2gsConnection);
            m_gameThread = new GameThread(m_d2gsConnection, chickenLife, potLife);
            m_asciiMap = new AsciiMap(m_gameThread.GameData, m_d2gsConnection);

            m_d2gsConnection.StartThread += delegate {
                m_d2gsHandlerThread = new Thread(m_d2gsHandler.ThreadFunction);
                m_d2gsHandlerThread.Name = account + " [D2Gs]:";
                m_d2gsReaderThread = new Thread(m_d2gsReader.ThreadFunction);
                m_d2gsReaderThread.Name = account + " [D2GS]:";

                m_d2gsHandlerThread.Start();
                m_d2gsReaderThread.Start();
            };

            m_d2gsHandler.StartPinging += delegate
            {
                m_gsPingThread = new Thread(m_gsPing.Run);
                m_gsPingThread.Name = account + " [D2GS]:";
                m_gsPingThread.Start();
                m_mapThread = new Thread(m_asciiMap.ThreadFunction);
                m_mapThread.Start();
            };

            m_botThread = new Thread(m_gameThread.BotThread);
            m_botThread.Name = account + " [BOT]:";
            m_botThread.Start();

            SubscribeGameServerEvents();
        }
Esempio n. 2
0
 public void SubscribeNextGameEvent(D2gsReader.NoParam sub)
 {
     m_d2gsReader.NextGame += sub;
 }