public void RequestRealmlist() { PacketOut packet = new PacketOut(LogonServerOpCode.REALM_LIST); packet.Write(0x00); Send(packet); // Most tricky code ever. It's so because retail server sends a lot of data in this packet... byte[] temp = pLoop.OnReceive(3); PacketIn p1 = new PacketIn(temp, true); byte[] temp2 = pLoop.OnReceive(p1.ReadUInt16()); byte[] temp3 = new byte[temp.Length + temp2.Length]; temp.CopyTo(temp3, 0); temp2.CopyTo(temp3, temp.Length); p1 = new PacketIn(temp3, false); HandlePacket(p1); }
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; LevelManager.Load("RealmServers"); //netInstance.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(); } }