public static void HandleActionButton(Packet packet) { packet.ReadByte("Button"); var data = packet.ReadInt32(); packet.AddValue("Type", (ActionButtonType)((data & 0xFF000000) >> 24)); packet.AddValue("ID", data & 0x00FFFFFF); }
public static void HandleVoiceRosterUpdate(Packet packet) { packet.ReadGuid("Group GUID"); packet.ReadInt16("Channel ID"); packet.ReadByte("Channel Type"); // 0: channel, 2: party packet.ReadCString("Channel Name"); packet.ReadBytes("Encryption Key", 16); packet.ReadIPAddress("IP"); packet.ReadInt16("Voice Server Port"); var count = packet.ReadByte("Player Count"); packet.ReadGuid("Leader GUID"); var leaderFlags1 = packet.ReadByte(); packet.AddValue("Leader Flags 1", "0x" + leaderFlags1.ToString("X2")); var leaderFlags2 = packet.ReadByte(); packet.AddValue("Leader Flags 2", "0x" + leaderFlags2.ToString("X2")); for (var i = 0; i < count - 1; i++) { packet.ReadGuid("Player GUID"); packet.ReadByte("Index"); var flags1 = packet.ReadByte(); packet.AddValue("Flags 1", "0x" + flags1.ToString("X2")); var flags2 = packet.ReadByte(); packet.AddValue("Flags 2", "0x" + flags2.ToString("X2")); } }
public static void HandlePetMode(Packet packet) { packet.ReadPackedGuid128("PetGUID"); var petModeFlag = packet.ReadUInt32(); packet.AddValue("React state", (ReactState)((petModeFlag >> 8) & 0xFF)); packet.AddValue("Command state", (CommandState)((petModeFlag >> 16) & 0xFF)); packet.AddValue("Flag", (petModeFlag & 0xFFFF0000), (PetModeFlags)(petModeFlag & 0xFFFF0000)); }
public static void HandleSetActionButton(Packet packet) { uint action = packet.ReadUInt32(); uint type = packet.ReadUInt32(); packet.AddValue("Action ", action); packet.AddValue("Type ", type); packet.ReadByte("Slot Id"); }
public static void HandleCombatLogMultiple(Packet packet) { var count = packet.ReadInt32("Count"); var unk1 = packet.ReadInt32(); for (var i = 0; i < count; i++) { var unk2 = packet.ReadInt32(); packet.AddValue("Unknown", unk1 - unk2, i); var opcode = Opcodes.GetOpcode(packet.ReadInt32(), Direction.ServerToClient); packet.AddValue("Opcode", opcode); switch (opcode) { case Opcode.SMSG_SPELL_HEAL_LOG: { ReadSpellHealLog(packet, i); break; } case Opcode.SMSG_SPELL_ENERGIZE_LOG: { ReadSpellEnergizeLog(packet, i); break; } case Opcode.SMSG_PERIODICAURALOG: { ReadPeriodicAuraLog(packet, i); // sub_5EEE10 break; } case Opcode.SMSG_SPELL_EXECUTE_LOG: { ReadSpellLogExecute(packet, i); break; } case Opcode.SMSG_SPELL_NON_MELEE_DAMAGE_LOG: { ReadSpellNonMeleeDamageLog(packet, i); break; } case Opcode.SMSG_SPELL_MISS_LOG: { ReadSpellMissLog(packet, i); break; } case Opcode.SMSG_SPELL_STEAL_LOG: case Opcode.SMSG_SPELL_DISPEL_LOG: case Opcode.SMSG_SPELL_BREAK_LOG: { ReadSpellRemoveLog(packet, i); break; } default: throw new InvalidDataException("Unknown Spell Log Type/Opcode: " + opcode); } } }
public static void ReadPetFlags(Packet packet, params object[] idx) { var petModeFlag = packet.ReadUInt16(); var reactState = packet.ReadByte(); var flag = petModeFlag >> 16; var commandState = (petModeFlag & flag); packet.AddValue("ReactState", (ReactState)reactState, idx); packet.AddValue("CommandState", (CommandState)commandState, idx); packet.AddValue("Flag", flag, idx); }
public static void HandleAccountCriteriaUpdate(Packet packet) { var counter = new byte[8]; var accountId = new byte[8]; counter[4] = packet.ReadBit(); accountId[2] = packet.ReadBit(); counter[2] = packet.ReadBit(); accountId[4] = packet.ReadBit(); counter[0] = packet.ReadBit(); counter[5] = packet.ReadBit(); accountId[3] = packet.ReadBit(); counter[3] = packet.ReadBit(); accountId[6] = packet.ReadBit(); counter[6] = packet.ReadBit(); accountId[1] = packet.ReadBit(); accountId[7] = packet.ReadBit(); counter[1] = packet.ReadBit(); packet.ReadBits("Flags", 4); // some flag... & 1 -> delete accountId[5] = packet.ReadBit(); counter[7] = packet.ReadBit(); accountId[0] = packet.ReadBit(); packet.ReadXORByte(accountId, 7); packet.ReadTime("Timer 2"); // 80 packet.ReadInt32("Criteria ID"); // 16 packet.ReadXORByte(counter, 7); packet.ReadTime("Timer 1"); // 76 packet.ReadXORByte(accountId, 4); packet.ReadXORByte(accountId, 3); packet.ReadPackedTime("Time"); packet.ReadXORByte(counter, 0); packet.ReadXORByte(counter, 1); packet.ReadXORByte(counter, 2); packet.ReadXORByte(counter, 3); packet.ReadXORByte(accountId, 1); packet.ReadXORByte(counter, 4); packet.ReadXORByte(counter, 5); packet.ReadXORByte(accountId, 5); packet.ReadXORByte(accountId, 2); packet.ReadXORByte(counter, 6); packet.ReadXORByte(accountId, 0); packet.ReadXORByte(accountId, 6); packet.AddValue("Account", BitConverter.ToUInt64(accountId, 0)); packet.AddValue("Counter", BitConverter.ToInt64(counter, 0)); }
public static void HandleServerUpdateAccountData(Packet packet) { var guid = new byte[8]; packet.ReadBitsE<AccountDataType>("Data Type", 3); packet.StartBitStream(guid, 5, 1, 3, 7, 0, 4, 2, 6); packet.ReadXORBytes(guid, 3, 1, 5); var decompCount = packet.ReadInt32(); var compCount = packet.ReadInt32(); var pkt = packet.Inflate(compCount, decompCount, false); var data = pkt.ReadWoWString(decompCount); pkt.ClosePacket(false); packet.AddValue("Account Data", data); packet.ReadXORBytes(guid, 7, 4, 0, 6, 2); packet.ReadTime("Login Time"); packet.WriteGuid("GUID", guid); }
public static void HandleUpdateWorldState(Packet packet) { packet.ReadBit("bit18"); var val = packet.ReadInt32(); var field = packet.ReadInt32(); packet.AddValue("Field", field + " - Value: " + val); }
public static void HandleCorpseQueryResponse(Packet packet) { var pos = new Vector3(); var guid = new byte[8]; guid[4] = packet.ReadBit(); guid[2] = packet.ReadBit(); guid[5] = packet.ReadBit(); guid[3] = packet.ReadBit(); guid[1] = packet.ReadBit(); guid[6] = packet.ReadBit(); guid[0] = packet.ReadBit(); packet.ReadBit("Corpse Found"); guid[7] = packet.ReadBit(); packet.ReadXORByte(guid, 3); packet.ReadXORByte(guid, 1); packet.ReadXORByte(guid, 2); packet.ReadInt32<MapId>("Map ID"); pos.X = packet.ReadSingle(); packet.ReadXORByte(guid, 6); packet.ReadXORByte(guid, 4); packet.ReadXORByte(guid, 5); packet.ReadInt32<MapId>("Corpse Map ID"); packet.ReadXORByte(guid, 7); pos.Z = packet.ReadSingle(); packet.ReadXORByte(guid, 0); pos.Y = packet.ReadSingle(); packet.AddValue("Position", pos); packet.WriteGuid("Corpse Low GUID", guid); }
public static void HandleDBReply(Packet packet) { var type = packet.ReadUInt32E<DB2Hash>("TableHash"); var entry = packet.ReadInt32("RecordID"); var timeStamp = packet.ReadUInt32(); packet.AddValue("Timestamp", Utilities.GetDateTimeFromUnixTime(timeStamp)); var allow = packet.ReadBit("Allow"); var size = packet.ReadInt32("Size"); var data = packet.ReadBytes(size); var db2File = new Packet(data, packet.Opcode, packet.Time, packet.Direction, packet.Number, packet.Writer, packet.FileName); if (entry < 0 || !allow) { packet.WriteLine("Row {0} has been removed.", -entry); HotfixStoreMgr.RemoveRecord(type, entry); Storage.AddHotfixData(entry, type, true, timeStamp); } else { packet.AddSniffData(StoreNameType.None, entry, type.ToString()); HotfixStoreMgr.AddRecord(type, entry, db2File); Storage.AddHotfixData(entry, type, false, timeStamp); db2File.ClosePacket(false); } }
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 HandleHotfixNotify(Packet packet) { var tableHash = packet.ReadUInt32E<DB2Hash>("TableHash"); var recordID = packet.ReadInt32("RecordID"); var timeStamp = packet.ReadUInt32(); packet.AddValue("Timestamp", Utilities.GetDateTimeFromUnixTime(timeStamp)); Storage.AddHotfixData(recordID, tableHash, false, timeStamp); }
public static void HandlePetAction(Packet packet) { packet.ReadPackedGuid128("PetGUID"); var action = (uint)packet.ReadUInt16() + (packet.ReadByte() << 16); packet.AddValue("Action", action); packet.ReadByte("Slot"); packet.ReadPackedGuid128("TargetGUID"); packet.ReadVector3("ActionPosition"); }
public static void HandleDeathReleaseLoc(Packet packet) { var pos = new Vector3(); pos.Y = packet.ReadSingle(); pos.Z = packet.ReadSingle(); pos.X = packet.ReadSingle(); packet.ReadInt32<MapId>("Map Id"); packet.AddValue("Position", pos); }
public static void HandleDeathReleaseLoc(Packet packet) { var pos = new Vector3(); pos.Y = packet.ReadSingle(); pos.Z = packet.ReadSingle(); pos.X = packet.ReadSingle(); packet.ReadEntry<Int32>(StoreNameType.Map, "Map Id"); packet.AddValue("Position", pos); }
public static void HandlePetAction(Packet packet) { packet.ReadGuid("GUID"); var action = (uint)packet.ReadUInt16() + (packet.ReadByte() << 16); packet.AddValue("Action", action); packet.ReadByteE<ActionButtonType>("Type"); packet.ReadGuid("GUID"); if (ClientVersion.AddedInVersion(ClientVersionBuild.V4_0_6_13596)) packet.ReadVector3("Position"); }
public static void HandleBindPointUpdate(Packet packet) { var pos = new Vector3(); pos.Y = packet.ReadSingle(); pos.X = packet.ReadSingle(); pos.Z = packet.ReadSingle(); packet.ReadEntry<Int32>(StoreNameType.Area, "Area Id"); CoreParsers.MovementHandler.CurrentMapId = (uint)packet.ReadEntry<Int32>(StoreNameType.Map, "Map"); packet.AddValue("Position", pos); }
public static void HandleLoginVerifyWorld(Packet packet) { var pos = new Vector4(); pos.Z = packet.ReadSingle(); packet.ReadInt32<MapId>("Map"); pos.Y = packet.ReadSingle(); pos.X = packet.ReadSingle(); pos.O = packet.ReadSingle(); packet.AddValue("Position", pos); }
public static void HandleLoginVerifyWorld(Packet packet) { var pos = new Vector4(); pos.Z = packet.ReadSingle(); packet.ReadEntry<Int32>(StoreNameType.Map, "Map"); pos.Y = packet.ReadSingle(); pos.X = packet.ReadSingle(); pos.O = packet.ReadSingle(); packet.AddValue("Position", pos); }
public static void HandleClientUpdateAccountData(Packet packet) { var decompCount = packet.ReadInt32(); packet.ReadTime("Login Time"); var compCount = packet.ReadInt32(); var pkt = packet.Inflate(compCount, decompCount, false); var data = pkt.ReadWoWString(decompCount); pkt.ClosePacket(); packet.ReadBitsE<AccountDataType>("Data Type", 3); packet.AddValue("Account Data", data); }
public static void HandleLoginVerifyWorld(Packet packet) { var pos = new Vector4(); pos.X = packet.ReadSingle(); pos.O = packet.ReadSingle(); pos.Y = packet.ReadSingle(); CoreParsers.MovementHandler.CurrentMapId = (uint)packet.ReadInt32<MapId>("Map"); pos.Z = packet.ReadSingle(); packet.AddValue("Position", pos); packet.AddSniffData(StoreNameType.Map, (int)CoreParsers.MovementHandler.CurrentMapId, "NEW_WORLD"); }
public static void HandleHotfixNotifyBlob(Packet packet) { var count = packet.ReadUInt32("HotfixCount"); for (var i = 0; i < count; ++i) { var tableHash = packet.ReadUInt32E<DB2Hash>("TableHash", i); var recordID = packet.ReadInt32("RecordID", i); var timeStamp = packet.ReadUInt32(); packet.AddValue("Timestamp", Utilities.GetDateTimeFromUnixTime(timeStamp), i); Storage.AddHotfixData(recordID, tableHash, false, timeStamp); } }
public static void HandleActionButtons(Packet packet) { const int buttonCount = 132; for (int i = 0; i < buttonCount; ++i) { PlayerCreateInfoAction action = new PlayerCreateInfoAction { Button = (uint)i }; action.Action = packet.ReadUInt32(); uint type = packet.ReadUInt32(); packet.AddValue("Action " + i, action.Action); packet.AddValue("Type " + i, type); if (type != 0) continue; if (CoreParsers.SessionHandler.LoginGuid != null) { WoWObject character; if (Storage.Objects.TryGetValue(CoreParsers.SessionHandler.LoginGuid, out character)) { Player player = character as Player; if (player != null && player.FirstLogin) { action.Race = player.Race; action.Class = player.Class; Storage.StartActions.Add(action, packet.TimeSpan); } } } } packet.ReadByte("Packet Type"); }
public static void HandlePetNameQuery(Packet packet) { var number = new byte[8]; var guid = new byte[8]; guid[6] = packet.ReadBit(); number[4] = packet.ReadBit(); number[6] = packet.ReadBit(); number[5] = packet.ReadBit(); guid[4] = packet.ReadBit(); number[7] = packet.ReadBit(); guid[5] = packet.ReadBit(); guid[3] = packet.ReadBit(); guid[2] = packet.ReadBit(); guid[7] = packet.ReadBit(); number[1] = packet.ReadBit(); number[0] = packet.ReadBit(); number[2] = packet.ReadBit(); number[3] = packet.ReadBit(); guid[1] = packet.ReadBit(); guid[0] = packet.ReadBit(); packet.ReadXORByte(guid, 7); packet.ReadXORByte(number, 2); packet.ReadXORByte(guid, 4); packet.ReadXORByte(guid, 6); packet.ReadXORByte(guid, 5); packet.ReadXORByte(number, 5); packet.ReadXORByte(guid, 3); packet.ReadXORByte(number, 0); packet.ReadXORByte(number, 6); packet.ReadXORByte(guid, 1); packet.ReadXORByte(number, 4); packet.ReadXORByte(guid, 0); packet.ReadXORByte(number, 7); packet.ReadXORByte(number, 1); packet.ReadXORByte(guid, 2); packet.ReadXORByte(number, 3); packet.WriteGuid("Guid2", number); packet.WriteGuid("Guid3", guid); var GUID = new WowGuid(BitConverter.ToUInt64(guid, 0)); var Number = BitConverter.ToUInt64(number, 0); packet.WriteGuid("Guid", guid); packet.AddValue("Pet Number", Number); // Store temporary name (will be replaced in SMSG_PET_NAME_QUERY_RESPONSE) StoreGetters.AddName(GUID, Number.ToString(CultureInfo.InvariantCulture)); }
public static void HandleUpdateObject(Packet packet) { var count = packet.ReadUInt32("NumObjUpdates"); uint map = packet.ReadUInt16<MapId>("MapID"); packet.ResetBitReader(); var bit552 = packet.ReadBit("HasDestroyObjects"); if (bit552) { packet.ReadInt16("Int0"); var int8 = packet.ReadUInt32("DestroyObjectsCount"); for (var i = 0; i < int8; i++) packet.ReadPackedGuid128("Object GUID", i); } packet.ReadUInt32("Data size"); for (var i = 0; i < count; i++) { var type = packet.ReadByte(); var typeString = ((UpdateTypeCataclysm)type).ToString(); packet.AddValue("UpdateType", typeString, i); switch (typeString) { case "Values": { var guid = packet.ReadPackedGuid128("Object Guid", i); WoWObject obj; var updates = CoreParsers.UpdateHandler.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 "CreateObject1": case "CreateObject2": // Might != CreateObject1 on Cata { var guid = packet.ReadPackedGuid128("Object Guid", i); ReadCreateObjectBlock(packet, guid, map, i); break; } } } }
public static void HandleInitWorldStates(Packet packet) { packet.ReadInt32<MapId>("Map ID"); CoreParsers.WorldStateHandler.CurrentAreaId = packet.ReadInt32<AreaId>("Area Id"); packet.ReadInt32<ZoneId>("Zone Id"); var numFields = packet.ReadBits("Field Count", 21); for (var i = 0; i < numFields; i++) { var val = packet.ReadInt32(); var field = packet.ReadInt32(); packet.AddValue("Field", field + " - Value: " + val, i); } }
public static void HandleBattlePetFinalizeLocation(Packet packet) { var pos = new Vector4(); pos.X = packet.ReadSingle(); pos.Y = packet.ReadSingle(); for (var i = 0; i < 2; i++) { var poz = new Vector3(); poz.Y = packet.ReadSingle(); poz.Z = packet.ReadSingle(); poz.X = packet.ReadSingle(); packet.AddValue("Poz", poz, i); } pos.Z = packet.ReadSingle(); var hasO = !packet.ReadBit("!hasO"); var unk24 = !packet.ReadBit("unk24!=-1"); if (unk24) packet.ReadInt32("unk24"); if (hasO) pos.O = packet.ReadSingle(); packet.AddValue("Position", pos); }
public static void HandleActionButtons(Packet packet) { const int buttonCount = 132; var startAction = new StartAction { Actions = new List<Action>(buttonCount) }; for (var i = 0; i < buttonCount; ++i) { var action = new Action(); //packet.ReadUInt64("Action"); action.Button = (uint)i; action.Id = packet.ReadUInt32(); var type = packet.ReadUInt32(); packet.AddValue("Action " + i, action.Id); packet.AddValue("Type " + i, type); if (type == 0) startAction.Actions.Add(action); } packet.ReadByte("Packet Type"); if (CoreParsers.SessionHandler.LoginGuid != null) { WoWObject character; if (Storage.Objects.TryGetValue(CoreParsers.SessionHandler.LoginGuid, out character)) { var player = character as Player; if (player != null && player.FirstLogin) Storage.StartActions.Add(new Tuple<Race, Class>(player.Race, player.Class), startAction, packet.TimeSpan); } } }
public static void HandleInitWorldStates(Packet packet) { packet.ReadEntry<Int32>(StoreNameType.Map, "Map ID"); CoreParsers.WorldStateHandler.CurrentAreaId = packet.ReadEntry<Int32>(StoreNameType.Area, "Area Id"); packet.ReadEntry<Int32>(StoreNameType.Zone, "Zone Id"); var numFields = packet.ReadBits("Field Count", 21); for (var i = 0; i < numFields; i++) { var val = packet.ReadInt32(); var field = packet.ReadInt32(); packet.AddValue("Field", field + " - Value: " + val, i); } }