LvL bot by Korzhik VAR MoveDelay 100 запуск голым на центре маркете su

  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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
;#######################################################################
; LvL bot by Korzhik
VAR MoveDelay = 100
# запуск голым на центре маркете
sub main()
while 1
go(3768,1273)
while uo.gety() > 1268
MoveOnce(GetDir(uo.GetX(),uo.GetY(),3767,1266), 0, 0)
wait(150)
wend
wait(1000)
dress()
checklag()
wait(300)
go(3761,1265)
while uo.gety() < 1270
MoveOnce(GetDir(uo.GetX(),uo.GetY(),3753,1263), 0, 0)
wait(150)
wend
go(3760, 1285)
go(3754, 1295)
go(3763, 1295)
while uo.getx() > 3760
MoveOnce(GetDir(uo.GetX(),uo.GetY(),3765,1295), 0, 0)
wait(150)
wend
go(3721,1359)
while uo.getx() < 5000
MoveOnce(GetDir(uo.GetX(),uo.GetY(),3721,1357), 0, 0)
wait(150)
wend
checklag()
# Теперь чар в левеле
uo.exec('exec begalka')
uo.exec('exec avtohil')
wait(100)
while not uo.dead()
uo.press(114)
wait(100)
ma()
castwait()
if uo.mana < 10 then
tmp()
ma()
endif
wait(100)
wend
checklag()
wait(1000)
go(5214,1727)
while uo.getx() > 5000
MoveOnce(GetDir(uo.GetX(),uo.GetY(),5214,1726), 0, 0)
wait(150)
wend
wait(1000)
wend
endsub
sub begalka()
var x,y
while not uo.dead()
x = rand(5207, 5215)
y = rand(1731, 1755)
uo.print(str(x) + ' ' + str(y))
go(x, y)
wait(100)
wend
endsub
Sub avtohil()
VAR Success = 'You put the bloody bandage'
VAR Fizzle = 'failed.'
VAR bandag = '0x0E21'
VAR frozen='You are frozen and can not move'
VAR frozen2='reach that.'
VAR k
repeat
If UO.GetHP() < UO.GetMaxHP() -1 Then
If UO.Count( Bandag ) > 0 Then
deljournal( Success )
deljournal( Fizzle )
k = 0
bandageself2()
repeat
Wait( 100 )
k = k + 1
until UO.InJournal( Success ) or UO.InJournal( Fizzle ) or k > 5
Else
return
EndIf
Else
Wait( 500 )
EndIf
until UO.LIfe == 0
end Sub
sub ghp()
uo.msg('.drink_heal_great')
endsub
sub tmp()
uo.msg('.drink_mana_total')
endsub
sub ip()
uo.msg('.drink_invis ')
endsub
sub protect()
uo.Exec("cast 'Protection'self")
endsub
sub ma_self()
uo.exec("cast 'Magic Arrow'self")
endsub
sub inv()
uo.Exec("cast 'Invisibility'self")
endsub
sub heal()
uo.waittargetobject('self')
uo.cast("Heal")
wait(30)
bandageself()
endsub
sub gr_heal()
uo.waittargetobject('self')
uo.cast("Greater Heal")
wait(30)
bandageself2()
endsub
sub ma()
uo.cast('Magic Arrow','laststatus')
endsub
sub bandageself2()
uo.waittargetobject('self')
uo.usetype('0x0E21')
wait(40)
uo.usetype('0x1B76')
restore()
endsub
sub restore()
if uo.life < 180 then
uo.usetype('0x0F09')
if uo.life < 150 then
ghp()
if uo.life < 60 then
ip()
endif
endif
endif
endsub
sub bus()
dim a[5]
a[0] = '0x1415'
a[1] = '0x1411'
a[2] = '0x1545'
a[3] = '0x1410'
a[4] = '0x1414' ;2
var c = get('ch_main_armor')
for var i = 0 to 4
uo.useType(a[i], c)
next
uo.useType('0x1F08')
uo.useType('0x1545')
endsub
sub crystal()
dim a[6]
a[0] = '0x1415'
a[1] = '0x1411'
a[2] = '0x1412'
a[3] = '0x1413'
a[4] = '0x1414'
a[5] = '0x1410'
for var i = 0 to 5
uo.useType(a[i], '0x04A0')
next
endsub
; ------------------------------------------------------------------------------
; OTHER ------------------------------------------------------------------------
; ------------------------------------------------------------------------------
; ------------------------------------------------------------------------------
; UTILS ------------------------------------------------------------------------
; ------------------------------------------------------------------------------
sub castwait()
var LastMana=uo.Mana
var LastHP = uo.life
deljournal( "You have been poizoned!" )
deljournal("see the target")
repeat
if LastMana > uo.Mana or LastHP > uo.life Then
return
else
if LastMana < uo.Mana Then
LastMana = uo.Mana
endif
if LastHP < uo.life Then
LastHP = uo.life
endif
endif
Wait(100)
until uo.InJournal("see the target") || uo.InJournal("You have been poizoned!") || uo.dead()
endsub
sub healwait()
var LastHP = uo.life
repeat
if LastHP <> uo.life Then
return
endif
Wait(5)
until false
endsub
sub gumpwait()
while uo.LastGump('replyed') <> 0
wait(5)
wend
endsub
sub between(num, min, max)
if num > min && num < max then
return true
endif
return false
endsub
sub rand( x, y )
var diff = y - x, r
repeat
r = x + uo.random(diff)
until r >= x && r <= y
return r
endsub
sub get(n)
return uo.getGlobal(n)
endsub
sub set(n, v)
uo.setGlobal(n, v)
return v
endsub
sub find(t, c)
uo.findtype( t, c, 'backpack' )
if uo.findcount() then
return uo.getserial('finditem')
endif
return false
endsub
sub checklag()
deljournal("ackpack")
uo.click("backpack")
repeat
wait(5)
until uo.injournal("ackpack")
endsub
sub deljournal(msg)
while uo.injournal(msg)
uo.setjournalline(uo.injournal(msg)-1,"")
wend
endsub
sub dress()
var stolb_arm
var stolb_eq
Dim Select[4]
Select[1] = '11' ; Бинты 2
Select[2] = '24' ; Химия 4
Select[3] = '13' ; Реги
Select[4] = '28'
Dim Item[4]
Item[1] = '0x0E21'
Item[2] = '0x09B0'
Item[3] = '0x0E76'
Item[4] = '0x0F09 0x042C'
deljournal( "You don't fear poison anymore!" )
if uo.countground('0x0ED4') then
uo.set('finddistance','3')
stolb_arm = dress.getStone('0x08BB', false)
stolb_eq = dress.getStone('0x079B', false)
if NOT uo.ObjAtLayer('Torso') or uo.Count('0x0EFA')==0 Then ;Проверка на пак
uo.UseObject('backpack')
Wait(5)
endif
if NOT uo.ObjAtLayer('Torso') Then
uo.Recall('0x4000426D', '2')
repeat
Wait(5)
Until uo.ObjAtLayer('Torso')
endif
wait(5)
uo.Recall( stolb_arm, '11')
repeat
Wait(5)
Until uo.injournal ("You don't fear poison anymore!")
uo.recall('0x4000B44E','23')
repeat
wait(5)
until uo.count('0x1B76') <> 0
Endif
if NOT uo.ObjAtLayer('Horse') Then
uo.Recall(stolb_eq,'8') ;
repeat
Wait(5)
Until uo.ObjAtLayer('Horse')
endif
For var n = 1 TO 4
if uo.Count(Item[n])==0 Then
uo.Recall(stolb_eq,Select[n])
uo.DeleteJournal()
repeat
Wait(5)
Until uo.InJournal("You put")
IF n == 4 THEN
uo.Recall(stolb_eq,'9')
repeat
Wait(5)
Until uo.InJournal("You put")
endif
endif
Next
uo.findType('0x1412', '-1', 'backpack')
set('ch_main_armor', uo.getcolor('finditem'))
uo.exec("usetype 0x1515;usetype 0x1718;usetype 0x1F06;usetype 0x1F08; usetype 0x1545; usetype 0x13FA; usetype 0x1537")
bus()
uo.msg('.arm_shield')
uo.Print('Done!')
endsub
sub dress.getStone(c,g)
var t = '0x0ED4'
if g then
t = '0x151C'
endif
uo.findtype ( t, c, 'ground' )
return uo.getserial( 'finditem' )
endsub
#(c)SerrouS
Sub InitStack()
UO.SetGlobal('STACK', '0')
endsub
Sub Push( param )
var chk = val(UO.GetGlobal('STACK')) ; количество элементов в стеке
UO.SetGlobal('STACK',str(chk + 1))
UO.SetGlobal('STACK_'+str(chk), param)
endsub
Sub Pop ()
var chk = val(UO.GetGlobal('STACK')) ; количество элементов в стеке
if chk then
UO.SetGlobal('STACK',str(chk - 1))
return UO.GetGlobal('STACK_'+str(chk - 1))
else
return ''
endif
endsub
Sub go( OX, OY)
var S = false, N = 1
VAR myx, myy, MD, J
VAR Lx1, Ly1
VAR Lx2, Ly2
VAR Sx, Sy
VAR T
VAR Des = N
J = 1
MD = MoveDelay * 1.5
myx = uo.getx()
myy = uo.gety()
MoveOnce( GetDir( uo.getx(), uo.gety(), ox, oy), MD, False)
Sx = 0
Sy = 0
Lx1 = uo.getx() / 2
Ly1 = uo.gety() / 2
Lx2 = Lx1 / 2
Ly2 = Ly1 / 2
T = UO.Timer()
If (GetDistance(ox, oy) <> N) OR ( (NOT S) AND GetDistance(ox, oy) > N ) Then
#UO.Exec('exec PermResend')
EndIf
While ( (GetDistance(ox, oy) <> N) OR ((NOT S) and GetDistance(ox, oy) > N) ) and ( OX >= 0 ) and ( OY >= 0 ) and not uo.dead()
If ( (UO.Timer() - T) * 15 > MoveDelay ) Then
T = UO.Timer()
Lx2 = Lx1
Ly2 = Ly1
Lx1 = myx
Ly1 = myy
myx = uo.getx()
myy = uo.gety()
endIf
MD=MoveDelay
If ((OX-uo.getx())*(OX-uo.getx())+(OY-uo.gety())*(OY-uo.gety())>0) Then
MD = MD * 3 / GetDistance( ox, oy )
EndIf
wait(MD)
If GetDistance( OX, OY ) > Des Then
MoveOnce(GetDir(uo.GetX(),uo.GetY(),ox,oy),MD,False)
Else
If S Then
If GetDistance(OX,OY)<Des Then
If GetDistance(OX,OY)<>0 Then
MoveOnce(GetDir(ox,oy,uo.GetX(),uo.GetY()),MD,False)
Else
MoveOnce(GetDir(uo.GetX(),uo.GetY(),Lx2,Ly2),MD,False)
EndIf
EndIf
EndIf
EndIf
If GetDistance(OX,OY)<>Des Then
If (Lx2==uo.getx()) and (Ly2==uo.gety()) Then
If (Sx<>uo.getx()) or (Sy<>uo.gety()) Then
J=1
EndIf
J=J+1
UO.Resend()
Sx = uo.getx()
Sy = uo.gety()
Stun(ox,oy,J)
EndIf
EndIf
Wend
endsub
;
; ============ MOVEONCE ===
; Процедура MoveOnce - хождение в определённую сторону
; Направления:
; Система направлений по клавишам Нумпада
; 8 = 1 | 2 = -1
; 9 = 2 | 1 = -2
; 6 = 3 | 4 = -3
; 3 = 4 | 7 = -4
;
; Такая система позволяет с лёгкостью получать направление, обратное
; данному...
;
Sub MoveOnce( Dir, Del, Rev )
VAR Num
Var MoveNumber = 1
If Rev Then
Num = MoveNumber + 1
Else
Num = MoveNumber
EndIf
If ( Num > 0 ) and ( Dir <> 0 ) Then
If Dir == 1 Then
UO.Press( 38, Num, Del )
EndIf
If Dir == 2 Then
UO.Press( 33, Num, Del )
EndIf
If Dir == 3 Then
UO.Press( 39, Num, Del )
EndIf
If Dir == 4 Then
UO.Press( 34, Num, Del )
EndIf
If Dir == -1 Then
UO.Press( 40, Num-1, Del )
EndIf
If Dir == -2 Then
UO.Press( 35, Num, Del )
EndIf
If Dir == -3 Then
UO.Press( 37, Num, Del )
EndIf
If Dir == -4 Then
UO.Press( 36, Num, Del )
EndIf
If Rev Then
If Dir <> -1 Then
UO.Press( 40, 1, Del )
EndIf
EndIf
EndIf
endsub
;
; ============== GETDIR ===
; Функция GetDir возвращает направление, по которому надо идти
; к координате
;
Sub GetDir( myx, myy, ox, oy )
VAR I, J
J = 0
VAR X = ox - myx
VAR Y = oy - myy
I = GetQDir( Abs(X), Abs(Y) )
If X >= 0 Then
If Y >= 0 Then
If I == 1 Then
J = -2
Else
If I == 2 Then
J = -1
Else
If I == 3 Then
J = 4
EndIf
EndIf
EndIf
Else
If I == 1 Then
J = 2
Else
If I == 2 Then
J = 3
Else
If I == 3 Then
J = 4
EndIf
EndIf
EndIf
EndIf
Else
If Y >= 0 Then
If I == 1 Then
J = -2
Else
If I == 2 Then
J = -3
Else
If I == 3 Then
J = -4
EndIf
EndIf
EndIf
Else
If I == 1 Then
J = 2
Else
If I == 2 Then
J = 1
Else
If I == 3 Then
J = -4
EndIf
EndIf
EndIf
EndIf
EndIf
RETURN J
endsub
;
; =============== GETQDIR ===
;
;
Sub GetQDir( x, y )
VAR Ep = 0.172
VAR J = 0
If X == 0 Then
J = 1
Else
If ( Y / X ) < Ep Then
J = 3
Else
If ( X / Y ) < Ep Then
J = 1
Else
J = 2
EndIf
EndIf
EndIf
RETURN J
endsub
;
; ============== GETDISTANCE ===
; Функция GetDistance возвращает расстояние до координат
; (как UO.GetDistance - до объекта)
;
; Почему так - потому что учим математику :)
;
Sub GetDistance( X, Y )
VAR A, B, C
A = abs( X - UO.GetX() )
B = abs( Y - UO.GetY() )
If A > B Then
C = A
Else
C = B
EndIf
Return C
endsub
;
; ============= PERP ===
; Функция Perp возвращает направление, перпендикулярное введённому
;
Sub Perp( Dir )
VAR D = Dir
If Dir == 1 Then
D = 3
EndIf
If Dir == 2 Then
D = 4
EndIf
If Dir == 3 Then
D = -1
EndIf
If Dir == 4 Then
D = -2
EndIf
If Dir == -1 Then
D = -3
EndIf
If Dir == -2 Then
D = -4
EndIf
If Dir == -3 Then
D = 1
EndIf
If Dir == -4 Then
D = 2
EndIf
RETURN D
endsub
;
; =============== STUN ===
; Обход препятствий
;
Sub Stun( X, Y, N )
VAR I
VAR myx
VAR myy
VAR MoveDelay = 100
myx = uo.getx()
myy = uo.gety()
For I=1 to N
MoveOnce(perp(GetDir(myx,myy,x,y)),MoveDelay,False)
Next
Wait(MoveDelay)
UO.Resend()
If (myx==uo.getx()) and (myy==uo.gety()) Then
For I=1 to N
MoveOnce(-perp(GetDir(myx,myy,x,y)),MoveDelay,False)
Next
Wait(MoveDelay)
UO.Resend()
EndIf
If (myx==uo.getx()) and (myy==uo.gety()) Then
For I=1 to N
MoveOnce(-GetDir(myx,myy,x,y),MoveDelay,False)
Next
Wait(MoveDelay)
Stun(x,y,N)
EndIf
endsub
;
; ============= ABS ===
; Убирает знак минуса в отрицательных числах
;
Sub abs( a )
VAR b
If a < 0 Then
b = -a
Else
b = a
endif
return b
endsub