-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3_autotrapdisarm.inc
executable file
·86 lines (65 loc) · 2.08 KB
/
p3_autotrapdisarm.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
SUB p3_autotrapdisarm_init() {
/declare canDoAutoDisarm bool outer TRUE
/declare checkAutoDisarmTimer timer outer
/if (${Select[${Me.Class.ShortName},BRD,ROG]}==0) {
/varset canDoAutoDisarm FALSE
/return
}
/declare doAutoTrapDisarm bool outer FALSE
/declare trapNames list outer
/varset doAutoTrapDisarm ${getBotIniOption[Misc.AutoTrapDisarm,${doAutoTrapDisarm}]}
/invoke ${trapNames.Append[DESERT CURSE,A BLADE,FESTERING OOZE,JAGGED BLADES,A DARK ENTITY,A SHIMMERING ORB,CAVE-IN]}
/invoke ${trapNames.Append[A FORMLESS TERROR,A LOW HUM,A SINGULARITY,A WARDSTONE,A NULL FIELD,AN IMMOBILIZER,TRAP]}
/invoke ${trapNames.Append[A PRESSURE PLATE,DECAYING REMAINS]}
/RETURN
}
SUB autotrapdisarmMaintenance() {
/if (${doAutoTrapDisarm}==FALSE) /RETURN
/if (${canDoAutoDisarm}==FALSE) /RETURN
/if (${checkAutoDisarmTimer}>0) /RETURN
/varset checkAutoDisarmTimer 5
/if (${Me.AbilityReady[Sense Traps]}==TRUE) {
/doability "sense traps"
/delay 3
}
/if (${Me.AbilityReady[Disarm Traps]}==TRUE) /call checkAutoDisarm
/RETURN
}
SUB checkAutoDisarm() {
/declare i int local 0
/declare j int local 1
/declare tName string local
/declare xspawn spawn local
/declare nearbySpawnCount int local ${SpawnCount[radius 70]}
/for i 0 to ${Math.Calc[${trapNames.Count}-1]}
/varset tName ${trapNames.Item[${i}]}
/for j 1 to ${nearbySpawnCount}
/if (${NearestSpawn[${j},radius 70].ID}==NULL) /break
/vardata xspawn NearestSpawn[${j},radius 70]
/if (${xspawn.CleanName.Find[${tName}]}!=NULL) {
/tar id ${xspawn.ID}
/delay 3
/doability "disarm traps"
/delay 3
/RETURN
}
/next j
|/varset j 1
|/while (1) {
| /if (${NearestSpawn[${j},radius 70].ID}==NULL) /break
|
| /vardata xspawn NearestSpawn[${j},radius 70]
|
| /if (${xspawn.CleanName.Find[${tName}]}!=NULL) {
| /tar id ${xspawn.ID}
| /delay 3
| /doability "disarm traps"
| /delay 3
| /RETURN
| }
|
| /varset j ${Math.Calc[${j}+1]}
|}
/next i
/RETURN
}