public static void HandleNpcTextUpdate(Packet packet) { var entry = packet.ReadEntry("Entry"); if (entry.Value) // Can be masked return; NpcText npcText = new NpcText { ID = (uint)entry.Key }; npcText.Probabilities = new float[8]; npcText.Texts1 = new string[8]; npcText.Texts2 = new string[8]; npcText.Languages = new Language[8]; npcText.EmoteDelays = new uint[8][]; npcText.EmoteIds = new EmoteType[8][]; for (int i = 0; i < 8; i++) { npcText.Probabilities[i] = packet.ReadSingle("Probability", i); npcText.Texts1[i] = packet.ReadCString("Text 1", i); npcText.Texts2[i] = packet.ReadCString("Text 2", i); npcText.Languages[i] = packet.ReadInt32E<Language>("Language", i); npcText.EmoteDelays[i] = new uint[3]; npcText.EmoteIds[i] = new EmoteType[3]; for (int j = 0; j < 3; j++) { npcText.EmoteDelays[i][j] = packet.ReadUInt32("Emote Delay", i, j); npcText.EmoteIds[i][j] = packet.ReadUInt32E<EmoteType>("Emote ID", i, j); } } packet.AddSniffData(StoreNameType.NpcText, entry.Key, "QUERY_RESPONSE"); Storage.NpcTexts.Add(npcText, packet.TimeSpan); }
public static void HandleNpcTextUpdate(Packet packet) { var npcText = new NpcText(); var entry = packet.ReadUInt32("Entry"); npcText.Probabilities = new float[8]; npcText.Texts1 = new string[8]; npcText.Texts2 = new string[8]; npcText.Languages = new Language[8]; npcText.EmoteDelays = new uint[8][]; npcText.EmoteIds = new EmoteType[8][]; for (var i = 0; i < 8; i++) { npcText.Probabilities[i] = packet.ReadSingle("Probability", i); npcText.Texts1[i] = packet.ReadCString("Text 1", i); npcText.Texts2[i] = packet.ReadCString("Text 2", i); npcText.Languages[i] = packet.ReadEnum<Language>("Language", TypeCode.Int32, i); npcText.EmoteDelays[i] = new uint[3]; npcText.EmoteIds[i] = new EmoteType[3]; for (var j = 0; j < 3; j++) { npcText.EmoteDelays[i][j] = packet.ReadUInt32("Emote Delay", i, j); npcText.EmoteIds[i][j] = packet.ReadEnum<EmoteType>("Emote ID", TypeCode.UInt32, i, j); } } Stuffing.NpcTexts.TryAdd(entry, npcText); }
public static void HandleNpcTextUpdate(Packet packet) { var npcText = new NpcText(); var entry = packet.ReadEntry("Entry"); if (entry.Value) // Can be masked return; var size = packet.ReadInt32("Size"); var data = packet.ReadBytes(size); var hasData = packet.ReadBit(); if (!hasData) return; // nothing to do var pkt = new Packet(data, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName); npcText.Probabilities = new float[8]; for (var i = 0; i < 8; ++i) npcText.Probabilities[i] = pkt.ReadSingle("Probability", i); for (var i = 0; i < 8; ++i) pkt.ReadInt32("Broadcast Text Id", i); }
public static void HandleNpcTextUpdate(Packet packet) { var npcText = new NpcText(); var hasData = packet.ReadBit("hasData"); var entry = packet.ReadEntry("TextID"); if (entry.Value) // Can be masked return; if (!hasData) return; // nothing to do var size = packet.ReadInt32("Size"); npcText.Probabilities = new float[8]; for (var i = 0; i < 8; ++i) npcText.Probabilities[i] = packet.ReadSingle("Probability", i); for (var i = 0; i < 8; ++i) packet.ReadInt32("Unknown Id", i); }
public static void HandleNpcTextUpdate(Packet packet) { var npcText = new NpcText(); var entry = packet.ReadEntry("Entry"); if (entry.Value) // Can be masked return; npcText.Probabilities = new float[8]; npcText.Texts1 = new string[8]; npcText.Texts2 = new string[8]; npcText.Languages = new Language[8]; npcText.EmoteDelays = new uint[8][]; npcText.EmoteIds = new EmoteType[8][]; for (var i = 0; i < 8; i++) { npcText.Probabilities[i] = packet.ReadSingle("Probability", i); npcText.Texts1[i] = packet.ReadCString("Text 1", i); npcText.Texts2[i] = packet.ReadCString("Text 2", i); npcText.Languages[i] = packet.ReadEnum<Language>("Language", TypeCode.Int32, i); npcText.EmoteDelays[i] = new uint[3]; npcText.EmoteIds[i] = new EmoteType[3]; for (var j = 0; j < 3; j++) { npcText.EmoteDelays[i][j] = packet.ReadUInt32("Emote Delay", i, j); npcText.EmoteIds[i][j] = packet.ReadEnum<EmoteType>("Emote ID", TypeCode.UInt32, i, j); } } packet.AddSniffData(StoreNameType.NpcText, entry.Key, "QUERY_RESPONSE"); packet.SniffFileInfo.Storage.NpcTexts.TryAdd((uint)entry.Key, npcText); }