-
Notifications
You must be signed in to change notification settings - Fork 1
/
post_parsing.lua
71 lines (69 loc) · 1.98 KB
/
post_parsing.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
-- post parsing
local post_netmsg_system = {
[Const.NETMSG_INPUT] = function(tree, data)
local size_field = tree[#tree]
assert(size_field.name == 'Size')
local size = size_field.value / 4
local msg_pos = size_field.start + size_field.size
for i=1,size do
local value, length = unpack_int(data, msg_pos+1)
table.insert(tree, {name = string.format('m_aData[%d]', i-1), start = msg_pos, size = length, value = value})
msg_pos = msg_pos + length
end
local value, length = unpack_int(data, msg_pos+1)
table.insert(tree, {name = 'PingCorrection', start = msg_pos, size = length, value = value})
end,
}
local post_netmsg_type = {
[Const.NETMSGTYPE_SV_VOTEOPTIONLISTADD] = function(tree, data)
local num_options = tree[1].value
local msg_pos = tree[1].start + tree[1].size
for i=1,num_options do
local value, next_pos = Struct.unpack("s", data, msg_pos+1)
table.insert(tree, { name = string.format("Option[%d]", i-1), start = msg_pos, size = next_pos - msg_pos - 1, value = value })
msg_pos = next_pos-1
end
end,
[Const.NETMSGTYPE_SV_TUNEPARAMS] = function(tree, data)
local msg_pos = tree.start
for _,k in ipairs{
'GroundControlSpeed',
'GroundControlAccel',
'GroundFriction',
'GroundJumpImpulse',
'AirJumpImpulse',
'AirControlSpeed',
'AirControlAccel',
'AirFriction',
'HookLength',
'HookFireSpeed',
'HookDragAccel',
'HookDragSpeed',
'Gravity',
'VelrampStart',
'VelrampRange',
'VelrampCurvature',
'GunCurvature',
'GunSpeed',
'GunLifetime',
'ShotgunCurvature',
'ShotgunSpeed',
'ShotgunSpeeddiff',
'ShotgunLifetime',
'GrenadeCurvature',
'GrenadeSpeed',
'GrenadeLifetime',
'LaserReach',
'LaserBounceDelay',
'LaserBounceNum',
'LaserBounceCost',
'PlayerCollision',
'PlayerHooking',
} do
local value, length = unpack_int(data, msg_pos+1)
table.insert(tree, {name = k, start = msg_pos, size = length, value = value / 100})
msg_pos = msg_pos + length
end
end,
}
-- post parsing end