Script:Veterinary.boo
Z AmonWiki
Jazyk: Boo
Shard: Dark Paradise
Tréning veteriny na zvířatech, ovládání, healování, hlídaní.
Script podporuje až 4 zvířata (technicky jich může být neomezeně, ale začnete pak lagovat server = toužíte po jailu).
Po spuštění vás script nechá vybrat zvířata. Musí jich být sudý počet. Pokud chcete jen dvě (pro nižší skill bohatě stačí), na třetí target zmáčkněte escape (nebo targetněte nejakou blbost).
Script se ukončí pokud dojdou bandy nebo vám něco ublíží (musíte mít plné HP).
Zvířata proti sobě script poštve přes All Kill v párech. Jestliže je nějaké zvíře na umření, script všechny zastaví a dohealuje ho. Sám pak pokračuje.
Pozn: Bandy musíte mít přímo v batohu.
Nemakrujte AFK!!!
namespace Scripts.DarkParadise import System import System.Linq.Enumerable import System.Collections.Generic import Phoenix import Phoenix.WorldData import System.Threading class Veterinary: static final BandagesType as ushort = 0x0E21 static final HitsCritical = 45 private def SelectMob(name) as UOCharacter: UO.Print("Vyber ${name} zvire:") mob = UOCharacter(UIManager.TargetObject()) if not mob.Exist or not mob.RequestStatus(5000) or not mob.Renamable: UO.PrintWarning('Neplatny target.') return null return mob [Executable('veterinary')] [BlockMultipleExecutions] public def Train(): // Select animals mobs = List[of UOCharacter]() for i in range(4): m = SelectMob(i + 1) if m is null and (i % 2) > 0: raise ScriptErrorException('Nelze mit lichy pocet zviratek.') if m is null: break if mobs.Contains(m): raise ScriptErrorException('Nemuzes vybrat stejne zvire 2x.') mobs.Add(m) if mobs.Count == 0: raise ScriptErrorException('Nevybral jsi zadne zvire!') UO.Print("Vybrano ${mobs.Count} zvirat pro trening.") // Validate names names = List[of string]() for i in range(0, mobs.Count): n = mobs[i].Name.ToLowerInvariant() if names.Contains(n): raise ScriptErrorException('Zvirata maji stejne jmeno, prosim prejmenujte je.') names.Add(n) // Show status bars //for m in mobs: // UO.Exec('statusbar', m.Serial) // Spust hlidace run = true target_sync = object() watchman_func = def(): try: lastAttack = DateTime() i = 0 interval = TimeSpan.FromSeconds(8 / mobs.Count) while run and World.Player.Hits >= World.Player.MaxHits: noattack = false // Kontrola hp for mob in mobs: if mob.Hits < HitsCritical: // Zastav je UO.Say('All Stop') UO.Wait(5000) noattack = true if not noattack and (DateTime.Now - lastAttack) > interval: lastAttack = DateTime.Now mob1 = mobs[i] mob2 = mobs[i + 1] // Posli je do utoku lock target_sync: r1 = UO.WaitTargetObject(mob2.Serial) UO.Say(mob1.Name + ' Kill') if not r1.Wait(8000): UO.PrintWarning('Kill command timeout.') continue UO.Wait(400) lock target_sync: r2 = UO.WaitTargetObject(mob1.Serial) UO.Say(mob2.Name + ' Kill') if not r2.Wait(8000): UO.PrintWarning('Kill command timeout.') continue UO.Wait(400) // Increment i = (i + 2) % mobs.Count else: // Jinak cekej UO.Wait(200) except ex as ThreadAbortException: UO.Print('Watchman thread aborted.') except e as Exception: UO.PrintError('Unhandled exception in watchmam thread.') UO.PrintError(e.Message) ensure: run = false watchman = Thread(watchman_func) watchman.IsBackground = true watchman.Start() // Zde je samotny script try: // Start loop while run: bandy = UO.Backpack.Items.FindType(BandagesType, 0) if bandy.Amount < 2: UO.PrintError('Dosli bandy!') break if World.SunLight > 0: UO.Cast(StandardSpell.NightSight, Aliases.Self) UO.Wait(3000) // Koho lecit? h = mobs.OrderBy({s as UOCharacter | cast(single, s.Hits) / cast(single, s.MaxHits)}).First() // Ma to vubec cenu? if h.Hits >= h.MaxHits: UO.PrintInformation('Nothing to do.') UO.Wait(500) continue // Lecime Journal.Clear() lock target_sync: t = UO.WaitTargetObject(h.Serial) bandy.Use() if not t.Wait(8000): UO.PrintWarning('Bandages target timeout.') UO.Wait(2400) Journal.WaitForText(true, 5000, 'bloody bandages', 'apply the bandages', 'Chces vytvorit', 'Cancelled', 'the target', 'wait', 'battle', 'frozen', 'vylecil', 'state') if Journal.Contains(true, 'battle', 'frozen'): UO.Say('All Stop') UO.RunCmd('speak', 'Help! Someone is attacking you!') break run = false watchman.Join(2000) ensure: try: if watchman.IsAlive: watchman.Abort() except : pass // Finalize UO.Say('All Stop') UO.RunCmd('speak', 'Veterinary script stopped.')