Незнаю как подогнать под своего чара
Code: Select all
Var FileName='d:\Games\UO\Injection\iron2.txt'
Var Box='0x40090F10'
Var Tool='0x1EB8'
var runemine='0x1F14'
var runebook='0x22C5'
var prosp='0x0FB4'
Var Iron='0x401AF67A'
Var MaxWeight= 400-10 #Вес
Var Pickaxe= '0x0F39' #Кирка которой копаем
Var RecKey=145 # Клавиша на которую в УО забито Sacred Journey -это Scroll
Lock
Var MoveDelay=1000 # Промежуток между шагами
Var MoveNumber=1 # Количество шагов при смене дислокации
Var Ep=0.172 # Значение ширины угла хождения при определении направления.
#Если на пути встречаются сложные и широкие препятствия - увеличить.
#0.172 - сбалансированный.
var XN = 2064
var YN = 1748
var Stoplocation
Var StopAxe
Sub Main()
if uo.count(Pickaxe) < 1 then
Recaling(runebook)
uo.useobject(Box)
GrAxe()
end if
UO.Exec('exec Mine')
EndSub
;---------------------------------------
Sub Mine()
Var Tl,T,X,Y,Z
Var F
var Tim
var Jurn
Dim Сli[9]
Сli[0]="cliloc# 0xA867" ;You can't mine...
Сli[1]="cliloc# 0xAD03" ;You loosen
Сli[2]="cliloc# 0xAD00" ;there no metal
Сli[3]="cliloc# 0x6B31" ;backpack full
Сli[4]="cliloc# 0xEE46" ;worn out tool!
Сli[5]="cliloc# 0x5DE1" ;dull cuper
Сli[6]="cliloc# 0x5DE6" ;agapit
Сli[7]="cliloc# 0xA2DE" ;is too far away
Сli[8]="cliloc# 0xACF9" ;where do you wish to dig
Сli[9]="cliloc# 0xA866" ;You can't mine...
;----------------------------
Begin:
recaling(runemine)
Stoplocation = 0
UO.SetGlobal('process','yes')
F=File(FileName)
F.Open()
Beg:
Tl=safecall F.Readln()
Tl=Trim(Tl)
If Tl=='File read error' Then
GoTo Ext
EndIf
T=GetNumb(Tl,0)
X=GetNumb(Tl,1)
Y=GetNumb(Tl,2)
Z=GetNumb(Tl,3)
UO.Print('GoTo next mine')
UO.Print('Tile '+Tl)
gotoxy(X,Y,1)
if Stoplocation == 1 then
Recaling(runebook)
SmOre()
GrOre()
GrAxe()
GoTo Ext
EndIf
StopAxe=uo.count(Pickaxe)
UO.WaitTargetTile(Str(T),Str(X),Str(Y),Str(Z))
UO.usetype(prosp)
wait(800)
REPEAT
uo.deletejournal()
UO.WaitTargetTile(Str(T),Str(X),Str(Y),Str(Z))
UO.usetype(Pickaxe)
wait(200)
Tim = UO.Timer()
REPEAT
wait(150)
Jurn=UO.Journal(0)
UNTIL ((UO.Timer()-Tim) > 40 or (not UO.Weight < MaxWeight) or Jurn[10] == "5"
or Jurn == Сli[1] or Jurn == Сli[2] or Jurn == Сli[3] or Jurn == Сli[4] or Jurn
== Сli[0] or Jurn == Сli[9] or UO.GetHP()==0)
UNTIL Jurn == Сli[3] or (not UO.Weight < MaxWeight) or Jurn == Сli[2] or
uo.count(Pickaxe)==0 or Jurn == Сli[7] or Jurn == Сli[0] or Jurn == Сli[9]
If Jurn == Сli[2] or Jurn == Сli[0] or Jurn == Сli[7] or Jurn == Сli[9] then
UO.Print('there no metal !!!')
GoTo Beg
EndIf
If Jurn == Сli[3] or (not UO.Weight < MaxWeight) or uo.count(Pickaxe)==0 then
UO.Print('backpack full!!!')
Recaling(runebook)
SmOre()
GrOre()
GrAxe()
EndIf
Ext:
F.Close()
UO.SetGlobal('process','no')
UO.Print('S T O P!!!')
GoTo Begin
EndSub
;---------------------------
Sub GetNumb(C,I)
var J,T,K
J=0
K=1
While K>0
J=J+1
If (Mid(C,J,1)==' ') Or (J>=Len(C)-1) Then
If I==0 Then
T=Val(Left(C,J))
Else
T=GetNumb(Right(C,Len(C)-J-1),I-1)
EndIf
K=0
EndIf
wend
UO.Print(T)
return T
end sub
;---------------------------------------------
sub SmOre()
repeat
uo.findtype("0x19B9") #ore
uo.waittargetground("0x0FB1") ;смол анвил
uo.useobject("finditem")
wait(900)
until not uo.count("0x19B9")
end sub
;---------------------------------------------
sub GrOre()
repeat
uo.findtype("0x1BF2") ;ingots
uo.moveitem("finditem","0",Box)
wait(1000)
until not uo.count("0x1BF2")
end sub
;---------------------------------------------
sub GrAxe()
UO.SetGlobal('Countaxe','Yes')
if uo.count(prosp) <1 then
uo.useobject(Box)
uo.findtype(prosp,"-1",Box)
wait(700)
UO.grab("1","finditem")
Wait(1200)
end if
if uo.count(Pickaxe) < 2 then
uo.useobject(Box)
uo.findtype(Pickaxe,"-1",Box)
Wait(600)
if (uo.findCount()+uo.count(Pickaxe)>=2) then
repeat
uo.findtype(Pickaxe,"-1",Box)
UO.grab("1","finditem")
Wait(1200)
until uo.count(Pickaxe)==2
else
UO.print("--NET KIROK!!!!----")
UO.Exec('terminate all')
end if
end if
end sub
;--------------------------
Sub Recaling(rune)
var myx, myy,Tim
var Cli="cliloc# 0xA8B6"
var Cli2="cliloc# 0xAA57" ;перегруз
var recOk = false
wait(500)
myx=uo.getx()
myy=uo.gety()
Tim = UO.Timer()
REPEAT
UO.waittargettype(rune) ;runebook
uo.Press(RecKey)
wait(2500)
If (myx<>uo.getx() or myy<>uo.gety() or UO.Journal(0)==Cli) Then
recOk = True
else
if UO.Journal(0)==Cli2 then
uo.findtype("0x19B9") #ore
uo.moveitem("finditem","1","ground")
wait(800)
end if
EndIf
UNTIL recOk
End Sub
;---------------------------------
sub gotoxy(x,y,prec)
var ld=0,ldc=0
var dx,dy
var mx,my
var ox,oy,mk,k
#uo.print(">")
#uo.track("1",str(x),str(y))
start:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if
if dx<=prec then
return
end if
if not ldc then
;uo.print(STR(dx))
end if
if dx<3 then
mk=70
else
mk=15
end if
ox=mx
oy=my
for k=1 to mk
mx=UO.GetX()
my=UO.GetY()
if mx<>ox or my<>oy then
goto sdidapl
end if
wait(10)
next
sdidapl:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if
if dx<=prec then
return
end if
if ld==dx then
ldc=ldc+1
if ldc>100 then
uo.print("Can not reach location!")
Stoplocation = 1
return
end if
else
ld=dx
end if
if mx==x then
if my==y then
return
endif
if my>y then
#UO.Print("UR")
UO.Press(33)
goto start
endif
#UO.Print("DL")
UO.Press(35)
goto start
end if
if mx<x then
if my>y then
#UO.Print("R")
UO.Press(39)
goto start
endif
if my==y then
#UO.Print("DR")
UO.Press(34)
goto start
endif
#UO.Print("D")
UO.Press(40)
goto start
end if
if my<y then
#UO.Print("L")
UO.Press(37)
goto start
endif
if my==y then
#UO.Print("LU")
UO.Press(36)
goto start
endif
#UO.Print("U")
UO.Press(38)
goto start
end sub
sub GtAxe()
repeat
uo.findtype("0x0F39") ;shovel
uo.moveitem("finditem","0",Box)
wait(1000)
until not uo.count("0x0F39")
end sub
sub tet()
uo.useobject(Box)
uo.findtype(Iron,"-1",Box)
wait(600)
uo.grab("200","finditem")
wait (1000)
uo.findtype(Tool)
wait(500)
uo.usetype(Tool)
wait(600)
repeat
uo.lclick(326,452)
until uo.count(Tool)==0 or uo.count(Iron)==0
end sub
sub Sm()
var vech="0x1403";Sspear
REPEAT
UO.waittargettype (vech)
wait(100)
UO.LClick(67,392)
wait(900)
UNTIL not uo.count(vech)
end sub