/// <summary>
        /// Repairs damaged pouches, replaces depleted glory, replenishes stamina, and fills three smallest pouches.
        /// </summary>
        protected bool Servicing()
        {
            if (DamagedPouches)
            {
                RepairPouches();
            }
            for (int i = 0; i < Math.Min(UserSelections.NumberOfPouches, 3); i++)
            {
                Inventory.ClickInventory(PouchSlots[i]);
                if (SafeWaitPlus(0, 50))
                {
                    return(false);
                }
            }
            if (LowStamina)
            {
                if (DepletedGlory)
                {
                    Inventory.ClickInventory(InventoryDepletedGlory);
                    DepletedGlory = false;
                }
                DrinkStaminaPotion();
            }
            else if (DepletedGlory)
            {
                Inventory.ClickInventory(InventorySlotCraftedRunes);
                DepletedGlory = false;
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Cleans the herbs in the first 14 inventory slots by default.
        /// </summary>
        /// <param name="fullInventory">set to true to clean all 28 inventory slots</param>
        /// <returns></returns>
        protected bool CleanHerbs(bool fullInventory = false)
        {
            //snake through the grimy herbs to clean them like a human would instead of going in index order
            for (int row = 0; row < Inventory.INVENTORY_ROWS; row++)
            {
                if (row % 2 == 0)
                {
                    for (int column = Inventory.INVENTORY_COLUMNS - 1; column >= 0; column--)
                    {
                        if (FirstHalfInventory[column, row])
                        {
                            Inventory.ClickInventory(column, row, false);
                        }
                    }
                }
                else
                {
                    for (int column = 0; column < Inventory.INVENTORY_COLUMNS; column++)
                    {
                        if (FirstHalfInventory[column, row])
                        {
                            Inventory.ClickInventory(column, row, false);
                        }
                    }
                }
            }

            return(!SafeWaitPlus(WAIT_FOR_HERBS_TO_CLEAN, 0.35 * WAIT_FOR_HERBS_TO_CLEAN));
        }
Exemple #3
0
        /// <summary>
        /// Attempts to safely unnote an item using the bank chest
        /// </summary>
        /// <param name="inventorySlot"></param>
        /// <returns></returns>
        protected bool UnNoteBankChest(Point inventorySlot, bool noteSelected)
        {
            if (!noteSelected)
            {
                Inventory.ClickInventory(inventorySlot, true);
            }

            Point bankChestClick;

            if (BankChestClickLocation(out bankChestClick))
            {
                Mouse.Move(bankChestClick.X, bankChestClick.Y);
                if (Vision.WaitForMouseOverText(BlueMouseOverText))
                {
                    Mouse.LeftClick(bankChestClick.X, bankChestClick.Y);
                    if (WaitFor(UnNoteTheBanknotes))
                    {
                        Keyboard.WriteNumber(1);
                        return(true);
                    }
                    else
                    {
                        RefreshInventory();
                        return(false);
                    }
                }
            }

            Inventory.ClickInventory(inventorySlot, true);
            return(false);
        }
Exemple #4
0
        /// <summary>
        /// Sets up a sawmill task for the butler
        /// Assumes that the butler is already waiting on a command
        /// </summary>
        /// <returns>true if successful</returns>
        protected bool StartSawmillTask()
        {
            Inventory.ClickInventory(FirstLogSlot, true);
            Blob demon;

            if (!Vision.LocateObject(DemonHead, out demon, 100))
            {
                return(false);
            }
            LeftClick(demon.Center.X, demon.Center.Y);
            return(true);
        }
Exemple #5
0
        /// <summary>
        /// Eats the next food in the inventory
        /// </summary>
        /// <returns>true if successful, false if no more food exists</returns>
        protected virtual bool EatNextFood()
        {
            if (FoodSlots.Count == 0)
            {
                return(false);
            }
            int nextFood = FoodSlots.Dequeue();

            Inventory.ClickInventory(nextFood);

            return(true);
        }
Exemple #6
0
 /// <summary>
 /// Sets all of the inventory logs on fire
 /// </summary>
 /// <returns>true if successful</returns>
 protected bool SetFires()
 {
     for (int i = 1; i < Math.Min(RunParams.Iterations + 1, Inventory.INVENTORY_CAPACITY); i++)
     {
         Inventory.ClickInventory(Tinderbox.X, Tinderbox.Y, false);
         Inventory.ClickInventory(i);
         if (SafeWait(SET_FIRE_TIME))
         {
             return(false);
         }
         RunParams.Iterations--;
     }
     return(true);
 }
Exemple #7
0
        /// <summary>
        /// Carefully un-notes logs using the bank chest
        /// </summary>
        /// <returns>true if successful</returns>
        protected override bool Bank()
        {
            Inventory.OpenInventory();
            SafeWait(500);
            Screen.ReadWindow();
            if (InventoryIsReady())
            {
                return(true);
            }

            Inventory.ClickInventory(InventoryLogSlot, true);
            Mouse.Move(Screen.Center.X, Screen.Center.Y);
            if (WaitForTeleport())
            {
                return(false);
            }

            if (!ItemsAreReady())   //reset the inventory to its correct starting configuration
            {
                RefreshInventory();
                if (SafeWait(1000))
                {
                    return(false);
                }
                if (!ItemsAreReady())
                {
                    return(false);   //TODO restock at the GE
                }
            }

            const int maxUnNoteTries = 5;

            for (int i = 0; i < maxUnNoteTries; i++)
            {
                if (StopFlag)
                {
                    return(false);
                }
                if (UnNoteBankChest(InventoryLogSlot, i == 0))
                {
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Drinks a dose of absorption potion if the absorption shield is low
        /// </summary>
        /// <returns>true if a dose of absorption is consumed</returns>
        protected bool Absorption()
        {
            if (!hasAbsorptions || AbsorptionShieldIsHigh())
            {
                return(false); //The absorption shield is already high or we ran out of absorptions to drink
            }

            Point?firstAbsorption = Inventory.FirstColorMatchingSlot(AbsorptionInventory, 0.01, false);

            if (firstAbsorption == null || !firstAbsorption.HasValue)
            {
                hasAbsorptions = false;
                return(false);
            }

            Inventory.ClickInventory(firstAbsorption.Value, false);
            return(true);
        }
        /// <summary>
        /// Drinks a dose of overload if the timer does not show up above the chat box
        /// </summary>
        /// <returns>true if a dose of overload is consumed</returns>
        protected bool Overload()
        {
            if (!hasOverloads || OverloadTimerExists() || (DateTime.Now - lastOverload).TotalMilliseconds < overloadDrainTime)
            {
                return(false);   //An overload is active or we ran out of overloads to drink
            }

            Point?firstOverload = Inventory.FirstColorMatchingSlot(OverloadInventory, 0.01, false);

            if (firstOverload == null || !firstOverload.HasValue)
            {
                hasOverloads = false;
                return(false);
            }

            Inventory.ClickInventory(firstOverload.Value, false);
            lastOverload = DateTime.Now;
            return(true);
        }
Exemple #10
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);
        }
Exemple #11
0
        /// <summary>
        /// Use the tool on the other 27 items
        /// </summary>
        /// <returns>true if successful</returns>
        protected override bool ProcessInventory()
        {
            for (int i = 0; i < 28; i++)
            {
                Inventory.ClickInventory(i, false);
                SafeWait(500);
            }
            // SafeWaitPlus(500, 200);
            // if (!ChatBoxSingleOptionMakeAll(RSClient))
            // {
            //     return false;
            // }

            //Wait for the inventory to be processed
            WatchNetflix(0);
            CountDownItems(true);
            SafeWaitPlus(0, 1500);

            return(true);
        }
Exemple #12
0
        protected override bool Execute()
        {
            if (failedRuns > CONSECUTIVE_FAILURES_ALLOWED)
            {
                return(false);
            }

            //Move to the bank and open it
            if (!MoveToBankPhasmatys() || !ClickBankBooth())
            {
                failedRuns++;
                return(true);
            }

            //Refresh inventory to a bracelet mould and 27 gold bars
            if (StopFlag)
            {
                return(false);
            }
            BankPopup = new Bank(RSClient, Inventory, Keyboard);
            if (!BankPopup.WaitForPopup(BotUtilities.WAIT_FOR_BANK_WINDOW_TIMEOUT))
            {
                failedRuns++;
                return(true);
            }
            if (StopFlag)
            {
                return(false);
            }
            BankPopup.DepositInventory();
            SafeWaitPlus(500, 200);
            BankPopup.WithdrawOne(7, 0);
            SafeWaitPlus(500, 150);
            BankPopup.WithdrawAll(6, 0);

            //Move to the furnace and use a gold bar on it
            if (StopFlag)
            {
                return(false);
            }
            if (!MoveToFurnace(6000))
            {
                failedRuns++;
                return(true);
            }
            Inventory.ClickInventory(1, 0, false);
            HandEye.ClickStationaryObject(Furnace, STATIONARY_OBJECT_TOLERANCE, 100, 12000, 1000);

            //Do the bot-specific actions at the furnace
            if (StopFlag)
            {
                return(false);
            }
            if (!FurnaceActions())
            {
                failedRuns++;
                return(true);
            }

            failedRuns = 0;
            return(true);
        }
Exemple #13
0
 /// <summary>
 /// Drinks a dose of stamina potion.
 /// Assumes that a stamina potion is already in its designated inventory slot.
 /// </summary>
 protected void DrinkStaminaPotion()
 {
     Inventory.ClickInventory(InventorySlotStaminaPotion);
     StaminaTimer.Restart();
 }