Esempio n. 1
0
        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();
        }
Esempio n. 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();
        }
Esempio n. 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);
            }
        }
Esempio n. 4
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();
            }
            else
            {
                Exit().Wait();
            }
        }
Esempio n. 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();
        }
Esempio n. 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);
            }
        }
Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 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();
        }