public static void LockShip() { int origFindDistance = World.FindDistance; World.FindDistance = 20; List <UOItem> prkna = World.Ground.Where(i => OpenDecks.Count(d => d.Graphic == i.Graphic) > 0 || CloseDecks.Count(d => d.Graphic == i.Graphic) > 0).ToList(); //new List<UOItem>(); if (prkna.Count > 0) { if (LastShipKeyOrDefault.Exist) { foreach (UOItem prkno in prkna) { Journal.Clear(); UO.WaitTargetObject(prkno); LastShipKeyOrDefault.Use(); if (Journal.WaitForText(true, 250, "You unlock the ship", "You lock the ship")) { if (Journal.Contains(true, "You unlock the ship")) { UO.WaitTargetObject(prkno); LastShipKeyOrDefault.Use(); if (Journal.WaitForText(true, 250, "You unlock the ship", "You lock the ship")) { World.Player.PrintMessage("[Lock...]"); } } else { World.Player.PrintMessage("[Lock...]"); } Game.Wait(250); } else { Game.Wait(250); continue; } } } else { World.Player.PrintMessage("[Neni klic...]", MessageType.Error); } } else { World.Player.PrintMessage("[Neni prkno...]", MessageType.Error); } World.FindDistance = origFindDistance; }
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 static void EscapeToShip() { int origFindDistance = World.FindDistance; World.FindDistance = 20; List <UOItem> prkna = World.Ground.Where(i => OpenDecks.Count(d => d.Graphic == i.Graphic) > 0 || CloseDecks.Count(d => d.Graphic == i.Graphic) > 0).ToList(); //new List<UOItem>(); ResultInfo openResult = OpenShip(); if (openResult.Success || prkna.Count > 0) { EnterShip(); if (LastShipKeyOrDefault.Exist) { LockShip(); } } World.FindDistance = origFindDistance; }