-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3_assist.inc
executable file
·236 lines (181 loc) · 6.68 KB
/
p3_assist.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
SUB p3_assist_init {
/call p3RegisterCommand STOP assistStop 50
/call p3RegisterCommand FOLLOW assistFollow 50
/call p3RegisterCommand KILL assistKill 40
/call p3RegisterCommand KILL assistKillNameCheck 1
/call p3RegisterCommand KILL assistKillNoTouchCheck 2
/call p3RegisterCommand KILL assistKillLockCheck 5
/declare assistSpawnID int outer 0
/declare assistSpawnIDZone int outer 0
/declare combatStateCheckTimer timer outer 0
/declare combatStateTimer timer outer 0
/declare combatStateTimerMax int outer 50
/declare combatStateLongTimer timer outer 0
/declare combatStateLongTimerMax int outer 150
/declare assistTime timer outer 0
/declare assistLock bool outer FALSE
/declare assistMustHaveName string outer -
/declare assistMustNotHaveName string outer -
/declare noTouchIDs list outer
/declare autoAssistHoldTimer timer outer 0
/declare autoAssistCheckTimer timer outer 0
/declare autoAssist bool outer TRUE
/declare maxAssistDistance int outer 500
/declare useAutoFire bool outer FALSE
/declare autoAssistPercent int outer 99
/declare useEQCombatIndicator bool outer FALSE
/varset autoAssist ${getBotIniOption[Assist.AutoAssist,${autoAssist}]}
/varset autoAssistPercent ${getBotIniOption[Assist.AutoAssistPercent,${autoAssistPercent}]}
/varset maxAssistDistance ${getBotIniOption[Assist.MaxAssistDistance,${maxAssistDistance}]}
/varset useAutoFire ${getBotIniOption[Assist.UseAutoFire,${useAutoFire}]}
/varset assistMustHaveName ${getBotIniOption[Assist.MustHaveName,${assistMustHaveName}]}
/varset assistMustNotHaveName ${getBotIniOption[Assist.MustNotHaveName,${assistMustNotHaveName}]}
/varset useEQCombatIndicator ${getBotIniOption[Misc.CombatStateUsesGameIndicator,${useEQCombatIndicator}]}
/RETURN
}
SUB assistKillNoTouchCheck(string cmd, string opts) {
/declare checkSpawnID string local
/varset checkSpawnID ${getStackCommandOpt[${opts},SPAWNID]}
/if (${noTouchIDs.Contains[${checkSpawnID}]}) {
/bc Won't attack spawnID ${checkSpawnID}. Marked as no-touch.
/RETURN RESET
}
/RETURN
}
SUB assistKillNameCheck(string cmd, string opts) {
/declare checkSpawnID int local
/if (${assistMustHaveName.NotEqual[FALSE]}) {
/varset checkSpawnID ${getStackCommandOpt[${opts},SPAWNID]}
/if (${Spawn[id ${checkSpawnID}].CleanName.Upper.Find[${assistMustHaveName.Upper}]}==NULL) /RETURN RESET
}
/if (${assistMustNotHaveName.NotEqual[FALSE]}) {
/varset checkSpawnID ${getStackCommandOpt[${opts},SPAWNID]}
/if (${Spawn[id ${checkSpawnID}].CleanName.Upper.Find[${assistMustNotHaveName.Upper}]}!=NULL) /RETURN RESET
}
/RETURN
}
SUB assistAddNoTouchID(string spawnID) {
/if (${noTouchIDs.Contains[${spawnID}]}==TRUE) /return
/invoke ${noTouchIDs.Append[${spawnID}]}
/bc Added ${spawnID} as a no-touch mob.
/RETURN
}
SUB assistKillLockCheck(string cmd, string opts) {
|/if (${assistLock}==TRUE) /RETURN RESET
/RETURN
}
SUB assistKill(string cmd, string opts) {
/declare checkSpawnID ${getStackCommandOpt[${opts},SPAWNID]}
/declare sourceName string local ${getStackCommandOpt[${opts},AUTHOR]}
/if (${Spawn[=${sourceName}].ID}==NULL) /RETURN RESET
/if (${Spawn[id ${checkSpawnID}].ID}==NULL) /RETURN RESET
/if (${Spawn[id ${checkSpawnID}].Distance}>${maxAssistDistance}) /RETURN RESET
/varset assistSpawnID ${checkSpawnID}
/varset assistSpawnIDZone ${Zone.ID}
/varset assistTime 1200s
/declare lock string local
/varset lock ${getStackCommandOpt[${opts},LOCK]}
/if (${lock.NotEqual[-]}) {
/bc locking on ${assistSpawnID}
/varset assistLock TRUE
}
/RETURN
}
SUB assistStop(string cmd, string opts) {
/declare holdTimer string local ${getStackCommandOpt[${opts},ASSISTHOLDTIMER]}
/if (${holdTimer.NotEqual[-]}) {
/varset autoAssistHoldTimer ${holdTimer}
}
| setting this low too fast will trigger buffs in the middle of combat
|/varset combatStateTimer 5
/varset assistSpawnID 0
/varset assistTime 0
/varset assistLock FALSE
/RETURN
}
SUB assistFollow(string cmd, string opts) {
/call assistStop STOP STOP;ASSISTHOLDTIMER=20
/RETURN
}
SUB assistMaintenance() {
/call updateCombatStateTimer
/if (${assistSpawnID}!=0) {
/if (${assistSpawnIDZone}!=${Zone.ID}) {
/invoke ${cq.Append[STOP;AUTHOR=${Me.CleanName};ASSISTHOLDTIMER=50]}
/RETURN
}
/if (${Spawn[id ${assistSpawnID}].ID}==NULL || ${Spawn[id ${assistSpawnID}].Dead}==TRUE) {
/call assistStop
/RETURN
}
/if (${assistMustHaveName.NotEqual[FALSE]}) {
/if (${Spawn[id ${assistSpawnID}].CleanName.Upper.Find[${assistMustHaveName.Upper}]}==NULL) {
/call assistStop
/RETURN
}
}
/if (${assistMustNotHaveName.NotEqual[FALSE]}) {
/if (${Spawn[id ${assistSpawnID}].CleanName.Upper.Find[${assistMustNotHaveName.Upper}]}!=NULL) {
/call assistStop
/RETURN
}
}
}
/call checkAutoAssist
/RETURN
}
SUB checkAutoAssist() {
/if (${autoAssistHoldTimer}>0) /return
/if (${autoAssistCheckTimer}>0) /return
/if (${autoAssist}==FALSE) /return
/if (${assistSpawnID}!=0) /return
/varset autoAssistCheckTimer 5
/declare i int local
/declare netbotName string local
/declare targetID int local 0
/for i 1 to ${NetBots.Counts}
/varset netbotName ${NetBots.Client[${i}]}
/if (${NetBots[${netbotName}].InZone}==FALSE) /continue
/if (${NetBots[${netbotName}].Attacking}==FALSE) /continue
/if (${NetBots[${netbotName}].TargetID}==0) /continue
/if (${Spawn[id ${NetBots[${netbotName}].TargetID}].Dead}==TRUE) /continue
/if (${Spawn[pc ${netbotName}].Distance} > ${maxAssistDistance}) /continue
/if (${Spawn[id ${NetBots[${netbotName}].TargetID}].Type.NotEqual[PC]} && ${NetBots[${netbotName}].TargetHP}<=${autoAssistPercent}) {
/varset targetID ${NetBots[${netbotName}].TargetID}
}
/next i
/if (${targetID}!=0) {
/invoke ${cq.Append[KILL;AUTHOR=${Me.CleanName};SPAWNID=${targetID}]}
}
/RETURN
}
SUB updateCombatStateTimer() {
/declare i int local
/declare botName string local
/if (${combatStateCheckTimer}>0) /return
/varset combatStateCheckTimer 5
/if (${Me.CombatState.Equal[COMBAT]}) {
/varset combatStateTimer ${combatStateTimerMax}
/varset combatStateLongTimer ${combatStateLongTimerMax}
/return
}
/for i 1 to ${NetBots.Counts}
/varset botName ${NetBots.Client[${i}]}
/if (${useEQCombatIndicator}==TRUE) {
/if (${NetBots[${botName}].CombatState}==0) {
/varset combatStateTimer ${combatStateTimerMax}
/varset combatStateLongTimer ${combatStateLongTimerMax}
/RETURN
}
} else {
/if (${NetBots[${botName}].Attacking} == TRUE) {
/if (${NetBots[${botName}].Zone} != ${Zone.ID}) /continue
/if (${Spawn[pc ${botName}].Distance} > ${maxAssistDistance}) /continue
/varset combatStateTimer ${combatStateTimerMax}
/varset combatStateLongTimer ${combatStateLongTimerMax}
/return
}
}
/next i
/RETURN
}