/// <summary> /// /// </summary> /// <param name="netState"></param> /// <param name="packetReader"></param> public static void Realm_HandleRegisterRealm(NetState netState, PacketReader packetReader) { RealmExtendData extendData = netState.GetComponent <RealmExtendData>(RealmExtendData.COMPONENT_ID); if (extendData == null) { Debug.WriteLine("Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData == null error!"); return; } if (extendData.IsLoggedIn == true) { Debug.WriteLine("Realm_PacketHandlers.Realm_HandleRegisterRealm(...) - extendData.IsLoggedIn == true error!"); return; } Realm realm = new Realm(); realm.Name = packetReader.ReadUTF8String(); realm.Address = packetReader.ReadUTF8String(); string strIcon = packetReader.ReadUTF8String(); if (Insensitive.Equals(strIcon, "PVP")) { realm.Icon = (uint)RealmIconType.REALMTYPE_PVP; } else if (Insensitive.Equals(strIcon, "RP")) { realm.Icon = (uint)RealmIconType.REALMTYPE_RP; } else if (Insensitive.Equals(strIcon, "RPPVP")) { realm.Icon = (uint)RealmIconType.REALMTYPE_RPPVP; } else { realm.Icon = (uint)RealmIconType.REALMTYPE_NORMAL; } realm.Colour = packetReader.ReadUInt32(); realm.TimeZone = packetReader.ReadUInt32(); realm.Population = packetReader.ReadFloat(); extendData.RequestSession.Serial = RealmHandler.RealmsExclusiveSerial.GetExclusiveSerial(); // Add to the main realm list RealmHandler.AddRealm(extendData.RequestSession.Serial, realm); extendData.IsLoggedIn = true; // Send back response packet. netState.Send(new Realm_RegisterRealmResult(extendData.RequestSession.Serial)); }
/// <summary> /// /// </summary> public Auth_RealmListResult() : base((long)AuthOpCode.CMSG_REALM_LIST_RESULT, 0) { WriterStream.Write((byte)AuthOpCode.CMSG_REALM_LIST_RESULT); WriterStream.Write((ushort)0); ////////////////////////////////////////////////////////////////////////// // dunno what this is.. WriterStream.Write((uint)0); Realm[] realmArrray = RealmHandler.RealmsToArray(); WriterStream.Write((ushort)realmArrray.Length); foreach (Realm itemRealm in realmArrray) { WriterStream.Write((byte)itemRealm.Colour); WriterStream.Write((byte)0); // Locked Flag. if 1, then realm locked. if 2, then realm is offline WriterStream.Write((byte)itemRealm.Icon); WriterStream.WriteUTF8Null(itemRealm.Name); WriterStream.WriteUTF8Null(itemRealm.Address); WriterStream.Write((float)itemRealm.Population); //this is population 0.5 = low 1.0 = medium 2.0 high (float)(maxplayers / players)*2 WriterStream.Write((byte)0); // Character Count 在这个服务器内创建的人物数量 WriterStream.Write((byte)itemRealm.TimeZone); // time zone WriterStream.Write((byte)0); // unk, may be realm number/id? } WriterStream.Write((byte)0x15); WriterStream.Write((byte)0); ////////////////////////////////////////////////////////////////////////// WriterStream.Seek(1, SeekOrigin.Begin); WriterStream.Write((ushort)(WriterStream.Length - 3)); }