-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
debug_packet.lua
56 lines (49 loc) · 2.17 KB
/
debug_packet.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
local packets = require('packets');
local tinc = {};
local tout = {};
-- table.insert(tinc, 0x029, function(id, size, packet)
-- string.char(id):hex()
-- print('IN: ' .. packet:hex());
-- end);
-- table.insert(tout, packets.out.PACKET_NPC_INTERACTION, function(id, size, packet)
-- -- https://github.com/Windower/Lua/blob/422880f0e353a82bb9a11328dc4202ed76cd948a/addons/libs/packets/fields.lua#L349
-- local target = struct.unpack('L', packet, 0x04 + 1);
-- local tidx = struct.unpack('H', packet, 0x08 + 1);
-- local cat = struct.unpack('H', packet, 0x0A + 1);
-- local param = struct.unpack('H', packet, 0x0C + 1);
-- local unk = struct.unpack('H', packet, 0x0E + 1);
--
-- print(packet:hex());
-- print('OUT: target: ' .. target .. ' tidx: ' .. tidx .. ' cat: ' .. cat .. ' param: ' .. param .. ' unk: ' .. unk);
-- end);
-- table.insert(tout, packets.out.PACKET_NPC_CHOICE, function(id, size, packet)
-- -- https://github.com/Windower/Lua/blob/422880f0e353a82bb9a11328dc4202ed76cd948a/addons/libs/packets/fields.lua#L661
-- local target = struct.unpack('L', packet, 0x04 + 1);
-- local idx = struct.unpack('H', packet, 0x08 + 1);
-- local unk = struct.unpack('H', packet, 0x0A + 1);
-- local tidx = struct.unpack('H', packet, 0x0C + 1);
-- local auto = struct.unpack('B', packet, 0x0E + 1); -- 0E 1 if the response packet is automatically generated, 0 if it was selected by you
-- local unk2 = struct.unpack('B', packet, 0x0F + 1);
-- local zone = struct.unpack('H', packet, 0x10 + 1);
-- local menuid = struct.unpack('H', packet, 0x12 + 1);
-- print(packet:hex());
-- print('OUT`: target: ' .. target .. ' idx: ' .. idx .. ' unk: ' .. unk .. ' tidx: ' .. tidx .. ' auto: ' .. auto .. ' unk2: ' .. unk2 .. ' zone: ' .. zone .. ' menuid: ' .. menuid);
-- end);
return {
inc = function(self, id, size, packet)
-- if (id ~= 0x0E) then
-- print('IN: ' .. packet:hex());
-- end
if (tinc[id] ~= nil) then
tinc[id](id, size, packet);
end
end,
out = function(self, id, size, packet)
-- if (id ~= 0x15) then
-- print('OUT: ' .. packet:hex());
-- end
if (tout[id] ~= nil) then
tout[id](id, size, packet);
end
end
};