-
Notifications
You must be signed in to change notification settings - Fork 0
/
observe.cmd
178 lines (142 loc) · 4.98 KB
/
observe.cmd
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
include libmaster.cmd
action send retreat when ^You are far too occupied
action var needPredict true when ^Too many futures cloud your mind - you learn nothing\.
action var tooInjured true when ^You are unable to hold the
action var tooInjured true when ^The pain is too much
action goto doneAddCd when ^That's a bit tough to do when you can't see the sky\.
var force false
if_1 then {
if (%1 = force) then {
var force true
}
if (%1 = nobuffs) then {
var noBuffs 1
}
}
###############################
### INIT
###############################
var skillset null
var skillsets magic|offens|defens|survival|lore
eval len count("%skillsets", "|")
var index 0
###############################
### OBJECTS TO OBSERVE
###############################
var magic $char.observe.magic
var lore $char.observe.lore
var offens $char.observe.offense
var defens $char.observe.defense
var survival $char.observe.survival
var objindex 0
var objlength 0
# Initialize $lastObserveAt if it doesn't have a valid value
if (!($lastObserveAt > 0)) then put #var lastObserveAt 0
var previousLastObserveAt $lastObserveAt
# The timer on observations is random from 2-4 minutes. If it has been longer than that, force it.
evalmath timeSinceLastObserve $gametime - $lastObserveAt
if (%timeSinceLastObserve > 240) then var force true
###############################
### main
###############################
main:
if (%force = false && $isObsOnCd = true) then goto done
if (matchre("$roomname", "Li Surmi Gelv")) then goto doneAddCd
gosub checkPredState
gosub findSkillSet
if (%skillset = null) then goto doneAllFull
if ($monstercount > 0) then gosub stance shield
var objects %%skillset
eval objlength count("%objects", "|")
if (%noBuffs != 1 && ($SpellTimer.AuraSight.active = 0 || $SpellTimer.AuraSight.duration < 2)) then {
gosub runScript cast aus
}
if (%noBuffs != 1 && ($SpellTimer.PiercingGaze.active = 0 || $SpellTimer.PiercingGaze.duration < 2)) then {
gosub runScript cast pg
}
###############################
### main.loop
###############################
main.loop:
if ("$lefthandnoun" != "telescope") then {
gosub stow right
gosub stow left
gosub get my $char.observe.telescope
gosub swap
}
gosub this.retreat
# If we can't use the telescope, just OBSERVE without it
if (%tooInjured = true) then {
gosub observe %objects(%objindex) in sky
} else {
gosub center my telescope on %objects(%objindex)
gosub this.retreat
gosub peer my telescope
}
math objindex add 1
if (%objindex > %objlength) then {
gosub nextSkillSet
var objindex 0
var objects %%skillset
eval objlength count("%objects", "|")
}
if (%needPredict = true && $char.observe.predict = 1) then {
gosub close my telescope
gosub stow my telescope
gosub runScript predict
var needPredict false
}
if ($lastObserveAt != %previousLastObserveAt || %objindex > %objlength) then goto done
goto main.loop
###############################
### checkPredState
###############################
checkPredState:
if ($lastPredictionAt > $lastPredStateAllAt) then {
#echo "No PRED STATE ALL since last PREDICTION, do predstateall"
gosub predict state all
} else {
# echo "predictPool.* is accurate"
return
}
goto checkPredState
###############################
### findSkillSet
###############################
findSkillSet:
if ($predictPool.%skillsets(%index) != complete) then {
var skillset %skillsets(%index)
return
}
math index add 1
if (%index > %len) then return
goto findSkillSet
nextSkillSet:
math index add 1
if (%index > %len) then goto doneAddCd
var skillset %skillsets(%index)
return
this.retreat:
if ($monstercount > 0) then gosub retreat
return
doneAllFull:
if (!($lastEchoPredStateAllAt > 0)) then put #var lastEchoPredStateAllAt 0
evalmath timeSinceLastEchoPredStateAll $gametime - $lastEchoPredStateAllAt
if (%timeSinceLastEchoPredStateAll > 3600) then {
put #echo >Log #f6d1ff [observe] All Pools Full
put #var lastEchoPredStateAllAt $gametime
}
put #var lastObserveAt $gametime
goto done
doneAddCd:
put #echo >Log [observe] Nothing found, setting cd
put #var lastObserveAt $gametime
put #var isObsOnCd true
goto done
doneInjured:
goto done
done:
if ("$righthandnoun" = "telescope" || "$lefthandnoun" = "telescope") then gosub put my $char.observe.telescope in my $char.inv.container.telescope
pause .2
put #parse OBSERVE DONE
exit