Yoko
http://forum.yoko.com.ua/

Black Smithing
http://forum.yoko.com.ua/viewtopic.php?f=20&t=17419
Page 1 of 1

Author:  kobol [ 2014-03-22 23:55:47 ]
Post subject:  Black Smithing

Вариант скрипта на Black Smithing.
Ковка от железа до верита, все что покупают вендоры NPC с целью прокачки и зарабатывания ГП.
Работа - Таргет на сундук с ингами, потом таргет на слиток из которого ковать.
Скрипт рассчитывает нужное количество ингов с учетом предельного веса и переносит их в пак.
Куются Gauntlets и Ring Gloves. При их ковке уменьшается вес, поэтому еще добираются инги. Когда количество в паке становится равным 255, чар летит к кузнецу продавать накованное. Там и остается стоять с деньгами.

На DRW проблема с Dull Copper и Bronze, ковать через меню Platemail не получается, куется всегда Ringmail.
Остальные металлы кует и то и другое с учетом скила BS.

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
###################################################
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 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=745 ; максимальный вес персонажа
   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()
         # начинаем ковать
         ;    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()>254 then
                  PrintInColor('!!! KolvoPAckItems='+str(uo.FindCount()),clr) ; '!!!!!!
                  GoSell() ; летим продавать
                  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))
            ;GoSell()
            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
            GoSell() ; летим продавать
            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
      ; цикл по всем ингам <<<<<<<<<<<<<<<<<<<<<<
      ;GoSell()
   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 GoSell()
   ;-- GO --
   rekol()
   sellvendor()
end sub
############################################################
sub rekol()
   var sFlg
   uo.findtype ('0x1F14','0x0000','backpack') ; 0x1F14 0x1F15 - кверх ногами справа налево  0x1F16 кверх ногами слева направо 0x1F17
   if uo.FindCount() then
      sFlg=1
      Uo.Exec("cast 'Recall' finditem")
   else
   end if
   if sFlg==1 then
   goto ret
   end if

   uo.findtype ('0x1F14','0x0000','backpack') ; 0x1F14 0x1F15 - кверх ногами справа налево  0x1F16 кверх ногами слева направо 0x1F17
   if uo.FindCount() then
   sFlg=1
      Uo.Exec("cast 'Recall' finditem")
   else
   end if
   if sFlg==1 then
   goto ret
   end if
   
   uo.findtype ('0x1F14','0x0000','backpack') ; 0x1F14 0x1F15 - кверх ногами справа налево  0x1F16 кверх ногами слева направо 0x1F17
   if uo.FindCount() then
      sFlg=1
      Uo.Exec("cast 'Recall' finditem")
   else
   end if
   if sFlg==1 then
      goto ret
   end if

   uo.findtype ('0x1F14','0x0000','backpack') ; 0x1F14 0x1F15 - кверх ногами справа налево  0x1F16 кверх ногами слева направо 0x1F17
   if uo.FindCount() then
      sFlg=1
      Uo.Exec("cast 'Recall' finditem")
   else
   end if
   
   uo.concolor('0x09DA')
   uo.charprint('0x09DC','Rune not found !!!! ')
   uo.concolor('0x09A4')
   
   ret:
   wait(8000) ; !!! добавлено!!!
   test()
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 sellvendor()
   var vendor=""
   var MyMoney
   MyMoney=UO.Gold
   uo.set('buydelay','3500')
   uo.set('maxsell','10')
   UO.DeleteJournal()
   repeat
      MyMoney=UO.Gold
      ;PrintInColor("MyMoney="+str(MyMoney), clg)
      uo.sell('gorget',vendor)
      wait (3800)
      ;PrintInColor("new UO.Gold="+str(UO.Gold), clw)
   until  MyMoney == UO.Gold
   uo.say('bye')
endsub
############################################
sub CheckLag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
############################################
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



Page 1 of 1 All times are UTC+02:00
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/