Example #1
0
        //---------------------------------------------------------------------------------------------

        public void MoveKlamakNext(int direction)
        {
            if (PossibleKlamaks.Count > 0)
            {
                if (selectedKlamak == null)
                {
                    this.SelectedKlamakSet = PossibleKlamaks[0];
                }
                else
                {
                    int index = 0;

                    for (int i = index; i < PossibleKlamaks.Count; i++)
                    {
                        if (PossibleKlamaks[i].Graphic == this.selectedKlamak.Graphic && PossibleKlamaks[i].Color == selectedKlamak.Color)
                        {
                            index = i + 1;
                            break;
                        }
                    }

                    if (index > PossibleKlamaks.Count - 1)
                    {
                        index = 0;
                    }

                    this.SelectedKlamakSet = PossibleKlamaks[index];
                }
            }
            else
            {
                World.Player.PrintMessage("Nejsou klamaci");
            }
        }
Example #2
0
        //---------------------------------------------------------------------------------------------

        public static bool IsSummon(UOCharacter ch)
        {
            bool result = false;

            if (ch.Renamable || Game.IsMob(ch.Serial) || Rename.IsMobRenamed(ch.Serial))
            {
                result = true;
            }

            if (!result)
            {
                foreach (IUOItemType itemType in ItemLibrary.PlayerSummons)
                {
                    if (itemType.Graphic == ch.Model && itemType.Color == ch.Color)
                    {
                        if (ItemLibrary.IsMonsterConflictSummon(ch))
                        {
                            UOItemType conflictType = ItemLibrary.GetMonsterConflictSummon(ch);
                            string     safeName     = ch.Name + String.Empty;
                            string     defaultName  = (conflictType.Name + String.Empty).Replace(" ", "").ToLower();
                            string     compareName  = (ch.Name + String.Empty).Replace(" ", "").ToLower();


                            if (!String.IsNullOrEmpty(compareName))
                            {
                                if (conflictType.Names.Count > 0)
                                {
                                    foreach (string nameAlter in conflictType.Names)
                                    {
                                        defaultName = (nameAlter + String.Empty).Replace(" ", "").ToLower();
                                        if (compareName.Contains(defaultName))
                                        {
                                            return(false);
                                        }
                                    }
                                }
                                else
                                {
                                    result = !compareName.Contains(defaultName);
                                }
                            }
                        }
                        else
                        {
                            result = true;
                        }

                        break;
                    }
                }
            }

            return(result);
        }
Example #3
0
        //---------------------------------------------------------------------------------------------

        public static bool IsItemType(this UOItem obj, UOItemType type)
        {
            return(type.Is(obj));
        }
Example #4
0
        //---------------------------------------------------------------------------------------------


        public static void RefullKlamaky(Serial aboxbedna, Serial targetbedna, params string[] options)
        {
            List <ItemRequipInfo> infos = ParseInfo <ItemRequipInfo>(options);

            UOItem targetCont = new UOItem(aboxbedna);

            if (targetCont.Serial == Serial.Invalid)
            {
                Game.PrintMessage("Vyber bednu s Animal boxy:");
                targetCont = new UOItem(UIManager.TargetObject());
            }

            UOItem targetBag = new UOItem(targetbedna);

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

            Game.PrintMessage("Nacitam Animal boxy ...");
            List <UOItem> items = ItemHelper.OpenContainerRecursive(targetCont);

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

            foreach (UOItem box in items)
            {
                if (box.Graphic == 0x09A8)//abox
                {
                    if (String.IsNullOrEmpty(box.Name))
                    {
                        box.Click();
                        Game.Wait(250);
                    }

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

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

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

            Game.PrintMessage("Nalezeno " + htBox.Keys.Count + " Animal boxu");
            List <UOItem> bagitems = new List <UOItem>();

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

            foreach (ItemRequipInfo info in infos)
            {
                foreach (string alter in info.NameAlternates)
                {
                    string a = alter.Trim().ToLower();

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

                    foreach (UOItem item in bagitems)
                    {
                        if (String.IsNullOrEmpty(item.Name))
                        {
                            item.Click();
                            Game.Wait(Game.SmallestWait);
                        }

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

                        if (name == a && ItemLibrary.ShrinkKlamaci.Contains(item.Graphic) && !info.Items.Contains(item))
                        {
                            info.Items.Add(item);
                        }
                        else
                        {
                            UOItemType foundType = null;
                            foreach (UOItemType shrinK in ItemLibrary.ShrinkKlamaci)
                            {
                                if (a == shrinK.Name.ToLower() && shrinK.Graphic == item.Graphic && shrinK.Color == item.Color)
                                {
                                    foundType = shrinK;
                                    break;
                                }
                            }

                            if (foundType != null && !info.Items.Contains(item))
                            {
                                info.Items.Add(item);
                            }
                        }
                    }
                }

                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;

                                box.Move(1, World.Player.Backpack);
                                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", "Box je prazdny"))
                                    {
                                        if (Journal.Contains(true, "Box je prazdny"))
                                        {
                                            break;
                                        }
                                        else
                                        {
                                            Game.Wait();
                                        }
                                    }
                                }

                                foreach (UOItem item in World.Player.Backpack.Items)
                                {
                                    if (String.IsNullOrEmpty(item.Name))
                                    {
                                        item.Click();
                                        Game.Wait(Game.SmallestWait);
                                    }

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

                                    if (name == a && ItemLibrary.ShrinkKlamaci.Contains(item.Graphic) && !info.Items.Contains(item))
                                    {
                                        info.Items.Add(item);
                                    }
                                }

                                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 != targetBag.Container || (info.X != 0xFFFF && info.Y != 0xFFFF && (info.X != item.X || info.Y != item.Y)))
                    {
                        item.Move(1, targetBag, (ushort)info.X, (ushort)info.Y);
                        Game.Wait(350);
                    }
                }

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

            Game.PrintMessage("Konec");
        }
Example #5
0
        public void MakeWire(int quantity)
        {
            decimal itemMake = 0m;
            decimal itemFail = 0m;

            Journal.Clear();

            Game.PrintMessage("Jaky >");
            UOItem type          = new UOItem(UIManager.TargetObject());
            UOItem containerFrom = new UOItem(type.Container);

            Game.PrintMessage("Bagl do >");
            UOItem containerTo = new UOItem(UIManager.TargetObject());

            UOItemType t = new UOItemType();

            t.Graphic = type.Graphic;
            t.Color   = type.Color;

            type.Click();
            Game.Wait();

            String name = (type.Name + String.Empty).ToLower().Replace("ingot", "").Trim();

            name = name[0].ToString().ToUpper() + name.Substring(1, name.Length - 1).ToLower();

            Game.PrintMessage("" + name + " Wire");

            string[] menus = new string[] { "Tinkering", "Wires", "Wires", name + " Wire" };

            while (!UO.Dead && itemMake < quantity)
            {
                if (!World.Player.Backpack.Items.FindType(t.Graphic, t.Color).Exist)
                {
                    containerFrom.Items.FindType(t.Graphic, t.Color).Move(100, World.Player.Backpack);
                    Game.Wait();

                    if (World.Player.Backpack.Items.FindType(0x1876).Exist)
                    {
                        World.Player.Backpack.Items.FindType(0x1876).Move(10000, containerTo);
                        Game.Wait();
                    }

                    if (World.Player.Backpack.Items.FindType(0x1877).Exist)
                    {
                        World.Player.Backpack.Items.FindType(0x1877).Move(10000, containerTo);
                        Game.Wait();
                    }

                    if (World.Player.Backpack.Items.FindType(0x1878).Exist)
                    {
                        World.Player.Backpack.Items.FindType(0x1878).Move(10000, containerTo);
                        Game.Wait();
                    }

                    if (World.Player.Backpack.Items.FindType(0x1879).Exist)
                    {
                        World.Player.Backpack.Items.FindType(0x1879).Move(10000, containerTo);
                        Game.Wait();
                    }
                }

                UO.UseType(0x1EBC, 0x0000);
                UO.WaitMenu(menus);

                Journal.WaitForText(true, 8000, "You have failed to make anything", "You can't make anything", "You put", "Tinkering failed");
                if (Journal.Contains("You put"))
                {
                    itemMake++;
                }
                else
                {
                    itemFail++;
                }

                if (Journal.Contains("You can't make anything"))
                {
                    Game.PrintMessage("Nemas suroviny");
                    break;
                }


                decimal okDivide = (itemMake / (itemMake + itemFail));
                decimal okPerc   = okDivide * 100;

                Game.PrintMessage("Ks: " + itemMake + "/" + (itemMake + itemFail) + " - " + String.Format("{0:n} %", okPerc));


                Journal.Clear();
            }
        }