Code: ############################################################################################ ### ### ### Alchemy / Алхимия ### ### Шард Dragon World ### ### v2.85 ### ### ### ### Автор Corwin ### ### ### ### Тестирование Euronimus ### ### ### ############################################################################################
############################################################################################ ### Глобальные переменные ### #############################
## к скрипту Alchemy var BottleType='0x0F0E' ## - тип пустой бутылки var BottleNumber=100 ## - количество бутылок, забираемое из сундука за раз var BottleMinNumber=0 ## - минимальное количество бутылок, которое надо оставить в сундуке var DoEating=1 ## 1 - включить потребление еды, 0 - отключить var FoodType='0x097B' ## - тип еды, которую будем есть (fish steaks) var BagType='0x0E76' ## - тип мешка для складывания вещей var MaxWeight=700 ## - максимальный вес в рюкзаке var MaxNumber=500 ## - максимальное количество делаемых вещей в рюкзаке и для заполнения одного мешка var Reconnect=0 ## 1 - включить реконнект на сервер, если выкинет, 0 - отключить реконнект var UseBags=0 ## 1 - использовать раскладывание делаемых бутылок по мешкам var UseHide=0 ## 1 - включить уход в хайд во время крафта, 0 - отключить var UseHeal=0 ## 1 - включить лечение в хайд во время крафта, если здоровье падает, 0 - отключить
############################################################################################ ### Код скрипта ### ###################
# Формат вызова процедуры алхимии для получения нужного снадобья # Sub Alchemy('тип реагента 1', 'тип реагента 2', 'тип реагента 3', 'название снадобья в меню крафта', # 'цвет бутылки с готовым снадобьем', количество реагента 1 для одного крафта, # количество реагента 2 для одного крафта, количество реагента 3 для одного крафта)
sub Agility() Alchemy("0x0F7B", "", "", "Agility", "0x0489", 1, 0, 0) end sub
sub GreaterAgility() Alchemy("0x0F7B", "", "", "Greater Agility", "0x0489", 3, 0, 0) end sub
sub LesserCure() Alchemy("0x0F84", "", "", "Lesser Cure", "0x09A6", 1, 0, 0) end sub
sub Cure() Alchemy("0x0F84", "", "", "Cure", "0x09A6", 3, 0, 0) end sub
sub GreaterCure() Alchemy("0x0F84", "", "", "Greater Cure", "0x09A6", 6, 0, 0) end sub
sub LesserHeal() Alchemy("0x0F85", "", "", "Lesser Heal", "0x09BB", 1, 0, 0) end sub
sub Heal() Alchemy("0x0F85", "", "", "Heal", "0x09BB", 3, 0, 0) end sub
sub GreaterHeal() Alchemy("0x0F85", "", "", "Greater Heal", "0x09BB", 7, 0, 0) end sub
sub NightSight() Alchemy("0x0F8D", "", "", "Nightsight", "0x0B9D", 1, 0, 0) end sub
sub LesserPoison() Alchemy("0x0F88", "", "", "Lesser Poison", "0x0998", 1, 0, 0) end sub
sub Poison() Alchemy("0x0F88", "", "", "Poison", "0x0998", 2, 0, 0) end sub
sub GreaterPoison() Alchemy("0x0F88", "", "", "Greater Poison", "0x0998", 3, 0, 0) end sub
sub DeadlyPoison() Alchemy("0x0F88", "", "", "Deadly Poison", "0x0998", 8, 0, 0) end sub
sub Refresh() Alchemy("0x0F7A", "", "", "Refresh", "0x0997", 1, 0, 0) end sub
sub TotalRefresh() Alchemy("0x0F7A", "", "", "Total Refresh", "0x0997", 5, 0, 0) end sub
sub Strength() Alchemy("0x0F86", "", "", "Strength", "0x0482", 2, 0, 0) end sub
sub GreaterStrength() Alchemy("0x0F86", "", "", "Greater Strength", "0x0482", 5, 0, 0) end sub
sub Shrink() Alchemy("0x0F78", "", "", "Shrink", "0x0388", 10, 0, 0) end sub
sub Invisibility() Alchemy("0x0F91", "", "", "Invisibility", "0x0631", 4, 0, 0) end sub
sub ManaRefresh() Alchemy("0x0F87", "", "", "Mana", "0x09DF", 3, 0, 0) end sub
sub TotalManaRefresh() Alchemy("0x0F87", "", "", "Total Mana", "0x09DF", 6, 0, 0) end sub
sub Clever() Alchemy("0x0F81", "", "", "Clever", "0x0482", 1, 0, 0) end sub
sub GreaterClever() Alchemy("0x0F81", "", "", "Greater Clever", "0x0482", 2, 0, 0) end sub
sub Bless() Alchemy("0x0F81", "0x0F86", "0x0F7B", "Bless", "0x09C5", 1, 1, 1) end sub
sub GreaterBless() Alchemy("0x0F81", "0x0F86", "0x0F7B", "Greater Bless", "0x09C5", 2, 5, 3) end sub
sub Steelskin() Alchemy("0x0F84", "0x0F85", "0x0F86", "Steelskin", "0x0962", 1, 1, 2) end sub
sub Stoneskin() Alchemy("0x0F84", "0x0F85", "0x0F86", "Stoneskin", "0x0964", 1, 1, 1) end sub
sub LavaBomb() Alchemy("0x0F8F", "", "", "Lava Bomb", "0x09DA", 1, 0, 0) end sub
#sub RuneBook() # Alchemy("0x1F4C", "0x0E34", "0x0F80", "0x0F90", "Runebook", "0x0510", 50, 50, 50, 50) #end sub # ############################################################################################ ### Процедуры поддержки ### ###########################
Sub Alchemy(Reagent1, Reagent2, Reagent3, Potion, BottleColor, ReagentNumber1, ReagentNumber2, ReagentNumber3)
var Exit, AllExit=0, CExit=0, k, findnumber var BottleInChest=0 var ReagentNumber=0 var CurrentBag var tmp
UO.Exec ('set distance 2') uo.Exec('set finddistance 3') UO.UnSetReceivingContainer() UO.DeleteJournal() UO.CancelMenu() uo.AutoMenu('What sort of potion do you want to', Potion)
SetObjects() uo.IgnoreReset()
Open('ChestFrom') Open('ChestFrom2') Open('ChestTo')
if Reconnect==1 then uo.Exec('exec Reconnect') endif
while not uo.Dead() and not (AllExit==1) and not (CExit==1) uo.DeleteJournal() Exit=0
if (UseBags==1) then uo.SetReceivingContainer('backpack')
CheckLag() uo.print('Выбираем пустой мешок') uo.findtype(BagType,'-1','backpack') wait(100) if uo.findcount()<=0 then while Exit==0 uo.findtype(BagType,'-1','ChestFrom') wait(100) if uo.findcount()>0 then CurrentBag=uo.GetSerial('finditem') Open(CurrentBag) uo.findtype('-1','-1',CurrentBag) wait(100) if uo.findcount()>0 then uo.Ignore(CurrentBag,'on') else uo.grab('0',CurrentBag) wait(1000) uo.IgnoreReset() Exit=1 endif else uo.print('Пустые мешки закончились, скрипт остановлен') uo.IgnoreReset() Exit=1 CExit=1 endif wend else CurrentBag=uo.getserial('finditem') endif
wait(1000) uo.UnSetReceivingContainer('backpack') Exit=0 else CurrentBag=uo.getserial('ChestTo') endif
while (Exit==0) and (CExit==0) if UseHeal == 1 then ToHeal() endif if UseHide == 1 then ToHide() endif
CheckLag() uo.findtype(BottleType,'0x0000','ChestFrom') wait(100) if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<0) then BottleInChest=0 else BottleInChest=uo.GetQuantity('finditem') endif
CheckLag() uo.findtype(BottleType,'0x0000',uo.GetSerial('backpack')) wait(100) if (uo.findcount()<=0) or (uo.GetQuantity('finditem')<1) then if (BottleInChest-BottleMinNumber)<BottleNumber then MoveItems(BottleType,'0x0000',str((BottleInChest-BottleMinNumber),0),'ChestFrom',uo.GetSerial('backpack')) else MoveItems(BottleType,'0x0000',str(BottleNumber,0),'ChestFrom',uo.GetSerial('backpack')) endif endif
if Reagent1<>'' then CheckLag() uo.findtype(Reagent1,'0x0000',uo.GetSerial('backpack')) wait(100) ReagentNumber = uo.GetQuantity('finditem') if (uo.findcount()<=0) or (ReagentNumber<ReagentNumber1) then MoveItems(Reagent1,'0x0000',str((ReagentNumber1*BottleNumber-ReagentNumber),0),'ChestFrom2',uo.GetSerial('backpack')) endif endif
if Reagent2<>'' then CheckLag() uo.findtype(Reagent2,'0x0000',uo.GetSerial('backpack')) wait(100) ReagentNumber = uo.GetQuantity('finditem') if (uo.findcount()<=0) or (ReagentNumber<ReagentNumber2) then MoveItems(Reagent2,'0x0000',str((ReagentNumber2*BottleNumber-ReagentNumber),0),'ChestFrom2',uo.GetSerial('backpack')) endif endif
if Reagent3<>'' then CheckLag() uo.findtype(Reagent3,'0x0000',uo.GetSerial('backpack')) wait(100) ReagentNumber = uo.GetQuantity('finditem') if (uo.findcount()<=0) or (ReagentNumber<ReagentNumber3) then MoveItems(Reagent3,'0x0000',str((ReagentNumber3*BottleNumber-ReagentNumber),0),'ChestFrom2',uo.GetSerial('backpack')) endif endif
CheckLag() if (uo.Count(BottleType)<=0) or ((BottleInChest-BottleMinNumber)<BottleNumber) then uo.Print('Скрипт работу заканчивает') Exit=1 AllExit=1 endif if (Reagent1<>'') then if (uo.Count(Reagent1)<ReagentNumber1) and (AllExit<>1) then uo.Print('Скрипт работу заканчивает') Exit=1 AllExit=1 endif endif if (Reagent2<>'') then if (uo.Count(Reagent2)<ReagentNumber2) and (AllExit<>1) then uo.Print('Скрипт работу заканчивает') Exit=1 AllExit=1 endif endif if (Reagent3<>'') then if (uo.Count(Reagent3)<ReagentNumber3) and (AllExit<>1) then uo.Print('Скрипт работу заканчивает') Exit=1 AllExit=1 endif endif
if AllExit<>1 then k=0 uo.DeleteJournal() CheckLag() uo.UseType(Reagent1,'0x0000') while not UO.InJournal('You put the') and not UO.InJournal('You toss the failed') and (k<200) wait(100) k=k+1 wend if (uo.Weight>=MaxWeight) or (uo.Count(BottleType,BottleColor)>=MaxNumber) then Exit=1 endif endif wend
if CExit==0 then CheckLag() MoveItems(BottleType,BottleColor,'0',uo.GetSerial('backpack'),CurrentBag)
if (UseBags==1) then CheckLag() uo.SetReceivingContainer('ChestTo') uo.Grab('0',CurrentBag) wait(1000) uo.UnSetReceivingContainer('ChestTo') endif endif
if DoEating==1 then CheckLag() Eating() endif wait(3000) wend
uo.Print('Скрипт Alchemy остановлен') end sub
##########
Sub SetObjects()
UO.Print('Выберите сундук-источник с пустыми бутылками, пустыми мешками и едой: ') UO.Exec('addobject ChestFrom') While UO.Targeting() Wait(100) Wend
UO.Print('Выберите сундук-источник с реагентами: ') UO.Exec('addobject ChestFrom2') While UO.Targeting() Wait(100) Wend
UO.Print('Выберите сундук-приемник: ') UO.Exec('addobject ChestTo') While UO.Targeting() Wait(100) Wend
end sub # SetObjects
##########
Sub CheckLag()
while (uo.ObjAtLayer('Bpack')=='') wait(1000) wend if UO.Waiting() then UO.CancelTarget() endif uo.DeleteJournal() uo.Click('backpack') repeat wait(50) until uo.InJournal('backpack')
end sub # CheckLag
##########
Sub MoveItems(ItemType,ItemColor,ItemQuantity,FromContainer,ToContainer)
var CurrentQuantity, flag=true
CheckLag() uo.SetReceivingContainer(ToContainer)
uo.FindType(ItemType,ItemColor,FromContainer) wait(100) CurrentQuantity=uo.GetQuantity('finditem') ## кол-во предметов в найденной стопке
while (uo.FindCount()>0) and (flag==true) ## если что-то нашли и еще не все нужное переместили CheckLag() if val(ItemQuantity)<=CurrentQuantity then ## если переместить нужно все или меньше, чем в стопке uo.Grab(ItemQuantity,'finditem') ## перемещаем всю стопку или заданное кол-во wait(500) if ItemQuantity=='0' then ## если переместить надо все CheckLag() uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку wait(100) CurrentQuantity=uo.GetQuantity('finditem') else ## если уже переместили нужное кол-во - выход из процедуры flag=false endif else ## если переместить нужно не все, но больше, чем в найденной стопке uo.Grab('0','finditem') ## перемещаем всю стопку wait(500) ItemQuantity=str((val(ItemQuantity)-CurrentQuantity),0) ## вычисляем, сколько еще нужно CheckLag() uo.FindType(ItemType,ItemColor,FromContainer) ## ищем следующую стопку wait(100) CurrentQuantity=uo.GetQuantity('finditem') endif wend
uo.UnSetReceivingContainer(ToContainer)
end sub # MovingItems
##########
Sub Eating()
var flag=true
MoveItems(FoodType,'-1','10','ChestFrom',uo.GetSerial('backpack'))
repeat uo.DeleteJournal() uo.FindType(FoodType,'-1',uo.GetSerial('backpack')) wait(100) if uo.FindCount()>0 then CheckLag() uo.UseType(FoodType) repeat wait(100) until uo.InJournal('full') or uo.InJournal('stuffed') or uo.InJournal('hungry') or uo.InJournal('satiated') or uo.Dead() wait(1000) else flag=false endif until uo.InJournal('too full') or uo.Dead() or (flag==false)
MoveItems(FoodType,'-1','0',uo.GetSerial('backpack'),'ChestFrom')
end sub # Eating
##########
Sub Open(Container)
CheckLag() uo.UseObject(Container) wait(3000)
end sub # Open
##########
Sub Reconnect()
var ReconnectTime,rFlag
ReconnectTime='0' rFlag=1 repeat while (uo.ObjAtLayer('Bpack')=='') if rFlag then ReconnectTime=Time() rFlag=0 endif wait(20000) 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.TextOpen() uo.TextPrint(ReconnectTime+' | Потеря связи с сервером, повторное подсоединение') rFlag=1 ReconnectTime='0' endif until false
end sub # Reconnect
##########
Sub Time()
var hh,mm,ss,hms,t=str(uo.Time())
if len(t)<=2 then hh="0" mm="0" ss=t endif
if len(t)==3 then hh="0" mm=left(t,len(t)-2) ss=right(t,len(t)-1) endif
if len(t)==4 then hh="0" mm=left(t,len(t)-2) ss=right(t,len(t)-2) endif
if len(t)==5 then hh=left(t,len(t)-4) hms=left(t,len(t)-2) mm=right(hms,len(hms)-1) ss=right(t,len(t)-3) endif
if len(t)==6 then hh=left(t,len(t)-4) hms=left(t,len(t)-2) mm=right(hms,len(hms)-2) ss=right(t,len(t)-4) endif
return hh+":"+mm+":"+ss
end sub # Time
##########
Sub ToHide() while not uo.Hidden() uo.Print('Пытаемся уйти в хайд...') CheckLag() uo.UseSkill('Hiding') repeat wait(200) until uo.InJournal('have hidden') or uo.InJournal('seem to hide') wait(100) wend end sub # ToHide
##########
Sub ToHeal() var k while uo.Life < (uo.Str-10) CheckLag() uo.BandageSelf() k=0 repeat Wait(100) k=k+1 until UO.InJournal("You put") or UO.InJournal("barely help") or UO.InJournal("don't need") or k>300 wend end sub # ToHeal
держи фулл алхимия.
|