Code: Select all
var book1='0x4005BC6D' #runebook 1
var book2='0x4005BC6D' #runebook 2
sub begging()
var k,j,b
var second=1 # 0 - two runebooks, 1 - one runebook.
#----------------------------------------
# NPC ID [,info]
#----------------------------------------
DIM ven[16]
ven[1]='0x000DF02C' #Minoc jew
ven[2]='0x000DE365' #Minoc jew2
ven[3]='0x000DE340' #Minoc bs
ven[4]='0x000DE302' #Minoc arm
ven[5]='0x000DE319' #Minoc prov
ven[6]='0x000DEF5A' #Vesper barb
ven[7]='0x000E0A7D' #Vesper bank
ven[8]='0x000DCF21' #Vesper tail
ven[9]='0x000DC5D7' #Vesper tink
ven[10]='0x000DBD85' #Vesper heller
ven[11]='0x000DC5F4' #Vesper arch
ven[12]='0x000DBDA4' #Vesper arm
ven[13]='0x000DBD97' #Vesper prov
ven[14]='0x000DBDB0' #Vesper tailor2
ven[15]='0x000E009A' #Vesper map
ven[16]='0x000E008F' #Vesper ship
DIM vem[16]
vem[1]='0x001026BA' #Britain scribe
vem[2]='0x00103B14' #Minoc bs
vem[3]='0x0010C4B3' #Minoc tailor
vem[4]='0x0010AA7C' #Minoc carpenter
vem[5]='0x0010A387' #Minoc provisioner
vem[6]='0x0010997F' #Minoc cook
vem[7]='0x00103981' #Minoc tamer
vem[8]='0x0010C7E6' #Minoc butcher
vem[9]='0x0010477D' #Moonglow alchemic
vem[10]='0x0010A2A9' #Moonglow alchemic 2
vem[11]='0x0010A201' #Britain bs
vem[12]='0x0010D340' #Britain bs2
vem[13]='0x00106C5C' #Britain architect
vem[14]='0x00101F70' #Britain armor2
vem[15]='0x00106143' #Britain provisioner
vem[16]='0x001052B0' #Britain jeweler
while not uo.dead()
for k=1 to 16
recall(book1,k)
UO.DeleteJournal()
repeat
wait(500)
SuperWalk(0,0,ven[k])
UO.WaitTargetObject(ven[k])
UO.Useskill('Begging')
#wait(500)
until UO.InJournal("You put the gold") or UO.InJournal("You receive") or (uo.JournalSerial(uo.InJournal("no money")-1))==ven[k]
next
if second==0 then
for j=1 to 16
recall(book2,j)
UO.DeleteJournal()
repeat
wait(500)
SuperWalk(0,0,vem[j])
UO.WaitTargetObject(vem[j])
UO.Useskill('Begging')
#wait(500)
until or UO.InJournal("You put the gold") or UO.InJournal("You receive") or (uo.JournalSerial(uo.InJournal("no money")-1))==vem[j]
next
end if
end if
wend
endsub
#==========================================================
# Recall System
# idrb - runebook id
# nrune - rune number
#----------------------------------------------------------
#---------------------------
# Runebook recall
# reagent use
#---------------------------
sub Recall(idrb,nrune)
Dim gumpreturn[16]
gumpreturn[1]="0x0014"
gumpreturn[2]="0x0016"
gumpreturn[3]="0x0018"
gumpreturn[4]="0x001A"
gumpreturn[5]="0x001C"
gumpreturn[6]="0x001E"
gumpreturn[7]="0x0020"
gumpreturn[8]="0x0022"
gumpreturn[9]="0x0024"
gumpreturn[10]="0x0026"
gumpreturn[11]="0x0028"
gumpreturn[12]="0x002A"
gumpreturn[13]="0x002C"
gumpreturn[14]="0x002E"
gumpreturn[15]="0x0030"
gumpreturn[16]="0x0032"
UO.Recall(idrb,gumpreturn[nrune])
UO.Exec('terminate Reconnector')
wait(5000)
UO.Exec('exec Reconnector')
wait(5000)
Uo.DeleteJournal()
endsub
#==============================================================
# SuperWalk(X,Y,Serial) - char is walking by dX and dY step
# sub using Home, End, PgUp, PgDown keys
# d'not rebind this key from default action!
# walkwait - delay after keypress
#--------------------------------------------------------------
sub SuperWalk(x,y,Target)
VAR i
VAR dir,ldir,rdir,key,olddir
VAR dx,dy,Exit=0
VAR CacheLimit=9,CacheIndex="Text"
DIM CacheX[10], CacheY[10]
CacheX[0]="Test"
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
return
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 ; GoSE
dir=3
ldir=2
rdir=4
key=40 ; DownArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==2 Then ; GoNE
dir=1
ldir=0
rdir=1
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=5
rdir=6
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx>0 AND dy<0 Then ; GoNE
dir=1
ldir=0
rdir=2
key=39 ; RightArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==0 Then ; GoWN
dir=7
ldir=6
rdir=7
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSE
dir=3
ldir=3
rdir=4
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx<0 AND dy>0 Then ; GoSW
dir=5
ldir=4
rdir=6
key=37 ; LeftArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==6 Then ; GoWN
dir=7
ldir=7
rdir=0
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSE
dir=3
ldir=2
rdir=3
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx<0 AND dy<0 Then ; GoWN
dir=7
ldir=6
rdir=0
key=38 ; UpArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==0 Then ; GoNE
dir=1
ldir=1
rdir=2
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=4
rdir=5
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
Endif
If dx<>0 AND dy==0 Then
If dx>0 Then ; GoE
dir=2
key=34 ; PgDown
olddir=UO.GetDir()
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==2 Then ; GoSE
dir=3
ldir=3
rdir=4
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoNE
dir=1
ldir=1
rdir=0
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx<0 Then ; GoW
dir=6
key=36 ; Home key
olddir=UO.GetDir()
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==0 Then ; GoWN
dir=7
ldir=7
rdir=0
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=4
rdir=5
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
Endif
If dx==0 AND dy<>0 Then
If dy>0 Then ; GoS
dir=4
key=35 ; End
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==2 Then ; GoSE
dir=3
ldir=2
rdir=3
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=6
rdir=5
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dy<0 Then ;GoN
dir=0
key=33 ; PgUp
olddir=UO.GetDir()
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==2 Then ; GoNE
dir=1
ldir=1
rdir=2
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoWN
dir=7
ldir=7
rdir=6
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
Endif
Wend
end sub
sub StepEdit(x,y,dir,key)
VAR walkwait=40
VAR ErrLevel=0
If UO.GetDir()<>dir Then
checkstam()
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
checkstam()
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
If x==UO.GetX() AND y==UO.GetY() Then
;zatik
ErrLevel=1
Endif
Endif
Return ErrLevel
end sub
sub StepArrow(x,y,dir,ldir,rdir,key)
VAR walkwait=40
VAR ErrLevel=0
If UO.GetDir()<>dir Then
CheckLag()
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir AND UO.GetDir()<>ldir AND UO.GetDir()<>rdir Then
CheckLag()
Endif
Endif
If UO.GetX()==x AND UO.GetY()==y Then
checkstam()
UO.Press(key)
wait(walkwait)
If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
CheckLag()
If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
; zatik
ErrLevel=1
Endif
Endif
Endif
Return ErrLevel
end sub
#========================================
# Functions
# chechstam()
# checklag()
# reconnector()
#----------------------------------------
sub checkstam()
var refresh = '0x0F0B'
if uo.stamina < 10 then
uo.findtype(refresh,-1,'backpack')
if uo.findcount() then
uo.usetype(refresh)
wait(1000)
else
uo.print("Nety Refreshey! Stoim...")
repeat
wait(500)
until uo.stamina >= 10
endif
else
endif
endsub
sub CheckLag()
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(500)
until UO.InJournal('backpack')
endsub
sub Reconnector()
var ReconnectTime, RFlag
ReconnectTime = '0'
RFlag = 1
Repeat
While (UO.ObjAtLayer('Bpack') == '')
if RFlag Then
ReconnectTime = MakeTime()
RFlag = 0
endif
Wait(20000) # WorldSave Protection
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.LDblClick(357,164)
UO.LClick(616,459)
Wait(3000)
WEnd
Wait(3000)
if (RFlag == 0) and (ReconnectTime <> '0') Then
UO.Exec('terminate Begging')
wait(1000)
UO.Exec('exec Begging')
wait(1000)
UO.TextOpen()
UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
RFlag = 1
ReconnectTime = '0'
endif
Until false
end sub
sub MakeTime()
VAR D, T, Ret, i
Ret = STR(UO.Time())
T = ""
For i = 0 To Len(Ret)
T = Ret[Len(Ret)-i] + T
If (I == 2) OR (I == 4) Then
T = ":" + T
EndIf
Next
Ret = STR(UO.Date())
D = ""
For i = 0 To Len(Ret)
D = Ret[Len(Ret)-i] + D
If (I == 2) OR (I == 4) Then
D = "." + D
EndIf
Next
Ret = T + " @ " + D
RETURN Ret
end sub
Но дело в том,что на нашем серве вендоры перемещаются и могут уйти из магазина на улицу

