示例#1
0
文件: Game.cs 项目: thelextor/BotFarm
        public Game(string hostname, int port, string username, string password, LogLevel logLevel)
        {
            UI          = new T();
            UI.Game     = this;
            UI.LogLevel = logLevel;

            World = new GameWorld();

            this.Username = username;

            socket = new AuthSocket(this, hostname, port, username, password);
            socket.InitHandlers();
        }
示例#2
0
        public AutomatedGame(string hostname, int port, string username, string password, int realmId, int character)
        {
            this.RealmID     = realmId;
            this.Character   = character;
            scheduledActions = new ScheduledActions();
            World            = new GameWorld();

            this.Hostname = hostname;
            this.Port     = port;
            this.Username = username;
            this.Password = password;

            socket = new AuthSocket(this, Hostname, Port, Username, Password);
            socket.InitHandlers();
        }
示例#3
0
        public void Reconnect()
        {
            Connected = false;
            LoggedIn  = false;
            while (Running)
            {
                socket.Disconnect();
                scheduledActions.Clear();
                socket = new AuthSocket(this, Hostname, Port, Username, Password);
                socket.InitHandlers();
                // exit from loop if the socket connected successfully
                if (socket.Connect())
                {
                    break;
                }

                // try again later
                Thread.Sleep(10000);
            }
        }
示例#4
0
文件: Game.cs 项目: thelextor/BotFarm
        public void ConnectTo(WorldServerInfo server)
        {
            if (socket is AuthSocket)
            {
                Key = ((AuthSocket)socket).Key;
            }

            socket.Dispose();

            socket = new WorldSocket(this, server);
            socket.InitHandlers();

            if (socket.Connect())
            {
                socket.Start();
            }
            else
            {
                Exit().Wait();
            }
        }
示例#5
0
        public AutomatedGame(string hostname, int port, string username, string password, int realmId, int character)
        {
            this.RealmID        = realmId;
            this.Character      = character;
            scheduledActions    = new ScheduledActions();
            updateObjectHandler = new UpdateObjectHandler(this);
            Triggers            = new IteratedList <Trigger>();
            World  = new GameWorld();
            Player = new Player();
            Player.OnFieldUpdated += OnFieldUpdate;
            Objects = new Dictionary <ulong, WorldObject>();
            CompletedAchievements = new HashSet <uint>();
            AchievementCriterias  = new Dictionary <uint, ulong>();

            this.Hostname = hostname;
            this.Port     = port;
            this.Username = username;
            this.Password = password;

            socket = new AuthSocket(this, Hostname, Port, Username, Password);
            socket.InitHandlers();
        }
示例#6
0
        public void Reconnect()
        {
            Connected = false;
            LoggedIn = false;
            while (Running)
            {
                socket.Disconnect();
                scheduledActions.Clear();
                ResetTriggers();
                socket = new AuthSocket(this, Hostname, Port, Username, Password);
                socket.InitHandlers();
                // exit from loop if the socket connected successfully
                if (socket.Connect())
                    break;

                // try again later
                Thread.Sleep(10000);
            }
        }
示例#7
0
        public void ConnectTo(WorldServerInfo server)
        {
            if (socket is AuthSocket)
                Key = ((AuthSocket)socket).Key;

            socket.Dispose();

            socket = new WorldSocket(this, server);
            socket.InitHandlers();

            if (socket.Connect())
            {
                socket.Start();
                Connected = true;
            }
            else
                Reconnect();
        }
示例#8
0
        public AutomatedGame(string hostname, int port, string username, string password, int realmId, int character)
        {
            this.RealmID = realmId;
            this.Character = character;
            scheduledActions = new ScheduledActions();
            updateObjectHandler = new UpdateObjectHandler(this);
            Triggers = new IteratedList<Trigger>();
            World = new GameWorld();
            Player = new Player();
            Player.OnFieldUpdated += OnFieldUpdate;
            Objects = new Dictionary<ulong, WorldObject>();
            CompletedAchievements = new HashSet<uint>();
            AchievementCriterias = new Dictionary<uint, ulong>();
            AIs = new Stack<IGameAI>();
            PushAI(new EmptyAI());

            this.Hostname = hostname;
            this.Port = port;
            this.Username = username;
            this.Password = password;

            socket = new AuthSocket(this, Hostname, Port, Username, Password);
            socket.InitHandlers();
        }
示例#9
0
        public AutomatedGame(string hostname, int port, string username, string password, int realmId, int character)
        {
            this.RealmID = realmId;
            this.Character = character;
            scheduledActions = new ScheduledActions();
            updateObjectHandler = new UpdateObjectHandler(this);
            Triggers = new List<Trigger>();
            World = new GameWorld();
            Player = new Player();
            Player.OnFieldUpdated += OnFieldUpdate;
            Objects = new Dictionary<ulong, WorldObject>();

            this.Hostname = hostname;
            this.Port = port;
            this.Username = username;
            this.Password = password;

            socket = new AuthSocket(this, Hostname, Port, Username, Password);
            socket.InitHandlers();
        }