Yoko

All sides of Injection
It is currently 2024-03-28 17:57:24

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2015-10-26 12:10:16 
Offline

Joined: 2014-06-03 16:10:29
Posts: 30
Code:
##################
# Black Smithing #
##################
# -- из старого скрипта, который был взят за основу ^^ --
# 21.12.06 .Tested on shard Dragon World
#------------------------------------------------------
# 2014. переделан by Kobol
var clr=38, clo=2524, cly=53, clg=63, clb=3, cla=89, clda=83, clp=120 , clgr=1088, clw=1156
var Sunduk='0x40074B86'
var Bag='0x0E76' # тип мешка
var gold='0x0EED' # Тип денег
var Necklace='0x13EB' # тип продаваемого
var VendorType='0x0191' # тип вендора
var Shop=8 # номер руны в магазин
var Home=5 # номер руны домой
var XSunduk=1033 # координаты перед сундуком
var YSunduk=398 #  координаты перед сундуком
var ShopList='gorget' # Название Shoplist'a в закладке Main-> Buy/Sell.
uo.Set('buydelay','1900') # Задержка на продажу. Мне хватало.
uo.Set('maxsell','5') # Сколько Necklace продаём за раз
uo.Set('finddistance','10')
var x,y,k,m,vendor, Xv, Yv
###################################################
Sub PrintInColor(text,color)
   # см также функцию uo.charprint(color, text)
   #
   # PrintInColor("здесь текст",'цвет текста')
   # красный   - '38' или '0x0026'  # темно-бирюзовый - '83' или '0x0053'
   # оранжевый - '43' или '0x002B'  # голубой    - '89'  или '0x0059'
   # желтый    - '53' или '0x0035'  # синий      - '3'   или '0x0003'
   # зеленый   - '63' или '0x003F'  # фиолетовый - '120' или '0x0078'
   # '1088' - по умолчанию
   # 1152 - бирюзовый 1151 - черный 1155 - фиолетовый 1156 - белый  1158 - кр 1161 - синий 1162 - темно зел 1166 ткр 1169 сз
   # 2500 2524 - оранж  2517 кр 2567 малин 2566=0x0A06 белый
   #  2998 - белый 3008 3221 3600 и выше - контур
   UO.ConColor(color)
   ;UO.Exec('set quiet 0')   # Показывать сообщения Injection.
   UO.Print(text)
   ;UO.Exec('set quiet 1')   # Не показывать сообщения Injection.
   UO.ConColor('1088')
endsub
##########################################################
sub main()
   uo.AddObject('Runebook')
   while uo.Targeting()
      wait(100)
   wend
   Start()
end sub

sub Start()
   BlackSmithingYMD()
end sub

sub BlackSmithingYMD()
   var IngType ;  Type of ignots to smith (0x1BEF)
   var IngColor;  Color of ingots to smith
   var IngName ; Name of ingot
   ;var Item=0x1410 ; Type of a produced item
   var  n, name ,KolvoPAckItems, KolvoItems
   ;var ingi='0x1BEF' ;тип ingi
   Var WeightLimit=700 ; максимальный вес персонажа
   var KolvoIngi ; количество  ингов которые можно забрать в пак
   var InginPack ; количество ингов в паке
   
   UO.Print('Choose ingots container') ; мешок где лежат инги для ковки
   UO.Exec('addobject istok')
   while UO.Targeting()
      wait(200)
   wend
   UO.UseObject('istok')
   
   UO.Print('Choose ingot type') ; выбор ингов для ковки
   UO.Exec('addobject tovar')
   while UO.Targeting()
      wait(100)
   wend
   
   IngType = UO.GetGraphic('tovar')
   IngColor=uo.getcolor('tovar')
   IngName=getname('tovar')
   UO.Print('Ing color='+(IngColor))
   PrintInColor('Ing name='+IngName,IngColor) ; '!!!!!!
   
   ; расчет перекладываемого веса
   if IngColor=="0" and IngType=="0x1BEF" then
      KolvoIngi=Int((WeightLimit -uo.weight)/0.61) ; вес инга железа=0.6
   else
      KolvoIngi=Int((WeightLimit -uo.weight))/0.61 ; вес инга железа=0.6
   end if
   
   UO.FindType('-1','-1','-1') ; сколько вещей в паке изначально
   KolvoPAckItems=uo.GetQuantity('finditem')
   UO.Print('WeightLimit='+str(WeightLimit))
   UO.Print('Char weight='+str(uo.weight))
   UO.Print('Ing kolvo='+str(KolvoIngi))
   UO.Print('KolvoPAckItems='+str(KolvoPAckItems))
   ; перекладываем инги в пак с учетом веса
   UO.FindType(IngType,IngColor,'istok')
   If UO.FindCount() > 0 then ; если инги в мешке есть
      repeat ; цикл по всем ингам контенер <<<<<<<<<<<<<<<<<<<<<<
         UO.MoveItem('finditem',KolvoIngi , 'backpack') ; перемещаем заданное количество в пак
         wait(800)
         CheckLag()
         while not uo.Hidden()
            uo.UseSkill('Hiding')
            wait(3500)
            # начинаем ковать
            ;    uo.FindType(IngType,'-1','backpack')
            uo.FindType(IngType,IngColor,'backpack') ; ищем инги в паке
            InginPack=uo.GetQuantity('finditem')
            PrintInColor('InginPack='+str(InginPack),IngColor) ; '!!!!!!
            UO.Print('backPak FindCount='+str(uo.FindCount()))
            if  uo.FindCount() and (InginPack > 11) then
               repeat ; цикл по ингам в паке ==================
                  uo.DeleteJournal()
                  uo.print('Ing='+str(uo.GetQuantity('finditem')))
                 
                  if IngColor=='0x0000' and IngType=='0x1BEF' then ; # куем железо
                     uo.print('Use Iron!!!')
                     ;UO.WaitMenu('Black','Armor','Armor', 'Armor','Armor','Plate','Plate','Gauntlets') ;Что куем
                     uo.WaitMenu('Black','Armor','Armor','Plate','Plate','gloves') # Change
                     
                  end if
                  if IngName=="Rusty"  then
                     if uo.SkillVal('Blacksmithing',1) > 599 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if IngName=="Old Copper"  then
                     if uo.SkillVal('Blacksmithing',1) > 639 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Copper"  then
                     if uo.SkillVal('Blacksmithing',1) > 719 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Silver"  then
                     if uo.SkillVal('Blacksmithing',1) > 784 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Golden"  then
                     
                     if uo.SkillVal('Blacksmithing',1) > 799 then
                        Gauntlets(IngName) ; +"en"
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Shadow"  then
                     if uo.SkillVal('Blacksmithing',1) > 824 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Rose"  then
                     if uo.SkillVal('Blacksmithing',1) > 849 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Agapite"  then
                     if uo.SkillVal('Blacksmithing',1) > 874 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Blood Rock"  then
                     if uo.SkillVal('Blacksmithing',1) > 899 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Verite"  then
                     if uo.SkillVal('Blacksmithing',1) > 924 then
                        Gauntlets(IngName)
                     else
                        Gloves(IngName)
                     end if
                  end if
                  if  IngName=="Dull Copper" then
                     Gloves2(IngName)
                     
                  end if
                  if  IngName=="Bronze" then
                     Gloves3(IngName)
                  end if
                  uo.UseObject('finditem')
                  wait (100)
                  repeat
                     wait(400)
                  until uo.InJournal('put') || uo.InJournal('fail')
                  wait(100)
                  UO.FindType('-1','-1','backpack') ; сколько всего вещей в паке
                  wait(100)
                  KolvoPAckItems=uo.GetQuantity('finditem')
                  UO.Print('In pack items='+str(KolvoPAckItems))
                  PrintInColor('>>> KolvoPAckItems='+str(uo.FindCount()),clo) ; '!!!!!!
                  if uo.FindCount()>250 then
                     PrintInColor('!!! KolvoPAckItems='+str(uo.FindCount()),clr) ; '!!!!!!
                     RecallShop() ; летим продавать
                     return
                  end if
                  wait(200)
                  uo.FindType(IngType,IngColor,'backpack') ; ищем инги в паке
               until not uo.FindCount() || uo.GetQuantity('finditem') < 12
               ; цикл по ингам в паке ==================
            else
            end if   
            UO.Print('Requare more ings. Take it from container')
            wait(100)
            KolvoIngi=Int((WeightLimit -uo.weight)/0.62) ; вес инга железа=0.6
            UO.Print('WeightLimit='+str(WeightLimit))
            UO.Print('Char weight='+str(uo.weight))
            UO.Print('KolvoIngi='+str(KolvoIngi))
           
            if KolvoIngi<20 then
               
               UO.Print('Ing quantity too small='+str(KolvoIngi))
               ;RecallShop()
               return
            end if
           
            UO.FindType('-1','-1','-1') ; сколько всего вещей в паке
            KolvoPAckItems=uo.GetQuantity('finditem')
            UO.Print('2: KolvoPAckItems='+str(KolvoPAckItems))
            PrintInColor('2: KolvoPAckItems='+str(uo.FindCount()),clo) ; '!!!!!!
            if KolvoPAckItems>254 then
               ;return
               RecallShop() ; летим продавать
               return
            end if
            KolvoItems=(255-KolvoPAckItems)
            UO.Print('Left place for Items='+str(KolvoItems))
            if KolvoIngi>KolvoItems*12 then
               KolvoIngi=KolvoItems*12
               UO.Print('2 -- KolvoIngi='+str(KolvoIngi))
               
            end if
            uo.ignorereset()
            UO.FindType(IngType,IngColor,'istok')
            UO.Print('Container Ing GetQuantity='+str(uo.GetQuantity('finditem')))
            UO.Print('Container Ing FindCount='+str(uo.FindCount()))
         until not uo.FindCount() ; || uo.GetQuantity('finditem') < 11 or
         ; цикл по всем ингам <<<<<<<<<<<<<<<<<<<<<<
         ;RecallShop()
      else
         UO.Print('insufficient ingots in container. Script terminated')
      end if
end sub
############################################################
sub Gauntlets(IngName)
   PrintInColor('Gauntlets Ing name='+IngName,clr) ; '!!!!!!
   uo.cancelmenu()
   wait (50)
   uo.automenu('Blacksmithing','Colored Armor & Weapons')
   wait (50)
   uo.automenu('Colored Armor & Weapons',IngName+' Armor')
   wait (50)
   uo.automenu(IngName+' Armor',IngName+' Plate Armor & Shields')
   wait (50)
   uo.automenu(IngName+' Plate Armor',IngName+' '+'Platemail Gauntlets')
   wait (50)
   checklag()
end sub
############################################################
sub Gloves(IngName)
   PrintInColor('Gloves Ing IngName='+IngName,clr) ; '!!!!!!
   uo.cancelmenu()
   uo.automenu('Blacksmithing','Colored Armor & Weapons')
   uo.automenu('Colored Armor & Weapons',IngName+' Armor')
   uo.automenu(IngName+' Armor' ,IngName+' Ringmail Armor')
   uo.automenu(IngName+' Ringmail Armor',IngName+' Ringmail Gloves (1')
   checklag()
end sub
############################################################
sub Gloves2(IngName)
   PrintInColor('Gloves2 Ing name='+IngName,clr) ; '!!!!!!
   uo.cancelmenu()
   wait (50)
   uo.automenu('Blacksmithing','Colored Armor') ;  & Weapons
   wait (50)
   uo.automenu('Colored Armor & Weapons',IngName+' Armor')
   wait (50)
   uo.automenu(IngName+' Armor & Shields', IngName+' Ringmail')
   wait (50)
   uo.automenu(IngName+' Ringmail',IngName+' '+'Ringmail Gloves')
   wait (50)
end sub

############################################################
sub Gloves3(IngName)
   PrintInColor('Gloves3 Ing name='+IngName,clr) ; '!!!!!!
   uo.cancelmenu()
   wait (50)
   
   uo.automenu('Blacksmithing','Colored Armor & Weapons')
   uo.automenu('Colored Armor & Weapons',Ingname+' Plate Armor')
   uo.automenu(IngName+' Plate Armor',Ingname+' Armor & Shields')
   uo.automenu(Ingname+' Armor & Shields',Ingname+' Ringmail')
   uo.automenu(Ingname+' Ringmail', 'Gloves')
   
   
end sub


############################################################
sub GetItem(type, color, quantity, where , to)
   uo.FindType(type,color,where)
   if uo.FindCount() then
      uo.moveitem('finditem',quantity,to)
      wait(750)
   end if
end sub
############################################################
sub RecallShop()
   x = uo.getX('self')
   y = uo.getY('self')
   Checklag()
   uo.UseObject('Runebook')
   wait(1000)
   uo.LClick(135,Shop*15+55)
   wait(1500)
   k = 0
   while uo.GetX('self') == X and (k<50)
      k = k + 1
      wait(1000)
   wend
   uo.Print('Selling...')
   Sell()
end sub
############################################################
sub RecallHome()
   x = uo.getX('self')
   y = uo.getY('self')
   Checklag() 
   uo.UseObject('Runebook')
   wait(1000)
   uo.LClick(135,Home*15+55)
   wait(1500)
   k = 0
   repeat
      k = k + 1
      wait(1000)
   until uo.GetX('self') <> X || (k>150)
   uo.Print('Get out money...')
   GetOutMoney()
   BlackSmithingYMD()
end sub

sub Checklag()
   uo.Click('backpack')
   repeat
      wait(100)
   until uo.InJournal('backpack')
end sub
###
############################################################
sub test()
   Uo.exec('set norbcheck 1')
   uo.exec('set norbcalc 1')
end sub
#Если Вы попытаетесь продать НПС-вендору несколько стопок вещей (или несколько вещей, которые не складываются в стопки) за один раз при помощи инжекта,
#то вендор скажет Вам, что Вы продаёте всё слишком быстро, а он - тормоз и поэтому не может купить весь Ваш товар сразу. Это связано с тем, что на ДРВ ввели
#задержку 0,3 секунды на продажу итемов, а инжект по умолчанию пытается продать все итемы одновременно. Выставить в инжекте задержку на продажу можно
#командой ,set buydelay X, где Х рассчитывается по формуле: X = 300*K (K - количество вещей, которое Вы продаёте).
#Но я бы посоветовала в рассчётах брать задержку немного побольше - 0,35 сек. Таким образом, если Вы хотите продать, например, 40 итемов,
#то задержка составит: X = 350*40 = 14000, и в клиенте нужно ввести: ,set buydelay 14000 (т.е. эти 40 итемов будут продаваться в течение 14ти секунд).
#При продаже Вам может пригодиться ещё одна команда, которая позволяет задать количество итемов, которые Вы хотите продать: ,set maxsell Y
#(Y - кол-во вещей для продажи)."
############################################################
sub Sell()
   for m = 0 to 1
      uo.FindType(Bag,'-1','bakpack')
      uo.UseObject('finditem')
      wait(750)
      uo.Ignore('finditem')
   next 
   uo.FindType(VendorType,'-1','ground')
   repeat 
      Xv=uo.GetX('finditem')
      Yv=uo.GetY('finditem')
      GotoXY(Xv,Yv)
      Checklag()
   until (uo.GetX('self') == Xv || uo.GetX('self') == Xv -1 || uo.GetX('self') == Xv +1) && (uo.GetY('self') == Yv || uo.GetY('self') == Yv -1 || uo.GetY('self') == Yv +1)
   uo.IgnoreReset()
   uo.FindType(Necklace,'-1','my')
   while uo.FindCount()
      Checklag()
      uo.Sell(ShopList)
      wait(2300)
      uo.FindType(Necklace,'-1','my')
   wend
   RecallHome()
end sub
############################################
sub GotoXY(x,y)
   var myX,myY,lastX=0,lastY=0,i,halt=0,z,r=0
   for i=1 to 60
      myX=uo.getX();
      myY=uo.getY();
      if LastX==myX and LastY==myY then
         halt=halt+1
      else
         halt=0
      end if
      if halt>=10 then
         if uo.GetDir()==1 then
            for z=0 to 8
               uo.Press(40)
            next
         end if
         if uo.GetDir()==3 then
            for z=0 to 8
               uo.Press(37)
            next
         end if
         if uo.GetDir()==5 then
            for z=0 to 8
               uo.Press(38)
            next
         end if
         if uo.GetDir()==7 then
            for z=0 to 8
               uo.Press(39)
            next
         end if
         halt=15
      end if
      if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
         return 1
      end if
      if x<=myX then
         if y<=myY then
            for z=0 to 3
               uo.Press(38)
            next
         else
            for z=0 to 3
               uo.Press(37)
            next
         end if
      else
         if y<=myY then
            for z=0 to 3
               uo.Press(39)
            next
         else
            for z=0 to 3
               uo.Press(40)
            next
         end if
      end if
      lastX=myX
      lastY=myY
      wait(200)
   next
   return 0
end sub

sub Numb(num)
   if num>=0 then
      return num
   else
      return num*(-1)
   end if
end sub
############################################
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub
############################################
sub pereklad()
   #****ДРВ*****#
   # (C) Cooper
   #****v1.0****#
   VAR IngType
   UO.Print('Выбери мешок с ингами')
   UO.Exec('addobject istok')
   while UO.Targeting()
      wait(100)
   wend
   UO.UseObject('istok')
   UO.Print('Выбери ПРИЕМНИК')
   UO.Exec('addobject priem')
   while UO.Targeting()
      wait(100)
   wend
   UO.Print('Выбери ТОВАР')
   UO.Exec('addobject tovar')
   while UO.Targeting()
      wait(100)
   wend
   IngType = UO.GetGraphic('tovar')
   UO.FindType(IngType,'-1','istok')
   If UO.FindCount() > 0 then
     
      repeat
         UO.MoveItem('finditem', '0', 'priem')
         wait(800)
         CheckLag()
         UO.FindType(IngType,'-1','istok')
      until not UO.FindCount()
     
      UO.Print('Закончили...')
   else
      UO.Print('А кидать то нечего...')
   endif
end sub
####################################
sub getname(ingi)
   var n, c, t
   Dim name[27]
   name[1]=''
   name[2]='Rusty'
   name[3]='Old Copper'
   name[4]='Dull Copper'
   name[5]='Bronze'
   name[6]='Shadow'
   name[7]='Rose'
   name[8]='Agapite'
   name[9]='Blood Rock'
   name[10]='Verite'
   name[11]='Valorite'
   name[12]='Mytheril'
   name[13]='Black Rock'
   name[14]='Obsidian'
   name[15]='Plutonium'
   name[16]='Vulcan'
   name[17]='Aqua'
   name[18]='Eldar'
   name[19]='Elvin'
   name[20]='Acid'
   name[21]='Steel'
   name[22]='Sand Rock'
   name[23]='Blood Crest'
   name[24]='Gorgan'
   name[25]='Krynite'
   name[26]='Crystaline'
   name[27]='Dragon'
   Dim col[27]
   col[1]='0x0000'
   col[2]='0x0750'
   col[3]='0x0590'
   col[4]='0x060A'
   col[5]='0x0488'
   col[6]='0x096B'
   col[7]='0x0014'
   col[8]='0x0193'
   col[9]='0x04C2'
   col[10]='0x07D5'
   col[11]='0x00CE'
   col[12]='0x052D'
   col[13]='0x0455'
   col[14]='0x0028'
   col[15]='0x08AF'
   col[16]='0x09DA'
   col[17]='0x0060'
   col[18]='0x0BA7'
   col[19]='0x09E6'
   col[20]='0x09B9'
   col[21]='0x09D3'
   col[22]='0x008F'
   col[23]='0x09EC'
   col[24]='0x09F0'
   col[25]='0x010F'
   col[26]='0x09A4'
   col[27]='0x0085'
   Dim typ[3]
   typ[1]='0x1BE3'
   typ[2]='0x1BF5'
   typ[3]='0x1BE9'
   Dim nam[3]
   nam[1]='Copper'
   nam[2]='Silver'
   nam[3]='Golden'
   t=uo.getgraphic(ingi)
   c=uo.getcolor(ingi)
   for n=1 to 3
      if typ[n]==t then
         return nam[n]
      endif
   next
   for n=2 to 27
      if col[n]==c then
         return name[n]
      endif
   next
endsub

sub GetOutMoney()
   GotoXY(XSunduk,YSunduk)
   while not uo.Hidden()
      uo.UseSkill('Hiding')
      wait(3500)
   wend
   Checklag() 
   uo.FindType(gold,'-1','backpack')
   while uo.FindCount()
      uo.moveitem('finditem','all',Sunduk)
      wait(750)
      uo.FindType(gold,'-1','backpack')
   wend
   uo.FindType(Bag,'-1','backpack')
   while uo.FindCOunt()
      uo.moveitem('finditem','all',Sunduk)
      wait(750)
      uo.FindType(Bag,'-1','backpack')   
   wend 
end sub


все норм работает но после продажи нада все опять указивать (сундук где инги и сами инги).
как зделать чтобы он ковал, летал продавал пока не закончатся инги
помогите плиз и ли может есть аналогичный скрипт !!!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited