public object Deserialize( StreamReader streamReader, SerializationContext serializationContext, PropertyMetaData propertyMetaData = null) { VendingMachineFullUpdateMessage message = new VendingMachineFullUpdateMessage(); message.N3MessageType = (N3MessageType)streamReader.ReadInt32(); message.Identity = streamReader.ReadIdentity(); message.Unknown = streamReader.ReadByte(); message.TypeIdentifier = streamReader.ReadInt32(); var identityType = (IdentityType)streamReader.ReadInt32(); int identityInstance = streamReader.ReadInt32(); message.NpcIdentity = new Identity() { Type = identityType, Instance = identityInstance }; if (message.NpcIdentity.Instance == 0) { message.Coordinates = new Vector3(); message.Coordinates.X = streamReader.ReadSingle(); message.Coordinates.Y = streamReader.ReadSingle(); message.Coordinates.Z = streamReader.ReadSingle(); message.Heading = new Quaternion(); message.Heading.X = streamReader.ReadSingle(); message.Heading.Y = streamReader.ReadSingle(); message.Heading.Z = streamReader.ReadSingle(); message.Heading.W = streamReader.ReadSingle(); } message.PlayfieldId = streamReader.ReadInt32(); message.Unknown4 = streamReader.ReadInt32(); message.Unknown5 = streamReader.ReadInt32(); message.Unknown6 = streamReader.ReadInt16(); int x3f1 = streamReader.ReadInt32(); x3f1 = x3f1 / 0x03f1; List<GameTuple<CharacterStat, uint>> temp = new List<GameTuple<CharacterStat, uint>>(); while (x3f1 > 1) { var temptuple = new GameTuple<CharacterStat, uint>(); temptuple.Value1 = (CharacterStat)streamReader.ReadInt32(); temptuple.Value2 = streamReader.ReadUInt32(); temp.Add(temptuple); x3f1--; } message.Stats = temp.ToArray(); message.Unknown7 = streamReader.ReadString(streamReader.ReadInt32()).Replace("\0", ""); /*int templen = streamReader.ReadInt32(); // String length!! message.Unknown7 = ""; while (templen > 0) { message.Unknown7 += (char)streamReader.ReadByte(); templen--; } message.Unknown7 = message.Unknown7.TrimEnd('\0');*/ message.Unknown8 = streamReader.ReadInt32(); if (message.Unknown8 == 2) { message.Unknown9 = streamReader.ReadInt32(); x3f1 = streamReader.ReadInt32(); x3f1 = x3f1 / 0x03f1; List<Identity> tempids = new List<Identity>(); while (x3f1 > 1) { identityType = (IdentityType)streamReader.ReadInt32(); identityInstance = streamReader.ReadInt32(); tempids.Add(new Identity() { Type = identityType, Instance = identityInstance }); x3f1--; } message.Unknown10 = tempids.ToArray(); } message.Unknown11 = streamReader.ReadInt32(); return message; }
public object Deserialize( StreamReader streamReader, SerializationContext serializationContext, PropertyMetaData propertyMetaData = null) { VendingMachineFullUpdateMessage message = new VendingMachineFullUpdateMessage(); message.N3MessageType = (N3MessageType)streamReader.ReadInt32(); message.Identity = streamReader.ReadIdentity(); message.Unknown = streamReader.ReadByte(); message.TypeIdentifier = streamReader.ReadInt32(); var identityType = (IdentityType)streamReader.ReadInt32(); int identityInstance = streamReader.ReadInt32(); message.NpcIdentity = new Identity() { Type = identityType, Instance = identityInstance }; if (message.NpcIdentity.Instance == 0) { message.Coordinates = new Vector3(); message.Coordinates.X = streamReader.ReadSingle(); message.Coordinates.Y = streamReader.ReadSingle(); message.Coordinates.Z = streamReader.ReadSingle(); message.Heading = new Quaternion(); message.Heading.X = streamReader.ReadSingle(); message.Heading.Y = streamReader.ReadSingle(); message.Heading.Z = streamReader.ReadSingle(); message.Heading.W = streamReader.ReadSingle(); } message.PlayfieldId = streamReader.ReadInt32(); message.Unknown4 = streamReader.ReadInt32(); message.Unknown5 = streamReader.ReadInt32(); message.Unknown6 = streamReader.ReadInt16(); int x3f1 = streamReader.ReadInt32(); x3f1 = x3f1 / 0x03f1; List <GameTuple <CharacterStat, uint> > temp = new List <GameTuple <CharacterStat, uint> >(); while (x3f1 > 1) { var temptuple = new GameTuple <CharacterStat, uint>(); temptuple.Value1 = (CharacterStat)streamReader.ReadInt32(); temptuple.Value2 = streamReader.ReadUInt32(); temp.Add(temptuple); x3f1--; } message.Stats = temp.ToArray(); message.Unknown7 = streamReader.ReadString(streamReader.ReadInt32()).Replace("\0", ""); /*int templen = streamReader.ReadInt32(); // String length!! * message.Unknown7 = ""; * while (templen > 0) * { * message.Unknown7 += (char)streamReader.ReadByte(); * templen--; * } * message.Unknown7 = message.Unknown7.TrimEnd('\0');*/ message.Unknown8 = streamReader.ReadInt32(); if (message.Unknown8 == 2) { message.Unknown9 = streamReader.ReadInt32(); x3f1 = streamReader.ReadInt32(); x3f1 = x3f1 / 0x03f1; List <Identity> tempids = new List <Identity>(); while (x3f1 > 1) { identityType = (IdentityType)streamReader.ReadInt32(); identityInstance = streamReader.ReadInt32(); tempids.Add(new Identity() { Type = identityType, Instance = identityInstance }); x3f1--; } message.Unknown10 = tempids.ToArray(); } message.Unknown11 = streamReader.ReadInt32(); return(message); }