-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheal.mod
More file actions
342 lines (309 loc) · 6.85 KB
/
heal.mod
File metadata and controls
342 lines (309 loc) · 6.85 KB
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
healyao1="jinchuang yao"
healyao2="yangjing dan"
heal={}
heal["ok"]=nil
heal["loc"]=0
heal["hp"]=0
getvbquemin=function()
vbqixuemin=GetVariable("qixuemin")
if vbqixuemin=="" or vbqixuemin ==nil then
return 75
else
return tonumber(vbqixuemin)
end
end
checkheal=function(cheal_ok,cheal_fail,forceheal)
if me.hp["qixue%"]<getvbquemin() then
do_heal(cheal_ok,cheal_fail,forceheal)
return true
elseif me.hp["jinqi%"]<getvbquemin() then
do_heal(cheal_ok,cheal_fail,"inspire")
return true
else
return false
end
end
do_heal=function(heal_ok,heal_fail,forceheal)
heal["ok"]=heal_ok
heal.fail=heal_fail
heal.loc=-2
heal.cmd="yun heal"
heal.hp=0
if familys[me.fam]~=nil and forceheal~=true then
if familys[me.fam].healcmd~=nil then
heal.loc=familys[me.fam].dazuoloc
heal.cmd=familys[me.fam].healcmd
end
end
if forceheal=="inspire" then
heal.loc=-2
heal.cmd="yun inspire"
healyao=healyao2
go(heal.loc,heal.arrive2,heal_end_fail)
else
healyao=healyao1
go(heal.loc,heal.arrive,heal_end_fail)
end
end
heal["end"]=function(s)
if ((s~="")and(s~=nil)) then
call(heal[s])
end
heal["ok"]=nil
heal.fail=nil
heal.hp=0
end
heal_end_fail=function()
heal["end"]("fail")
end
heal_end_ok=function()
heal["end"]("ok")
end
heal["arrive"]=function()
if me.hp["qixue%"]==100 then
heal["end"]("ok")
return
end
if me.hp["qixue%"]==heal["hp"] then
if getnum(itemlist[healyao])>0 then
heal["yao"]()
else
item["go"](healyao,1,heal["yao"],heal_end_fail)
end
else
heal.hp=me.hp["qixue%"]
busytest(heal.go)
end
end
heal["arrive2"]=function()
if me.hp["jinqi%"]>=getvbquemin() then
heal["end"]("ok")
return
end
if me.hp["jinqi%"]==heal["hp"] then
if getnum(itemlist[healyao])>0 then
heal["yao"]()
else
item["go"](healyao,1,heal["yao"],heal_end_fail)
end
else
heal.hp=me.hp["jinqi%"]
busytest(heal.go)
end
end
heal["go"]=function()
run(heal.cmd)
busytest(heal.test)
end
heal["test"]=function()
hp()
if heal.cmd=="yun inspire" then
print(healcmd)
infoend(heal.arrive2)
else
infoend(heal.arrive)
end
end
heal["yao"]=function()
busytest(heal["eatyao"])
end
heal["eatyao"]=function()
run("eat "..healyao)
busytest(heal_end_ok)
end
posioned=false
-------------------------------------------------------
dispel={}
dispel["ok"]=nil
dispel["fail"]=nil
dispel.neilifail=false
do_dispel=function(dispel_ok,dispel_fail)
dispel["ok"]=dispel_ok
dispel["fail"]=dispel_fail
go(-2,dispel.arrive,dispel_end_fail)
end
dispel.arrive=function()
busytest(dispel.cmd)
end
dispel.cmd=function()
catch("dispel","yun recover;yun dispel")
dispel.neilifail=false
busytest(dispel.test)
end
dispel.test=function()
if dispel.neilifail==true then
if cantouch()==true then
do_touchneili(dispel.arrive,dispel.eatdan)
else
dispel.eatdan()
end
return
end
if posioned then
busytest(dispel.cmd)
else
dispel_end_ok()
end
end
dispel.eatdan=function()
do_eatdan(dispel.arrive,dispel.eatdanfail)
end
dispel.eatdanfail=function()
discon()
end
dispel["end"]=function(s)
if ((s~="")and(s~=nil)) then
call(dispel[s])
end
dispel["ok"]=nil
dispel["fail"]=nil
end
dispel_end_ok=function()
dispel["end"]("ok")
end
dispel_end_fail=function()
dispel["end"]("fail")
end
dispel_posioned=function()
posioned=true
end
on_dispelneilifail=function()
dispel.neilifail=true
end
dispel_ok=function()
posioned=false
drunk=0
end
checkdispel=function(dispel_ok,dispel_fail)
if posioned then
do_dispel(dispel_ok,dispel_fail)
return true
else
return false
end
end
-------------------------------------------------------
eatdan={}
eatdan["ok"]=nil
eatdan["fail"]=nil
eatdan.index=0
eatdan.list={"luosha dan","baola dan","xiongshe wan","jiuhua wan","baoming dan","shengsheng dan"}
eatdan.nlist={"Luosha dan","Baola dan","Xiongshe wan","jiuhua wan","baoming dan","Shengsheng dan"}
eatdan.budaiindex=0
eatdan.budailist={"xuanyuan dan"}
eatdan.budainlist={"Xuanyuan dan"}
do_eatdan=function(eatdan_ok,eatdan_fail)
eatdan.index=0
eatdan.budaiindex=0
eatdan["ok"]=eatdan_ok
eatdan["fail"]=eatdan_fail
if chatroom==nil then
getmudvar()
infoend(eatdan.main)
else
busytest(eatdan.main)
end
end
eatdan["end"]=function(s)
if ((s~="")and(s~=nil)) then
call(eatdan[s])
end
EnableTriggerGroup("enterchatfail",false)
EnableTriggerGroup("eatdan",false)
eatdan["ok"]=nil
eatdan["fail"]=nil
end
eatdan_end_ok=function()
eatdan["end"]("ok")
end
eatdan_end_fail=function()
eatdan["end"]("fail")
end
eatdan["main"]=function()
if canenterchat()==true then
EnableTriggerGroup("enterchatfail",true)
go(chatroomloc,eatdan.arrive,eatdan_end_fail)
else
eatdan_end_fail()
end
end
eatdan.arrive=function()
EnableTriggerGroup("enterchatfail",false)
getbagitems("budai of here")
busytest(eatdan.eatdan)
end
eatdan.eatdan=function()
eatdan.index=eatdan.index+1
if eatdan.index>#eatdan.list then
busytest(eatdan.eatbudai)
return
end
if room_obj[eatdan.nlist[eatdan.index]]~=nil then
busytest(eatdan.eatdancmd)
else
busytest(eatdan.eatdan)
end
end
eatdan.danbusy=false
eatdan.eatdancmd=function()
eatdan.danbusy=false
catch("eatdan","get 1 "..eatdan.list[eatdan.index]..";eat "..eatdan.list[eatdan.index]..";drop "..eatdan.list[eatdan.index])
busytest(eatdan.eatok)
end
eatdan.eatbudai=function()
eatdan.budaiindex=eatdan.budaiindex+1
if eatdan.budaiindex>#eatdan.budailist then
busytest(eatdan.eatjz)
return
end
if bags["budai of here"]==nil then
busytest(eatdan.eatjz)
return
end
if bags["budai of here"][eatdan.budainlist[eatdan.budaiindex]]~=nil then
busytest(eatdan.eatbudaicmd)
else
busytest(eatdan.eatbudai)
end
end
eatdan.eatbudaicmd=function()
eatdan.danbusy=false
catch("eatdan","get 1 "..eatdan.budailist[eatdan.budaiindex].." from budai of here;eat "..eatdan.budailist[eatdan.budaiindex]..";put "..eatdan.budailist[eatdan.budaiindex].." in budai of here")
busytest(eatdan.eatbudaiok)
end
eatdan.eatbudaiok=function()
if eatdan.danbusy==true then
busytest(eatdan.eatbudai)
else
eatdan_end_ok()
end
end
on_danbusy=function()
eatdan.danbusy=true
end
eatdan.eatok=function()
if eatdan.danbusy==true then
busytest(eatdan.eatdan)
else
eatdan_end_ok()
end
end
eatdan.eatjz=function()
if jiuzhuanfull~=true then eatdan_end_fail()
return
end
getbagitems("budai of here")
infoend(eatdan.eatjzcmd)
end
eatdan.eatjzcmd=function()
if bags["budai of here"]==nil or mudvar.eatjz~=true then
eatdan_end_fail()
return
end
if getnum(bags["budai of here"]["jiuzhuan jindan"]) ~=0 then
run("get jiuzhuan jindan from budai;eat jiuzhuan jindan")
eatdan_end_ok()
else
eatdan_end_fail()
end
end