Пример #1
0
        /// <summary>
        /// Fills the small, medium, and large pouches.
        /// Refreshes stamina if it is almost out.
        /// Replaces any depleted jewelry.
        /// </summary>
        /// <param name="refreshStamina">set to true to drink a dose of stamina potion</param>
        /// <returns>true if successful</returns>
        protected bool FillSmallMediumLargePouches()
        {
            Point cursorLocation = new Point(Mouse.X, Mouse.Y);
            Bank  bank;

            if (HandEye.MouseOverStationaryObject(new Blob(cursorLocation), true, 0, 0))    //try mousing over the default guess location first
            {
                bank = new Bank(RSClient, Inventory, Keyboard);
                if (!bank.WaitForPopup(6000))
                {
                    return(false);
                }
            }
            else if (!Banking.OpenBank(out bank, 3))    //Look for the bank if guessing fails
            {
                return(false);
            }

            bank.DepositAll(InventorySlotCraftedRunes);
            BankWithdrawForServicing(bank);
            bank.WithdrawAll(BankSlotPureEssence.X, BankSlotPureEssence.Y);
            bank.Close();

            return(Servicing());
        }
Пример #2
0
        public const int REPAIR_POUCHES_DURATION = NPCContact.NPC_CONTACT_CAST_TIME + 3000; //approximate time needed to go through the full pouch repair process

        /// <summary>
        /// Replenishes pure essence. Drinks a dose of stamina potion on every other trip.
        /// </summary>
        /// <returns></returns>
        protected bool RefreshItems()
        {
            EvaluateStamina();  //determine if the player should drink a dose of stamina potion

            //Fill small-large pouches. Service if not using all four pouches.
            if (StopFlag || !FillSmallMediumLargePouches())
            {
                return(false);
            }

            //Fill huge pouch
            if (StopFlag || UserSelections.NumberOfPouches >= 4 && !FillHugePouch())
            {
                return(false);
            }

            //Refill inventory
            if (UserSelections.NumberOfPouches > 0 || LowStamina)
            {
                Bank bank;
                if (!Banking.OpenBank(out bank))
                {
                    return(false);
                }
                if (LowStamina)
                {
                    bank.DepositItem(InventorySlotStaminaPotion);
                    LowStamina = false;
                }
                bank.WithdrawAll(BankSlotPureEssence.X, BankSlotPureEssence.Y); //don't waste time closing the bank since it will close itself when we start running
            }

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Withdraw half an inventory of secondary ingredients.
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool WithdrawSecondaryIngredients()
        {
            Bank bank;

            if (!Banking.OpenBank(out bank))
            {
                return(false);
            }
            bank.WithdrawX(SecondaryIngredientBankSlot.X, SecondaryIngredientBankSlot.Y, HALF_INVENTORY);
            bank.Close();
            return(true);
        }
Пример #4
0
        /// <summary>
        /// Opens the bank, withdraw 14 ashes + 14 tarromin potions, and closes the bank.
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool WithdrawAshesAndPotions()
        {
            Bank bank;

            if (!Banking.OpenBank(out bank, 2))
            {
                return(false);
            }
            bank.DepositInventory();
            bank.WithdrawX(HerbBankSlot.X, HerbBankSlot.Y, HALF_INVENTORY);
            bank.WithdrawX(VialOfWaterBankSlot.X, VialOfWaterBankSlot.Y, HALF_INVENTORY);
            bank.Close();
            return(true);
        }
Пример #5
0
        protected override bool Execute()
        {
            //Move to the bank and open it
            if (!Banking.MoveToBank(7000, true, BankIconMinSize))
            {
                if (StopFlag)
                {
                    return(false);
                }

                Point moveTowardBank = Minimap.RadialToRectangular(350, 1);
                LeftClick(moveTowardBank.X, moveTowardBank.Y);
                if (SafeWait(6000))
                {
                    return(false);
                }
                Vision.WaitDuringPlayerAnimation(10000);
                if (!MoveToBankPhasmatys(2700))
                {
                    return(false);
                }
            }
            if (StopFlag || !ClickBankBooth())
            {
                return(false);
            }

            if (StopFlag)
            {
                return(false);
            }
            BankItems();

            if (!MoveToFireLine() || StopFlag)
            {
                return(false);
            }
            if (SafeWait(5000))
            {
                return(false);
            }
            Vision.WaitDuringPlayerAnimation(10000);

            if (!SetFires() || StopFlag)
            {
                return(false);
            }

            return(true);
        }
Пример #6
0
        /// <summary>
        /// Open bank, withdraw items, close bank, do work with items
        /// </summary>
        /// <returns>true if successful</returns>
        protected override bool Execute()
        {
            Bank bank;

            if (!Banking.OpenBank(out bank) || !WithdrawItems(bank))
            {
                return(false);
            }
            bank.Close();
            if (StopFlag || !ProcessInventory())
            {
                return(false);
            }

            return(true);
        }
Пример #7
0
        /// <summary>
        /// Fills the small, medium, and large pouches.
        /// Refreshes stamina if it is almost out.
        /// </summary>
        /// <param name="refreshStamina">set to true to drink a dose of stamina potion</param>
        /// <returns>true if successful</returns>
        protected bool FillHugePouch()
        {
            Bank bank;

            if (!Banking.OpenBank(out bank))
            {
                return(false);
            }
            if (LowStamina)
            {
                bank.DepositItem(InventorySlotStaminaPotion);
                LowStamina = false;
            }
            bank.WithdrawAll(BankSlotPureEssence.X, BankSlotPureEssence.Y);
            bank.Close();
            Inventory.ClickInventory(InventorySlotGiantPouch);

            return(true);
        }
Пример #8
0
        /// <summary>
        /// Teleports to Edgeville and moves to the Edgeville bank
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool MoveToEdgevilleBank()
        {
            //teleport to Edgeville bank
            Inventory.GloryTeleport(Inventory.GloryTeleports.Edgeville, false);
            Stopwatch watch = new Stopwatch();

            watch.Start();
            MoveMouse(Minimap.Center.X + 35, Minimap.Center.Y + 8, 35);
            SafeWait(Inventory.TELEPORT_DURATION);

            //Start moving to bank booth
            Point bankIconOffsetTarget = new Point(2 * MinimapGauge.GRID_SQUARE_SIZE, MinimapGauge.GRID_SQUARE_SIZE / 2);

            if (!Banking.MoveToBank(0, true, 4, 2, bankIconOffsetTarget))
            {
                return(false);
            }

            CheckItems();
            Inventory.OpenInventory();
            MoveMouse(Screen.Center.X, Screen.Center.Y + 30, 15);
            return(true);
        }
Пример #9
0
        /// <summary>
        /// Initializes a bot program with a client matching startParams
        /// </summary>
        /// <param name="startParams">specifies how to run the bot</param>
        protected BotProgram(RunParams startParams)
        {
            RunParams                       = startParams;
            RunParams.ClientType            = ScreenScraper.Client.Jagex;
            RunParams.DefaultCameraPosition = RunParams.CameraPosition.NorthAerial;
            RunParams.LoginWorld            = 0;

            RSClient = new RSClient(RunParams);
            Screen   = new GameScreen(RSClient, RunParams);
            RSClient.AddScreen(Screen);

            Vision         = new Vision(Screen, RunParams);
            Keyboard       = new Keyboard(RSClient);
            Mouse.RSClient = RSClient;
            HandEye        = new HandEye(Vision, Screen);
            Inventory      = new Inventory(RSClient, Keyboard, Screen);
            Minimap        = new MinimapGauge(RSClient, Keyboard, Screen);
            Textbox        = new TextBoxTool(RSClient, Keyboard, Screen);
            Banking        = new Banking(Screen, Vision, HandEye, RSClient, Keyboard, Inventory, Minimap);
            Conversation   = new Conversation(Textbox, Screen, RunParams.Conversation);

            RNG = new Random();
        }
Пример #10
0
        /// <summary>
        /// Restore hitpoints at the Seers' Village bank and reset location to the Seers' bank teleport before continuing
        /// </summary>
        /// <returns></returns>
        private bool BankAndHeal()
        {
            Bank bank;

            SetFoodSlots(); //Record which inventory slots are currenty empty and will be occupied by food
            if (!Banking.MoveToBank(5000) || !Banking.OpenBank(out bank))
            {
                return(false);
            }
            bank.WithdrawAll(FoodBankSlot.X, FoodBankSlot.Y);
            bank.Close();
            if (!ManageHitpoints() || !Banking.OpenBank(out bank))  //Eat food from initially empty inventory slots until we have very high health.
            {
                return(false);
            }
            DepositFood(bank);
            bank.Close();

            if (!Inventory.StandardTeleport(Inventory.StandardTeleports.Camelot))
            {
                return(Inventory.StandardTeleport(Inventory.StandardTeleports.Camelot, true, true));
            }
            return(true);
        }