forked from dotabuff/manta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
field_patch.go
85 lines (78 loc) · 1.61 KB
/
field_patch.go
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package manta
import (
"github.com/golang/protobuf/proto"
)
type fieldPatch struct {
minBuild uint32
maxBuild uint32
patch func(f *field)
}
var fieldPatches = []fieldPatch{
fieldPatch{0, 990, func(f *field) {
switch f.varName {
case
"angExtraLocalAngles",
"angLocalAngles",
"m_angInitialAngles",
"m_angRotation",
"m_ragAngles",
"m_vLightDirection":
if f.parentName == "CBodyComponentBaseAnimatingOverlay" {
f.encoder = "qangle_pitch_yaw"
} else {
f.encoder = "QAngle"
}
case
"dirPrimary",
"localSound",
"m_flElasticity",
"m_location",
"m_poolOrigin",
"m_ragPos",
"m_vecEndPos",
"m_vecLadderDir",
"m_vecPlayerMountPositionBottom",
"m_vecPlayerMountPositionTop",
"m_viewtarget",
"m_WorldMaxs",
"m_WorldMins",
"origin",
"vecLocalOrigin":
f.encoder = "coord"
case "m_vecLadderNormal":
f.encoder = "normal"
}
}},
fieldPatch{0, 954, func(f *field) {
switch f.varName {
case "m_flMana", "m_flMaxMana":
f.lowValue = nil
f.highValue = proto.Float32(8192.0)
}
}},
fieldPatch{1016, 1027, func(f *field) {
switch f.varName {
case
"m_bItemWhiteList",
"m_bWorldTreeState",
"m_iPlayerIDsInControl",
"m_iPlayerSteamID",
"m_ulTeamBannerLogo",
"m_ulTeamBaseLogo",
"m_ulTeamLogo":
f.encoder = "fixed64"
}
}},
fieldPatch{0, 0, func(f *field) {
switch f.varName {
case "m_flSimulationTime", "m_flAnimTime":
f.encoder = "simtime"
}
}},
}
func (p *fieldPatch) shouldApply(build uint32) bool {
if p.minBuild == 0 && p.maxBuild == 0 {
return true
}
return build >= p.minBuild && build <= p.maxBuild
}