Code: Select all
var EQ,RQ1,RQ2,QB
var Eat='0x097B' ; Type Åäà (Ðûáà)
var Res1='0x0F88' ; Type Ðåñóðñ 1 (Ðåã)
var Res2='0x0F0E' ; Type Ðåñóðñ 2 (Áóòûëêà)
var Kit='0x0E9B' ; Type Èíñòðóìåíòà êðàôòà (Ñòóïêà)
var Items='0x0F0A' ; Type Âûõîäíîãî ìàòåðèàëà
EQ=50 ; Êîëè÷åñòâî åäû
RQ1=200 ; Êîëè÷åñòâî ðåñóðñà 1
RQ2=100 ; Êîëè÷åñòâî ðåñóðñà 2
;|---------------------------------|
;| Îïèñàíèå ïåðåìåííûõ êîíòåéíåðîâ |
;|---------------------------------|
var ContainerRes='0x4032A7CA' ; Object Êîíòåéíåð ñ ðåñóðñàìè
var ContainerBag='0x4058E631' ; Object Êîíòåéíåð ñ ñóìêàìè
var BagCount='0x0E76' ; Type ñóìîê â êîíòåéíåðå ContainerBag
sub Main()
uo.Set('quiet','1')
uo.Exec('exec Craft')
uo.IgnoreReset()
end sub
sub OpenBag()
var i,BagID
uo.UseObject(ContainerBag)
uo.UseObject(ContainerRes)
uo.IgnoreReset()
repeat
uo.DeleteJournal()
wait(1000)
uo.FindType(BagCount,'-1',ContainerBag)
if uo.FindCount('finditem') > 1 then
i=(uo.FindCount('finditem') +1)
uo.Click('finditem')
if uo.InJournal("a bag") Then
BagID=uo.JournalSerial(uo.InJournal("a bag")-1)
uo.SetJournalLine(uo.InJournal("a bag")-1,"")
uo.FindType(Items,'-1',BagID)
uo.UseObject(BagID)
wait(2000)
uo.Hide(BagID)
uo.Ignore(BagID,'on')
end if
end if
i=(i-1)
until i==0
uo.Hide(ContainerBag)
uo.Hide(ContainerRes)
uo.Resend()
wait(3000)
uo.IgnoreReset()
end sub
sub Craft()
var Last=0,LastTimer
OpenBag()
While not uo.Dead()
;|-----------------------------------|
;| Search of resources and Take them |
;|-----------------------------------|
uo.FindType(Eat,'-1','me')
if uo.GetQuantity('finditem')<1 then
uo.FindType(Eat,'-1',ContainerRes)
if uo.GetQuantity('finditem')>1 then
ToTake(3)
else
uo.Exec('Terminate Craft')
end if
else
ToEat()
end if
uo.FindType(Res1,'-1','me')
if uo.GetQuantity('finditem')<45 then
uo.FindType(Res1,'-1',ContainerRes)
if uo.GetQuantity('finditem')>1 then
ToTake(1)
else
uo.Exec('Terminate Craft')
end if
end if
uo.FindType(Res2,'-1','me')
if uo.GetQuantity('finditem')<1 then
uo.FindType(Res2,'-1',ContainerRes)
if uo.GetQuantity('finditem')>1 then
ToTake(2)
else
uo.Exec('Terminate Craft')
end if
end if
;|-------------|
;| Craft Items |
;|-------------|
uo.DeleteJournal()
uo.WaitTargetType(Res1)
uo.UseType(Kit)
uo.WaitMenu ('what sort of potion','Poison') ; Íàçâàíèå ÊðàôòÌåíþ1(Cloth),ÏîäÌåíþ2(Shirts) -> ÊðàôòÌåíþ2(Shirts),ÏîäÌåíþ2(Robe)
LastTimer=UO.Timer()
repeat
wait(100)
until uo.InJournal("You put") or uo.InJournal("Alchemy") or LastTimer+150<uo.Timer()
UnLoadItem()
wend
end sub
sub ToTake(i)
var G,F
if i==1 then
G=RQ1
F=Res1
end if
if i==2 then
G=RQ2
F=Res2
end if
if i==3 then
G=EQ
F=Eat
end if
uo.FindType(F,'-1',ContainerRes)
if uo.GetQuantity('finditem')>1 then
uo.Grab(''+str(G)+'','finditem')
uo.DeleteJournal()
repeat
uo.FindType(F,'-1','me')
wait(1500)
until uo.InJournal("That is too") or uo.GetQuantity('finditem') > 1
end if
end sub
sub ToEat()
uo.UseType(Eat)
end sub
sub UnLoadItem()
var BagID
var i=0
var m=0
repeat
uo.DeleteJournal()
uo.FindType(BagCount,'-1',ContainerBag)
uo.Click('finditem')
m=0
repeat
wait(1000)
until uo.InJournal("a bag")
if uo.InJournal("a bag") Then
BagID=uo.JournalSerial(uo.InJournal("a bag")-1)
uo.SetJournalLine(uo.InJournal("a bag")-1,"")
uo.FindType('-1','-1',BagID)
if uo.FindCount('finditem')<50 then
m=uo.FindCount('finditem')
uo.SetReceivingContainer(BagID)
uo.FindType(Items,'-1','me')
uo.Grab('0','finditem')
uo.ConColor('0x0021')
uo.Set('quiet','0')
uo.Print(uo.Print('In BagPack#'+Str(i+1)+' items '+Str(m)+''))
uo.Set('quiet','1')
uo.ConColor('0x0035')
wait(1000)
uo.UnSetReceivingContainer()
else
i=i+1
uo.Ignore(BagID, 'on')
end if
end if
if i==QB then
uo.IgnoreReset()
i=0
end if
uo.FindType(Items,'-1','me')
until uo.FindCount('finditem') < 1
end sub