Beispiel #1
0
 private static void ServerList(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     int num = pvSrc.ReadInt16();
     if (num <= 0)
     {
         Gumps.Desktop.Children.Clear();
         xGumps.SetVariable("FailMessage", "The Ultima Online servers are currently down. Please try again in a few moments.");
         xGumps.Display("ConnectionFailed");
         Cursor.Hourglass = false;
     }
     else
     {
         Server[] array = new Server[num];
         Server server = null;
         for (int i = 0; i < num; i++)
         {
             array[i] = new Server(pvSrc.ReadInt16(), pvSrc.ReadString(0x20), pvSrc.ReadByte(), pvSrc.ReadSByte(), new IPAddress((long) pvSrc.ReadUInt32()));
             if (array[i].ServerID == NewConfig.LastServerID)
             {
                 server = array[i];
             }
         }
         Array.Sort(array);
         Engine.Servers = array;
         Engine.LastServer = server;
         if (Engine.m_QuickLogin)
         {
             for (int j = 0; j < array.Length; j++)
             {
                 if ((array[j].ServerID == Engine.m_QuickEntry.ServerID) && (array[j].Name == Engine.m_QuickEntry.ServerName))
                 {
                     array[j].Select();
                     Cursor.Hourglass = true;
                     Gumps.Desktop.Children.Clear();
                     xGumps.Display("Connecting");
                     Engine.DrawNow();
                     return;
                 }
             }
             Cursor.Hourglass = false;
             Gumps.Desktop.Children.Clear();
             xGumps.SetVariable("FailMessage", "That server was not found on the server list.");
             xGumps.Display("ConnectionFailed");
             Engine.DrawNow();
         }
         else
         {
             Cursor.Hourglass = false;
             Gumps.Desktop.Children.Clear();
             xGumps.Display("ServerList");
         }
     }
 }
Beispiel #2
0
        public void ShardList(PacketReader pvSrc)
        {
            pvSrc.ReadByte();
            int num = pvSrc.ReadInt16();

            if (num > 0)
            {
                int port = this.m_Server.Port;
                switch (port)
                {
                case 0x1e5f:
                case 0x1e60:
                    port = 0x1389;
                    break;
                }
                for (int i = 0; i < num; i++)
                {
                    int       index       = pvSrc.ReadInt16();
                    string    name        = pvSrc.ReadString(0x20);
                    int       percentFull = pvSrc.ReadByte();
                    int       timeZone    = pvSrc.ReadSByte();
                    IPAddress address     = new IPAddress((long)pvSrc.ReadUInt32());
                    if (this.m_Shard == null)
                    {
                        ShardProfile profile = null;
                        for (int j = 0; (profile == null) && (j < this.m_Account.Shards.Length); j++)
                        {
                            if (this.m_Account.Shards[j].Name == name)
                            {
                                profile = this.m_Account.Shards[j];
                            }
                        }
                        if (profile == null)
                        {
                            this.m_Account.AddShard(profile = new ShardProfile(this.m_Account, address, port, index, timeZone, percentFull, 0xbadf00d, name));
                        }
                        else
                        {
                            profile.Index       = index;
                            profile.Address     = address;
                            profile.Port        = port;
                            profile.TimeZone    = timeZone;
                            profile.PercentFull = percentFull;
                        }
                        if (i == 0)
                        {
                            new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
                        }
                    }
                }
                ShardProfile[] shards = this.m_Account.Shards;
                if (shards.Length > 0)
                {
                    if (this.m_Shard == null)
                    {
                        Array.Sort(shards, new ShardComparer());
                        this.m_Shard = shards[0];
                    }
                    this.Send(new PServerSelection(this.m_Shard.Index));
                }
            }
        }
Beispiel #3
0
 public void ShardList(PacketReader pvSrc)
 {
     pvSrc.ReadByte();
     int num = pvSrc.ReadInt16();
     if (num > 0)
     {
         int port = this.m_Server.Port;
         switch (port)
         {
             case 0x1e5f:
             case 0x1e60:
                 port = 0x1389;
                 break;
         }
         for (int i = 0; i < num; i++)
         {
             int index = pvSrc.ReadInt16();
             string name = pvSrc.ReadString(0x20);
             int percentFull = pvSrc.ReadByte();
             int timeZone = pvSrc.ReadSByte();
             IPAddress address = new IPAddress((long) pvSrc.ReadUInt32());
             if (this.m_Shard == null)
             {
                 ShardProfile profile = null;
                 for (int j = 0; (profile == null) && (j < this.m_Account.Shards.Length); j++)
                 {
                     if (this.m_Account.Shards[j].Name == name)
                     {
                         profile = this.m_Account.Shards[j];
                     }
                 }
                 if (profile == null)
                 {
                     this.m_Account.AddShard(profile = new ShardProfile(this.m_Account, address, port, index, timeZone, percentFull, 0xbadf00d, name));
                 }
                 else
                 {
                     profile.Index = index;
                     profile.Address = address;
                     profile.Port = port;
                     profile.TimeZone = timeZone;
                     profile.PercentFull = percentFull;
                 }
                 if (i == 0)
                 {
                     new Timer(new OnTick(this.Update_OnTick), 0, 1).Start(false);
                 }
             }
         }
         ShardProfile[] shards = this.m_Account.Shards;
         if (shards.Length > 0)
         {
             if (this.m_Shard == null)
             {
                 Array.Sort(shards, new ShardComparer());
                 this.m_Shard = shards[0];
             }
             this.Send(new PServerSelection(this.m_Shard.Index));
         }
     }
 }