;#######################################################################
; 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