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"); }