public void TestConstructor() { var bit = new Bit(); Assert.IsNotNull(bit); Assert.IsFalse(bit); }
public static void HandlePvPLogData406(Packet packet) { if (packet.Direction == Direction.ClientToServer) return; var arenaScores = packet.ReadBit("Has Arena Scores"); var arenaStrings = packet.ReadBit("Has Arena Strings"); var finished = packet.ReadBit("Is Finished"); if (arenaStrings) for (var i = 0; i < 2; ++i) packet.ReadCString("Name", i); if (arenaScores) { for (var i = 0; i < 2; ++i) { packet.ReadUInt32("Points Lost", i); packet.ReadUInt32("Points Gained", i); packet.ReadUInt32("Matchmaker Rating", i); } } var scoreCount = packet.ReadInt32("Score Count"); if (finished) packet.ReadByte("Team Winner"); var bits = new Bit[scoreCount, 4]; for (var i = 0; i < scoreCount; ++i) { bits[i, 0] = packet.ReadBit("Unk Bit 1", i); // sets *(v23 + v18 + 40) bits[i, 1] = packet.ReadBit("Is Battleground", i); // sets *(v27 + v18 + 48) bits[i, 2] = packet.ReadBit("Unk Bit 3", i); // sets *(v2->dword1C + v18 + 4) bits[i, 3] = packet.ReadBit("Unk Bit 4", i); // sets *(v32 + v18 + 68) } for (var i = 0; i < scoreCount; ++i) { packet.ReadInt32("Damage Done", i); if (bits[i, 0]) packet.ReadInt32("Unk Int32 1", i); var count = packet.ReadInt32("Extra values counter", i); if (bits[i, 1]) { packet.ReadUInt32("Honorable Kills", i); packet.ReadUInt32("Deaths", i); packet.ReadUInt32("Bonus Honor", i); } packet.ReadGuid("Player GUID", i); packet.ReadInt32("Killing Blows"); for (var j = 0; j < count; ++j) packet.ReadInt32("Extra Value", i, j); if (bits[i, 3]) packet.ReadInt32("Unk Int32 2", i); packet.ReadInt32("Healing Done", i); } }
public static void HandleLfgProposalUpdate434(Packet packet) { packet.ReadTime("Date"); packet.ReadInt32("Bosses Killed Mask"); packet.ReadInt32("Unk UInt32 1"); packet.ReadUInt32("Unk UInt32 2"); packet.ReadLfgEntry("LFG Entry"); packet.ReadUInt32("Unk UInt32 3"); packet.ReadByteE<LfgProposalState>("State"); var guid1 = new byte[8]; var guid2 = new byte[8]; guid2[4] = packet.ReadBit(); guid1[3] = packet.ReadBit(); guid1[7] = packet.ReadBit(); guid1[0] = packet.ReadBit(); guid2[1] = packet.ReadBit(); packet.ReadBit("Silent"); guid1[4] = packet.ReadBit(); guid1[5] = packet.ReadBit(); guid2[3] = packet.ReadBit(); var count = packet.ReadBits("Response Count", 23); guid2[7] = packet.ReadBit(); for (var i = 0; i < count; ++i) { var bits = new Bit[5]; for (var j = 0; j < 5; ++j) bits[j] = packet.ReadBit(); packet.AddValue("Bits", string.Format("In Dungeon?: {0}, Same Group?: {1}, Accept: {2}, Answer: {3}, Self: {4}", bits[0], bits[1], bits[2], bits[3], bits[4]), i); // 0 and 1 could be swapped } guid2[5] = packet.ReadBit(); guid1[6] = packet.ReadBit(); guid2[2] = packet.ReadBit(); guid2[6] = packet.ReadBit(); guid1[2] = packet.ReadBit(); guid1[1] = packet.ReadBit(); guid2[0] = packet.ReadBit(); packet.ReadXORByte(guid1, 5); packet.ReadXORByte(guid2, 3); packet.ReadXORByte(guid2, 6); packet.ReadXORByte(guid1, 6); packet.ReadXORByte(guid1, 0); packet.ReadXORByte(guid2, 5); packet.ReadXORByte(guid1, 1); for (var i = 0; i < count; ++i) packet.ReadInt32E<LfgRoleFlag>("Roles", i); packet.ReadXORByte(guid2, 7); packet.ReadXORByte(guid1, 4); packet.ReadXORByte(guid2, 0); packet.ReadXORByte(guid2, 1); packet.ReadXORByte(guid1, 2); packet.ReadXORByte(guid1, 7); packet.ReadXORByte(guid2, 2); packet.ReadXORByte(guid1, 3); packet.ReadXORByte(guid2, 4); }
public static void HandleTransmogrifyItems(Packet packet) { var npcGUID = new byte[8]; npcGUID[3] = packet.ReadBit(); npcGUID[2] = packet.ReadBit(); npcGUID[4] = packet.ReadBit(); npcGUID[5] = packet.ReadBit(); npcGUID[1] = packet.ReadBit(); npcGUID[0] = packet.ReadBit(); var count = packet.ReadBits("Count", 21); npcGUID[7] = packet.ReadBit(); npcGUID[6] = packet.ReadBit(); var itemGUID = new byte[count][]; var unk0 = new Bit[count]; var unk1 = new Bit[count]; for (var i = 0; i < count; ++i) { unk0[i] = packet.ReadBit("unk0", i); unk1[i] = packet.ReadBit("unk1", i); if (unk1[i]) { itemGUID[i] = packet.StartBitStream(5, 6, 4, 0, 7, 3, 1, 2); } if (unk0[i]) { itemGUID[i] = packet.StartBitStream(3, 6, 4, 0, 1, 7, 5, 2); } } for (var i = 0; i < count; ++i) { packet.ReadInt32("NewEntries"); packet.ReadInt32("Slots"); } packet.ParseBitStream(npcGUID, 5, 4, 1, 0, 2, 7, 6, 3); packet.WriteGuid("npcGuid", npcGUID); for (var i = 0; i < count; ++i) { if (unk1[i]) { packet.ParseBitStream(itemGUID[i], 4, 0, 5, 6, 2, 7, 1, 3); } if (unk0[i]) { packet.ParseBitStream(itemGUID[i], 3, 6, 2, 7, 4, 5, 0, 1); } packet.WriteGuid("Guid", itemGUID[i], i); } }
public static void HandleSwapItem(Packet packet) { packet.ReadByte("SrcSlotAlt"); packet.ReadByte("DstSlotAlt"); var count = packet.ReadBits("Item Count", 2); var hasSlot = new Bit[count]; for (var i = 0; i < count; ++i ) { hasSlot[i] = !packet.ReadBit("hasSlot", i); packet.ReadBit("unkb", i); } for (var i = 0; i < count; ++i) { if (hasSlot[i]) packet.ReadByte("Slot", i); packet.ReadByte("Bag", i); } }
public static void HandleLfgProposalUpdate(Packet packet) { //packet.ReadTime("Date"); //packet.ReadInt32("Bosses Killed Mask"); //packet.ReadInt32("Unk UInt32 1"); //packet.ReadUInt32("Unk UInt32 2"); //packet.ReadLfgEntry("LFG Entry"); //packet.ReadUInt32("Unk UInt32 3"); var guid1 = new byte[8]; var guid2 = new byte[8]; guid1[6] = packet.ReadBit(); guid1[0] = packet.ReadBit(); guid2[1] = packet.ReadBit(); guid2[7] = packet.ReadBit(); guid2[5] = packet.ReadBit(); guid1[5] = packet.ReadBit(); guid2[4] = packet.ReadBit(); packet.ReadBit("Silent"); // 64 guid1[2] = packet.ReadBit(); guid2[6] = packet.ReadBit(); guid1[3] = packet.ReadBit(); guid1[7] = packet.ReadBit(); guid2[3] = packet.ReadBit(); uint count = packet.ReadBits("Response Count", 21); for (int i = 0; i < count; ++i) { var bits = new Bit[5]; for (int j = 0; j < 5; ++j) // 6 4 7 8 5 bits[j] = packet.ReadBit(); packet.AddValue("Bits", $"In Dungeon?: {bits[1]}, Same Group?: {bits[4]}, Accept: {bits[0]}, Answer: {bits[2]}, Self: {bits[3]}", i); // 0 and 1 could be swapped } guid2[2] = packet.ReadBit(); guid1[4] = packet.ReadBit(); packet.ReadBit("unk16"); // 16 guid2[0] = packet.ReadBit(); guid1[1] = packet.ReadBit(); packet.ReadXORByte(guid1, 1); packet.ReadXORByte(guid2, 4); packet.ReadXORByte(guid1, 4); packet.ReadXORByte(guid2, 7); packet.ReadXORByte(guid2, 2); packet.ReadXORByte(guid2, 0); packet.ReadInt32("unk32"); // 32 packet.ReadByteE<LfgProposalState>("State"); // 65 packet.ReadInt32("unk48"); // 48 packet.ReadXORByte(guid1, 6); packet.ReadInt32("unk84"); // 84 packet.ReadXORByte(guid2, 5); packet.ReadXORByte(guid2, 3); packet.ReadInt32("unk56"); // 56 packet.ReadXORByte(guid1, 5); packet.ReadXORByte(guid2, 6); for (int i = 0; i < count; ++i) packet.ReadInt32E<LfgRoleFlag>("Roles", i); packet.ReadInt32("unk88"); // 88 packet.ReadXORByte(guid1, 7); packet.ReadXORByte(guid2, 1); packet.ReadXORByte(guid1, 0); packet.ReadXORByte(guid1, 2); packet.ReadInt32("unk52"); // 52 packet.ReadXORByte(guid1, 3); packet.WriteGuid("Guid1", guid1); packet.WriteGuid("Guid2", guid2); }