/// <summary> /// Attempts to teleport to the specified location /// </summary> /// <param name="location">location to teleport to</param> /// <param name="wait">whether to wait for expected teleport duration</param> /// <returns>False if the player doesn't have the runes to teleport</returns> public bool HoverStandardTeleport(StandardTeleports location, bool wait = true, bool safeTab = false) { Point spellbookSlot = TeleportToSpellBookSlot(location); HoverSpellbookStandard(spellbookSlot.X, spellbookSlot.Y, safeTab); if (wait) { BotProgram.SafeWait(TELEPORT_DURATION); } return(true); }
/// <summary> /// Determines if the player is carrying the required runes for the selected spell /// </summary> /// <param name="x">inventory column (0-6)</param> /// <param name="y">inventory row (0-9)</param> /// <returns></returns> public bool TeleportHasRunes(StandardTeleports location) { Point inventorySlot = TeleportToSpellBookSlot(location); int x = inventorySlot.X; int y = inventorySlot.Y; if (!SpellbookStandardToScreen(ref x, ref y)) { return(false); } OpenSpellbook(false); int radius = 5; Color[,] icon = ImageProcessing.ScreenPiece(Screen, x - radius, x + radius, y - radius, y + radius); Color colorAverage = ImageProcessing.ColorAverage(icon); float brightness = colorAverage.GetBrightness(); return(brightness > 0.2f); }
/// <summary> /// Converts a standard spellbook teleport location to inventory slot coordinates /// </summary> /// <param name="location"></param> /// <returns></returns> public Point TeleportToSpellBookSlot(StandardTeleports location) { switch (location) { case StandardTeleports.Home: return(new Point(0, 0)); case StandardTeleports.Varrock: return(new Point(1, 2)); case StandardTeleports.Lumbridge: return(new Point(4, 2)); case StandardTeleports.Falador: return(new Point(0, 3)); case StandardTeleports.House: return(new Point(2, 3)); case StandardTeleports.Camelot: return(new Point(5, 3)); case StandardTeleports.Ardougne: return(new Point(4, 4)); case StandardTeleports.Watchtower: return(new Point(2, 5)); case StandardTeleports.Trollheim: return(new Point(2, 6)); case StandardTeleports.ApeAtoll: return(new Point(5, 6)); case StandardTeleports.Kourend: return(new Point(3, 7)); default: throw new Exception("Selected teleport not implemented"); } }