public static Notoriety Get(UOItem item, int timeout) { Notoriety notoriety; lock (syncRoot) { if (corpsesNotoriety.TryGetValue(item, out notoriety)) { return(notoriety); } } if (!item.Exist || item.Graphic != 0x2006) { throw new ScriptErrorException("Item doesn't exist or it's not a corpse."); } using (JournalSerialEventWaiter ew = new JournalSerialEventWaiter(item)) { item.Click(); ew.Wait(timeout); } lock (syncRoot) { corpsesNotoriety.TryGetValue(item, out notoriety); } return(notoriety); }
public void poisset() { UOItem tmp = new UOItem(UIManager.TargetObject()); tmp.Click(); UO.Wait(200); PoisonColor = tmp.Color; }
private static void EnsureItem(UOItem item) { if (String.IsNullOrEmpty(item.Name)) { item.Click(); } Pause(); }
private static string GetItemCodeData(UOItem sourceItem) { sourceItem.Click(); Pause(); string data = "main.Add(\"" + sourceItem.Graphic + ";" + sourceItem.Color + "\"," + sourceItem.Container + ");"; return(data); }
private static string GetItemData(UOItem sourceItem) { sourceItem.Click(); Pause(); string data = sourceItem.Graphic + ";" + sourceItem.Color + ";" + sourceItem.Name + ":" + GetItemContainerChain(sourceItem, ""); return(data); }
public static void EnsureItem(UOItem item) { if (String.IsNullOrEmpty(item.Name)) { item.Click(); } UO.Wait(800); }
public static void GetRunes() { UOItem a, aa; List <uint> runeTypes = new List <uint>() { 0x1F14, 0x1F15, 0x1F16, 0x1F17 }; UO.Print("Zamer bednu s runama"); UOItem runeBox = new UOItem(UIManager.TargetObject()); runeBox.Click(); UO.Wait(200); runeBox.Use(); Runes.Clear(); openBoxes(runeBox, 200); foreach (UOItem it in runeBox.AllItems.Where(item => runeTypes.Any(typ => item.Graphic == typ))) { string tmps = ""; uint[] tmp = { 0x0, 0x0, 0x0 }; string[] tmp2 = { "null", "null" }; it.Click(); UO.Wait(100); if (it.Container != runeBox) { tmp[0] = it.Container; a = new UOItem(it.Container); a.Click(); UO.Wait(100); tmp2[0] = a.Name; if (a.Container != runeBox) { tmp[1] = a.Container; aa = new UOItem(a.Container); aa.Click(); UO.Wait(100); tmp2[1] = aa.Name; } if (tmp2[1] != "null" && tmp2[0] != "null") { tmps = tmp2[0]; tmp2[0] = tmp2[1]; tmp2[1] = tmps; } } tmp[2] = runeBox; Runes.Add(new Rune() { Name = it.Name, Id = it.Serial, Containers = tmp, ContainersName = tmp2 }); } UO.PrintInformation("Nacteno"); }
public void testruna() { UO.Print("runa ?"); UOItem runa = new UOItem(UIManager.TargetObject()); int counter = 0; while (runa.Exist) { if (true || runa.Graphic != 0x1F14 || runa.Color != 0x0482) { //portni domov //UO.Say(",nbruna"); //UO.Wait(30000); //TODO ensure WS //chod k truhle //GoHomeAtJelom(); //zober si novu runu UOItem bedna = new UOItem(0x40314338); bedna.Click(); UO.Wait(500); bedna.Use(); UOItem suflik = new UOItem(0x40258A79); suflik.Click(); UO.Wait(500); suflik.Use(); UO.Wait(500); UOItem newRune = suflik.AllItems.FindType(0x1F14, 0x0482); newRune.Move(1, World.Player.Backpack); UO.Wait(500); //portni starou runu RecallByRune(runa.Serial); //markni novu UO.Wait(90000); UO.DeleteJournal(); UO.UseObject(newRune.Serial); UO.WaitMenu("Jak chces runu pouzit?", "Mark"); UO.Wait(5000); //zahod staru throw new Exception("HOTOVO A MARKNUTE"); } counter++; UO.Print("Pocet kopnuti: " + counter); if (World.Player.Mana < 25) { UO.Say(",exec DrinkPotion \"Total Mana Refresh\""); } runa.Click(); UO.Wait(500); runa.Move(1, World.Player.Backpack); UO.Wait(500); RecallByRune(runa.Serial); UO.Wait(15000); } }
public void Add() { UO.PrintInformation("Zamer Bagl se setem"); UOItem bag = new UOItem(UIManager.TargetObject()); if (bag.Items.Count() > 0) { bag.Click(); UO.Wait(200); equipy.Add(new EqSet(bag)); } }
public EqSet(UOItem SetBAG) { set = new List <uint>() { SetBAG.Serial }; SetBAG.Click(); UO.Wait(100); SetBAG.Use(); foreach (UOItem it in SetBAG.Items) { it.Click(); set.Add(it.Serial); } SetName = SetBAG.Name; }
//Serial: 0x40363D29 Name: "clean bandages" Position: 3167.30.26 Flags: 0x0020 Color: 0x0000 Graphic: 0x0E21 Amount: 29339 Layer: None Container: 0x00000000 //--------------------------------------------------------------------------------------------- public void TrainForensic() { UOItem body = new UOItem(UIManager.TargetObject()); body.Click(); Game.Wait(); Game.PrintMessage("Train na tele: " + body.Name); while (!UO.Dead && body.Exist) { Journal.Clear(); UO.WaitTargetObject(body); UO.UseSkill(StandardSkill.ForensicEvaluation); Journal.WaitForText(true, 2500, "this is body of", "You can tell nothing about the corpse.");// Game.Wait(1500); Game.Wait(150); } }
public void RecallSvitek() { DateTime n = DateTime.Now; UOItem svitek = new UOItem(0x00); DateTime start = DateTime.Now; while (svitek.Name != "Recall") { svitek = new UOItem(World.Player.Backpack.AllItems.FindType(0x1F4C)); svitek.Click(); if (DateTime.Now - n > TimeSpan.FromSeconds(2)) { return; } } new UOItem(Id).WaitTarget(); svitek.Use(); }
//--------------------------------------------------------------------------------------------- public void Lumber() { int iteration = 0; World.Player.RequestStatus(1000); World.Player.Click(); Game.Wait(); bool doLumber = this.GoToNext(); while (doLumber) { UO.Print("doLumber" + iteration); iteration++; UO.Print("doLumber" + lastPositionIndex + " / " + this.Trees.Count); IUOPosition current = this.Trees[lastPositionIndex]; UOItem myDeadBody = this.MyDeadBody(); bool dead = UO.Dead; bool returnToLast = false; bool goToNext = false; bool trainForensic = this.MaxForensicSkill > 0 && !dead && myDeadBody != null && myDeadBody.Exist; this.LastPosition = new UOPosition(World.Player.X, World.Player.Y, 0); UO.DeleteJournal(); if (Game.CurrentGame.WorldSave()) { Game.Wait(30000); if (!dead) { Nastroj.Move(1, World.Player.Backpack); Game.Wait(500); Nastroj.Click(); } Game.Wait(); if (World.Player.Backpack.AllItems.FindType(0x0FF0).Exist) { World.Player.Backpack.AllItems.FindType(0x0FF0).Move(1, World.Player.Backpack);//Sychr test na zasek Game.Wait(); } if (myDeadBody != null && myDeadBody.Exist) { myDeadBody.Click(); } } if (this.EnableVisitorInfo) { VisitorInfo visitor; if (this.NavstevnikHandle(out visitor).Result == ActionResult.Continue) { continue; } if (visitor != null && UO.Dead && visitor.LastVisit != null) { visitor.LastVisit.ZabilMe = true; } } if (World.Player.Warmode) { World.Player.ChangeWarmode(WarmodeChange.Peace); } if (dead) { Game.Wait(60000); this.BezSeResnout(); this.BezLast(); this.VylotSiTelo(); continue; } if (World.Player.Backpack.AllItems.FindType(LogGraphic, 0x0979).Amount >= 3 || World.Player.Backpack.AllItems.FindType(LogGraphic, 0x06D3).Amount >= 2 || World.Player.Backpack.AllItems.FindType(LogGraphic, 0x0972).Amount >= 1 || World.Player.Backpack.AllItems.FindType(LogGraphic, 0x05A6).Amount >= 1 || World.Player.Backpack.AllItems.FindType(LogGraphic, 0x0522).Amount >= 1 ) { this.BezVylozit(); returnToLast = true; } if (this.WeightLimitReached) { this.BezVylozit(); returnToLast = true; } if (!dead && !Nastroj.Exist) { this.BezVylozit(); returnToLast = true; } if (returnToLast) { this.Robot.GoTo(this.LastPosition); } this.VylotSiTelo(); this.DropDeny(); if (trainForensic && SkillsHelper.GetSkillValue("ForensicEvaluation").Value < this.MaxForensicSkill) { Game.Wait(150); UO.Print("Train - ForensicEvaluation"); UO.WaitTargetObject(myDeadBody); UO.UseSkill(StandardSkill.ForensicEvaluation); Journal.WaitForText(true, 2500, "this is body of", "You can tell nothing about the corpse.");// Game.Wait(1500); Game.Wait(150); continue; } StaticTarget target = new StaticTarget(Serial.Invalid, current.X.GetValueOrDefault(), current.Y.GetValueOrDefault(), (sbyte)current.Z.GetValueOrDefault(), TreeGraphic[0]); SekInfo sek = this.SekTree(target); if (sek.Mined || sek.Wrong) { goToNext = true; } this.SeberLogy(); if (goToNext) { this.GoToNext(); } } }
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"); }
//--------------------------------------------------------------------------------------------- private void Slot_MouseClick(object sender, MouseEventArgs e) { Phoenix.Gui.Controls.ArtImageControlExt image = (Phoenix.Gui.Controls.ArtImageControlExt)sender; SlotItem slot = GetSlotItem(image.Name); if (slot == null) { return; } if (e.Button == MouseButtons.Right) { slot.Color = 0; slot.Graphic = 0; slot.Serial = 0; slot.ItemName = ""; slot.Selectable = true; slot.DisposeCounter(); image.Selected = false; image.Mark1 = false; image.Grayscale = false; image.DataIndex = 0; image.HueIndex = 0; } else if (e.Button == MouseButtons.Left) { bool currCtrlHold = (ModifierKeys & Keys.Control) == Keys.Control; bool currAltHold = (ModifierKeys & Keys.Alt) == Keys.Alt; if (currCtrlHold && !currAltHold) { image.Selection = true; UOItem item = new UOItem(UIManager.TargetObject()); image.Selection = false; if (item.Exist) { slot.Graphic = item.Graphic; slot.Color = item.Color; slot.Serial = item.Serial; slot.Selectable = true; if (String.IsNullOrEmpty(item.Name)) { item.Click(); Game.Wait(100); } slot.ItemName = item.Name; image.Mark1 = !slot.Selectable; image.DataIndex = item.Graphic; if (item.Color > 0 && item.Color.IsConstant) { image.UseHue = true; image.HueIndex = item.Color; } else { image.UseHue = false; } if (slot.SlotType == "Klamak" || slot.SlotType == "Potion") { slot.PrintCounter = true; } slot.RegisterCounter(); EnsureUnique(slot); EnsureSelection("Weapon"); //EnsureExists(); } else { //smazat? radsi ne } } else if (currAltHold && !currCtrlHold) { if (slot.SlotType == "Potion") { } else { slot.Selectable = !slot.Selectable; image.Mark1 = !slot.Selectable; } } else { if (slot.SlotType == "Potion") { if (!slot.IsEmpty) { Potion p = PotionCollection.GetPotionBy(slot.Graphic, slot.Color); if (p != null) { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["DrinkPotion"], p.Name); } } } else if (slot.Exist) { if (slot.SlotType == "Weapon") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.CommandList["useobject"], slot.Item.Serial); } else if (slot.SlotType == "Klamak") { //ClearSelection("Klamak"); //image.Selected = true; Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["VyhodKlamakNa"], slot.Item.Serial); } } } } image.Invalidate(); }
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(); } }
//--------------------------------------------------------------------------------------------- protected bool BezSeResnout() { bool ressSuccess = false; if (this.RessPositionPath != null) { UO.Print("BezSeResnout"); int gotoDistance = this.RessPositionPath.Count == 1 ? 1 : 0; if (this.Robot.GoTo(this.RessPositionPath, gotoDistance)) { UOCharacter resser = null; foreach (UOCharacter ch in World.Characters) { if (ch.Notoriety == Notoriety.Innocent || ch.Notoriety == Notoriety.Invulnerable || ch.Notoriety == Notoriety.Neutral || ch.Distance < 10) { resser = ch; break; } } if (World.Ground.FindType(0x1E5D).Exist)////0x1E5D ress kriz { UOItem ressKriz = World.Ground.FindType(0x1E5D); if (ressKriz > 3) { this.Robot.GoTo(ressKriz.X, ressKriz.Y, 1, 100); } ressKriz.Click(); Game.Wait(); World.Player.ChangeWarmode(WarmodeChange.Switch); Game.Wait(); World.Player.ChangeWarmode(WarmodeChange.War); Game.Wait(); ressKriz.Use(); Game.Wait(); World.Player.RequestStatus(1000); ressSuccess = !UO.Dead; } else if (resser != null && resser.Exist) { if (this.Robot.GoTo(resser.X, resser.Y, 2, 50)) { resser.Click(); Game.Wait(); World.Player.ChangeWarmode(WarmodeChange.Switch); Game.Wait(); World.Player.ChangeWarmode(WarmodeChange.War); resser.Tell("ress"); Game.Wait(); World.Player.RequestStatus(1000); ressSuccess = !UO.Dead; } else { UO.Print("BezSeResnout - !Goto resser"); } } else { UO.Print("BezSeResnout - !resser"); } } else { UO.Print("BezSeResnout - !GoTo ForgePosition"); } if (ressSuccess && this.RessPositionPath.Count > 1) { List <IUOPosition> reverse = new List <IUOPosition>(); reverse.AddRange(this.RessPositionPath.ToArray()); reverse.Reverse(); this.Robot.GoTo(reverse, gotoDistance); } } else { UO.Print("BezSeResnout - RessPosition == null"); Game.Wait(1500); } return(ressSuccess); }