-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3_buffs.inc
executable file
·472 lines (372 loc) · 14.9 KB
/
p3_buffs.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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
SUB p3_buffs_init {
/call p3RegisterCommand STOP buffsStop 60
/declare updateNetnoteTimer timer outer 0
/declare buffCheckTimer timer outer 30
/declare buffsEnabled bool outer true
/declare emptySpawn spawn outer
/call processArrayTargets iniBuffs
/declare canDoExtendedStackCheck bool outer TRUE
/if (${Plugin[MQ2Dannet].Name.Length}==NULL) {
/varset canDoExtendedStackCheck FALSE
}
/netnote
/RETURN
}
SUB buffsMaintenance() {
/if (${buffsEnabled}==FALSE) /return
/call updateNetnoteBuffDurations
/if (${holdFunctionsAfterZoning}==TRUE && ${recentlyZoned}==TRUE) /return
/if (${Me.Invis}==TRUE) /return
/if (${Stick.Active}==TRUE && ${combatStateTimer}==0) /return
/if (${Navigation.Active}==TRUE) /return
/if (${Me.Casting.ID} !=0 && ${Twist.Twisting}==FALSE) /return
|/if ((${Me.Moving} || ${movingTimer}>0) && ${canCastWhileMoving}==FALSE) /return
/call checkBuffs
/RETURN
}
SUB buffsStop() {
/varset buffCheckTimer 30
/RETURN
}
SUB updateNetnoteBuffDurations {
/if (${updateNetnoteTimer}>0) /return
/varset updateNetnoteTimer 5
/declare i int local
/declare buffDurations string local
/for i 1 to 30
/if (${Me.Buff[${i}].ID}==NULL) /continue
/varset buffDurations ${buffDurations};${Me.Buff[${i}].Spell.ID}_${Me.Buff[${i}].Duration.TotalSeconds}
/next i
/for i 1 to 30
/if (${Me.Song[${i}].ID}==NULL) /continue
/varset buffDurations ${buffDurations};${Me.Song[${i}].Spell.ID}_${Me.Song[${i}].Duration.TotalSeconds}
/next i
/netnote ${buffDurations}
/RETURN
}
SUB checkBuffs {
/if (${buffCheckTimer}>0) /return
/varset buffCheckTimer 15
/declare i int local
/declare targetNames list local
/declare targetName string local
/declare buffCastName string local
/declare buffSpell spell local
/declare buffSpellID int local
/declare netbotName string local
/declare checkSpellID int local
/declare buffSpawn spawn local
/declare noholdTimerName string local
/declare buffSpellRange int local
/declare cancelCheck string local
/declare note string local
/declare cancelConditions string local
/declare j int local
/declare k int local
/for i 1 to ${iniBuffs.Size}
/invoke ${targetNames.Clear}
/if (${iniBuffs[${i},${bTargets}].Length}==0) /continue
/if (${iniBuffs[${i},1].Equal[-]}) /break
/if (${iniBuffs[${i},${bEnabled}].Equal[NO]}) /continue
/if (${iniBuffs[${i},${bPreCommand}].NotEqual[-]}) {
/echo performingcmd: ${iniBuffs[${i},${bPreCommand}]}
/call p3command "${iniBuffs[${i},${bPreCommand}]}"
/delay 5
}
/if ( (${Me.Moving} || ${movingTimer}>0) && ${iniBuffs[${i},${bCastableMoving}].Equal[-]}) {
/continue
}
/if (${combatStateTimer}>0) {
/if (${iniBuffs[${i},${bCastableDuringAssist}].Equal[-]} && ${iniBuffs[${i},${bCastOnlyDuringAssist}].Equal[-]}) {
/if (${combatStateTimer}>0) /continue
}
}
/if (${iniBuffs[${i},${bGiftOfMana}].NotEqual[-]}) {
/if (${Me.Song[Gift Of Mana].ID}==NULL) /continue
}
/if (${iniBuffs[${i},${bCastableOnlyResting}].NotEqual[-]}) {
/if (${combatStateTimer}>0) /continue
}
/if (${iniBuffs[${i},${bCastOnlyDuringAssist}].NotEqual[-]}) {
/if (${combatStateTimer}==0) /continue
}
/if (${iniBuffs[${i},${bNotIfAssistTag}].NotEqual[-]}) {
/if (${tempCombatTags.Count}>0 || ${assistTags.Count}>0) {
/call validateAssistTags ${iniBuffs[${i},${bNotIfAssistTag}]} TRUE
/if (${Macro.Return}==TRUE) /continue
}
}
/if (${iniBuffs[${i},${bRequireAssistTag}].NotEqual[-]}) {
/if (${tempCombatTags.Count}==0 && ${assistTags.Count}==0) /continue
/call validateAssistTags ${iniBuffs[${i},${bRequireAssistTag}]} TRUE
/if (${Macro.Return}==FALSE) /continue
}
/if (${iniBuffs[${i},${bMyName}].NotEqual[-]}) {
/if (${Me.CleanName.Upper.NotEqual[${iniBuffs[${i},${bMyName}].Upper}]}) /continue
}
/if (${iniBuffs[${i},${bNotIfMounted}].NotEqual[-]}) {
/if (${Me.Mount.ID}!=NULL) /continue
}
/if (${iniBuffs[${i},${bRequireCastIdle}].NotEqual[-]}) {
/if (${idleCastingTimer}>0) /continue
}
/if (${iniBuffs[${i},${bRequireAssistTarget}].NotEqual[-]}) {
/if (${assistSpawnID}==0) /continue
}
/if (${iniBuffs[${i},${bSelfOverHP}].NotEqual[-]}) {
/if (${Me.PctHPs} < ${iniBuffs[${i},${bSelfOverHP}]}) /continue
}
/if (${iniBuffs[${i},${bSelfUnderHP}].NotEqual[-]}) {
/if (${Me.PctHPs} >= ${iniBuffs[${i},${bSelfUnderHP}]}) /continue
}
/if (${iniBuffs[${i},${bSelfOverMana}].NotEqual[-]}) {
/if (${Me.PctMana} < ${iniBuffs[${i},${bSelfOverMana}]}) /continue
}
/if (${iniBuffs[${i},${bSelfUnderMana}].NotEqual[-]}) {
/if (${Me.PctMana} >= ${iniBuffs[${i},${bSelfUnderMana}]}) /continue
}
/if (${iniBuffs[${i},${bSelfUnderEnd}].NotEqual[-]}) {
/if (${Me.PctEndurance} >= ${iniBuffs[${i},${bSelfUnderEnd}]} ) /continue
}
/if (${iniBuffs[${i},${bSelfOverEnd}].NotEqual[-]}) {
/if (${Me.PctEndurance} < ${iniBuffs[${i},${bSelfUnderEnd}]} ) /continue
}
/if (${iniBuffs[${i},${bRequireMobsInProximity}].NotEqual[-]}) {
/if (${SpawnCount[npc loc ${Me.X} ${Me.Y} radius 45]} < ${iniBuffs[${i},${bRequireMobsInProximity}]}) /continue
}
/if (${iniBuffs[${i},${bRequireUW}].NotEqual[-]}) {
/if (${Me.FeetWet}==FALSE) /continue
}
/if (${iniBuffs[${i},${bRequireDiscNotReady}].NotEqual[-]}) {
/if (${Me.CombatAbilityReady[${iniBuffs[${i},${bRequireDiscNotReady}]}]}==TRUE) /continue
}
| OBTAIN BUFF SPELL DETAIL
/varset buffCastName ${iniBuffs[${i},${bName}]}
/call getSpellFromCastRequest "${buffCastName}"
/if (${Macro.Return.Equal[UNKNOWN]}) {
/bc Warning: checkBuffs() getSpellFromCastRequest() returned UNKNOWN for ${iniBuffs[${i},${bName}]}. Not sure what to do. Disabling entry.
/varset iniBuffs[${i},${bEnabled}] NO
/RETURN
} else {
/vardata buffSpell ${Macro.Return}
}
/varset buffSpellID ${buffSpell.ID}
/if (${iniBuffs[${i},${bForceSpellID}].NotEqual[-]}) {
/varset buffSpellID ${iniBuffs[${i},${bForceSpellID}]}
}
/if (${isLockoutExpired[bufflockout_${buffSpellID}]}==FALSE) /CONTINUE
/if (${iniBuffs[${i},${bIgnoreTargetType}].Equal[-]}) {
/if (${buffSpell.TargetType.Equal[Pet]} || ${iniBuffs[${i},${bTargetType}].Upper.Equal[PET]} ) {
/if (${Me.Pet.ID}==NULL) /continue
/if (${Me.PetBuff[${buffSpell.Name}]}!=NULL) /continue
/goto :skipNetBots
} else /if (${buffSpell.TargetType.Equal[Self]}) {
/invoke ${targetNames.Append[${Me.CleanName}]}
} else {
/invoke ${targetNames.Append[${iniBuffs[${i},${bTargets}]}]}
}
} else {
/invoke ${targetNames.Append[${iniBuffs[${i},${bTargets}]}]}
}
/varset buffSpellRange ${buffSpell.Range}
/if (${buffSpell.TargetType.Equal[Group v1]}) /varset buffSpellRange ${buffSpell.AERange}
/if (${buffSpell.TargetType.Equal[Group v2]}) /varset buffSpellRange ${buffSpell.AERange}
/if (${buffSpell.TargetType.Equal[Single]}) /varset buffSpellRange ${buffSpell.MyRange}
/if (${buffSpell.TargetType.Equal[Self]} && ${iniBuffs[${i},${bIgnoreTargetType}].NotEqual[-]}) /varset buffSpellRange 50
| TARGETNAMES ARE ALL POSSIBLE TARGETS REGARDLESS OF WHETHER OR NOT THEY HAVE THE BUFF.
| THIS LOOP REMOVES PEOPLE WHO DONT QUALIFY FOR A CAST, TYPICALLY BECAUSE THEY HAVE THE
| BUFF. BUFF ENTRIES WITH REBUFFSECONDS MAY KEEP PEOPLE IN THE LIST WHO ALREADY HAVE
| THE BUFF IF THE TIME ON THE BUFF IS LOW ENOUGH.
/for j ${Math.Calc[${targetNames.Count}-1]} downto 0
/varset targetName ${targetNames.Item[${j}]}
/if (${targetName.Length}==0) /continue
/if (${Spawn[${targetName}].ID}==NULL) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
/if (${NetBots[${targetName}].State.Equal[DEAD]}) /continue
|/echo ${targetName} ${iniBuffs[1,1]}
| HAVE THE BUFF?
/if (${Select[${buffSpellID},${NetBots[${targetName}].Buff}]}>0 || ${Select[${buffSpellID},${NetBots[${targetName}].ShortBuff}]}>0) {
| REBUFF SECONDS DONT MATER? REMOVE THIS PERSON FROM BUFF CANDIDATES
/if (${iniBuffs[${i},${bRebuffSeconds}].Equal[-]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
| REBUFFSECONDS ENTRY PRESENT, EXAMINE NETNOTE
| EMPTY NETNOTE. REMOVE FROM CANDIDATES SINCE THEY HAVE THE BUFF
/if (${NetBots[${targetName}].Note.Length}==0) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
| NO NETNOTE FOR SPELL FOUND - ASSUME PERSON NEEDS BUFF - LEAVE THEM IN LIST
/if (${NetBots[${targetName}].Note.Find[;${buffSpellID}_]}==NULL) /continue
| NETNOTE FOR SPELLID EXISTS, CHECK
/varset note ${NetBots[${targetName}].Note}
/varset note ${note.Right[ -${note.Find[;${buffSpellID}_]} ]}
| REMAINING BUFF TIME IS SUFFICIENT, REMOVE PLAYER FROM BUFF CANDIDATES
/if (${note.Token[1,;].Token[2,_]} > ${iniBuffs[${i},${bRebuffSeconds}]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
| REMAINING TIME IS NOT SUFFICIENT, LEAVE THEM IN THE LIST BY DOING NOTHING
}
|/if (${Select[${buffSpellID},${NetBots[${targetName}].ShortBuff}]}>0) {
| /invoke ${targetNames.Remove[${targetName}]}
| /continue
|}
/if (${NetBots[${targetName}].InZone}==FALSE) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
/if (${iniBuffs[${i},${bExtendedStackCheck}].NotEqual[-]} && ${canDoExtendedStackCheck}==TRUE) {
/dquery ${targetName} -q "Spell[${buffSpell}].Stacks"
/if (${DanNet.Q}==FALSE) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bRequireGroupInRange}].NotEqual[-]}) {
/if (${targetName.NotEqual[${Me.CleanName}]} && ${Group.Member[${targetName}].Index}==NULL) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
/if (${Spawn[pc ${targetName}].Distance3D} > ${buffSpellRange}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bTargetUnderHP}].NotEqual[-]}) {
/if (${NetBots[${targetName}].PctHPs} > ${iniBuffs[${i},${bTargetUnderHP}]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bTargetUnderMana}].NotEqual[-]}) {
/if (${NetBots[${targetName}].PctMana} > ${iniBuffs[${i},${bTargetUnderMana}]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bTargetOverHP}].NotEqual[-]}) {
/if (${NetBots[${targetName}].PctHPs} <= ${iniBuffs[${i},${bTargetOverHP}]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bNotIfShortBuff}].NotEqual[-]}) {
/varset checkSpellID ${Spell[${iniBuffs[${i},${bNotIfShortBuff}]}].ID}
/if (${Select[${checkSpellID},${NetBots[${targetName}].ShortBuff}]}>0) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bNotIfLongBuff}].NotEqual[-]}) {
/varset checkSpellID ${Spell[${iniBuffs[${i},${bNotIfLongBuff}]}].ID}
/if (${Select[${checkSpellID},${NetBots[${targetName}].Buff}]}>0) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bTargetOverLevel}].NotEqual[-]}) {
/if (${NetBots[${targetName}].Level} < ${iniBuffs[${i},${bTargetOverLevel}]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${iniBuffs[${i},${bTargetUnderLevel}].NotEqual[-]}) {
/if (${NetBots[${targetName}].Level} >= ${iniBuffs[${i},${bTargetUnderLevel}]}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
}
/if (${Spawn[pc ${targetName}].Distance3D} > ${buffSpellRange}) {
/invoke ${targetNames.Remove[${targetName}]}
/continue
}
/next j
/if (${targetNames.Count}==0) {
/if (${iniBuffs[${i},${bRevertToBandolier}].NotEqual[-]}) {
/if (${bandolierProfileIsActive[${iniBuffs[${i},${bRevertToBandolier}]}]}==FALSE) {
/band activate ${iniBuffs[${i},${bRevertToBandolier}]}
}
}
/continue
}
/if (${iniBuffs[${i},${bActivateBandolier}].NotEqual[-]}) {
/if (${bandolierProfileIsActive[${iniBuffs[${i},${bActivateBandolier}]}]}==FALSE) {
/band activate ${iniBuffs[${i},${bActivateBandolier}]}
}
}
/if (${iniBuffs[${i},${bRequireGroupInRange}].NotEqual[-]}) {
/for k 1 to ${Group.Members}
/if (${Spawn[group =${Group.Member[${k}]}].ID}==NULL) /continue
/if (${Spawn[group =${k}].Distance3D} > ${buffSpellRange}) /continue
/next k
}
:skipNetBots
/vardata buffSpawn emptySpawn
/if (${iniBuffs[${i},${bTargetType}].Upper.Equal[PET]}) {
/vardata buffSpawn Spawn[id ${Me.Pet.ID}]
} else {
/if (${iniBuffs[${i},${bUseTeamIndex}].NotEqual[-]}) {
/if (${targetNames.Count}<${teamIndex}) /continue
/if (${Spawn[pc ${targetNames.Item[${teamIndex}]}].ID}==NULL) /continue
/vardata buffSpawn Spawn[pc ${targetNames.Item[${teamIndex}]}]
} else {
/for k 0 to ${Math.Calc[${targetNames.Count}-1]}
/vardata buffSpawn Spawn[pc ${targetNames.Item[${k}]}]
/if (${isLockoutExpired[noHoldTimer_${buffSpawn.ID}_${buffSpellID}]}==TRUE) /break
/next k
}
}
/if (${buffSpawn.ID}==NULL) /continue
/if (${isLockoutExpired[noHoldTimer_${buffSpawn.ID}_${buffSpellID}]}==FALSE) /continue
/if (${iniBuffs[${i},${bNoCast}].NotEqual[-]}) /continue
/if (${iniBuffs[${i},${bMemInGem}].NotEqual[-]} && ${Me.Gem[${buffCastName}]}==NULL) {
/call memorizeSpellInGem "${buffCastName}" ${iniBuffs[${i},${bMemInGem}]}
/if (${Macro.Return}==FALSE) {
/varset iniBuffs[${i},${bEnabled}] NO
/continue
}
}
/if (${isCastReady[${buffCastName}]}==FALSE) {
/continue
}
/if (${iniBuffs[${i},${bDoCommand}].NotEqual[-]}) {
/docommand ${iniBuffs[${i},${bDoCommand}]}
/delay 3
}
/invoke (${cq.Append[CAST;SPELL=${buffCastName};FORCETARGETTING=${iniBuffs[${i},${bForceTargetting}]};TARGETID=${buffSpawn.ID};SPELLID=${buffSpellID};CANCELCONDITIONS=${cancelConditions};SRC=iniBuffs;SRCIDX=${i};ONRESULT=onBuffCastResult]})
/varset buffCheckTimer 15
/break
/next i
/RETURN
}
SUB onBuffCastResult(string result, string opts) {
/declare i int local ${getStackCommandOpt[${opts},SRCIDX]}
/declare targetID int local ${getStackCommandOpt[${opts},TARGETID]}
/declare buffSpellID ${getStackCommandOpt[${opts},SPELLID]}
/declare targetName string ${Spawn[id ${targetID}]}
/if (${NetBots[${targetName}].ID}!=NULL) {
/bct ${targetName} //netnote
}
/if (${iniBuffs[${i},${bNoSitTimer}].NotEqual[-]}) {
/call pauseAutoMed ${iniBuffs[${i},${bNoSitTimer}]}
}
/if (${result.Equal[FAIL_NOHOLD]}==TRUE) {
/echo Spell did not take hold. Locking out buff ${Spell[${buffSpellID}]} for 5m.
/call lockout noHoldTimer_${targetID}_${buffSpellID} 300
}
/if (${iniBuffs[${i},${bRecastDelay}].NotEqual[-]}) {
/call lockout bufflockout_${buffSpellID} ${iniBuffs[${i},${bRecastDelay}]}
/echo Buff recast requested. Locking out buff ${Spell[${buffSpellID}]} for ${iniBuffs[${i},${bRecastDelay}]}.
}
/if (${result.Equal.Equal[PASS_CAST_SUCCESS]}) {
/if (${NetBots[${Spawn[id ${targetID}].CleanName}].Level}!=NULL) {
/bc tell ${NetBots[${Spawn[id ${targetID}].CleanName} NETNOTE
/squelch /bct ${targetName} //netnote
}
}
/RETURN
}