Example #1
0
        public static void EnsureArcherAmmo()
        {
            UOItem bolts        = World.Player.Backpack.AllItems.FindType(0x1BFB);
            UOItem quiver       = World.Player.Backpack.AllItems.FindType(0x1EA0, 0x083A);
            bool   requipBolts  = false;
            bool   requipArrows = false;

            if (!bolts.Exist)
            {
                if (quiver.Exist)
                {
                    quiver.Use();
                    Game.Wait(100);
                    bolts       = World.Player.Backpack.AllItems.FindType(0x1BFB);
                    requipBolts = true;
                }
            }


            UOItem arrows      = World.Player.Backpack.AllItems.FindType(0x0F3F);
            UOItem quiverArrow = World.Player.Backpack.AllItems.FindType(0x1EA0, 0x0747);

            if (!arrows.Exist)
            {
                if (quiverArrow.Exist)
                {
                    quiverArrow.Use();
                    Game.Wait(100);
                    arrows       = World.Player.Backpack.AllItems.FindType(0x0F3F);
                    requipArrows = true;
                }
            }

            if (quiver.Exist)
            {
                if (requipBolts)
                {
                    UOItemExtInfo info = ItemHelper.GetItemExtInfo(quiver);
                    World.Player.PrintMessage("[" + info.Charges + " " + info.ChargesName + "]", Game.Val_LightGreen);
                }
                else
                {
                    Game.PrintMessage("Bolts - " + bolts.Amount);
                }
            }

            if (quiverArrow.Exist)
            {
                if (requipArrows)
                {
                    UOItemExtInfo info = ItemHelper.GetItemExtInfo(quiverArrow);
                    World.Player.PrintMessage("[" + info.Charges + " " + info.ChargesName + "]", Game.Val_LightGreen);
                }
                else
                {
                    Game.PrintMessage("Arrows - " + arrows.Amount);
                }
            }
        }
Example #2
0
        public static void kadtokad()
        {
            World.Player.PrintMessage("Vyber zdrojovou kad:", Game.Val_SuperLightYellow);
            UOItem kadFrom = new UOItem(UIManager.Target().Serial);

            World.Player.PrintMessage("Vyber cilovou kad:", Game.Val_SuperLightYellow);
            UOItem kadDo = new UOItem(UIManager.Target().Serial);

            UOItemExtInfo info = ItemHelper.GetItemExtInfo(kadFrom, null);
        }
Example #3
0
        public static void MakeDust(ushort amount, UOColor ingotColor)
        {
            if (!AdaHammer.Exist)
            {
                World.Player.PrintMessage("Nemas kladivo", MessageType.Error);
                return;
            }

            if (!World.Player.FindType(0x1BEF, ingotColor).Exist)
            {
                World.Player.PrintMessage("Nemas Ingoty", MessageType.Error);
                return;
            }

            if (!World.Player.FindType(0x1BEF, ingotColor).Move(amount, World.Player.X, World.Player.Y, World.Player.Z))
            {
                World.Player.PrintMessage("Nepovedl se drop", MessageType.Error);
                return;
            }

            Game.Wait(250);

            UOItem ingot = World.Ground.OrderBy(i => i.Distance).FirstOrDefault(i => i.Graphic == 0x1BEF && i.Color == ingotColor);//.FindType(0x1BEF, ingotColor);

            if (ingot != null && ingot.Distance > 1)
            {
                World.Player.PrintMessage("Ingot moc daleko " + ingot.Distance, MessageType.Error);
                ingot.PrintMessage("Tento!", MessageType.Error);
                return;
            }

            Journal.Clear();

            UO.WaitTargetObject(ingot);
            AdaHammer.Use();

            Journal.WaitForText(true, 500, "Rozbils ingot na kouzelne shardy!");



            Game.Wait(250);

            if (Journal.Contains(true, "at your feet. It is too heavy.."))
            {
                World.Player.PrintMessage("[ too heavy.. ]", MessageType.Warning);
            }

            UOItemExtInfo info = ItemHelper.GetItemExtInfo(AdaHammer);

            Game.PrintMessage("Nabiti kladiva " + info.PlusValue);
        }
Example #4
0
        public void GetRuneCoordinates()
        {
            UO.Print("runa ?");
            UOItem        rune = new UOItem(UIManager.TargetObject());
            UOItemExtInfo info = ItemHelper.GetItemExtInfo(rune);

            string realName = Game.LastEntry.Text;

            if (!realName.ToLower().StartsWith(rune.Name.ToLower()))
            {
                for (int i = Game.EntryHistory.Count - 1; i >= Game.EntryHistory.Count - 5 && i >= 0; i--)
                {
                    if (Game.EntryHistory[i].Text.ToLower().StartsWith(rune.Name.ToLower()))
                    {
                        realName = Game.EntryHistory[i].Text;
                        break;
                    }
                }
            }
            string fullName    = realName;
            string coordinates = realName.Split('(')[1].Split(')')[0];

            UO.Print(realName.Split('(')[1].Split(')')[0]);
        }
Example #5
0
        public static void RefullKade(Serial zdrojBagl, Serial cilBagl, params string[] options)
        {
            List <ItemRequipInfo> infos = ParseInfo <ItemRequipInfo>(options);
            UOItem zdrojKont            = new UOItem(zdrojBagl);

            World.FindDistance = 20;
            if (zdrojKont.Serial == Serial.Invalid && zdrojKont.Serial > 0)
            {
                Game.PrintMessage("Vyber bednu s zdrojem (ESC = Ground):");
                zdrojKont = new UOItem(UIManager.TargetObject());
            }

            UOItem cilKont = new UOItem(cilBagl);

            if (cilKont.Serial == Serial.Invalid)
            {
                Game.PrintMessage("Vyber pytel kam:");
                cilKont = new UOItem(UIManager.TargetObject());
            }


            Game.PrintMessage("Nacitam Itemy ...");
            List <UOItem> items = new List <UOItem>();

            if (zdrojBagl == 0 || !zdrojBagl.IsValidCust() || !zdrojKont.ExistCust())// { World.FindDistance = 8; isGround = true;  }
            {
                items.AddRange(World.Ground.ToArray());
            }
            else
            {
                items = ItemHelper.OpenContainerRecursive(zdrojKont);
            }

            Game.PrintMessage("items ..." + items.Count);

            List <UOItem> bagitems = new List <UOItem>();

            if (ItemHelper.IsInBackpack(cilKont))
            {
                bagitems.AddRange(ItemHelper.OpenContainerRecursive(World.Player.Backpack));
            }
            else
            {
                bagitems.AddRange(ItemHelper.OpenContainerRecursive(cilKont));
            }

            ushort startX = 100;
            ushort startY = 16;

            //ushort currentX = startX;
            //ushort currentY = startY;

            for (int i = 0; i < infos.Count; i++)
            {
                Game.PrintMessage("infos ..." + i);
                ItemRequipInfo info    = infos[i];
                int            minPerc = 80;
                if (info.Amount >= 200)
                {
                    minPerc = 90;
                }

                Potion  potion   = PotionCollection.Potions.GetItemByName(info.Name);
                Graphic kadGra   = potion.Qualities[info.Quality].KadGraphic;
                UOColor kadColor = potion.Qualities[info.Quality].KadColor;

                Game.PrintMessage("kad ..." + kadGra + " / " + kadColor);
                UOItem sourcekad = new UOItem(Serial.Invalid);

                foreach (UOItem item in bagitems)
                {
                    if (item.Graphic == kadGra && item.Color == kadColor)
                    {
                        info.Items.Add(item);
                    }
                }

                foreach (UOItem item in items)
                {
                    if (item.Graphic == kadGra && item.Color == kadColor)
                    {
                        sourcekad = item;
                        break;
                    }
                }

                if (sourcekad.Exist)
                {
                    Game.PrintMessage("info.Items ..." + info.Items.Count);
                    foreach (Serial item in info.Items)
                    {
                        UOItem kad = new UOItem(item);
                        if (String.IsNullOrEmpty(kad.Name))
                        {
                            kad.Click();
                            Game.Wait(Game.SmallestWait);
                        }

                        Game.PrintMessage("Kad OK " + kad.Name);
                        UOItemExtInfo extInfo = ItemHelper.GetItemExtInfo(kad, null);

                        //UOItem from = new UOItem(Serial.Invalid);
                        //UOItem to = new UOItem(Serial.Invalid);

                        if (extInfo.Success)
                        {
                            if (extInfo.Charges < info.Amount)//TODO dodelat pokud je v kadi 90%-+ tak nedolevat?
                            {
                                if (((extInfo.Charges.GetValueOrDefault() / (decimal)info.Amount) * 100) < minPerc)
                                {
                                    //Game.PrintMessage("V kadi je " + String.Format("{0:N1}", ((extInfo.Charges.GetValueOrDefault() / (decimal)info.Amount) * 100)) + "% / "  + minPerc + "% -  " + extInfo.Charges);
                                    int toFill = info.Amount - extInfo.Charges.GetValueOrDefault();

                                    Serial orgiCont = kad.Container;
                                    if (!ItemHelper.IsInBackpack(kad))
                                    {
                                        kad.Move(1, World.Player.Backpack);
                                        Game.Wait();
                                    }

                                    for (int u = toFill; u > 0; u -= 50)
                                    {
                                        UO.WaitTargetObject(kad);
                                        sourcekad.Use();
                                        Game.Wait();
                                    }

                                    if (new UOItem(kad.Serial).Container != orgiCont)
                                    {
                                        kad.Move(1, orgiCont);
                                        Game.Wait();
                                    }

                                    Game.PrintMessage(info.Name + " doplneno " + toFill);
                                }
                                else
                                {
                                    Game.PrintMessage("V kadi je " + ((extInfo.Charges.GetValueOrDefault() / (decimal)info.Amount) * 100) + "% / " + minPerc + "% - " + extInfo.Charges);
                                }
                            }
                            else if (extInfo.Charges > info.Amount + 50)//odlejvat ?? uvidime
                            {
                            }
                        }
                        else
                        {
                            Game.PrintMessage("Kad extInfo FAIL " + kad.Name);
                        }
                    }
                }
                else
                {
                    Game.PrintMessage("Kad " + info.Name + " NENALEZENA.");
                }

                foreach (Serial s in info.Items)
                {
                    UOItem item = new UOItem(s);

                    ushort[] xy = FindEmptySlotCoordinates(cilKont, startX, startY, 165, 8, 16);
                    //if (currentX > 165)
                    //{
                    //  currentX = startX;
                    //  currentY += 16;
                    //}

                    if (item.X != xy[0] && item.Y != xy[1] || item.Container != cilKont.Serial)
                    {
                        item.Move(1, cilKont.Serial, xy[0], xy[1]);
                        Game.Wait(Game.SmallWait);
                    }
                    //currentX += 8;
                }
            }

            Game.PrintMessage("Konec");
        }
Example #6
0
        public static void RefullSperky(Serial zdrojBagl, Serial cilBagl, params string[] options)
        {
            List <ItemRequipInfo> infos = ItemRequip.ParseInfo <ItemRequipInfo>(options);

            UOItem zdrojKont = new UOItem(zdrojBagl);

            if (zdrojKont.Serial == Serial.Invalid)
            {
                Game.PrintMessage("Vyber bednu se Sperkovnicemi:");
                zdrojKont = new UOItem(UIManager.TargetObject());
            }

            UOItem cilKont = new UOItem(cilBagl);

            if (cilKont.Serial == Serial.Invalid)
            {
                Game.PrintMessage("Vyber pytel kam:");
                cilKont = new UOItem(UIManager.TargetObject());
            }

            Game.PrintMessage("Nacitam Sperkovnice ...");
            List <UOItem> items = ItemHelper.OpenContainerRecursive(zdrojKont);

            Dictionary <string, List <UOItem> > htBox = new Dictionary <string, List <UOItem> >();

            foreach (UOItem box in items)
            {
                if (box.Graphic == 0x09A8 && (box.Color == 0x054E || box.Color == 0x049F || box.Color == 0x0796 || box.Color == 0x06FB))// Barva: aktivni 0x054E  , neaktivni 0x049F
                {
                    if (String.IsNullOrEmpty(box.Name))
                    {
                        box.Click();
                        Game.Wait(250);
                    }

                    string name = box.Name + String.Empty;
                    name = name.Replace("an ", "").Replace("a ", "").Trim().ToLower();

                    string fixBugName = String.Empty;
                    if (name == "Great Alabaster Necklace".ToLower())
                    {
                        fixBugName = "Great Alabastr Necklace".ToLower();
                    }

                    if (!htBox.ContainsKey(name))
                    {
                        htBox.Add(name, new List <UOItem>());
                    }

                    if (!String.IsNullOrEmpty(fixBugName) && !htBox.ContainsKey(fixBugName))
                    {
                        htBox.Add(fixBugName, new List <UOItem>());
                    }

                    if (htBox.ContainsKey(fixBugName))
                    {
                        htBox[fixBugName].Add(box);
                    }

                    htBox[name].Add(box);
                }
            }

            List <UOItem> bagitems = new List <UOItem>();

            if (ItemHelper.IsInBackpack(cilKont))
            {
                bagitems.AddRange(ItemHelper.OpenContainerRecursive(World.Player.Backpack));
            }
            else
            {
                bagitems.AddRange(ItemHelper.OpenContainerRecursive(cilKont));
            }

            foreach (ItemRequipInfo info in infos)
            {
                Game.PrintMessage("Count: " + info.Count + " / Amount: " + info.Amount);

                if (info.Items.Count < info.Count)
                {
                    foreach (string alter in info.NameAlternates)
                    {
                        string a = alter.Trim().ToLower();

                        if (info.Items.Count >= info.Count)
                        {
                            break;
                        }

                        if (htBox.ContainsKey(a))
                        {
                            Dictionary <Serial, object[]> originalPositions = new Dictionary <Serial, object[]>();

                            foreach (UOItem box in htBox[a])
                            {
                                if (!originalPositions.ContainsKey(box.Serial))
                                {
                                    originalPositions.Add(box.Serial, new object[3]);
                                }

                                originalPositions[box.Serial][0] = box.X;
                                originalPositions[box.Serial][1] = box.Y;
                                originalPositions[box.Serial][2] = box.Container;

                                if (box.Container != World.Player.Backpack)
                                {
                                    box.Move(1, World.Player.Backpack);
                                    Game.Wait();
                                }

                                if (box.Color == 0x049F || box.Color == 0x0796)
                                {
                                    UO.WaitTargetObject(box);
                                    box.Use();
                                    Game.Wait();
                                }

                                for (int i = info.Items.Count; i < info.Count; i++)
                                {
                                    Journal.Clear();

                                    UO.WaitTargetSelf();
                                    box.Use();

                                    if (Journal.WaitForText(true, 500, "You put the", "Sperkovnice je prazdna"))
                                    {
                                        if (Journal.Contains(true, "Sperkovnice je prazdna"))
                                        {
                                            break;
                                        }
                                        else
                                        {
                                            //Ve sperkovnici nejsou zadna nabiti!
                                            Game.Wait(Game.SmallestWait);

                                            foreach (UOItem item in World.Player.Backpack.Items)
                                            {
                                                if (Jewelry.IsJewelry(item))
                                                {
                                                    UOItemExtInfo extInfo = ItemHelper.GetItemExtInfo(item, a);

                                                    if (extInfo.Success && !info.Items.Contains(item))
                                                    {
                                                        int count  = extInfo.Charges.GetValueOrDefault();
                                                        int amount = info.Amount - count;

                                                        for (int u = amount; u > 0; u -= 2)
                                                        {
                                                            UO.WaitTargetObject(item);
                                                            box.Use();
                                                            if (Journal.WaitForText(true, 500, "Ve sperkovnici nejsou zadna nabiti!"))
                                                            {
                                                                break;
                                                            }
                                                            else
                                                            {
                                                                Game.Wait();
                                                            }
                                                        }

                                                        UOItem itemAfter = new UOItem(item.Serial);
                                                        extInfo = ItemHelper.GetItemExtInfo(itemAfter, a);
                                                        Game.PrintMessage(extInfo.Name + " nabit na + " + (extInfo.Charges.GetValueOrDefault() - count));

                                                        info.Items.Add(itemAfter);
                                                    }
                                                }
                                            }

                                            Game.Wait(Game.SmallestWait);
                                        }
                                    }
                                }

                                if (info.Items.Count >= info.Count)
                                {
                                    break;
                                }
                            }

                            foreach (UOItem box in htBox[a])
                            {
                                if (originalPositions.ContainsKey(box.Serial))
                                {
                                    box.Move(1, (Serial)originalPositions[box.Serial][2], (ushort)originalPositions[box.Serial][0], (ushort)originalPositions[box.Serial][1]);
                                    Game.Wait();
                                }
                            }
                        }
                    }
                }

                foreach (Serial s in info.Items)
                {
                    UOItem item = new UOItem(s);
                    if (item.Container != cilKont.Container || (info.X != 0xFFFF && info.Y != 0xFFFF && (info.X != item.X || info.Y != item.Y)))
                    {
                        item.Move(1, cilKont, (ushort)info.X, (ushort)info.Y);
                        Game.Wait(350);
                    }
                }
                Game.Wait();

                Game.PrintMessage(info.Name + " - " + info.Items.Count);
            }

            Jewelry.SetridSperky(cilKont);

            Game.PrintMessage("Konec");
        }
Example #7
0
        public void CopyKeys(int copiesNum)
        {
            Game.PrintMessage("Vyber kontejner s Blank klici a key ringy:");
            UOItem blankBag = new UOItem(UIManager.TargetObject());

            Game.PrintMessage("Pytlik nebo Key ring k okopirovani:");
            UOItem toCopyBag = new UOItem(UIManager.TargetObject());

            ItemHelper.EnsureContainer(blankBag);

            int blankCount   = blankBag.Items.Count(ItemLibrary.BlankMagicKey.Graphic);
            int keyRingCount = blankBag.Items.Count(ItemLibrary.KeyRing0.Graphic);

            UOItemExtInfo extInfo = ItemHelper.GetItemExtInfo(toCopyBag, null);

            int  toCopyCount     = extInfo.Success ? extInfo.Charges.GetValueOrDefault() : toCopyBag.Items.Count(ItemLibrary.BlankMagicKey.Graphic);
            bool sourceIsKeyRing = false;

            if (keyRingCount < copiesNum)
            {
                Game.PrintMessage("Neni dostatek Key ringu.");
                return;
            }

            if (blankCount < (copiesNum * toCopyCount))
            {
                Game.PrintMessage("Neni dostatek Blank Keys.");
                return;
            }

            List <UOItem> originals    = new List <UOItem>();
            List <Serial> keyRingItems = new List <Serial>();



            if (
                toCopyBag.Graphic == ItemLibrary.KeyRing1.Graphic ||
                toCopyBag.Graphic == ItemLibrary.KeyRing2.Graphic ||
                toCopyBag.Graphic == ItemLibrary.KeyRing3.Graphic)
            {
                sourceIsKeyRing = true;
                List <Serial> saveState = ItemHelper.ContainerState(World.Player.Backpack);
                UO.WaitTargetObject(toCopyBag);
                toCopyBag.Use();
                Game.Wait();

                keyRingItems = ItemHelper.ContainerStateDiff(saveState, ItemHelper.ContainerState(World.Player.Backpack));

                foreach (var ser in keyRingItems)
                {
                    UOItem itm = new UOItem(ser);
                    if (itm.Graphic == ItemLibrary.BlankMagicKey.Graphic && itm.Color == ItemLibrary.BlankMagicKey.Color)
                    {
                        originals.Add(itm);
                    }
                }
            }
            else
            {
                ItemHelper.EnsureContainer(toCopyBag);
                originals.AddRange(toCopyBag.Items.Where(itm => itm.Graphic == ItemLibrary.BlankMagicKey.Graphic && itm.Color == ItemLibrary.BlankMagicKey.Color).ToArray());
            }

            toCopyCount = originals.Count;

            Game.PrintMessage(String.Format("Ke kopirovani: {0}, prazdnych: {1}/{2}", toCopyCount, blankCount, keyRingCount));

            for (int i = 0; i < copiesNum; i++)
            {
                UOItem emptyKeyRing = blankBag.Items.FindType(ItemLibrary.KeyRing0.Graphic);
                if (emptyKeyRing.Move(1, World.Player.Backpack))
                {
                    Game.Wait();

                    foreach (var orig in originals)
                    {
                        UOItem empty = blankBag.Items.FindType(ItemLibrary.BlankMagicKey.Graphic);

                        if (empty.Move(1, World.Player.Backpack))
                        {
                            Game.Wait();
                            UO.WaitTargetObject(empty);
                            orig.Use();
                            Game.Wait();

                            if (empty.Move(1, emptyKeyRing))
                            {
                                Game.Wait();
                            }
                        }
                    }
                }
            }

            if (sourceIsKeyRing)
            {
                Game.PrintMessage("Vracim klice");
                foreach (var ser in keyRingItems)
                {
                    UOItem itm = new UOItem(ser);
                    itm.Move(1, toCopyBag);
                    Game.Wait();
                }
            }

            Game.PrintMessage("KOnec.");
        }
Example #8
0
        public void CopyKeys(int copiesNum)
        {
            Game.PrintMessage("Vyber kontejner s Blank klici a key ringy:");
            UOItem blankBag = new UOItem(UIManager.TargetObject());

            Game.PrintMessage("Pytlik nebo Key ring k okopirovani:");
            UOItem toCopyBag = new UOItem(UIManager.TargetObject());

            Game.PrintMessage("Pytlik kam davat klice:");
            UOItem targetBag = new UOItem(UIManager.TargetObject());

            ItemHelper.EnsureContainer(blankBag);

            int blankCount   = blankBag.Items.Count(ItemLibrary.BlankMagicKey.Graphic);
            int keyRingCount = blankBag.Items.Count(ItemLibrary.KeyRing0.Graphic);

            UOItemExtInfo extInfo = ItemHelper.GetItemExtInfo(toCopyBag, null);

            int  toCopyCount     = extInfo.Success ? extInfo.Charges.GetValueOrDefault() : toCopyBag.Items.Count(ItemLibrary.BlankMagicKey.Graphic);
            bool sourceIsKeyRing = false;

            if (keyRingCount > 0 && keyRingCount < copiesNum)
            {
                Game.PrintMessage("Neni dostatek Key ringu.");
                return;
            }

            if (blankCount < (copiesNum * toCopyCount))
            {
                Game.PrintMessage("Neni dostatek Blank Keys.");
                return;
            }

            List <UOItem> originals    = new List <UOItem>();
            List <Serial> keyRingItems = new List <Serial>();



            if (
                toCopyBag.Graphic == ItemLibrary.KeyRing1.Graphic ||
                toCopyBag.Graphic == ItemLibrary.KeyRing2.Graphic ||
                toCopyBag.Graphic == ItemLibrary.KeyRing3.Graphic)
            {
                sourceIsKeyRing = true;
                List <Serial> saveState = ItemHelper.ContainerState(World.Player.Backpack);
                UO.WaitTargetObject(toCopyBag);
                toCopyBag.Use();
                Game.Wait();

                keyRingItems = ItemHelper.ContainerStateDiff(saveState, ItemHelper.ContainerState(World.Player.Backpack));

                foreach (var ser in keyRingItems)
                {
                    UOItem itm = new UOItem(ser);
                    if (itm.Graphic == ItemLibrary.BlankMagicKey.Graphic && itm.Color == ItemLibrary.BlankMagicKey.Color)
                    {
                        originals.Add(itm);
                    }
                }
            }
            else
            {
                ItemHelper.EnsureContainer(toCopyBag);
                originals.AddRange(toCopyBag.Items.Where(itm => itm.Graphic == ItemLibrary.BlankMagicKey.Graphic && itm.Color == ItemLibrary.BlankMagicKey.Color).ToArray());
            }

            toCopyCount = originals.Count;

            Game.PrintMessage(String.Format("Ke kopirovani: {0}, prazdnych: {1}/{2}", toCopyCount, blankCount, keyRingCount));

            for (int i = 0; i < copiesNum; i++)
            {
                UOItem emptyKeyRing = blankBag.Items.FindType(ItemLibrary.KeyRing0.Graphic);
                if (keyRingCount == 0 || emptyKeyRing.Move(1, World.Player.Backpack))
                {
                    Game.Wait();
                    int counter = 0;
                    foreach (var orig in originals)
                    {
                        string origName = "";
                        if (orig.Container != World.Player.Backpack)
                        {
                            orig.Move(1, World.Player.Backpack);
                            Game.Wait();
                            ItemHelper.EnsureItem(orig);
                        }
                        origName = (orig.Name + String.Empty).Replace("Key to:", "");

                        if (String.IsNullOrEmpty(origName))
                        {
                            origName = "Klicek " + (counter + 1);
                        }

                        UOItem empty = blankBag.Items.FindType(ItemLibrary.BlankMagicKey.Graphic);

                        if (empty.Move(1, World.Player.Backpack))
                        {
                            Game.Wait();
                            UO.WaitTargetObject(empty);
                            orig.Use();
                            Game.Wait();

                            RenameKey(empty, origName);
                            Game.Wait();

                            if (emptyKeyRing.Exist && empty.Move(1, emptyKeyRing))
                            {
                                Game.Wait();
                            }
                            else if (targetBag.Exist && empty.Move(1, targetBag))
                            {
                                Game.Wait();
                            }
                        }
                        counter++;
                    }
                }
            }

            //     Serial: 0x4018E69C  Name: "Key to:calebovo novy"  Position: 62.119.0  Flags: 0x0000  Color: 0x0000  Graphic: 0x1012  Amount: 1  Layer: None Container: 0x4032F802



            if (sourceIsKeyRing)
            {
                Game.PrintMessage("Vracim klice");
                foreach (var ser in keyRingItems)
                {
                    UOItem itm = new UOItem(ser);
                    itm.Move(1, toCopyBag);
                    Game.Wait();
                }
            }
            else
            {
                foreach (var orig in originals)
                {
                    if (orig.Container != toCopyBag.Serial)
                    {
                        orig.Move(1, toCopyBag.Serial);
                        Game.Wait();
                    }
                }
            }

            Game.PrintMessage("KOnec.");
        }
Example #9
0
        public static void PoisonWeapons()
        {
            UOItem kit = World.Player.Backpack.Items.FindType(0x185B, 0x0B8B);

            if (!kit.Exist)
            {
                Game.PrintMessage("Nemas kit!", MessageType.Error);
                return;
            }

            UOItemExtInfo extInfo = ItemHelper.GetItemExtInfo(kit);

            if (extInfo.Charges < 10)
            {
                Game.PrintMessage("Kit ma malo nabiti - " + extInfo.Charges, MessageType.Error);
                return;
            }

            UO.Print("Kontainer se zbranemi >");
            UOItem sourceCont = new UOItem(UIManager.Target().Serial);

            UO.Print("Cilovy kontainer >");
            UOItem targetCont = new UOItem(UIManager.Target().Serial);

            if (!sourceCont.Exist)
            {
                Game.PrintMessage("Kontainer se zbranemi INVALID!", MessageType.Error);
                return;
            }

            if (!targetCont.Exist)
            {
                Game.PrintMessage("Cilovy kontainer INVALID!", MessageType.Error);
                return;
            }

            sourceCont.Use();
            Game.Wait(250);
            targetCont.Use();
            Game.Wait(250);

            List <UOItem> toPoisnList = sourceCont.AllItems.Where(p => p.Color == 0x08A1).ToList();
            int           maxCharges  = extInfo.Charges.GetValueOrDefault() / 10;
            decimal       doneCount   = 0;
            int           failCount   = 0;
            decimal       fizzCount   = 0;

            Game.PrintMessage(String.Format("Poisn Start - Zbrani: {0}, Maxnabiti: {1}.", toPoisnList.Count, maxCharges));

            for (int i = 0; i < toPoisnList.Count; i++)
            {
                bool end = false;

                do
                {
                    Journal.Clear();

                    UOItem toPois = toPoisnList[i];

                    UO.WaitTargetObject(toPois);
                    kit.Use();

                    if (Journal.WaitForText(true, 1000, "Uspesne jsi otravil zbran.", "Bohuzel, nepodarilo se ti otravit zbran.", "Tohle neni ani kad, ani zbran!"))
                    {
                        if (Journal.Contains(true, "Uspesne jsi otravil zbran."))
                        {
                            doneCount++;
                            end = true;
                            toPois.Move(1, targetCont);
                        }
                        else if (Journal.Contains(true, "Bohuzel, nepodarilo se ti otravit zbran."))
                        {
                            fizzCount++;
                        }
                        else
                        {
                            failCount++;
                            end = true;
                        }
                    }
                    else
                    {
                        failCount++;
                        end = true;
                    }

                    Game.Wait();
                } while (!end);

                Game.Wait(1000);
                Game.PrintMessage(String.Format("Otraveno: {0}, Fail: {1}, Uspesnost: {2:N2}%", doneCount, failCount, (doneCount / (doneCount + fizzCount)) * 100));
            }

            Game.PrintMessage(String.Format("Poisn End - Otraveno: {0}, Fail: {1}, Uspesnost: {2:N2}%", doneCount, failCount, (doneCount / (doneCount + fizzCount)) * 100));
        }