///////////////////////////////////////////////////////////////////////// // // www.ultima.smoce.net // Name: Skywawk Shrink // ///////////////////////////////////////////////////////////////////////// using System; using System.Collections.Generic; using System.Text; using Phoenix; using Phoenix.WorldData; using System.Linq; using Phoenix.Communication; using Phoenix.Runtime; using Phoenix.Runtime.Reflection; namespace Script.shrink.dp.skywawk { public class ruznellll { [Executable] public void sdsH() { UOCharacter skyptak = new UOCharacter(World.Ground.FindType(0x0005, 0x0000)); UO.AddObject("ptacek_ohnivacek", skyptak); UOCharacter character = new UOCharacter(World.Player.Serial); character.Print(0x0553, "{0} [{1}]", character.Name, character.MaxHits); } [Command] public static void Shirink() { ushort skyhawk_g = 0x0005; ushort skyhawk_c = 0x0847; ushort shrinkly_g = 0x211D; ushort shrinkly_c = 0x0847; bool nearby = true; UOCharacter character = new UOCharacter(World.Player.Serial); UOCharacter ch = nearby ? find_skyhawk(skyhawk_g, skyhawk_c) : new UOCharacter(UIManager.TargetObject()); if (!ch.Exist) ScriptErrorException.Throw("Skyhawk neni v dosahu!"); if (UO.Count(0x13F4, 0x076B) >= 1 & UO.Count(0x1843, 0x0724) >= 1) { UO.DeleteJournal(); UO.WaitTargetType(0x1843, 0x0724); UO.UseType(0x13F4, 0x076B); while (!UO.InJournal("Hul nabita!")) { UO.Wait(200); } UO.Wait(200); if (World.Player.Layers[Layer.LeftHand].Exist) { UO.MoveItem(World.Player.Layers[Layer.LeftHand].Serial, 1, World.Player.Backpack, 25, 90); } } else { if (UO.Count(0x1843, 0x0724) >= 1) { if (World.Player.Backpack.AllItems.Count(0x0F0E) > 0) { World.Player.ChangeWarmode(WarmodeChange.Switch); UO.WaitTargetObject(World.Player.Backpack.AllItems.FindType(0x0F0E)); UO.UseType(0x1843, 0x0724); UO.Print("Shirink nalitej!"); UO.Wait(200); } else { UO.Print("Nemas lahvicky."); } UO.Wait(50); } } if (ch.Exist) {//pokud existuje if (World.Player.Layers[Layer.LeftHand].Exist) { UO.MoveItem(World.Player.Layers[Layer.LeftHand].Serial, 1, World.Player.Backpack, 25, 90); } if ((UO.Count(0x13F4, 0x096D) >= 1) || (UO.Count(0x0F09, 0x045E) >= 1)) { // hul nebo shirink if (UO.Count(0x13F4, 0x096D) >= 1) {// hul if (World.Player.Layers[Layer.LeftHand].Exist) { UO.MoveItem(World.Player.Layers[Layer.LeftHand].Serial, 1, World.Player.Backpack, 25, 90); } UO.WaitTargetObject(ch.Serial); UO.UseType(0x13F4, 0x096D); UO.Wait(100); UOItem shirinklepresuns = World.Ground.FindType(shrinkly_g, shrinkly_c); if (shirinklepresuns.Exist) { UO.MoveItem(shirinklepresuns.Serial, 1, World.Player.Backpack); } character.Print(0x0481, "Shirinknuto!"); } if (UO.Count(0x0F09, 0x045E) >= 1) {//shirink UOItem Shirinkw = World.Player.Layers.FindType(0x0F09, 0x045E); UO.MoveItem(Shirinkw, 1, World.GetCharacter(ch.Serial)); UO.Wait(50); UOItem shirinklepresun = World.Ground.FindType(shrinkly_g, shrinkly_c); UO.MoveItem(shirinklepresun.Serial, 1, World.Player.Backpack); character.Print(0x0481, "Shirinknuto!"); } } else { character.Print(0x0481, "Nemas cim shirinknout !"); } UO.Wait(100); UOItem shirinklepresunssa = World.Ground.FindType(shrinkly_g, shrinkly_c); if (shirinklepresunssa.Exist) { UO.MoveItem(shirinklepresunssa.Serial, 1, World.Player.Backpack); } } } private static UOCharacter find_skyhawk(ushort graphic, ushort color) { UOCharacter output = new UOCharacter(Serial.Invalid); foreach (UOCharacter ch in World.Characters) if (ch.Model == graphic & ch.Color == color) if (ch.Distance < 3 && ch.Distance < output.Distance) output = ch; return output; } } }