-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3_roam.inc
executable file
·119 lines (94 loc) · 2.68 KB
/
p3_roam.inc
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
SUB p3_roam_init() {
/call p3RegisterCommand ROAMLOCK roamRoam 50
/call p3RegisterCommand ROAMOFF roamRoamOff 50
/call p3RegisterCommand CAMPON roamCampOn 60
/call p3RegisterCommand ZONECHANGE roamZoneChange 60
/declare roamTargetID int outer 0
/declare roamTargetName string outer -
/declare roamMode bool outer FALSE
/declare roamRefreshTimer timer outer 0
/declare roamTargetZoneID int outer 0
/declare roamFlyDown bool outer FALSE
/varset roamFlyDown ${getBotIniOption[Misc.RoamFlyDown,${roamFlyDown}]}
/RETURN
}
SUB roamMaintenance() {
/if (${roamMode}==TRUE) /call checkRoam
/RETURN
}
SUB roamZoneChange(string cmd, string opts) {
/if (${roamMode}==FALSE) /RETURN
|/echo Disabling roam from zone change.
|/call disableRoam
/if (${roamMode}==TRUE) {
/bc Resetting roam target...
/varset roamTargetID ${Spawn[=${roamTargetName}].ID}
/varset roamTargetZoneID ${Zone.ID}
}
/RETURN
}
SUB roamRoamOff(string cmd, string opts) {
/declare sourceName string local ${getStackCommandOpt[${opts},SOURCENAME]}
/if (${Spawn[=${sourceName}].ID}==FALSE) /RETURN
/if (${roamMode}==FALSE) /RETURN
/call disableRoam
/RETURN
}
SUB disableRoam() {
/varset roamTargetZoneID 0
/varset roamMode FALSE
/varset roamTargetName -
/bc Roam off.
/RETURN
}
SUB roamCampOn(string cmd, string opts) {
/if (${roamMode}==FALSE) /RETURN
/call disableRoam
/RETURN
}
SUB roamRoam(string cmd, string opts) {
/declare targetID string local ${getStackCommandOpt[${opts},TARGETID]}
/if (${targetID}==0) {
/varset roamMode FALSE
/bc Roam off.
} else {
/varset roamMode TRUE
/varset roamTargetName ${Spawn[id ${targetID}].CleanName}
/varset roamTargetID ${targetID}
/varset roamTargetZoneID ${Zone.ID}
/bc Roaming with ${Spawn[id ${roamTargetID}].CleanName}
}
/RETURN
}
SUB checkRoam() {
/if (${roamRefreshTimer}==0 && ${Spawn[id ${roamTargetID}].Distance3D}>40) {
/invoke ${cq.Append[ROAMMOVESTART;]}
/if (${assistSpawnID}!=0) {
/call assistStop STOP STOP;ASSISTHOLDTIMER=20
}
/if (${Zone.ID}!=${roamTargetZoneID}) /RETURN
/if (${navPlugin}==TRUE) {
/if (${Navigation.PathExists[id ${roamTargetID}]}==FALSE) {
/bc Can't find path to my roam target. Trying face/walk for 1s.
/face fast id ${roamTargetID}
/keypress FORWARD HOLD
/delay 10
/keypress FORWARD
/return
}
/nav id ${roamTargetID}
/if (${roamFlyDown}==TRUE) {
/keypress CMD_MOVE_DOWN hold
/timed 3 /keypress CMD_MOVE_DOWN
}
/if (${Me.FeetWet}==TRUE) {
/keypress PITCHUP hold
/timed 30 /keypress PITCHUP
}
} else {
/moveto loc ${Spawn[${roamTargetID}].Y} ${Spawn[${roamTargetID}].X} ${Spawn[${roamTargetID}].Z}
}
/varset roamRefreshTimer 30
}
/RETURN
}