Code: Select all
sub Mark()
dim PX[500], PY[500]
var Minepoints=0
var i
uo.Print('Start marking...')
for i=1 to 500
UO.DeleteJournal()
uo.Print('Set point '+ str(i))
repeat
wait(500)
if UO.InJournal('stop')then
SaveToFile(i-1,PX,PY)
return
endif
until UO.InJournal('set')
PX[i] = UO.GetX("self")
PY[i] = UO.GetY("self")
uo.Print('Point '+str(i)+' X: '+str(PX[i])+' Y: '+str(PY[i])+'taken')
next
end sub
sub SaveToFile(mp,PX,PY)
var s=0,k=0
f.open()
f.create()
uo.Print('points = '+ str(mp))
s=safe call f.writeln(mp)
for k=1 to mp
s=safe call f.writeln(str(PX[k])+' '+str(PY[k]))
next
f.close()
end sub
var f=file('E:\UO\Injection\MinocMine3.dat')
#########
sub main()
repeat
;perexodtuda()
ToHide()
mining()
;perexodobratno()
until UO.Dead()
end sub
#########
sub perexodtuda()
walkn(2517,554,'')
walkn(2524,554,'')
walkn(2524,553,'')
UO.Press(33)
wait(200)
UO.Press(33)
wait(200)
end sub
#########
sub perexodobratno()
walkn(2571,481,'')
walkn(2580,481,'')
UO.Press(34)
wait(200)
UO.Press(34)
wait(200)
end sub
#########
sub mining()
ToHide()
dim PX[150], PY[150]
var Minepoints=0
var i,q,p,w
uo.Print('Loading from file...')
f.open()
uo.Print('file loaded')
Minepoints=safe call f.ReadNumber()
uo.Print('minepoints')
for i=1 to Minepoints
PX[i]=safe call f.ReadNumber()
PY[i]=safe call f.ReadNumber()
next
f.close()
uo.Print('file closed')
for p=1 to Minepoints
uo.Print('X: '+str(PX[p])+' Y: '+str(PY[p]))
WalkN(PX[p],PY[p],'')
q=PX[p]
w=PY[p]
uo.Print('Mining...')
UO.Exec("warmode 0")
mine(PX,PY,p)
next
end sub
sub tohide()
while NOT UO.Hidden()
UO.DeleteJournal()
UO.FindType('0x0F0E','0x0631','my')
if UO.Life<UO.STR/2 AND UO.GetQuantity('finditem')>0 then
UO.UseType('0x0E86','0x0E86')
UO.Exec('warmode 0')
wait(2000)
else
UO.Exec('warmode 0')
UO.UseSkill('Stealth')
repeat
wait(50)
until UO.InJournal('You have hidden') OR UO.InJournal('seem to hide') OR UO.InJournal('preoccupied')
endif
wend
end sub
#########
sub mine(PX,PY,p)
tohide()
var x, y,z,t
var LastTimer
z=UO.GetZ("self")
for x=-2 to 2
for y=-2 to 2
t=0
Repeat
UO.DeleteJournal()
UO.Exec("warmode 0")
UO.WaitTargetTile("1339",STR(UO.GetX()+x),STR(UO.GetY()+Y),z)
;UO.WaitTargetTile("1342",STR(UO.GetX()+x),STR(UO.GetY()+Y),z)
UO.UseType('0x0E85')
UO.DeleteJournal()
wait(200)
LastTimer=UO.Timer()
Repeat
wait(500)
;UO.Print('aaa')
Until UO.InJournal('Try mining') or UO.InJournal('There is nothing') or UO.InJournal('You put') or UO.InJournal('There is no metal') or UO.InJournal("You loosen some") or UO.InJournal("You can") or UO.InJournal("Target cannot") or UO.InJournal("Âû âûêîïàëè") or UO.InJournal("That is too") or UO.InJournal("You have moved") or UO.Timer()>LastTimer+200
wait(2000)
t=t+1
Until UO.InJournal('Try mining') or UO.InJournal('There is nothing') or UO.InJournal("There is no metal") or UO.InJournal("You can") or UO.InJournal("Target cannot") or UO.InJournal("That is too") or UO.InJournal("You have moved") or UO.Timer()>LastTimer+200 or t>2
check(PX,PY,p)
next
next
end sub
#########
sub check(PX,PY,p)
var Che
Che=0
if UO.Weight>600 then
Che=Che+1
endif
if UO.Count('0x0E85')<1 then
Che=Che+1
endif
if Che > 0 then
unload(PX,PY,p)
endif
end sub
#########
sub unload(PX,PY,p)
var i
for i=p to 1 step -1
walkn(PX[i],PY[i],'')
next
;perexodobratno()
;perexodtuda()
vozvrat(PX,PY,p)
end sub
#########
sub vozvrat(PX,PY,p)
var i
for i=1 to p
uo.Print('X: '+str(PX[p])+' Y: '+str(PY[p]))
WalkN(PX[i],PY[i],'')
next
end sub
#########
Sub WalkN(x,y,Target)
VAR i,StepSucess
VAR dx,dy,Exit=0
While Exit<>1
If Target<>"" Then
dx=UO.GetX(Target)-UO.GetX()
dy=UO.GetY(Target)-UO.GetY()
; UO.Print("Target locked!")
If UO.GetDistance(Target)<2 Then
Exit=1
Endif
Else
dx=x-UO.GetX()
dy=y-UO.GetY()
If dx==0 AND dy==0 Then
Exit=1
Endif
Endif
If dx<>0 AND dy<>0 Then
If dx>0 AND dy>0 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
Endif
Endif
If dx>0 AND dy<0 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
Endif
Endif
Endif
If dx<0 AND dy>0 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
Endif
Endif
Endif
If dx<0 AND dy<0 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
StepSucess=Go(5,37,300) ;SW - LeftArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
Endif
Endif
Endif
If dx<>0 AND dy==0 Then
If dx>0 Then
StepSucess=Go(2,34,300) ;E - PgDown
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
StepSucess=Go(2,34,300) ;E - PgDown
Endif
Endif
If dx<0 Then
StepSucess=Go(6,36,300) ;W - Home
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
StepSucess=Go(6,36,300) ;W - Home
Endif
Endif
Endif
If dx==0 AND dy<>0 Then
If dy>0 Then
StepSucess=Go(4,35,300) ;S - End
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
StepSucess=Go(4,35,300) ;S - End
Endif
Endif
If dy<0 Then
StepSucess=Go(0,33,300) ;N - PgUp
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
Endif
StepSucess=Go(0,33,300) ;N - PgUp
Endif
Endif
Endif
Wend
end sub
Sub Go(dir,key,walkwait)
VAR x,y, OldDir
x=UO.GetX()
y=UO.GetY()
OldDir=UO.GetDir()
;Hid()
If UO.GetDir()<>dir Then
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
Endif
Endif
UO.Press(key)
wait(walkwait)
end sub