Ejemplo n.º 1
0
        public void HandleRealmlist(PacketIn packetIn)
        {
            //packetIn.ReadByte();
            UInt16 Length = packetIn.ReadUInt16();
            UInt32 Request = packetIn.ReadUInt32();
            int realmscount = packetIn.ReadInt16();

            //Console.Write(packetIn.ToHex());

            Log.WriteLine(LogType.Success, "Got information about {0} realms.", realmscount);
            Realm[] realms = new Realm[realmscount];
            try
            {
                for (int i = 0; i < realmscount; i++)
                {
                    realms[i].Type = packetIn.ReadByte();
                    realms[i].Color = packetIn.ReadByte();
                    packetIn.ReadByte(); // unk
                    realms[i].Name = packetIn.ReadString();
                    realms[i].Address = packetIn.ReadString();
                    realms[i].Population = packetIn.ReadFloat();
                    realms[i].NumChars = packetIn.ReadByte();
                    realms[i].Language = packetIn.ReadByte();
                    packetIn.ReadByte();
               }

                Realmlist = realms;
                mCore.Event(new Event(EventType.EVENT_REALMLIST, "", new object[] { Realmlist }));

            }
            catch (Exception ex)
            {
                Log.WriteLine(LogType.Error, "Exception Occured");
                Log.WriteLine(LogType.Error, "Message: {0}", ex.Message);
                Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace);
                Disconnect();
            }
        }