public void LootGround(LootType lootType, bool lootAll) { //List<UOItem> searchItems = new List<UOItem>(); List <UOItem> ground = new List <UOItem>(); ground.AddRange(World.Ground.ToArray()); List <UOItem> search = new List <UOItem>(); int done = 0; int toDo = 0; int bodies = 0; List <Serial> bpkState = ItemHelper.ContainerState(World.Player.Backpack); foreach (UOItem item in ground) { if (item.Graphic == 0x2006) { bodies++; if (cutedBodies.Contains(item.Serial)) { done++; } else { toDo++; if (item.Distance <= 6) { search.Add(item); } } } } for (int i = 0; i < search.Count; i++)//(UOItem item in search) { UOItem item = search[i]; Game.PrintMessage(String.Format("Try Loot Body [{0}/{1}]", i + 1, search.Count), Game.Val_LightGreen); if (!item.Opened) { Journal.Clear(); item.Use(); if (Journal.WaitForText(true, 250, "You can't reach that")) { UO.PrintObject(item.Serial, Game.Val_LightGreen, "[Can't reach]"); continue; } } List <UOItem> items = new List <UOItem>(); items.AddRange(item.Items.ToArray()); bool hasLootBag = items.Count(si => si.Graphic == 0x0E76 && si.Color == 0x049A) > 0; if (!hasLootBag) { foreach (UOItem bag in items.Where(b => b.Graphic == 0x0E76)) { if (String.IsNullOrEmpty(bag.Name)) { bag.Click(); Game.Wait(175); if ((bag.Name + String.Empty).ToLower().StartsWith("loot")) { hasLootBag = true; break; } } } } //Notepad.WriteLine("LootManual: " + item.Description); //Notepad.WriteLine("LootManual hasLootBag: " + hasLootBag); //Notepad.WriteLine("LootManual items: " + items.Count); //return; if (hasLootBag || lootAll || item.Distance <= 1) //item.Items.FindType(0x0E76, 0x049A).Exist)// lootbag { UO.PrintObject(item.Serial, Game.Val_LightGreen, "[Looting...]"); if (DwarfKnife.Exist && (hasLootBag || item.Distance <= 1) && !lootAll)//TODO predelat nejak jinak, ted kvuly tamingu aby to nelotovalo maso a kuze { toDo--; done++; foreach (UOItem lootItem in items) { if (Loot.IsLootItem(lootItem)) { lootItem.Move(65000, LootBag); Game.Wait(300); } } DwarfKnife.Use(); UO.WaitTargetObject(item); Game.Wait(350); items = new List <UOItem>(); items.AddRange(item.Items.ToArray()); } if (item.Exist) { foreach (UOItem lootItem in items) { if (Loot.IsLootItem(lootItem) || lootAll) { lootItem.Move(60000, LootBag); Game.Wait(425); } } } } //cutedBodies.Add(item.Serial); } World.Player.PrintMessage(String.Format("Bodies remain [{0}]", toDo), Game.Val_LightGreen); foreach (UOItem item in World.Ground) { if (item.Distance <= 6 && item.Graphic == 0x0E76 && item.Color == 0x049A)//IsLootItem(item))//jen lootbag { item.Move(60000, LootBag); Game.Wait(425); } } List <Serial> bpkAfterLoot = ItemHelper.ContainerState(World.Player.Backpack); List <Serial> diff = ItemHelper.ContainerStateDiff(bpkState, bpkAfterLoot); Game.PrintMessage("Diff... " + diff.Count); if (LootBag.Serial != World.Player.Backpack.Serial) { foreach (Serial lootedItem in diff) { UOItem item = new UOItem(lootedItem); if (item.Container == World.Player.Backpack.Serial) { if (item.Move(65000, LootBag)) { Game.PrintMessage("LootItem Moved to Bag..."); } Game.Wait(); } } } }
public static ResultInfo OpenShip() { ResultInfo result = new ResultInfo(); UOItem deed = World.Player.Backpack.AllItems.FindType(ShipDeedType); if (deed.Exist) { World.Player.PrintMessage("Umisti lod"); TargetInfo target = new TargetInfo().GetTarget(); if (target.Success) { List <Serial> bpkState = ItemHelper.ContainerState(World.Player.Backpack); Journal.Clear(); UO.WaitTargetTile(target.StaticTarget.X, target.StaticTarget.Y, target.StaticTarget.Z, target.StaticTarget.Graphic); deed.Use(); if (Journal.WaitForText(true, 500, "Terrain is too bumpy to place structure here", "The duplicate key is in your bank account")) { if (Journal.Contains(true, "The duplicate key is in your bank account")) { result.Success = true; List <Serial> bpkStateAfter = ItemHelper.ContainerState(World.Player.Backpack); List <Serial> diff = ItemHelper.ContainerStateDiff(bpkState, bpkStateAfter); UOItem lastKey = new UOItem(Serial.Invalid); foreach (Serial ds in diff) { UOItem dsItem = new UOItem(ds); if (dsItem.Graphic == ShipKeyType.Graphic) { lastKey = dsItem; break; } } if (!lastKey.Serial.IsValid) { lastKey = World.Player.Backpack.Items.FindType(ShipKeyType.Graphic); } if (lastKey.Serial.IsValid) { LastShipKey = lastKey; } result.Item = lastKey; } else { World.Player.PrintMessage("Sem nelze.."); } } else { Game.PrintMessage("Nepovedlo se...?"); } } } else { World.Player.PrintMessage("Nemas lod", MessageType.Error); } return(result); }
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."); }
public void LootGround(LootType lootType, bool lootAll) { //List<UOItem> searchItems = new List<UOItem>(); List <UOItem> ground = new List <UOItem>(); ground.AddRange(World.Ground.ToArray()); List <UOItem> search = new List <UOItem>(); int done = 0; int toDo = 0; int bodies = 0; List <Serial> bpkState = ItemHelper.ContainerState(World.Player.Backpack); foreach (UOItem item in ground) { if (item.Graphic == 0x2006) { bodies++; if (cutedBodies.Contains(item.Serial)) { done++; } else { toDo++; if (item.Distance <= 6) { search.Add(item); } } } } for (int i = 0; i < search.Count; i++)//(UOItem item in search) { UOItem item = search[i]; Game.PrintMessage(String.Format("Try Loot Body [{0}/{1}]", i + 1, search.Count), Game.Val_LightGreen); if (!item.Opened) { Journal.Clear(); item.Use(); if (Journal.WaitForText(true, 250, "You can't reach that")) { UO.PrintObject(item.Serial, Game.Val_LightGreen, "[Can't reach]"); continue; } } List <UOItem> items = new List <UOItem>(); items.AddRange(item.Items.ToArray()); if (items.FirstOrDefault(si => si.Graphic == 0x0E76 && si.Color == 0x049A) != null || lootAll) //item.Items.FindType(0x0E76, 0x049A).Exist)// lootbag { UO.PrintObject(item.Serial, Game.Val_LightGreen, "[Looting...]"); if (DwarfKnife.Exist && item.Distance <= 3 && !lootAll)//TODO predelat nejak jinak, ted kvuly tamingu aby to nelotovalo maso a kuze { toDo--; done++; foreach (UOItem lootItem in items) { if (Loot.IsLootItem(lootItem)) { lootItem.Move(65000, LootBag); Game.Wait(300); } } DwarfKnife.Use(); UO.WaitTargetObject(item); Game.Wait(350); items = new List <UOItem>(); items.AddRange(item.Items.ToArray()); } if (item.Exist) { foreach (UOItem lootItem in items) { if (Loot.IsLootItem(lootItem) || lootAll) { lootItem.Move(60000, LootBag); Game.Wait(425); } } } } cutedBodies.Add(item.Serial); } World.Player.PrintMessage(String.Format("Bodies remain [{0}]", toDo), Game.Val_LightGreen); foreach (UOItem item in World.Ground) { if (item.Distance <= 6 && IsLootItem(item)) { item.Move(60000, LootBag); Game.Wait(425); } } List <Serial> bpkAfterLoot = ItemHelper.ContainerState(World.Player.Backpack); List <Serial> diff = ItemHelper.ContainerStateDiff(bpkState, bpkAfterLoot); Game.PrintMessage("Diff... " + diff.Count); if (LootBag.Serial != World.Player.Backpack.Serial) { foreach (Serial lootedItem in diff) { UOItem item = new UOItem(lootedItem); if (item.Container == World.Player.Backpack.Serial) { if (item.Move(65000, LootBag)) { Game.PrintMessage("LootItem Moved to Bag..."); } Game.Wait(); } } } }
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."); }