public static async void OnReceivedRSGZWrapperPDU(Client Client, VoltronPacket Packet) { try { uint SendingAvatarID = Packet.ReadUInt32(); Packet.ReadUInt32(); //MessageID. uint MsgSize = Packet.ReadUInt32(); MessageClsIDs MessageClsID = (MessageClsIDs)Packet.ReadUInt32(); switch (MessageClsID) { case MessageClsIDs.cTSONetMessageStandard: Console.WriteLine("Received a cTSONetMessageStandard!"); cTSONetMessageStandard NetMessageStandard = Packet.ReadcTSONetMessageStandard(); if ((NetMessageStandard.Flags & (1 << 1)) != 0) { NetMessageStandard.Data1 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 2)) != 0) { NetMessageStandard.Data2 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 3)) != 0) { NetMessageStandard.Data3 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 4)) != 0) { NetMessageStandard.Data4 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 5)) != 0) { uint ExtraClsID = Packet.ReadUInt32(); NetMessageStandard.ExtraClsID = (ExtraClsRequestIDs)ExtraClsID; switch (NetMessageStandard.ExtraClsID) { case ExtraClsRequestIDs.TSOAvatarCreationRequest: Console.WriteLine("Received TransmitCreateAvatarNotificationPDU!"); Packet.ReadUInt32(); //Version Avatar Av = new Avatar(); Av.Name = Packet.ReadString(); Av.Description = Packet.ReadString(); Console.WriteLine("Name:" + Av.Name); Console.WriteLine("Description: " + Av.Description); Av.Gender = Packet.ReadByte(); Av.SkinColor = Packet.ReadByte(); Console.WriteLine("Gender: " + ((Av.Gender == 0) ? "male" : "female")); Av.HeadOutfitID = Packet.ReadUInt64().ToString("X8"); Av.BodyNormalID = Packet.ReadUInt64().ToString("X8"); Av.BodySwimWearID = Packet.ReadUInt64().ToString("X8"); Av.BodySleepWearID = Packet.ReadUInt64().ToString("X8"); Av.BodyNudeID = Packet.ReadUInt64().ToString("X8"); Packet.ReadUInt32(); //ClsID RefpackStream RefStream = new RefpackStream(Packet.Decompress(), true); MemoryStream cTSONeighborBlob = (MemoryStream)RefStream.Decompress(); Av.cTSONeighborBlob = cTSONeighborBlob.ToArray(); cTSONeighborBlob.Dispose(); //cTSONeighbor Neighbor = new cTSONeighbor(RefStream.Decompress(), true); Av.AvatarID = (uint)Guid.NewGuid().ToString().GetHashCode(); Client.TemporaryAvatarID = Av.AvatarID; Av.PropertyID = 0; DatabaseFacade.CreateAvatar(Av.AvatarID, Av.Name, Av.Description, 5000, 0, 10, 10, "AlphaVille", Av.PropertyID, 0x1011, 0x1213, 0x1415, 0x1617, 0x1819, 0x1a1b, 0x1c1d, 0x1e1f, 0x2021, 0x2223, 0x2425, 0x2627, 0x00, 0x00, 5000, Av.HeadOutfitID, Av.BodyNormalID, Av.BodySwimWearID, Av.BodySleepWearID, Av.BodyNudeID, 0, 0x84858687, 0x88898A8B, 0x8C8D8E8F, 0xbbbc, Av.cTSONeighborBlob); Client.NewAvatar = Av; //TODO: Is this thread-safe? Probably not :( Client.HasCreatedNewAvatar = true; TransmitCreateAvatarNotificationPDUResponse Response = new TransmitCreateAvatarNotificationPDUResponse(1, 1, NetMessageStandard.TransactionID1, Av.AvatarID); await Client.SendData(Response.ToArray()); m_Logger.Info("Sent TransmitCreateAvatarNotificationPDUResponse: " + Response.ToHexString()); //Send a type 22 packet to retrieve the client's updated account //with AccountID from the DB (see OnReceivedPacket22). await Client.SendData(new Type22Packet().ToArray()); m_Logger.Info("Sent Type22 packet!"); break; } } break; } } catch (Exception E) { m_Logger.Info("PacketParser.cs: Failed to parse packet: " + E.ToString()); } }
public static async void OnReceivedRSGZWrapperPDU(Client Client, VoltronPacket Packet) { uint SendingAvatarID = Packet.ReadUInt32(); Packet.ReadUInt32(); //Unknown. uint MsgSize = Packet.ReadUInt32(); MessageClsIDs MessageClsID = (MessageClsIDs)Packet.ReadUInt32(); switch (MessageClsID) { case MessageClsIDs.cTSONetMessageStandard: Console.WriteLine("Received a cTSONetMessageStandard!"); cTSONetMessageStandard NetMessageStandard = new cTSONetMessageStandard(); NetMessageStandard.TransactionID1 = Packet.ReadInt16(); NetMessageStandard.TransactionID2 = Packet.ReadInt16(); NetMessageStandard.SendingAvatarID = Packet.ReadUInt32(); NetMessageStandard.Flags = Packet.ReadByte(); NetMessageStandard.MessageID = (cTSONetMessageStandardMsgIDs)Packet.ReadUInt32(); if ((NetMessageStandard.Flags & (1 << 1)) != 0) { NetMessageStandard.Data1 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 2)) != 0) { NetMessageStandard.Data2 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 3)) != 0) { NetMessageStandard.Data3 = Packet.ReadUInt32(); } if ((NetMessageStandard.Flags & (1 << 5)) != 0) { uint ExtraClsID = Packet.ReadUInt32(); NetMessageStandard.ExtraClsID = (ExtraClsRequestIDs)ExtraClsID; uint AvatarID; switch (NetMessageStandard.ExtraClsID) { case ExtraClsRequestIDs.TransmitCreateAvatarNotificationPDU: Console.WriteLine("Received TransmitCreateAvatarNotificationPDU!"); Packet.ReadUInt32(); //SendingAvatarID Avatar Av = new Avatar(); Av.Name = Packet.ReadString(); Av.Description = Packet.ReadString(); Console.WriteLine("Name:" + Av.Name); Console.WriteLine("Description: " + Av.Description); Console.WriteLine(Packet.ReadString()); Av.Gender = Packet.ReadByte(); Av.SkinColor = Packet.ReadByte(); Console.WriteLine("Gender: " + ((Av.Gender == 0) ? "male" : "female")); Av.HeadOutfitID = Packet.ReadUInt64().ToString("X8"); Av.BodyNormalID = Packet.ReadUInt64().ToString("X8"); Av.BodySwimWearID = Packet.ReadUInt64().ToString("X8"); Av.BodySleepWearID = Packet.ReadUInt64().ToString("X8"); Packet.ReadUInt32(); //ClsID? RefpackStream RefStream = new RefpackStream(Packet.Decompress(), true); cTSONeighbor Neighbor = new cTSONeighbor(RefStream.Decompress()); await Client.SendData(new TransmitCreateAvatarNotificationPDUResponse(Neighbor.AvatarID).ToArray()); break; } } break; } }