public static void HandleBotDetected(Packet packet) { packet.ReadBool("Glider 1 Detected"); packet.ReadBool("Glider 2 Detected"); packet.ReadBool("Inner Space Detected"); packet.ReadBytes(20); // Hash }
public static void HandleInstanceLockWarningQuery(Packet packet) { packet.ReadInt32("Time"); packet.ReadInt32("Encounters Completed Mask"); packet.ReadBool("Extending"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6a_13623)) // guessing packet.ReadBool("Locked warning"); // Displays a window asking if the player choose to join an instance which is saved. }
public static void HandleLfgBootProposalUpdate(Packet packet) { packet.ReadBool("In Progress"); packet.ReadBool("Did Vote"); packet.ReadBool("Vote"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545)) packet.ReadByte("Offline/afk"); packet.ReadGuid("Victim GUID"); packet.ReadInt32("Total Votes"); packet.ReadInt32("Agree Count"); packet.ReadInt32("Time Left"); packet.ReadInt32("Needed Votes"); packet.ReadCString("Comment"); }
public static void HandleGroupAssistantLeader(Packet packet) { var guid = new byte[8]; packet.ReadBool("Promote"); guid[1] = packet.ReadBit(); var bit11 = packet.ReadBit(); guid[0] = packet.ReadBit(); guid[7] = packet.ReadBit(); guid[5] = packet.ReadBit(); guid[3] = packet.ReadBit(); guid[4] = packet.ReadBit(); guid[2] = packet.ReadBit(); guid[6] = packet.ReadBit(); packet.ReadXORByte(guid, 7); packet.ReadXORByte(guid, 4); packet.ReadXORByte(guid, 1); packet.ReadXORByte(guid, 6); packet.ReadXORByte(guid, 0); packet.ReadXORByte(guid, 2); packet.ReadXORByte(guid, 3); packet.ReadXORByte(guid, 5); packet.WriteGuid("Guid", guid); }
public static void HandleDestroyObject(Packet packet) { packet.ReadGuid("GUID"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_2_9056)) packet.ReadBool("Despawn Animation"); }
public static void HandleUpdateObject(Packet packet) { uint map = MovementHandler.CurrentMapId; if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164)) map = packet.ReadUInt16("Map"); var count = packet.ReadUInt32("Count"); if (ClientVersion.RemovedInVersion(ClientVersionBuild.V3_0_2_9056)) packet.ReadBool("Has Transport"); for (var i = 0; i < count; i++) { var type = packet.ReadByte(); var typeString = ClientVersion.AddedInVersion(ClientType.Cataclysm) ? ((UpdateTypeCataclysm)type).ToString() : ((UpdateType)type).ToString(); packet.AddValue("UpdateType", typeString, i); switch (typeString) { case "Values": { var guid = packet.ReadPackedGuid("GUID", i); WoWObject obj; var updates = ReadValuesUpdateBlock(packet, guid.GetObjectType(), i, false); if (Storage.Objects.TryGetValue(guid, out obj)) { if (obj.ChangedUpdateFieldsList == null) obj.ChangedUpdateFieldsList = new List<Dictionary<int, UpdateField>>(); obj.ChangedUpdateFieldsList.Add(updates); } break; } case "Movement": { var guid = ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_2_9901) ? packet.ReadPackedGuid("GUID", i) : packet.ReadGuid("GUID", i); ReadMovementUpdateBlock(packet, guid, i); // Should we update Storage.Object? break; } case "CreateObject1": case "CreateObject2": // Might != CreateObject1 on Cata { var guid = packet.ReadPackedGuid("GUID", i); ReadCreateObjectBlock(packet, guid, map, i); break; } case "FarObjects": case "NearObjects": case "DestroyObjects": { ReadObjectsBlock(packet, i); break; } } } }
public static void HandleServerAddonsList(Packet packet) { // This packet requires _addonCount from CMSG_AUTH_SESSION to be parsed. if (_addonCount == -1) { packet.AddValue("Error", "CMSG_AUTH_SESSION was not received - cannot successfully parse this packet."); packet.ReadToEnd(); return; } for (var i = 0; i < _addonCount; i++) { packet.ReadByte("Addon State", i); var sendCrc = packet.ReadBool("Use CRC", i); if (sendCrc) { var usePublicKey = packet.ReadBool("Use Public Key", i); if (usePublicKey) packet.ReadBytes("Name MD5", 256); packet.ReadInt32("Unk Int32", i); } if (packet.ReadBool("Use URL File", i)) packet.ReadCString("Addon URL File", i); } if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_0_8_9464)) { var bannedCount = packet.ReadInt32("Banned Addons Count"); for (var i = 0; i < bannedCount; i++) { packet.ReadInt32("ID", i); packet.ReadBytes("Name MD5", 16); packet.ReadBytes("Version MD5", 16); packet.ReadTime("Time", i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_3a_11723)) packet.ReadInt32("Is banned", i); } } }
public static void HandleChannelJoin(Packet packet) { packet.ReadInt32("Channel Id"); packet.ReadBool("Has Voice"); packet.ReadBool("Joined by zone update"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164)) { packet.ReadCString("Channel Pass"); packet.ReadCString("Channel Name"); } else { packet.ReadCString("Channel Name"); packet.ReadCString("Channel Pass"); } }
public static void HandleNpcGossip(Packet packet) { GossipMenu gossip = new GossipMenu(); WowGuid guid = packet.ReadGuid("GUID"); gossip.ObjectType = guid.GetObjectType(); gossip.ObjectEntry = guid.GetEntry(); uint menuId = packet.ReadUInt32("Menu Id"); gossip.Entry = menuId; if (ClientVersion.AddedInVersion(ClientType.MistsOfPandaria)) packet.ReadUInt32("Friendship Faction"); gossip.TextID = packet.ReadUInt32("Text Id"); uint count = packet.ReadUInt32("Amount of Options"); for (int i = 0; i < count; i++) { GossipMenuOption gossipOption = new GossipMenuOption { MenuID = menuId, ID = packet.ReadUInt32("Index", i), OptionIcon = packet.ReadByteE<GossipOptionIcon>("Icon", i), BoxCoded = packet.ReadBool("Box", i), BoxMoney = packet.ReadUInt32("Required money", i), OptionText = packet.ReadCString("Text", i), BoxText = packet.ReadCString("Box Text", i) }; Storage.GossipMenuOptions.Add(gossipOption, packet.TimeSpan); } uint questgossips = packet.ReadUInt32("Amount of Quest gossips"); for (int i = 0; i < questgossips; i++) { packet.ReadUInt32<QuestId>("Quest ID", i); packet.ReadUInt32("Icon", i); packet.ReadInt32("Level", i); packet.ReadUInt32E<QuestFlags>("Flags", i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309)) packet.ReadUInt32E<QuestFlags2>("Flags 2", i); packet.ReadBool("Change Icon", i); packet.ReadCString("Title", i); } if (guid.GetObjectType() == ObjectType.Unit) if (Storage.Objects.ContainsKey(guid)) ((Unit)Storage.Objects[guid].Item1).GossipId = menuId; Storage.Gossips.Add(gossip, packet.TimeSpan); packet.AddSniffData(StoreNameType.Gossip, (int)menuId, guid.GetEntry().ToString(CultureInfo.InvariantCulture)); }
public static void HandleGetGMTicket(Packet packet) { var ticketStatus = packet.ReadInt32E<GMTicketStatus>("TicketStatus"); if (ticketStatus != GMTicketStatus.GMTICKET_STATUS_HASTEXT) return; packet.ReadInt32("TicketID"); packet.ReadCString("Description"); packet.ReadByte("Category"); packet.ReadSingle("Ticket Age"); packet.ReadSingle("Oldest Ticket Time"); packet.ReadSingle("Update Time"); packet.ReadBool("Assigned to GM"); packet.ReadBool("Opened by GM"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_3_4_15595)) { packet.ReadCString("Average wait time Text"); packet.ReadUInt32("Average wait time"); } }
public static void HandleAuctionHello(Packet packet) { packet.ReadGuid("GUID"); if (packet.Direction == Direction.ClientToServer) return; packet.ReadUInt32("AuctionHouse ID"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_3_0_10958)) packet.ReadBool("Enabled"); }
public static void HandleComplain(Packet packet) { bool fromChat = packet.ReadBool("From Chat"); // false = from mail packet.ReadGuid("Guid"); packet.ReadInt32E<Language>("Language"); packet.ReadInt32E<ChatMessageType>("Type"); packet.ReadInt32("Channel ID"); if (fromChat) { packet.ReadTime("Time ago"); packet.ReadCString("Complain"); } }
public static void HandleSetFactionStanding(Packet packet) { if (ClientVersion.AddedInVersion(ClientVersionBuild.V2_4_0_8089)) packet.ReadSingle("Reputation loss"); if (ClientVersion.AddedInVersion(ClientType.WrathOfTheLichKing)) packet.ReadBool("Play Visual"); var count = packet.ReadInt32("Count"); for (var i = 0; i < count; i++) { packet.ReadInt32("Faction List Id"); packet.ReadInt32("Standing"); } }
public static void HandleCorpseQuery(Packet packet) { if (packet.Direction == Direction.ClientToServer) return; if (!packet.ReadBool("Corpse Found")) return; packet.ReadInt32<MapId>("Map ID"); packet.ReadVector3("Corpse Position"); packet.ReadInt32<MapId>("Corpse Map ID"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_2_2_10482)) packet.ReadInt32("Corpse Low GUID"); }
public static void HandleLfgCompletionReward434(Packet packet) { packet.ReadLfgEntry("Random LFG Entry"); packet.ReadLfgEntry("Actual LFG Entry"); packet.ReadUInt32("Base Money"); packet.ReadUInt32("Base XP"); var numFields = packet.ReadByte("Reward Item Count"); for (var i = 0; i < numFields; i++) { packet.ReadInt32<ItemId>("Reward Item Or Currency Id", i); packet.ReadInt32("Reward Item Display ID", i); packet.ReadInt32("Reward Item Stack Count", i); packet.ReadBool("Is Currency", i); } }
public static void HandleGuildBankList(Packet packet) { packet.ReadUInt64("Money"); var tabId = packet.ReadByte("Tab Id"); packet.ReadInt32("Remaining Withdraw"); if (packet.ReadBool("Full Slot List") && tabId == 0) { var size = packet.ReadByte("Number of Tabs"); for (var i = 0; i < size; i++) { packet.ReadCString("Tab Name", i); packet.ReadCString("Tab Icon", i); } } var slots = packet.ReadByte("Number of Slots"); for (var i = 0; i < slots; i++) { packet.ReadByte("Slot Id", i); var entry = packet.ReadInt32<ItemId>("Item Entry", i); if (entry > 0) { packet.ReadUInt32E<UnknownFlags>("Unk mask", i); var ramdonEnchant = packet.ReadInt32("Random Item Property Id", i); if (ramdonEnchant != 0) packet.ReadUInt32("Item Suffix Factor", i); packet.ReadUInt32("Stack Count", i); packet.ReadUInt32("Unk Uint32 2", i); // Only seen 0 packet.ReadByte("Spell Charges", i); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6a_13623)) { packet.ReadInt32("Unk 1 Int32", i); packet.ReadInt32("Unk 2 Int32", i); } var enchantment = packet.ReadByte("Number of Enchantments", i); for (var j = 0; j < enchantment; j++) { packet.ReadByte("Enchantment Slot Id", i, j); packet.ReadUInt32("Enchantment Id", i, j); } } } }
public static void HandleNameQueryResponse(Packet packet) { WowGuid guid; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { guid = packet.ReadPackedGuid("GUID"); var end = packet.ReadByte("Result"); /* if (end == 1) DenyItem(&WDB_CACHE_NAME, v11, v12); if (end == 2) RetryItem(&WDB_CACHE_NAME, v11, v12); if (end == 3) { AddItem(&WDB_CACHE_NAME, (int)&v8, v11, v12); SetTemporary(&WDB_CACHE_NAME, v11, v12); } */ if (end != 0) return; } else guid = packet.ReadGuid("GUID"); var name = packet.ReadCString("Name"); StoreGetters.AddName(guid, name); packet.ReadCString("Realm Name"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { packet.ReadByteE<Race>("Race"); packet.ReadByteE<Gender>("Gender"); packet.ReadByteE<Class>("Class"); } else { packet.ReadInt32E<Race>("Race"); packet.ReadInt32E<Gender>("Gender"); packet.ReadInt32E<Class>("Class"); } if (!packet.ReadBool("Name Declined")) return; for (var i = 0; i < 5; i++) packet.ReadCString("Declined Name", i); var objectName = new ObjectName { ObjectType = ObjectType.Player, ID = (int)guid.GetLow(), Name = name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void HandlerLFGuildBrowseUpdated434(Packet packet) { var count = packet.ReadBits("Count", 19); var guids = new byte[count][]; var strlen = new uint[count][]; for (int i = 0; i < count; ++i) { guids[i] = new byte[8]; strlen[i] = new uint[2]; guids[i][7] = packet.ReadBit(); guids[i][5] = packet.ReadBit(); strlen[i][1] = packet.ReadBits(8); guids[i][0] = packet.ReadBit(); strlen[i][0] = packet.ReadBits(11); guids[i][4] = packet.ReadBit(); guids[i][1] = packet.ReadBit(); guids[i][2] = packet.ReadBit(); guids[i][6] = packet.ReadBit(); guids[i][3] = packet.ReadBit(); } for (int i = 0; i < count; ++i) { packet.ReadInt32("Tabard Emblem Color", i); packet.ReadInt32("Tabard Border Style", i); // Guessed from sniffs packet.ReadInt32("Tabard Icon", i); packet.ReadWoWString("Comment", strlen[i][0], i); packet.ReadBool("Cached", i); packet.ReadXORByte(guids[i], 5); packet.ReadUInt32E<GuildFinderOptionsInterest>("Guild Interests", i); packet.ReadXORByte(guids[i], 6); packet.ReadXORByte(guids[i], 4); packet.ReadInt32("Level", i); packet.ReadWoWString("Name", strlen[i][1], i); packet.ReadInt32("Achievement Points", i); packet.ReadXORByte(guids[i], 7); packet.ReadBool("Request Pending", i); packet.ReadXORByte(guids[i], 2); packet.ReadXORByte(guids[i], 0); packet.ReadUInt32E<GuildFinderOptionsAvailability>("Availability", i); packet.ReadXORByte(guids[i], 1); packet.ReadInt32("Tabard Background Color", i); packet.ReadInt32("Unk Int 2", i); // + 128 (Always 0 or 1) packet.ReadInt32("Tabard Border Color", i); packet.ReadUInt32E<GuildFinderOptionsRoles>("Class Roles", i); packet.ReadXORByte(guids[i], 3); packet.ReadInt32("Number of Members", i); packet.WriteGuid("Guild Guid", guids[i], i); } }
public static void HandleMonsterMove(Packet packet) { WowGuid guid = packet.ReadPackedGuid("GUID"); if (Storage.Objects != null && Storage.Objects.ContainsKey(guid)) { WoWObject obj = Storage.Objects[guid].Item1; UpdateField uf; if (obj.UpdateFields != null && obj.UpdateFields.TryGetValue(UpdateFields.GetUpdateField(UnitField.UNIT_FIELD_FLAGS), out uf)) if ((uf.UInt32Value & (uint)UnitFlags.IsInCombat) == 0) // movement could be because of aggro so ignore that obj.Movement.HasWpsOrRandMov = true; } if (packet.Opcode == Opcodes.GetOpcode(Opcode.SMSG_MONSTER_MOVE_TRANSPORT, Direction.ServerToClient)) { WowGuid transportGuid = packet.ReadPackedGuid("Transport GUID"); int seat = -1; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly seat = packet.ReadByte("Transport Seat"); if (transportGuid.HasEntry() && transportGuid.GetHighType() == HighGuidType.Vehicle && guid.HasEntry() && guid.GetHighType() == HighGuidType.Creature) { VehicleTemplateAccessory vehicleAccessory = new VehicleTemplateAccessory { Entry = transportGuid.GetEntry(), AccessoryEntry = guid.GetEntry(), SeatId = seat }; Storage.VehicleTemplateAccessorys.Add(vehicleAccessory, packet.TimeSpan); } } if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) // no idea when this was added exactly packet.ReadBool("Toggle AnimTierInTrans"); var pos = packet.ReadVector3("Position"); packet.ReadInt32("Move Ticks"); var type = packet.ReadByteE<SplineType>("Spline Type"); switch (type) { case SplineType.FacingSpot: { packet.ReadVector3("Facing Spot"); break; } case SplineType.FacingTarget: { packet.ReadGuid("Facing GUID"); break; } case SplineType.FacingAngle: { packet.ReadSingle("Facing Angle"); break; } case SplineType.Stop: return; } if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309)) { // Not the best way ReadSplineMovement510(packet, pos); return; } if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545)) { // Not the best way ReadSplineMovement422(packet, pos); return; } var flags = packet.ReadInt32E<SplineFlag>("Spline Flags"); if (flags.HasAnyFlag(SplineFlag.AnimationTier)) { packet.ReadByteE<MovementAnimationState>("Animation State"); packet.ReadInt32("Async-time in ms"); } packet.ReadInt32("Move Time"); if (flags.HasAnyFlag(SplineFlag.Trajectory)) { packet.ReadSingle("Vertical Speed"); packet.ReadInt32("Async-time in ms"); } var waypoints = packet.ReadInt32("Waypoints"); if (flags.HasAnyFlag(SplineFlag.Flying | SplineFlag.CatmullRom)) { for (var i = 0; i < waypoints; i++) packet.ReadVector3("Waypoint", i); } else { var newpos = packet.ReadVector3("Waypoint Endpoint"); Vector3 mid = (pos + newpos) * 0.5f; for (var i = 1; i < waypoints; i++) { var vec = packet.ReadPackedVector3(); vec = mid - vec; packet.AddValue("Waypoint", vec, i); } } }
public static void HandleNpcGossip(Packet packet) { var guidBytes = new byte[8]; uint menuId = packet.ReadUInt32("Menu Id"); packet.ReadUInt32("Friendship Faction"); uint textId = packet.ReadUInt32("Text Id"); packet.StartBitStream(guidBytes, 0, 1); uint amountOfOptions = packet.ReadBits("Amount of Options", 20); packet.StartBitStream(guidBytes, 6, 7); var optionTextLen = new uint[amountOfOptions]; var boxTextLen = new uint[amountOfOptions]; for (int i = 0; i < amountOfOptions; ++i) { optionTextLen[i] = packet.ReadBits(12); boxTextLen[i] = packet.ReadBits(12); } packet.StartBitStream(guidBytes, 4, 3, 2); uint questgossips = packet.ReadBits("Amount of Quest gossips", 19); var titleLen = new uint[questgossips]; for (int i = 0; i < questgossips; ++i) { titleLen[i] = packet.ReadBits(9); packet.ReadBit("Change Icon", i); } guidBytes[5] = packet.ReadBit(); packet.ResetBitReader(); for (int i = 0; i < questgossips; i++) { packet.ReadUInt32E<QuestFlags2>("Flags 2", i); packet.ReadUInt32("Icon", i); packet.ReadWoWString("Title", titleLen[i], i); packet.ReadUInt32E<QuestFlags>("Flags", i); packet.ReadInt32("Level", i); packet.ReadUInt32<QuestId>("Quest ID", i); } for (int i = 0; i < amountOfOptions; ++i) { GossipMenuOption gossipOption = new GossipMenuOption { MenuID = menuId, BoxMoney = packet.ReadUInt32("Required money", i), ID = packet.ReadUInt32("Index", i), BoxText = packet.ReadWoWString("Box Text", boxTextLen[i], i), BoxCoded = packet.ReadBool("Box", i), OptionText = packet.ReadWoWString("Text", optionTextLen[i], i), OptionIcon = packet.ReadByteE<GossipOptionIcon>("Icon", i) }; Storage.GossipMenuOptions.Add(gossipOption, packet.TimeSpan); } packet.ParseBitStream(guidBytes, 3, 4, 7, 2, 1, 6, 0, 5); GossipMenu gossip = new GossipMenu { Entry = menuId, TextID = textId }; WowGuid guid = packet.WriteGuid("GUID", guidBytes); gossip.ObjectType = guid.GetObjectType(); gossip.ObjectEntry = guid.GetEntry(); if (guid.GetObjectType() == ObjectType.Unit) if (Storage.Objects.ContainsKey(guid)) ((Unit)Storage.Objects[guid].Item1).GossipId = menuId; Storage.Gossips.Add(gossip, packet.TimeSpan); packet.AddSniffData(StoreNameType.Gossip, (int)menuId, guid.GetEntry().ToString(CultureInfo.InvariantCulture)); }
public static void HandleSpellMove510(Packet packet) { var hasMovement = packet.ReadBool("Has Movement Data"); if (hasMovement) { var guid = new byte[8]; var transportGuid = new byte[8]; var hasTransTime2 = false; var hasTransTime3 = false; var hasFallDirection = false; var pos = new Vector4(); pos.Z = packet.ReadSingle(); pos.X = packet.ReadSingle(); pos.Y = packet.ReadSingle(); guid[7] = packet.ReadBit(); var hasTrans = packet.ReadBit("Has Transport"); var hasFallData = packet.ReadBit("Has Fall Data"); var hasField152 = !packet.ReadBit("Lacks field152"); var hasMovementFlags = !packet.ReadBit(); packet.ReadBit(); guid[0] = packet.ReadBit(); var hasMovementFlags2 = !packet.ReadBit(); var hasO = !packet.ReadBit("Lacks Orientation"); guid[2] = packet.ReadBit(); var hasTime = !packet.ReadBit("Lacks Timestamp"); guid[1] = packet.ReadBit(); packet.ReadBit("Has Spline"); guid[3] = packet.ReadBit(); var unkLoopCounter = packet.ReadBits(24); guid[5] = packet.ReadBit(); guid[6] = packet.ReadBit(); var hasPitch = !packet.ReadBit("Lacks Pitch"); guid[4] = packet.ReadBit(); var hasSplineElev = !packet.ReadBit("Lacks Spline Elevation"); packet.ReadBit(); if (hasTrans) { hasTransTime2 = packet.ReadBit(); transportGuid[2] = packet.ReadBit(); transportGuid[3] = packet.ReadBit(); transportGuid[4] = packet.ReadBit(); transportGuid[0] = packet.ReadBit(); transportGuid[5] = packet.ReadBit(); hasTransTime3 = packet.ReadBit(); transportGuid[6] = packet.ReadBit(); transportGuid[7] = packet.ReadBit(); transportGuid[1] = packet.ReadBit(); } if (hasMovementFlags2) packet.ReadBitsE<MovementFlagExtra>("Extra Movement Flags", 13); if (hasFallData) hasFallDirection = packet.ReadBit("Has Fall Direction"); if (hasMovementFlags) packet.ReadBitsE<MovementFlag>("Movement Flags", 30); packet.ReadXORByte(guid, 1); packet.ReadXORByte(guid, 2); packet.ReadXORByte(guid, 5); for (var i = 0; i < unkLoopCounter; i++) packet.ReadUInt32("Unk UInt32", i); packet.ReadXORByte(guid, 6); packet.ReadXORByte(guid, 7); packet.ReadXORByte(guid, 4); packet.ReadXORByte(guid, 0); packet.ReadXORByte(guid, 3); if (hasTrans) { var tpos = new Vector4(); packet.ReadUInt32("Transport Time"); packet.ReadXORByte(transportGuid, 5); packet.ReadSByte("Transport Seat"); tpos.O = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 7); packet.ReadXORByte(transportGuid, 1); tpos.Z = packet.ReadSingle(); tpos.X = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 6); tpos.Y = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 4); packet.ReadXORByte(transportGuid, 2); if (hasTransTime3) packet.ReadUInt32("Transport Time 3"); if (hasTransTime2) packet.ReadUInt32("Transport Time 2"); packet.ReadXORByte(transportGuid, 0); packet.ReadXORByte(transportGuid, 3); packet.WriteGuid("Transport Guid", transportGuid); packet.AddValue("Transport Position", tpos); } if (hasTime) packet.ReadUInt32("Timestamp"); if (hasO) pos.O = packet.ReadSingle(); if (hasFallData) { packet.ReadUInt32("Fall Time"); if (hasFallDirection) { packet.ReadSingle("Fall Sin"); packet.ReadSingle("Fall Cos"); packet.ReadSingle("Horizontal Speed"); } packet.ReadSingle("Vertical Speed"); } if (hasField152) packet.ReadUInt32("Unk field152"); if (hasPitch) packet.ReadSingle("Pitch"); if (hasSplineElev) packet.ReadSingle("Spline Elevation"); packet.WriteGuid("Guid", guid); packet.AddValue("Position", pos); } }
public static void HandleSpellMove(Packet packet) { if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_1_0_16309)) { HandleSpellMove510(packet); return; } var hasMovement = packet.ReadBool("Has Movement Data"); if (hasMovement) { var guid = new byte[8]; var transportGuid = new byte[8]; var hasTransTime2 = false; var hasTransTime3 = false; var hasFallDirection = false; var pos = new Vector4(); pos.Z = packet.ReadSingle(); pos.Y = packet.ReadSingle(); pos.X = packet.ReadSingle(); var bytes = new byte[8]; var hasFallData = packet.ReadBit("Has fall data"); var hasTime = !packet.ReadBit("Has timestamp"); var hasO = !packet.ReadBit("Has O"); packet.ReadBit("Has Spline"); packet.ReadBit(); guid[6] = bytes[4] = packet.ReadBit(); //6 guid[4] = bytes[5] = packet.ReadBit(); //4 var hasMovementFlags2 = !packet.ReadBit(); var bytes2 = new byte[8]; guid[3] = bytes2[0] = packet.ReadBit(); //3 guid[5] = bytes2[1] = packet.ReadBit(); //5 var hasSplineElev = !packet.ReadBit("Has Spline Elevation"); var hasPitch = !packet.ReadBit("Has Pitch"); guid[7] = bytes2[6] = packet.ReadBit(); //7 var hasTrans = packet.ReadBit("Has transport"); guid[2] = bytes2[5] = packet.ReadBit(); //2 var hasMovementFlags = !packet.ReadBit(); guid[1] = packet.ReadBit(); guid[0] = packet.ReadBit(); if (hasTrans) { transportGuid[6] = packet.ReadBit();//54 transportGuid[2] = packet.ReadBit();//50 transportGuid[5] = packet.ReadBit();//53 hasTransTime2 = packet.ReadBit(); transportGuid[7] = packet.ReadBit();//55 transportGuid[4] = packet.ReadBit();//52 hasTransTime3 = packet.ReadBit(); transportGuid[0] = packet.ReadBit();//48 transportGuid[1] = packet.ReadBit();//49 transportGuid[3] = packet.ReadBit();//51 } if (hasMovementFlags2) packet.ReadBitsE<MovementFlagExtra>("Movement flags extra", 12); if (hasMovementFlags) packet.ReadBitsE<MovementFlag>("Movement flags", 30); if (hasFallData) hasFallDirection = packet.ReadBit("hasFallDirection"); packet.ParseBitStream(guid, 1, 4, 7, 3, 0, 2, 5, 6); if (hasTrans) { var tpos = new Vector4(); packet.ReadSByte("Transport Seat"); tpos.O = packet.ReadSingle(); packet.ReadUInt32("Transport Time"); packet.ReadXORByte(transportGuid, 6); packet.ReadXORByte(transportGuid, 5); if (hasTransTime2) packet.ReadUInt32("Transport Time 2"); tpos.X = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 4); tpos.Z = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 2); packet.ReadXORByte(transportGuid, 0); if (hasTransTime3) packet.ReadUInt32("Transport Time 3"); packet.ReadXORByte(transportGuid, 1); packet.ReadXORByte(transportGuid, 3); tpos.Y = packet.ReadSingle(); packet.ReadXORByte(transportGuid, 7); packet.WriteGuid("Transport Guid", transportGuid); packet.AddValue("Transport Position", tpos); } if (hasO) pos.O = packet.ReadSingle(); if (hasSplineElev) packet.ReadSingle("Spline elevation"); if (hasFallData) { packet.ReadUInt32("Fall time"); if (hasFallDirection) { packet.ReadSingle("Fall Cos"); packet.ReadSingle("Fall Sin"); packet.ReadSingle("Horizontal Speed"); } packet.ReadSingle("Vertical Speed"); } if (hasTime) packet.ReadUInt32("Timestamp"); if (hasPitch) packet.ReadSingle("Pitch"); packet.WriteGuid("Guid", guid); packet.AddValue("Position", pos); } }
public static void HandleCreatureQueryResponse(Packet packet) { var entry = packet.ReadEntry("Entry"); if (entry.Value) return; CreatureTemplate creature = new CreatureTemplate { Entry = (uint)entry.Key }; var name = new string[4]; for (int i = 0; i < name.Length; i++) name[i] = packet.ReadCString("Name", i); creature.Name = name[0]; if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914)) { var femaleName = new string[4]; for (int i = 0; i < femaleName.Length; i++) femaleName[i] = packet.ReadCString("Female Name", i); creature.FemaleName = femaleName[0]; } creature.SubName = packet.ReadCString("Sub Name"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V5_0_5_16048)) packet.ReadCString("Unk String"); creature.IconName = packet.ReadCString("Icon Name"); creature.TypeFlags = packet.ReadUInt32E<CreatureTypeFlag>("Type Flags"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_1_0_13914)) // Might be earlier or later creature.TypeFlags2 = packet.ReadUInt32("Creature Type Flags 2"); // Missing enum creature.Type = packet.ReadInt32E<CreatureType>("Type"); creature.Family = packet.ReadInt32E<CreatureFamily>("Family"); creature.Rank = packet.ReadInt32E<CreatureRank>("Rank"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { creature.KillCredits = new uint?[2]; for (int i = 0; i < 2; ++i) creature.KillCredits[i] = packet.ReadUInt32("Kill Credit", i); } else // Did they stop sending pet spell data after 3.1? { packet.ReadInt32("Unk Int"); creature.PetSpellDataID = packet.ReadUInt32("Pet Spell Data Id"); } creature.ModelIDs = new uint?[4]; for (int i = 0; i < 4; i++) creature.ModelIDs[i] = packet.ReadUInt32("Model ID", i); creature.HealthModifier = packet.ReadSingle("Modifier 1"); creature.ManaModifier = packet.ReadSingle("Modifier 2"); creature.RacialLeader = packet.ReadBool("Racial Leader"); int qItemCount = ClientVersion.AddedInVersion(ClientVersionBuild.V3_2_0_10192) ? 6 : 4; //TODO: Move to creature_questitem //creature.QuestItems = new uint[qItemCount]; if (ClientVersion.AddedInVersion(ClientVersionBuild.V3_1_0_9767)) { for (int i = 0; i < qItemCount; i++) /*creature.QuestItems[i] = (uint)*/packet.ReadInt32<ItemId>("Quest Item", i); creature.MovementID = packet.ReadUInt32("Movement ID"); } if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_1_13164)) creature.ExpUnk = packet.ReadUInt32E<ClientType>("Expansion"); packet.AddSniffData(StoreNameType.Unit, entry.Key, "QUERY_RESPONSE"); Storage.CreatureTemplates.Add(creature, packet.TimeSpan); ObjectName objectName = new ObjectName { ObjectType = ObjectType.Unit, ID = entry.Key, Name = creature.Name }; Storage.ObjectNames.Add(objectName, packet.TimeSpan); }
public static void ReadAttackRoundInfo(Packet packet, params object[] indexes) { var hitInfo = packet.ReadInt32E<SpellHitInfo>("HitInfo"); packet.ReadPackedGuid128("Attacker Guid"); packet.ReadPackedGuid128("Target Guid"); packet.ReadInt32("Damage"); packet.ReadInt32("OverDamage"); var subDmgCount = packet.ReadBool("HasSubDmg"); if (subDmgCount) { packet.ReadInt32("SchoolMask"); packet.ReadSingle("Float Damage"); packet.ReadInt32("Int Damage"); if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_PARTIAL_ABSORB | SpellHitInfo.HITINFO_FULL_ABSORB)) packet.ReadInt32("Damage Absorbed"); if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_PARTIAL_RESIST | SpellHitInfo.HITINFO_FULL_RESIST)) packet.ReadInt32("Damage Resisted"); } packet.ReadByteE<VictimStates>("VictimState"); packet.ReadInt32("Unk Attacker State 0"); packet.ReadInt32<SpellId>("Melee Spell ID"); if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_BLOCK)) packet.ReadInt32("Block Amount"); if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_RAGE_GAIN)) packet.ReadInt32("Rage Gained"); if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_UNK0)) { packet.ReadInt32("Unk Attacker State 3 1"); packet.ReadSingle("Unk Attacker State 3 2"); packet.ReadSingle("Unk Attacker State 3 3"); packet.ReadSingle("Unk Attacker State 3 4"); packet.ReadSingle("Unk Attacker State 3 5"); packet.ReadSingle("Unk Attacker State 3 6"); packet.ReadSingle("Unk Attacker State 3 7"); packet.ReadSingle("Unk Attacker State 3 8"); packet.ReadSingle("Unk Attacker State 3 9"); packet.ReadSingle("Unk Attacker State 3 10"); packet.ReadSingle("Unk Attacker State 3 11"); packet.ReadInt32("Unk Attacker State 3 12"); } if (hitInfo.HasAnyFlag(SpellHitInfo.HITINFO_BLOCK | SpellHitInfo.HITINFO_UNK12)) packet.ReadSingle("Unk Float"); }
public static void HandleSetTaxiBenchmarkMode(Packet packet) { packet.ReadBool("Activate"); }
public static void HandleUnitSpellcastStart(Packet packet) { packet.ReadPackedGuid("Caster GUID"); packet.ReadPackedGuid("Target GUID"); packet.ReadUInt32<SpellId>("Spell Id"); packet.ReadInt32("Time Casted"); packet.ReadInt32("Cast time"); if (packet.ReadBool("Unknown bool")) { packet.ReadUInt32("Unk"); packet.ReadUInt32("Unk"); } }
public static void HandleAuctionListItems(Packet packet) { packet.ReadGuid("Auctioneer GUID"); packet.ReadUInt32("Auction House Id"); packet.ReadCString("Search Pattern"); packet.ReadByte("Min Level"); packet.ReadByte("Max Level"); packet.ReadInt32("Slot ID"); packet.ReadInt32("Category"); packet.ReadInt32("Sub Category"); packet.ReadInt32("Quality"); packet.ReadByte("Usable"); packet.ReadBool("GetAll"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_2_2_14545)) packet.ReadByte("Unk Byte"); var count = packet.ReadByte("Count"); for (var i = 0; i < count; ++i) { packet.ReadByte("Unk Byte 2", i); packet.ReadByte("Unk Byte 3", i); } }
public static void HandleSpellChannelStart(Packet packet) { packet.ReadPackedGuid("GUID"); packet.ReadUInt32<SpellId>("Spell ID"); packet.ReadInt32("Duration"); if (ClientVersion.RemovedInVersion(ClientVersionBuild.V4_0_6a_13623)) return; if (packet.ReadBool("Has castflag Immunity")) { packet.ReadUInt32("CastSchoolImmunities"); packet.ReadUInt32("CastImmunities"); } if (packet.ReadBool("Has castflag HealPrediction")) { packet.ReadPackedGuid("Target GUID"); packet.ReadInt32("Heal Amount"); var type = packet.ReadByte("Type"); if (type == 2) packet.ReadPackedGuid("Unk GUID"); } }
public static void HandleNpcGossip(Packet packet) { var gossip = new Gossip(); var guidBytes = new byte[8]; guidBytes[7] = packet.ReadBit(); guidBytes[6] = packet.ReadBit(); guidBytes[1] = packet.ReadBit(); var questgossips = packet.ReadBits(19); guidBytes[0] = packet.ReadBit(); guidBytes[4] = packet.ReadBit(); guidBytes[5] = packet.ReadBit(); guidBytes[2] = packet.ReadBit(); guidBytes[3] = packet.ReadBit(); var amountOfOptions = packet.ReadBits(20); var boxTextLen = new uint[amountOfOptions]; var optionTextLen = new uint[amountOfOptions]; for (var i = 0; i < amountOfOptions; ++i) { boxTextLen[i] = packet.ReadBits(12); optionTextLen[i] = packet.ReadBits(12); } var titleLen = new uint[questgossips]; for (var i = 0; i < questgossips; ++i) { packet.ReadBit("Change Icon", i); titleLen[i] = packet.ReadBits(9); } for (var i = 0; i < questgossips; ++i) { packet.ReadUInt32E<QuestFlags2>("Flags 2", i); packet.ReadUInt32<QuestId>("Quest ID", i); packet.ReadInt32("Level", i); packet.ReadUInt32("Icon", i); packet.ReadUInt32E<QuestFlags>("Flags", i); packet.ReadWoWString("Title", titleLen[i], i); } packet.ReadXORByte(guidBytes, 6); gossip.GossipOptions = new List<GossipOption>((int)amountOfOptions); for (var i = 0; i < amountOfOptions; ++i) { var gossipOption = new GossipOption { RequiredMoney = packet.ReadUInt32("Required money", i), OptionText = packet.ReadWoWString("Text", optionTextLen[i], i), Index = packet.ReadUInt32("Index", i), OptionIcon = packet.ReadByteE<GossipOptionIcon>("Icon", i), BoxText = packet.ReadWoWString("Box Text", boxTextLen[i], i), Box = packet.ReadBool("Box", i) }; gossip.GossipOptions.Add(gossipOption); } packet.ReadXORByte(guidBytes, 2); var textId = packet.ReadUInt32("Text Id"); packet.ReadXORByte(guidBytes, 1); packet.ReadXORByte(guidBytes, 5); var menuId = packet.ReadUInt32("Menu Id"); packet.ReadUInt32("Friendship Faction"); packet.ReadXORByte(guidBytes, 4); packet.ReadXORByte(guidBytes, 7); packet.ReadXORByte(guidBytes, 3); packet.ReadXORByte(guidBytes, 0); packet.WriteGuid("Guid", guidBytes); var guid = new WowGuid64(BitConverter.ToUInt64(guidBytes, 0)); gossip.ObjectType = guid.GetObjectType(); gossip.ObjectEntry = guid.GetEntry(); if (guid.GetObjectType() == ObjectType.Unit) if (Storage.Objects.ContainsKey(guid)) ((Unit)Storage.Objects[guid].Item1).GossipId = menuId; if (Storage.Gossips.ContainsKey(Tuple.Create(menuId, textId))) { var oldGossipOptions = Storage.Gossips[Tuple.Create(menuId, textId)]; if (oldGossipOptions != null) { foreach (var gossipOptions in gossip.GossipOptions) oldGossipOptions.Item1.GossipOptions.Add(gossipOptions); } } else Storage.Gossips.Add(Tuple.Create(menuId, textId), gossip, packet.TimeSpan); packet.AddSniffData(StoreNameType.Gossip, (int)menuId, guid.GetEntry().ToString(CultureInfo.InvariantCulture)); }
public static void HandleSpellProcResist(Packet packet) { packet.ReadGuid("Caster GUID"); packet.ReadGuid("Target GUID"); packet.ReadUInt32<SpellId>("Spell ID"); packet.ReadBool("Debug Log"); // not found in 3.3.5a sniff nor 3.3.3a //if (ClientVersion.Build == ClientVersionBuild.V3_3_5a_12340) // blizzard retardness, client doesn't even read this //{ // packet.ReadSingle("Unk"); // packet.ReadSingle("Unk"); //} }