public CallbackResult OnMapInfo(byte[] data, CallbackResult prevResult) { PacketReader reader = new PacketReader(data); reader.Skip(1); // opcode uint serial = reader.ReadUInt32(); ushort gump = reader.ReadUInt16(); ushort ux = reader.ReadUInt16(); ushort uy = reader.ReadUInt16(); ushort lx = reader.ReadUInt16(); ushort ly = reader.ReadUInt16(); ushort width = reader.ReadUInt16(); ushort height = reader.ReadUInt16(); ushort x = (ushort)(ux + 180 * (lx - ux > 361 ? -1 : 1)); ushort y = (ushort)(uy + 180 * (ly - uy > 361 ? -1 : 1)); UOPositionBase pos = new UOPositionBase(x, y, 0); if (!OpenedMapsLoc.ContainsKey(pos.ToString())) { OpenedMapsLoc.Add(pos.ToString(), new List <uint>()); OpenedMapsLoc[pos.ToString()].Add(serial); } else { OpenedMapsLoc[pos.ToString()].Add(serial); } Game.PrintMessage(String.Format("Poklad je na {0},{1} - {2}", x, y, serial)); return(CallbackResult.Normal);// CallbackResult.Sent; }
public static void EnterShip() { int origFindDistance = World.FindDistance; World.FindDistance = 20; List <UOItem> prknaOpen = World.Ground.Where(i => OpenDecks.Count(d => d.Graphic == i.Graphic) > 0).ToList(); //new List<UOItem>(); List <UOItem> prknaClose = World.Ground.Where(i => CloseDecks.Count(d => d.Graphic == i.Graphic) > 0).ToList(); //new List<UOItem>(); if (prknaOpen.Count == 0 && prknaClose.Count == 0) { World.Player.PrintMessage("[Neni prkno...]", MessageType.Error); return; } else { UOPositionBase lastPostion = (UOPositionBase)World.Player.GetPosition(); if (prknaOpen.Count == 0) { foreach (UOItem prkno in prknaClose) { prkno.Use(); Game.Wait(250); prknaOpen = World.Ground.Where(i => OpenDecks.Count(d => d.Graphic == i.Graphic) > 0).ToList(); if (prknaOpen.Count > 0) { prknaOpen[0].Use(); break; } } } else { prknaOpen[0].Use(); } Game.Wait(250); UOPositionBase currentPosition = (UOPositionBase)World.Player.GetPosition(); if (lastPostion.Distance(currentPosition) > 0) { World.Player.PrintMessage("[ Nastoupils...]"); } else { World.Player.PrintMessage("[ Nenastoupils...]", MessageType.Error); } } World.FindDistance = origFindDistance; }
//--------------------------------------------------------------------------------------------- public void ZazdiTarget(ushort ingotAmount) { UOItem ingots = World.Player.Backpack.AllItems.FindType(IronIngotType.Graphic, IronIngotType.Color); if (!ingots.Exist || ingots.Amount < ingotAmount) { UO.PrintWarning("Nemas potrebny pocet ingotu! Pocet: {0}", ingots.Exist ? ingots.Amount : 0); return; } UOItem kladivo = Kladivo; if (!kladivo.Exist) { return; } UO.PrintInformation("Zamer cil >"); StaticTarget target = UIManager.Target(); UOPositionBase currentPosition = new UOPositionBase(World.Player.X, World.Player.Y, 0); UOPositionBase targetPosition = new UOPositionBase(target.X, target.Y, 0); if (Robot.GetRelativeVectorLength(currentPosition, targetPosition) < 4) { if (ingots.Move(ingotAmount, target.X, target.Y, target.Z)) { UO.Wait(100); UOItem targetIngots = World.Ground.FindType(IronIngotType.Graphic, IronIngotType.Color); if (targetIngots.Exist && targetIngots.Distance < 4) { UO.WaitTargetObject(targetIngots.Serial); kladivo.Use(); UO.Wait(100); UO.PrintInformation("Ingoty premeneny!"); } else { UO.PrintWarning("Vzdalil jsi se od ingotu! Vzdalenost: {0}", targetIngots.Exist ? targetIngots.Distance : -1); } } else { UO.PrintWarning("Nepodarilo se presunout ingoty na cil!"); } } else { UO.PrintWarning("Cil neexistuje, nebo je dal nez 3 policka! Vzdalenost: {0}", Robot.GetRelativeVectorLength(currentPosition, targetPosition)); } }
//--------------------------------------------------------------------------------------------- private bool TryMoveNextPlace() { if (moveTries > 2) { moveTries = 0; Game.PrintMessage("moveTries:" + moveTries); return(false); } UOPositionBase startPosition = new UOPositionBase(World.Player.X, World.Player.Y, 0); UOPositionBase currentPosition = new UOPositionBase(World.Player.X, World.Player.Y, 0); if (moveTries > 0) { Game.Wait(); UO.Say("Turn left"); } UO.Say("Forward"); UO.Say("Forward"); // int currentNotChangeCount = 0; while (Robot.GetRelativeVectorLength(startPosition, currentPosition) < 12) { Game.Wait(500); Game.PrintMessage("Distance:" + Robot.GetRelativeVectorLength(startPosition, currentPosition)); if (currentPosition.X == World.Player.X && currentPosition.Y == World.Player.Y) { currentNotChangeCount++; } if (currentNotChangeCount > 10) { moveTries++; return(TryMoveNextPlace()); } currentPosition = new UOPositionBase(World.Player.X, World.Player.Y, 0); } UO.Say("Stop"); moveTries = 0; return(true); }
public void buywalk(params string[] positionsDefinition) { Robot r = new Robot(); r.UseTryGoOnly = true; r.UseMinWait = true; r.UseRun = true; r.SearchSuqareSize = 450; string[] locations = positionsDefinition; foreach (string loc in locations) { string[] options = loc.Split('|'); int button = -1; string bookType = "r"; if (!String.IsNullOrEmpty(options[0]) && Regex.IsMatch(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})")) { Match m = Regex.Match(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})"); bookType = m.Groups["booktype"].Value.ToLower(); button = Int32.Parse(m.Groups["button"].Value); } if (button > -1) { string book = "RuneBookUse"; if (bookType == "t") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1); UO.Wait(1000); book = "TravelBookUse"; } else if (bookType == "c") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["CestovniKnihaUse"], 1); UO.Wait(1000); book = "CestovniKnihaUse"; } bool teleported = false; while (!teleported) { UO.DeleteJournal(); Phoenix.Runtime.RuntimeCore.Executions.Execute(RuntimeCore.ExecutableList[book], button); Game.Wait(500); if (!World.Player.Hidden) { UO.UseSkill("Hiding"); } UO.Print("Cekam na kop.. nehybat"); if (Journal.WaitForText(true, 2000, "Nesmis vykonavat zadnou akci")) { Game.CurrentGame.CurrentPlayer.SwitchWarmode(); Game.Wait(1000); } else if (Journal.WaitForText(true, 120000, "You have been teleported")) { teleported = true; } if (Game.CurrentGame.WorldSave()) { UO.Print("WS opakovani kopu za 45s"); Game.Wait(45000); if (bookType == "t") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1); UO.Wait(1000); } Game.Wait(500); } } } for (int i = 1; i < options.Length; i++) { if (UO.Dead) { return; } string[] parm = options[i].Split('.'); string x = parm[0]; string[] y = parm[1].Split(new string[] { "//" }, StringSplitOptions.RemoveEmptyEntries); string placeName = ""; if (y.Length > 1) { placeName = y[1]; } UOPositionBase pos = new UOPositionBase(ushort.Parse(x), ushort.Parse(y[0]), (ushort)0); int distance = parm.Length > 2 ? CalExtension.UOExtensions.Utils.ToNullInt(parm[2]).GetValueOrDefault(1) : 1; int gotries = parm.Length > 3 ? CalExtension.UOExtensions.Utils.ToNullInt(parm[3]).GetValueOrDefault(1000) : 1000; Game.PrintMessage("GoTo: " + pos); if (r.GoTo(pos, distance, gotries)) { Game.PrintMessage("In position: " + pos); if (parm[parm.Length - 1].ToLower() == "opendoor") { ItemHelper.OpenDoorAll(); Game.Wait(); } } } } }
//--------------------------------------------------------------------------------------------- public void TrainTamingRecusive(int maxTries, params string[] positionsDefinition) { Robot r = new Robot(); r.UseTryGoOnly = true; r.UseMinWait = true; r.UseRun = true; r.SearchSuqareSize = 450; this.doneList = new List <Serial>(); string[] locations = positionsDefinition; foreach (string loc in locations) { string[] options = loc.Split('|'); int button = -1; string bookType = "r"; if (!String.IsNullOrEmpty(options[0]) && Regex.IsMatch(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})")) { Match m = Regex.Match(options[0], "(?<booktype>[a-z])(?<button>\\d{1,2})"); bookType = m.Groups["booktype"].Value.ToLower(); button = Int32.Parse(m.Groups["button"].Value); } if (button > -1) { string book = "RuneBookUse"; if (bookType == "t") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1); UO.Wait(1000); book = "TravelBookUse"; } else if (bookType == "c") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["CestovniKnihaUse"], 1); UO.Wait(1000); book = "CestovniKnihaUse"; } bool teleported = false; while (!teleported) { UO.DeleteJournal(); Phoenix.Runtime.RuntimeCore.Executions.Execute(RuntimeCore.ExecutableList[book], button); Game.Wait(500); if (!World.Player.Hidden) { UO.UseSkill("Hiding"); } UO.Print("Cekam na kop.. nehybat"); if (Journal.WaitForText(true, 2000, "Nesmis vykonavat zadnou akci")) { Game.CurrentGame.CurrentPlayer.SwitchWarmode(); Game.Wait(1000); } else if (Journal.WaitForText(true, 120000, "You have been teleported")) { teleported = true; } if (Game.CurrentGame.WorldSave()) { UO.Print("WS opakovani kopu za 45s"); Game.Wait(45000); if (bookType == "t") { Phoenix.Runtime.RuntimeCore.Executions.Execute(Phoenix.Runtime.RuntimeCore.ExecutableList["TravelBookUse"], 1); UO.Wait(1000); } Game.Wait(500); } } } for (int i = 1; i < options.Length; i++) { if (UO.Dead) { return; } string[] parm = options[i].Split('.'); string x = parm[0]; string[] y = parm[1].Split(new string[] { "//" }, StringSplitOptions.RemoveEmptyEntries); string placeName = ""; if (y.Length > 1) { placeName = y[1]; } UOPositionBase pos = new UOPositionBase(ushort.Parse(x), ushort.Parse(y[0]), (ushort)0); int distance = parm.Length > 2 ? UOExtensions.Utils.ToNullInt(parm[2]).GetValueOrDefault(1) : 1; int gotries = parm.Length > 3 ? UOExtensions.Utils.ToNullInt(parm[3]).GetValueOrDefault(1000) : 1000; Game.PrintMessage("GoTo: " + pos); if (r.GoTo(pos, distance, gotries)) { Game.PrintMessage("In position: " + pos); if (parm[parm.Length - 1].ToLower() == "opendoor") { ItemHelper.OpenDoorAll(); Game.Wait(); if (World.Player.Layers[Layer.OuterTorso].Exist) { World.Player.Layers[Layer.OuterTorso].Move(1, World.Player.Backpack); Game.Wait(); } } List <UOCharacter> characters = new List <UOCharacter>(); characters.AddRange(World.Characters); characters.Sort(delegate(UOCharacter char1, UOCharacter char2) { return(char1.Distance.CompareTo(char2.Distance)); }); foreach (UOCharacter character in characters) { if (UO.Dead) { return; } Game.Wait(50); if (character.Distance < 6 && character.Serial != World.Player.Serial && !doneList.Contains(character.Serial) && character.Model != 0x0190 && character.Model != 0x0191 && character.Model != 0x0192) { SkillValue atSkill = SkillsHelper.GetSkillValue("Animal Taming"); bool isBird = character.Model == 0x0006; World.Player.PrintMessage(isBird + " / " + atSkill.Value); if (isBird && atSkill.RealValue > 450) { World.Player.PrintMessage("Try Kill."); UO.Cast(StandardSpell.Harm, character.Serial); Game.Wait(3000); if (character.Exist) { UO.Cast(StandardSpell.Harm, character.Serial); Game.Wait(2500); } //World.Player.PrintMessage("Try Kill result: " + KillCharacter(character)); } else { this.TameCharacter(character, maxTries); doneList.Add(character); } //if (!isBird || atSkill.RealValue < 450) //{ //} //else //{ //} } } } //else // Phoenix.Runtime.RuntimeCore.Executions.Terminate(musicRun.ManagedThreadId); } } if (UO.Dead) { return; } TrainTamingRecusive(maxTries, positionsDefinition); }
public static void StayAndFight(int distance, int hpMin, bool boost, bool reversePath, string path, string summonName, int summonCount) { ManualLastTarget.SwitchShowStatusBar(); int initGold = World.Player.Gold; int initFD = World.Player.Backpack.AllItems.FindType(0x103D, 0x0B52).Amount; //Serial: 0x4023CD57 Name: "Fairy Dust" Position: 136.144.0 Flags: 0x0020 Color: 0x0B52 Graphic: 0x103D Amount: 4 Layer: None Container: 0x4019287E PlayerClass pclass = Game.CurrentGame.CurrentPlayer.PlayerClass; UOPosition zero = new UOPosition(World.Player.X, World.Player.Y, (ushort)World.Player.Z); CalebConfig.AutoHeal = true; World.Player.ChangeWarmode(WarmodeChange.War); Game.Wait(); short maxHitsBase = World.Player.MaxHits; DateTime? lastBoostTime = null; List <Serial> deny = new List <Serial>(); UOCharacter current = null; Robot r = new Robot(); Robot r2 = new Robot(); Robot r3 = new Robot(); Loot l = new Loot(); DateTime startTime = DateTime.Now; Hashtable htKilled = new Hashtable(); int walkCounter = 0; GotoEventHandler beforeMoveHandler = (sender, e) => { ushort x = e.Destination.X.GetValueOrDefault(); ushort y = e.Destination.Y.GetValueOrDefault(); walkCounter++; if (Game.CurrentGame.Mobs.Count > 0 && (walkCounter % 15) == 0) { new Thread(new ThreadStart(MobMaster.Current.MobCome)).Start(); } foreach (UOItem item in World.Ground) { if (item.Graphic == 0x0DDA && item.X == x && item.Y == y) { e.IvalidDestination = true; } } }; GotoEventHandler beforeMoveHandler2 = (sender, e) => { walkCounter++; if (current != null && e.Tries > 5) { List <UOCharacter> chars = new List <UOCharacter>(); chars.AddRange(World.Characters.Where(ch => (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer) && ch.Distance <= distance && !deny.Contains(ch.Serial) && !Characters.IsSummon(ch) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ThenBy(ch => ch.MaxHits).ToArray()); if (Game.CurrentGame.Mobs.Count > 0 && (walkCounter % 15) == 0) { new Thread(new ThreadStart(MobMaster.Current.MobCome)).Start(); } foreach (UOCharacter ch in chars) { if (ch.Distance < current.Distance) { e.Abort = true; break; } } } }; GotoEventHandler beforeMoveHandler3 = (sender, e) => { walkCounter++; List <UOCharacter> chars = new List <UOCharacter>(); chars.AddRange(World.Characters.Where(ch => (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer) && ch.Distance <= distance && !deny.Contains(ch.Serial) && !Characters.IsSummon(ch) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ThenBy(ch => ch.MaxHits).ToArray()); if (Game.CurrentGame.Mobs.Count > 0 && (walkCounter % 15) == 0) { new Thread(new ThreadStart(MobMaster.Current.MobCome)).Start(); } foreach (UOCharacter ch in chars) { if (current == null || ch.Distance < current.Distance) { e.Abort = true; break; } } }; List <IUOPosition> posPath = new List <IUOPosition>(); posPath.Add(new UOPositionBase(World.Player.X, World.Player.Y, (ushort)World.Player.Z)); if (!String.IsNullOrEmpty(path)) { posPath.AddRange(UOPositionBase.ParseList(path)); } r2.BeforeMove += beforeMoveHandler; r2.BeforeMove += beforeMoveHandler2; r.BeforeMove += beforeMoveHandler; r3.BeforeMove += beforeMoveHandler; r3.BeforeMove += beforeMoveHandler3; int pathIndex = 0; Poisoning p = new Poisoning(); while (!UO.Dead) { if (boost) { if (lastBoostTime == null || (DateTime.Now - lastBoostTime).Value.TotalMilliseconds > 180000) { Game.RunScript(8000); lastBoostTime = DateTime.Now; Game.PrintMessage("Try booost..."); UO.Cast(StandardSpell.ReactiveArmor, Aliases.Self); Game.Wait(2500); Game.RunScript(4000); UO.Cast(StandardSpell.Strength, Aliases.Self); Game.Wait(3500); Game.RunScript(4000); UO.Cast(StandardSpell.Protection, Aliases.Self); Game.Wait(3500); } } List <UOCharacter> chars = new List <UOCharacter>(); chars.AddRange(World.Characters.Where(ch => (ch.Notoriety == Notoriety.Enemy || ch.Notoriety == Notoriety.Murderer) && ch.Distance <= distance && !Characters.IsSummon(ch) && ch.Serial != World.Player.Serial).OrderBy(ch => ch.Distance).ThenBy(ch => ch.MaxHits).ToArray()); foreach (UOCharacter ch in chars) { bool isVladimirSkorp = ch.Model == 0x0030 && ch.Color == 0x0B78; if (deny.Contains(ch.Serial) && ch.Distance > 2) { continue; } ch.RequestStatus(500); ch.Click(); Game.Wait(); if (World.Player.Hits <= hpMin) { while (World.Player.Hits < hpMin) { Game.Wait(500); } } ch.Print(Game.Val_GreenBlue, "[killing...]"); current = ch; if (!String.IsNullOrEmpty(summonName) && World.Player.Layers[Layer.Hat].Graphic == 0x1451 && Game.CurrentGame.Mobs.Count < summonCount && World.Player.Mana > 20) { Magery.ExecCastSummonCreature(summonName, "Self"); Game.Wait(4000); MobMaster.Current.MobStop(); } for (int i = 0; i < Game.CurrentGame.Mobs.Count; i++) { MobMaster.Current.MobKill(); Game.Wait(250); } if (ch.Exist && ch.Hits > 0 && ch.Distance < 50 && r2.GoTo(ch.X, ch.Y, 1, 25)) { UOItem trainKit = World.Player.Backpack.AllItems.FindType(Poisoning.TrainKit.Graphic, Poisoning.TrainKit.Color); if (trainKit.Exist) { p.TrainPoisEngage(); } while (ch.Exist && ch.Hits > 0) { if (!Game.CurrentGame.WorldSave()) { //Serial: 0x401E33B3 Position: 0.0.0 Flags: 0x0000 Color: 0x0000 Graphic: 0x1451 Amount: 0 Layer: Hat Container: 0x0037EAF7 if (!String.IsNullOrEmpty(summonName) && World.Player.Layers[Layer.Hat].Graphic == 0x1451 && Game.CurrentGame.Mobs.Count < summonCount && World.Player.Mana > 20) { Magery.ExecCastSummonCreature(summonName, "Self"); Game.Wait(4000); MobMaster.Current.MobStop(); } if (ch.Exist && ch.Hits > 0 && ch.Distance > 1 && ch.Distance < 30) { Game.PrintMessage("HUNT... " + new UOPositionBase(ch.X, ch.Y, 0)); Game.RunScript(500); Game.Wait(500); UO.Attack(ch.Serial); if (!r.GoTo(ch.X, ch.Y, 1, 5)) { break; } } htKilled[ch.Serial] = ch; UO.Attack(ch.Serial); Game.RunScript(1500); Game.Wait(1000); for (int i = 0; i < Game.CurrentGame.Mobs.Count; i++) { MobMaster.Current.MobKill(); Game.Wait(250); } if (World.Player.Hits <= hpMin) { while (World.Player.Hits < hpMin) { if (pclass == PlayerClass.Vampire) { if (Game.CurrentGame.CanDrink) { Alchemy.ExecDrinkPotion("Blood"); Game.Wait(500); } if (World.Player.Hits < 45) { Vampire.SnezBandu(); Game.Wait(500); } } else { if (Game.CurrentGame.CanDrink && Potion.Heal.ContainsTopKad(World.Player.Backpack)) { Alchemy.ExecDrinkPotion("Heal"); Game.Wait(150); } } if (World.Player.Hits < hpMin) { Game.RunScript(5); // Game.CurrentGame.SwitchWarRunOff(); Game.Wait(2500); } if (Game.CurrentGame.Mobs.Count > 0) { if (!ch.Exist) { MobMaster.Current.MobStop(); Game.Wait(150); } else { MobMaster.Current.MobKill(); Game.Wait(150); } } } } if (ch.Exist && ch.Hits > 0 && ch.Distance > 1 && ch.Distance < 30) { Game.PrintMessage("HUNT... " + new UOPositionBase(ch.X, ch.Y, 0)); if (!r.GoTo(ch.X, ch.Y, 1, 5)) { break; } } } else { Game.Wait(2500); } } if (!ch.Exist) { if (isVladimirSkorp && World.Player.Backpack.Items.FindType(0x227B, 0x0697).Exist) { Game.UseTypeCust(0x227B, 0x0697, "nearestcorpse", "[Target]", "[Ladislav]"); } if (Game.CurrentGame.Mobs.Count > 0) { MobMaster.Current.MobCome(); } Game.PrintMessage("KILLED..."); Game.Wait(1500); current = null; break; } } else { Game.PrintMessage("Deny ADD " + ch.Name); deny.Add(ch.Serial); break; } } l.LootGround(Loot.LootType.QuickCut); if (chars.Count == 0 || chars.Count - deny.Count <= 0) { pathIndex++; if (pathIndex > posPath.Count - 1) { if (reversePath) { posPath.Reverse(); } pathIndex = 0; } Game.PrintMessage("Goto Next " + posPath[pathIndex]); deny.Clear(); Game.Wait(500); if (!r3.GoTo(posPath[pathIndex], 0, 500)) { Game.PrintMessage("Cant go to NEXT " + posPath[pathIndex]); continue; } else { Game.PrintMessage(posPath[pathIndex].ToString() + " - Com:" + posPath[pathIndex].CommandName); if (!String.IsNullOrEmpty(posPath[pathIndex].CommandName)) { if (posPath[pathIndex].CommandName.ToLower() == "opendoor") { ItemHelper.OpenDoorAll(); Game.Wait(); } } //,exec stayandfight 5 110 false true "5125.1152|5122.1163|5124.1178|5124.1185|5124.1185.0.OpenDoor|5124.1187.0.OpenDoor|5125.1188|5125.1198|5125.1209|5137.1208|5143.1207|5156.1208|5167.1209|5181.1209|5182.1212|5188.1211|5188.1201|5188.1193|5180.1193" Game.PrintMessage(String.Format("Zabito {0} za {1:N0} min. Gold: {2}, FD: {3}", htKilled.Values.Count, (DateTime.Now - startTime).TotalMinutes, World.Player.Gold - initGold, World.Player.Backpack.AllItems.FindType(0x103D, 0x0B52).Amount - initFD)); } } } }
//--------------------------------------------------------------------------------------------- public bool NeedCommand() { UOPositionBase ep = new UOPositionBase(GetEnemyOrDefault().X, GetEnemyOrDefault().Y, 0); UOPositionBase mp = new UOPositionBase(Mob.X, Mob.Y, 0); this.ZeroPosition = Robot.GetRelativeVectorLength(mp, ep) == 0; this.ToFar = Robot.GetRelativeVectorLength(mp, ep) > 1.5; this.NotLookingAt = !Robot.LookingDirectlyAt(mp, ep, Mob.Direction); this.Dragon = IsDragon(this.Mob); this.TimerReset = (DateTime.Now - LastCommandTime).TotalMilliseconds > resetTimer; this.ChangeReset = (DateTime.Now - LastChangedTime).TotalMilliseconds > 8500; bool result = this.IsAliveReach && GetEnemyOrDefault().Serial != this.Mob.Serial && ( this.ZeroPosition || this.ToFar || this.NotLookingAt || this.Dragon || this.TimerReset || this.ChangeReset ); if (result) { if (this.ZeroPosition) { if (Game.Debug) { Game.PrintMessage(Game.RenameSufix(Mob.Name) + " - Pozice 0 [" + this.CommandCount + "]", Game.Val_GreenBlue); } this.CommandReasonCode = "Z"; } else if (this.NotLookingAt) { if (Game.Debug) { Game.PrintMessage(Game.RenameSufix(Mob.Name) + " - Nekouka [" + this.CommandCount + "]", Game.Val_GreenBlue); } this.CommandReasonCode = "N"; } else if (this.ToFar) { if (Game.Debug) { Game.PrintMessage(Game.RenameSufix(Mob.Name) + " - Je Daleko [" + this.CommandCount + "]", Game.Val_GreenBlue); } this.CommandReasonCode = "F"; } else if (this.Dragon) { if (Game.Debug) { Game.PrintMessage(Game.RenameSufix(Mob.Name) + " - Drak [" + this.CommandCount + "]", Game.Val_GreenBlue); } this.CommandReasonCode = "D"; } else if (this.TimerReset) { if (Game.Debug) { Game.PrintMessage(Game.RenameSufix(Mob.Name) + " - Casovac [" + this.CommandCount + "] " + (String.Format("{0:n1}", (DateTime.Now - LastCommandTime).TotalMilliseconds)), Game.Val_GreenBlue); } this.CommandReasonCode = "T"; } else if (this.ChangeReset) { if (Game.Debug) { Game.PrintMessage(Game.RenameSufix(Mob.Name) + " - Change [" + this.CommandCount + "] " + (String.Format("{0:n1}", (DateTime.Now - LastChangedTime).TotalMilliseconds)), Game.Val_GreenBlue); } this.CommandReasonCode = "C"; } } return(result); }
public static void StartLumber(Serial container, Serial innerContainer, string containerPosition, string ressPosition, string deny, string trees, int maxForesnicSkill, int nastrojLoad, bool enableVisitor, string ESWN) { Lumberjacking2 lumber = new Lumberjacking2(); lumber.StartPosition = new UOPositionBase(World.Player.X, World.Player.Y, 0); if (!String.IsNullOrEmpty(ESWN)) { string[] esvnSplit = ESWN.Split(new char[] { ',' }); if (esvnSplit.Length > 0) { lumber.MaxE = Int32.Parse(esvnSplit[0]); } if (esvnSplit.Length > 1) { lumber.MaxS = Int32.Parse(esvnSplit[1]); } if (esvnSplit.Length > 2) { lumber.MaxW = Int32.Parse(esvnSplit[2]); } if (esvnSplit.Length > 3) { lumber.MaxN = Int32.Parse(esvnSplit[3]); } } if (String.IsNullOrEmpty(trees)) { int currentX = lumber.StartPosition.X.GetValueOrDefault(); int currentY = lumber.StartPosition.Y.GetValueOrDefault(); int minX = 0; int minY = 0; int maxX = 0; int maxY = 0; minX = (currentX - lumber.SearchSuqareSize < 0 ? 0 : currentX - lumber.SearchSuqareSize); maxX = (currentX + lumber.SearchSuqareSize > 6000 ? 6000 : currentX + lumber.SearchSuqareSize); minY = (currentY - lumber.SearchSuqareSize < 0 ? 0 : currentY - lumber.SearchSuqareSize); maxY = (currentY + lumber.SearchSuqareSize > 6000 ? 6000 : currentY + lumber.SearchSuqareSize); if (lumber.MaxE > 0) { maxX = Math.Min(maxX, lumber.MaxE); } if (lumber.MaxS > 0) { maxY = Math.Min(maxY, lumber.MaxS); } if (lumber.MaxW > 0) { minX = Math.Max(minX, lumber.MaxW); } if (lumber.MaxN > 0) { minY = Math.Max(minY, lumber.MaxN); } UOPositionCollection allTrees = new UOPositionCollection(); allTrees.Load(String.Format("IsTree=1 AND X>={0} AND X<={1} AND Y>={2} AND Y<={3}", minX, maxX, minY, maxY)); allTrees = allTrees.SortByOptimalTrack(new Robot().ActualPosition); lumber.Trees.AddRange(allTrees.ToArray()); } else { lumber.Trees.AddRange(UOPositionBase.ParseList(trees)); } lumber.Container = container; lumber.InnerContainer = innerContainer; lumber.ContainerPosition = UOPositionBase.ParseList(containerPosition); lumber.RessPositionPath = UOPositionBase.ParseList(ressPosition); lumber.MaxForensicSkill = maxForesnicSkill; lumber.NastrojLoad = nastrojLoad; lumber.EnableVisitorInfo = enableVisitor; foreach (string s in deny.Split(new char[] { ',' })) { lumber.dennyLogList.Add(s); } UO.Print(0x0035, "StartLumber s nasledujicimi parametry:"); UO.Print(0x0035, "Container:" + lumber.Container); UO.Print(0x0035, "InnerContainer:" + lumber.InnerContainer); UO.Print(0x0035, "ContainerPosition:" + UOPositionBase.ListToString(lumber.ContainerPosition)); UO.Print(0x0035, "RessPositionPath:" + UOPositionBase.ListToString(lumber.RessPositionPath)); UO.Print(0x0035, "StartPosition:" + lumber.StartPosition); UO.Print(0x0035, "Trees:" + lumber.Trees.Count); UO.Print(0x0035, "MaxForensicSkill:" + lumber.MaxForensicSkill); UO.Print(0x0035, "KumpLoad:" + lumber.NastrojLoad); UO.Print(0x0035, "EnableVisitorInfo:" + lumber.EnableVisitorInfo); UO.Print(0x0191, "DenyOres:" + String.Join(",", lumber.dennyLogList.ToArray())); lumber.Lumber(); }
public static List <EnemyInfo> GetEnemyList(List <UOCharacter> chars, IUOPosition center) { List <EnemyInfo> enemyList = new List <EnemyInfo>(); foreach (UOCharacter ch in chars)//World.Characters) { if (Game.CurrentGame.IsAlie(ch.Serial) || Game.CurrentGame.IsHealAlie(ch.Serial)) { continue; } EnemyInfo enemy = new EnemyInfo(); enemy.Char = ch; enemy.Damage = (ch.MaxHits - ch.Hits); enemy.Perc = (((decimal)(ch.MaxHits - ch.Hits) / (decimal)ch.MaxHits) * 100.0m) / (decimal)ch.MaxHits; enemy.DamagePerc = ((decimal)(ch.MaxHits - ch.Hits) / (decimal)ch.MaxHits) * 100.0m; enemy.Distance = Robot.GetRelativeVectorLength(center, UOPositionBase.CharacterPosition(ch)); if (enemy.Distance <= 5) { enemy.Zone = 0; } else if (enemy.Distance <= 10) { enemy.Zone = 1; } else if (enemy.Distance <= 15) { enemy.Zone = 2; } else { enemy.Zone = 3; } if (String.IsNullOrEmpty(ch.Name)) { ch.Click(); UO.Wait(100); } if ((String.Empty + ch.Name).ToLower().Contains("mirror") && ch.MaxHits >= 255) { enemy.Priority = 100; } else if ((String.Empty + ch.Name).ToLower().Contains("chameleon")) { enemy.Priority = ch.MaxHits; } else if ((String.Empty + ch.Name).ToLower().Contains("lethargy")) { enemy.Priority = ch.MaxHits; } else if ((String.Empty + ch.Name).ToLower().Contains("lethargy")) { enemy.Priority = ch.MaxHits; } else if ((String.Empty + ch.Name).ToLower().Contains("acid ooze")) { enemy.Priority = ch.MaxHits; } else if ((String.Empty + ch.Name).ToLower().Contains("bird")) { enemy.Priority = ch.MaxHits - 100; } if (enemy.Char.Notoriety == Notoriety.Enemy || enemy.Char.Notoriety == Notoriety.Murderer) { enemy.Priority += 1000; } enemyList.Add(enemy); } return(enemyList); }
//--------------------------------------------------------------------------------------------- public static List <UOCharacter> GetEnemiesByDistance(int maxDistance, bool useDistanceCircles, IUOPosition pos) { List <UOCharacter> enemies = new List <UOCharacter>(); if (pos == null) { pos = UOPositionBase.PlayerPosition; } int distance5 = 0; int distance10 = 0; int enemyDistance = maxDistance; List <UOCharacter> chars = CharactersByDistance; foreach (UOCharacter character in chars) { if ( character.Serial != World.Player.Serial && Robot.GetRelativeVectorLength(pos, UOPositionBase.CharacterPosition(character)) <= maxDistance && // character.Distance < maxDistance && Array.IndexOf(EnemyFilter, character.Notoriety) >= 0 && !Game.CurrentGame.IsAlie(character.Serial) && !Game.CurrentGame.IsHealAlie(character.Serial) && !IsSummon(character) ) { if (character.Distance <= 7) { distance5++; } else if (character.Distance <= 12) { distance10++; } } } if (useDistanceCircles) { if (distance5 > 0) { enemyDistance = 8; } else if (distance10 > 0) { enemyDistance = 13; } } foreach (UOCharacter character in chars) { if ( character.Serial != World.Player.Serial && // character.Distance < enemyDistance && Robot.GetRelativeVectorLength(pos, UOPositionBase.CharacterPosition(character)) <= maxDistance && Array.IndexOf(EnemyFilter, character.Notoriety) >= 0 && !Game.CurrentGame.IsAlie(character.Serial) && !Game.CurrentGame.IsHealAlie(character.Serial) && !IsSummon(character)) { enemies.Add(character); } } return(enemies); }
public static void SortMap(int maxDistance) { openedMapsLoc = null; Game.PrintMessage("Bagl s mapkami >"); UOItem containerFrom = new UOItem(UIManager.TargetObject()); if (containerFrom.Serial.IsValid && containerFrom.Exist) { foreach (UOItem item in containerFrom.Items) { if (item.Graphic == mapka.Graphic) { item.Move(1, World.Player.Backpack); Game.Wait(); } } } foreach (UOItem item in World.Player.Backpack.Items) { if (item.Graphic == mapka.Graphic) { item.Use(); Game.Wait(); } } Game.PrintMessage("OpenedMapsLoc: " + OpenedMapsLoc.Count); Dictionary <string, List <uint> > groups = new Dictionary <string, List <uint> >(); foreach (KeyValuePair <string, List <uint> > kvp in OpenedMapsLoc) { string[] pos = kvp.Key.Split(','); UOPositionBase mapPos = new UOPositionBase(ushort.Parse(pos[0]), ushort.Parse(pos[1]), 0); bool found = false; foreach (KeyValuePair <string, List <uint> > groupkvp in groups) { string[] gruppos = groupkvp.Key.Split(','); UOPositionBase groupmapPos = new UOPositionBase(ushort.Parse(gruppos[0]), ushort.Parse(gruppos[1]), 0); if (Robot.GetRelativeVectorLength(groupmapPos, mapPos) < maxDistance) { groups[groupkvp.Key].AddRange(kvp.Value); found = true; break; } } if (!found) { if (groups.ContainsKey(mapPos.ToString())) { groups[mapPos.ToString()].AddRange(kvp.Value); } else { groups.Add(mapPos.ToString(), kvp.Value); } } } //pytlik obyc 5 rad 20; //4 sloupce po 20 ushort currentCol = 10; ushort currentRow = 1; foreach (KeyValuePair <string, List <uint> > kvp in groups) { ushort colItemPos = currentCol; foreach (uint serial in kvp.Value) { UOItem item = new UOItem(serial); item.Move(1, containerFrom, colItemPos, currentRow); colItemPos++; Game.Wait(); } currentCol = (ushort)(currentCol + 20); if (currentCol > 120) { currentCol = 10; currentRow = (ushort)(currentRow + 16); } } }