ilpersi / BHBot

A bot that automates a game called Bit Heroes
GNU General Public License v3.0
28 stars 32 forks source link

Worldboss tier selection restarts when not all the tiers are available/unlocked #182

Closed ilpersi closed 3 years ago

ilpersi commented 3 years ago

Describe the bug Some of the world bosses have multiple tiers (e.g. Orlag from 3 to 12) and based on your level only some of the tiers may be unlocked. Despite this, the bot is assuming that all the tiers are always unlocked so if you run a character that only has few unlocked tiers the logic is buggy (see snippet below part of changeWorldBossTier method)

        // If the world boss has scrollbar positions, it means that we must check if we need to scroll the bar
        if (wbType.getYScrollerPositions().length > 0) {

            seg = MarvinSegment.fromCue(BHBot.cues.get("StripScrollerTopPos"), 2 * Misc.Durations.SECOND, bot.browser);

            if (seg == null) {
                BHBot.logger.error("Error: unable to detect world boss scrollbar postion in changeWorldBossTier!");
                bot.saveGameScreen("scroll_wb_error", "errors");
                return false;
            }

The generated error

17:00:39,124 DEBUG - autoRunesDefault not defined; aborting autoRunes 17:00:39,149 INFO - Attempting Normal T3 Orlag Clan. Lobby timeout is 3m. 17:00:44,834 DEBUG - Detected: WB Netherworld unlocked 17:00:44,841 DEBUG - WB selected is Orlag Clan 17:00:52,263 INFO - T4 detected, changing to T3 17:00:59,670 ERROR - Error: unable to detect world boss scrollbar postion in changeWorldBossTier! 17:01:00,248 WARN - Doing driver emergency restart...

To Reproduce Steps to reproduce the behavior: Assumption: you need a low-level character that has not yet unlocked all the tiers.

  1. Activate Worlboss in the settings: worldBoss o 1 3 100 180
  2. Run the bot and wait for it to start a World Boss

Expected behavior Bot is able to find unlocked tiers and acts consequently

Screenshots See attachment

Settings See steps to reproduce

Desktop (please complete the following information):

scroll_wb_error_20201101