Yoko

All sides of Injection
It is currently 2025-10-14 20:43:54

All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 

Нужен ли универсальный крафтовый модуль?
Да! 86%  86%  [ 6 ]
Нет! 14%  14%  [ 1 ]
Нужен но такого уже навалом! 0%  0%  [ 0 ]
Ты щаз с кем говоришь? 0%  0%  [ 0 ]
Total votes: 7
Author Message
PostPosted: 2011-05-15 00:02:02 
Offline
User avatar

Joined: 2009-05-28 09:58:28
Posts: 2802
Location: Иваново
Давно блуждала в голове мысль унифицироваться крафты. Сегодня посидел, почеркал, чтото получилось, чтото неочень. Хочу спросить присутствующих читателей - нужен ли крафт-универсал в котором прописав одну строку можно набрать сырья, накрафтить тонны продукции, вести логирование, есть, спать, ходить по нужне и прочее, прочее... Или все таки лучше иметь отдельные модули для крафта каждого предмета?

Набросок универсального крафта выглядит примерно так:

Code:
VAR Container   = '0x40B5267F'   ;айрон, рыба, инструменты, может быть равен Sunduk 1
VAR Sunduk1   = '0x40B5267F'      ;пустые мешки
VAR Sunduk2   = '0x40B52599'      ;полные
VAR Instrum   = '0x1EBC'      ;набор жестянщика
VAR hammer   = '0x13E3'      ;кузнечный молоток
VAR saw      = '0x1034'      ;пила
VAR Ing      = '0x1BEF'      
VAR log      = '0x1BDD'   
VAR key      = '0x1010'      
VAR Lock   = '0x14FB'      
VAR Bottle   = '0x0F0E'      
VAR Dagger   = '0x0F51'      
VAR club   = '0x13B3'      
VAR Bow      = '0x13B1'      #лук#
VAR spool   = '0x0FA0'      #нитки#
VAR Сap      = '0x171C'      #колпак#
VAR cloth   = '0x175D'      #ткань#
VAR Skit   = '0x0F9D'      #швейный набор#
VAR Deed    = '0x14EF'
VAR Meshok    = '0x0E76'      ;тип мешка
var havka   = '0x097B'
VAR MeshSer, d, LastTimer, timemove, itemM, i
var quantity = 150; количество предметов в 1 мешке
var msg ='You put|положили|fail|не удалось|You broke|сломали'
var printcolour = '1069'
VAR HIDE = 1; если 1 прячемся, если 0 нет.
###################
sub TinkKey()
   var menu = "waitmenu 'Tinkering' 'Keys' 'Keys' 'Iron key'"
   var item = key
   var speek_item = 'Ключей'
   open_cont()
   WHILE NOT UO.Dead()
      craft_one(menu, item, speek_item, 1, 0) ; меню, тип предмета, название предмета, брать ли железо для крафта, брать ли дерево для крафта.
   wend
end sub
###################
sub TinkerLockpicks()
   var menu = "waitmenu 'Tinkering' 'Tools' 'Tools' 'lockpick'"
   var item = Lock
   var speek_item = 'Отмычек'
   open_cont()
   WHILE NOT UO.Dead()
      craft_stack(menu, item, speek_item, 1, 1)
   WEND
end sub
###################
sub TinkerBottle()
   var menu = "waitmenu 'Tinkering' 'Tools' 'Tools' 'Empty bottle'"
   var item = Bottle
   var speek_item = 'Бутылок'
   open_cont()
   WHILE NOT UO.Dead()
      craft_stack(menu, item, speek_item, 1, 0)
   WEND
end sub
###################
Sub craft_one(menu, item, speek_item, iron, logs)
   UO.CancelMenu()
   UO.FindType( Meshok, '-1', Sunduk1 )
   MeshSer = UO.GetSerial( 'finditem' )
   UO.MoveItem( MeshSer, 0, Sunduk2 )
   checklag()
   uo.useobject( MeshSer )
   eat()
   REPEAT
      if iron==1 then
         GET('железа', ing, Container, 1, 100)
      endif
      if logs==1 then
         GET('дров', log, Container, 1, 100)
      endif
      GET('Инструментов', Instrum, Container, 2, 2)
      Repeat
         Hide()
         UO.DeleteJournal()
         LastTimer=UO.Timer()
         UO.exec( menu )
         UO.Usetype( Instrum )
         repeat
            wait( 300 )
         until UO.InJournal( msg ) or UO.Timer()>LastTimer+150
      Until UO.Count( item ) > 0
      checklag()
      PUT( item, MeshSer )
      UO.FindType( item, -1, MeshSer )
      uo.charprint(printcolour,speek_item+' в мешке: '+Str( UO.FindCount()))
   UNTIL UO.FindCount()>=quantity
   uo.charprint(printcolour,'Берем другую сумку')
   wait( 300 )
end sub
###################
Sub craft_stack(menu, item, speek_item, iron, logs)
   if iron==1 then
      GET('железа', ing, Container, 1, 100)
   endif
   if logs==1 then
      GET('дров', log, Container, 1, 100)
   endif
   GET('инструментов', Instrum, Container, 2, 2)
   Hide()
   UO.DeleteJournal()
   LastTimer=UO.Timer()
   Repeat
      UO.DeleteJournal()
      LastTimer=UO.Timer()
      UO.exec( menu )
      UO.Usetype( Instrum )
      repeat
         wait( 100 )
      until UO.InJournal( msg ) or UO.Timer()>LastTimer+150
   Until UO.Count( item ) > 0
   checklag()
   PUT(item, Container)
   UO.FindType( item, -1, Container)
   uo.charprint(printcolour,speek_item+' в сундуке: '+Str(UO.GetQuantity('finditem')))
end sub
Sub open_cont()
   DIM ID[4]
   ID[0]='0xFFFFFFFF'
   ID[1]=Container
   ID[2]=Sunduk1
   ID[3]=Sunduk2
   for i=1 to 3
      if ID[i]<>ID[i-1] then
         UO.Useobject( ID[i] )
         timemove=UO.Timer()
         while uo.GetSerial('lastcontainer')<>ID[i] && timemove+20>UO.Timer()
            UO.Useobject( ID[i] )
            wait(100)
         wend
      endif
   next
end sub
Sub eat()
   GET('рыбы',havka, Container, 1, 20)
   REPEAT
      UO.DeleteJournal()
      LastTimer=UO.Timer()
      UO.findtype(havka,-1,'backpack')
      If UO.FindCount() > 0 Then
         UO.Useobject('finditem')
         wait(200)
      Else
         uo.charprint(printcolour, 'кончилась рыба' )
         return 0
      end if
   Until UO.InJournal("simply too full to eat|stuffed!|think|found|Вы ничего не можете") OR UO.Timer()>LastTimer+200
   PUT(havka, Container)
end sub
Sub GET(name_item, type, cont, min, max) ; предмет, откуда, минимум, сколько брать
   If UO.Count( type ) < min Then
      UO.FindType( type, '-1', cont )
      if UO.FindCount() > 0 Then
         uo.charprint(printcolour,'Сырья в сундуке: '+Str(UO.GetQuantity('finditem')) ) 
         itemM=UO.GetSerial('finditem')
         timemove=UO.Timer()
         while UO.ContainerOf(itemM)==cont && timemove+20>UO.Timer()
            uo.moveitem('finditem', max, 'backpack')
            wait(300)
         wend
      else
         uo.charprint(printcolour,'Нет '+name_item)
         UO.CancelMenu()
         MyTerminate()
      endif
   Endif
end sub
Sub PUT(item, cont)
   while UO.Count( item ) > 0
      UO.FindType( item, -1, -1 )
      itemM=UO.GetSerial('finditem')
      timemove=UO.Timer()
      UO.MoveItem( 'finditem', 0, cont )
      while UO.ContainerOf(itemM)=='my' && timemove+20>UO.Timer()
         wait(300)
      wend
   wend
end sub
Sub Hide()
   VAR LastTimer, n=0, HidFlag=1
   if UO.Hidden() then
      HidFlag=0
   else
   end if
   while HidFlag
      DeleteJournal("can't seem to hide|to perform|stop trying|прекратили|не удалось|удачно|You have hidden yourself well")
      LastTimer=UO.Timer()
      UO.WarMode(0)
      UO.UseSkill('Hiding')
      repeat
         wait(50)
      until UO.InJournal("can't seem to hide|to perform|stop trying|прекратили|не удалось|удачно|You have hidden yourself well") || LastTimer+50<UO.Timer()
      if UO.InJournal("0xA5F8|удачно|You have hidden yourself well") then
         HidFlag=0
      else
         n=n+1
         if n>3 then
            UO.Set('quiet','0')
            uo.charprint(printcolour,'Спрятаться не получается!')
            UO.Set('quiet','1')
            MyTerminate()
         end if
      end if
   wend
end sub
Sub DeleteJournal(msg)
   While UO.InJournal(msg)
      UO.SetJournalLine(UO.InJournal(msg) - 1,'')
   wend
endsub
Sub MyTerminate()
   UO.Set('quiet','1')
   UO.CancelMenu()
   UO.IgnoreReset()
   UO.Set('quiet','0')
   UO.Exec('terminate all')
end sub
Sub checklag()
   DeleteJournal("ackpack")
   UO.Click("backpack")
   repeat
      wait(100)
   until UO.InJournal("ackpack")
end sub



То же самое только в отдельных модулях (без дополнительных функций):

Code:
sub TinkKey()
   var menu = "waitmenu 'Tinkering' 'Keys' 'Keys' 'Iron key'"
   var item = key
   UO.CancelMenu()
   WHILE NOT UO.Dead()
      UO.FindType( Meshok, '-1', Sunduk1 )
      MeshSer = UO.GetSerial( 'finditem' )
      UO.MoveItem( MeshSer, 0, Sunduk2 )
      checklag()
      uo.useobject( MeshSer )
      eat()
      REPEAT
         GET(ing, Container, 20, 100)
         GET(Instrum, Container, 2, 2)
         Repeat
            Hide()
            UO.DeleteJournal()
            LastTimer=UO.Timer()
            UO.exec( menu )
            UO.Usetype( Instrum )
            repeat
               wait( 300 )
            until UO.InJournal( msg ) or UO.Timer()>LastTimer+150
         Until UO.Count( item ) > 0
         checklag()
         PUT( item, MeshSer )
         UO.FindType( item, -1, MeshSer )
         uo.charprint(printcolour,'Ключей в мешке: '+Str( UO.FindCount()))
      UNTIL UO.FindCount()>=quantity
      uo.charprint(printcolour,'Берем другую сумку')
      wait( 300 )
   wend
end sub
###################
sub TinkerLockpicks()
   var menu = "waitmenu 'Tinkering' 'Tools' 'Tools' 'lockpick'"
   var item = Lock
   UO.CancelMenu()
   WHILE NOT UO.Dead()
      GET(ing, Container, 1, 100)
      GET(log, Container, 1, 100)
      GET(Instrum, Container, 2, 2)
         Hide()
      UO.DeleteJournal()
      LastTimer=UO.Timer()
      Repeat
         UO.DeleteJournal()
         LastTimer=UO.Timer()
         UO.exec( menu )
         UO.Usetype( Instrum )
         repeat
            wait( 100 )
         until UO.InJournal( msg ) or UO.Timer()>LastTimer+150
      Until UO.Count( item ) > 0
      checklag()
      PUT(item, Container)
      UO.FindType( item, -1, Container)
      uo.charprint(printcolour,'Отмычек в банке: '+Str(UO.GetQuantity('finditem')))
   WEND
end sub
###################
sub TinkerBottle()
   var menu = "waitmenu 'Tinkering' 'Tools' 'Tools' 'Empty bottle'"
   var item = Bottle
   WHILE NOT UO.Dead()
      GET(ing, Container, 10, 100)
      GET(Instrum, Container, 2, 2)
         Hide()
      UO.DeleteJournal()
      LastTimer=UO.Timer()
      Repeat
         UO.DeleteJournal()
         LastTimer=UO.Timer()
         UO.exec( menu )
         UO.Usetype( Instrum )
         repeat
            wait( 100 )
         until UO.InJournal( msg ) or UO.Timer()>LastTimer+150
      Until UO.Count( item ) > 0
      checklag()
      PUT(item, Container)
      UO.FindType( item, -1, Container)
      uo.charprint(printcolour,'Банок в банке: '+Str(UO.GetQuantity('finditem')))
   WEND
end sub


Или все это полуночный бред? :mrgreen:

_________________
Image
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"
Стрелялка для олдов.


Top
   
PostPosted: 2011-05-15 02:21:40 
Offline
User avatar

Joined: 2009-03-21 10:03:06
Posts: 165
Location: Одесса-Мама
Идея хорошая. Если нужна помощь, обращайся :wink:

_________________
Спасибо всем, у кого учился!

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


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 2 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:  
Powered by phpBB® Forum Software © phpBB Limited