def run_challenge(challenge: int, cont: bool = False) -> None: """Run the selected challenge. Keyword arguments challenge -- The index of the challenge, starting at 1 for Basic challenge, ending at 11 for No TM challenge cont -- Whether the challenge is already running. """ global ChList Navigation.challenges() if cont: pass else: x = coords.CHALLENGE.x y = coords.CHALLENGE.y + challenge * coords.CHALLENGEOFFSET Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() chall = ChList[challenge - 1] print(f"Starting {chall.name} Challenge script.") for x in chall.extra: if callable(x): print(x()) else: print(x) chall.script()
def init(target: int) -> None: """Counts available inventory pages.""" Glop.start = time.time() Glop.target = target Navigation.menu("inventory") for btn in coords.INVENTORY_PAGE: res = Inputs.check_pixel_color(*btn, coords.COLOR_INVENTORY_BG) if not res: Glop.inv_pages_unlocked += 1 Glop.update_inventory()
def get_wish_status(self): """Check which wishes are done and which are level 1 or higher.""" Navigation.menu("wishes") self.wishes_completed = [] # completed wishes self.wishes_in_progress = [] # wishes above level 0 self.wishes_active = [] # wishes that currently are progressing Inputs.click( *coords.WISH_PAGE[1] ) # go to page 2 and select the first wish to get rid of the green border time.sleep(userset.MEDIUM_SLEEP) Inputs.click(*coords.WISH_PORTRAIT) time.sleep(userset.MEDIUM_SLEEP) Inputs.click(*coords.WISH_PAGE[0]) for i, page in enumerate(coords.WISH_PAGE): Inputs.click(*page) for y in range(3): for x in range(7): border_color = Inputs.get_pixel_color( coords.WISH_BORDER.x + x * 92, coords.WISH_BORDER.y + y * 106) if border_color == coords.COLOR_WISH_COMPLETED: self.wishes_completed.append(1 + x + y + y * 6 + i * 21) if border_color == coords.COLOR_WISH_STARTED: self.wishes_in_progress.append(1 + x + y + y * 6 + i * 21) active_color = Inputs.get_pixel_color( coords.WISH_SELECTION.x + x * 92, coords.WISH_SELECTION.y + y * 106) if active_color == coords.COLOR_WISH_ACTIVE: self.wishes_active.append(1 + x + y + y * 6 + i * 21) if active_color == coords.COLOR_WISH_INACTIVE: Inputs.click(coords.WISH_SELECTION.x + x * 92, coords.WISH_SELECTION.y + y * 106) Inputs.click(*coords.WISH_CLEAR_WISH) self.wishes_in_progress.append(1 + x + y + y * 6 + i * 21) if i == 0: # after page 1 is scanned, select first wish Inputs.click(*coords.WISH_PORTRAIT) used_slots = len(self.wishes_active) self.available_slots = self.wish_slots - used_slots if used_slots > 0: print( f"{used_slots} wish slots are already in use and will be ignored." )
def get24boss(): try: x = coords.CHALLENGE.x y = coords.CHALLENGE.y + 3 * coords.CHALLENGEOFFSET Navigation.challenges() Inputs.click(x, y, button="right") time.sleep(userset.LONG_SLEEP) target = Inputs.ocr(*coords.OCR_CHALLENGE_24HC_TARGET) target = Inputs.get_numbers(target)[0] return f"Target boss: {target}" except ValueError: Discord.send_message("Couldn't detect the target level of 24HC", Discord.ERROR) return "Couldn't detect the target level of 24HC"
def __init__(self, source_content_dir, destination_content_dir, template_dir, language ): if not source_content_dir: raise ValueError('source_content_dir must not be None!') if not destination_content_dir: raise ValueError('destination_content_dir must not be None!') if not template_dir: raise ValueError('template_dir must not be None!') self.source_content_dir = source_content_dir self.destination_content_dir = destination_content_dir self.theme_dir = os.path.join(source_content_dir, 'theme') self.template_dir = template_dir self.language = language print('--------- [Generator] Getting templates') self.templates = self.get_templates() print('[Generator] Acquired %s templates' % (str(len(self.templates)))) print('--------- [Generator] Getting css styles') self.styles = self.get_styles() print('[Generator] Acquired %s css styles' % (str(len(self.styles)))) print('--------- [Generator] Getting categories') self.root_category = Category(self.source_content_dir) print('--------- [Generator] Getting navigation') Navigation(self.root_category) print('--------- [Generator] Rendering') self.render()
def add_emr(self, wish, emr): """Add EMR to wish.""" alloc_coords = [ coords.WISH_E_ADD, coords.WISH_M_ADD, coords.WISH_R_ADD ] Navigation.menu("wishes") page = ((wish.id - 1) // 21) Inputs.click(*coords.WISH_PAGE[page]) x = coords.WISH_SELECTION.x + ( (wish.id - 1) % 21 % 7) * coords.WISH_SELECTION_OFFSET.x y = coords.WISH_SELECTION.y + ( (wish.id - 1) % 21 // 7) * coords.WISH_SELECTION_OFFSET.y # have to add to add some offset here, otherwise the clicks don't register for some reason. Inputs.click(x + 20, y + 20) for i, e in enumerate(emr): Navigation.input_box() Inputs.send_string(e) Inputs.click(*alloc_coords[i])
def loop() -> None: while len(Glop.reagents["glop.png"]) < Glop.target: Navigation.menu("inventory") # Find the glop reagent we have the fewest of target = min(Glop.reagents, key=lambda x: len(Glop.reagents[x]) if x != "glop.png" else float('Inf')) for reagent in Glop.reagents[target]: Inputs.click(*coords.INVENTORY_PAGE[reagent.page]) Inputs.click(reagent.x, reagent.y, button="right") Inputs.ctrl_click(reagent.x, reagent.y) print(f"converted {len(Glop.reagents[target])} glops") Adventure.snipe(Glop.GLOP_ZONE_MAP[target], 2) Glop.update_inventory() elapsed = round(time.time() - Glop.start) print( f"Finished collecting {Glop.target} glops in {datetime.timedelta(seconds=elapsed)}" )
def start_challenge(challenge: int, quitCurrent: bool = False) -> None: """Start the selected challenge. Checks for currently running challenges. Keyword arguments challenge -- The index of the challenge, starting at 1 for Basic challenge, ending at 11 for No TM challenge quitCurrent -- Quit the current challenge if it is different to the desired. """ BloodMagic.toggle_auto_spells(drop=False) chall = Rebirth.check_challenge(getNum=True) if chall and chall != challenge: print(f"A challenge is currently running ({chall}).") if quitCurrent: print("Quitting current challenge.") Navigation.challenge_quit() else: Challenge.run_challenge(chall, cont=True) Challenge.run_challenge(challenge)
def set_value_with_ocr(value): """Store start EXP via OCR.""" try: if value == "TOTAL XP": Navigation.misc() Stats.total_xp = Inputs.ocr_notation(*coords.OCR_TOTAL_EXP) # print("OCR Captured TOTAL XP: {:,}".format(Stats.total_xp)) elif value == "XP": Navigation.exp() Stats.xp = Inputs.ocr_number(*coords.OCR_EXP) # print("OCR Captured Current XP: {:,}".format(Stats.xp)) elif value == "PP": Navigation.perks() Misc.waste_click() Stats.pp = Inputs.ocr_number(*coords.OCR_PP) # print("OCR Captured Current PP: {:,}".format(Stats.pp)) Stats.OCR_failed = False Stats.OCR_failures = 0 except ValueError: Stats.OCR_failures += 1 if Stats.OCR_failures <= 3: print("OCR couldn't detect {}, retrying.".format(value)) if Stats.OCR_failures >= 2: print("Clearing Navigation.current_menu") Navigation.current_menu = "" Stats.set_value_with_ocr(value) else: print("Something went wrong with the OCR") Stats.OCR_failures = 0 Stats.OCR_failed = True
def update_inventory() -> None: """Scan all inventory pages for glop related items.""" Navigation.menu("inventory") for item in coords.GLOP_FILENAMES: Glop.reagents[item] = [] for page in range(Glop.inv_pages_unlocked): Inputs.click(*coords.INVENTORY_PAGE[page]) time.sleep(userset.LONG_SLEEP) bmp = Inputs.get_bitmap() for item in coords.GLOP_FILENAMES: path = Inputs.get_file_path("images", item) # Using the whole window instead of cropping out just the inventory yields higher accuracy rect = (Window.x, Window.y, Window.x + 960, Window.y + 600) res = Inputs.find_all(*rect, path, threshold=0.9, bmp=bmp) reagents = list( map(lambda x: Reagent(x[0], x[1], item, page), res)) if reagents: Glop.reagents[item].extend(reagents) print("\nScan found these glop reagents\n") for item in coords.GLOP_FILENAMES: print(f"{item}: {len(Glop.reagents[item])}")
tracker.adjustxp() # print("Going into Sleep till 30 mins up?") # print(str(f.rt_to_seconds()) + " < end") if rt > end: f.do_rebirth() time.sleep(1) rt = f.rt_to_seconds() return w = Window() i = Inputs() nav = Navigation() feature = Features() #ngui = NGUI(nav) Window.x, Window.y = i.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, 400, 600) nav.menu("inventory") u = UpgradeEM(37500, 37500, 1, 1, 3) r3unlocked = False print(f"Top left found at: {w.x}, {w.y}") tracker = Tracker(30) while True: # main loop speedrun(30, feature)
if idle_magic != 0: print("Reassign NGU Magic") f.assign_ngu(idle_magic, [2], magic=True) # f.blood_magic(7, reverse=True) idle_magic = f.get_idle_cap(2) idle_energy = f.get_idle_cap(1) print("Sniping") nav.menu("adventure") f.kill_titan("BEAST1") f.adventure(19, highest=False) f.snipe(19, 10, once=False, bosses=True, manual=True) print("Finished Snipe") w = Window() i = Inputs() nav = Navigation() feature = Features() #ngui = NGUI(nav_obj=nav, input_obj=i) Window.x, Window.y = i.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, 400, 600) time.sleep(2) rt = feature.get_rebirth_time() start_procedure(feature, rt) while True: rt = feature.get_rebirth_time() spells = feature.check_spells_ready() start_procedure(feature, rt) # if spells: # check if any spells are off CD # for spell in spells: # feature.cast_spell(spell) feature.save_check()
def get_breakdowns(self): """Go to stat breakdowns and fetch the necessary stats.""" Navigation.stat_breakdown() Inputs.click(*coords.BREAKDOWN_E) time.sleep(userset.MEDIUM_SLEEP) print("OCR is scanning a large area, this might take a few seconds") e_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN)) Inputs.click(*coords.BREAKDOWN_M) time.sleep(userset.MEDIUM_SLEEP) m_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN)) Inputs.click(*coords.BREAKDOWN_R) time.sleep(userset.MEDIUM_SLEEP) r_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN)) Inputs.click(*coords.BREAKDOWN_MISC) time.sleep(userset.MEDIUM_SLEEP) Inputs.click_drag(*coords.BREAKDOWN_MISC_SCROLL_DRAG_START, *coords.BREAKDOWN_MISC_SCROLL_DRAG_END) misc_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN)) fields = [ "total energy power:", "total magic power:", "total r power:", "total wish speed:" ] try: for e in e_list: if e[0].lower() in fields: self.epow = float(e[1]) except ValueError: print("couldn't fetch energy power") self.epow = 1 try: for e in m_list: if e[0].lower() in fields: self.mpow = float(e[1]) except ValueError: print("couldn't fetch magic power") self.mpow = 1 try: for e in r_list: if e[0].lower() in fields: self.rpow = float(e[1]) except ValueError: print("couldn't fetch R3 power") self.rpow = 1 try: for e in misc_list: if e[0].lower() in fields: self.wish_speed = int(e[1]) / 100 except ValueError: print("Couldn't fetch wish speed, defaulting to 100%") self.wish_speed = 1 if not self.wish_speed: print("Couldn't get wish speed") self.wish_speed = 1 if not self.epow: print("Couldn't get epow") self.epow = 1 if not self.mpow: print("Couldn't get mpow") self.mpow = 1 if not self.rpow: print("Couldn't get rpow") self.rpow = 1 self.get_caps()
assaign_NGU() NotInFarmZone = False for x in ManualKillList: NotInFarmZone = True print("Manually killing " + x) while int(TITANS[x]["KillTime"] - time.time()) <= timeToWait: createTimeStamp(x, feature.kill_titan(x)) return NotInFarmZone w = Window() i = Inputs() nav = Navigation() feature = Features() Window.x, Window.y = i.pixel_search(ncon.TOP_LEFT_COLOR, 10, 10, 400, 600) nav.menu("inventory") #feature.kill_titan("BEAST1") #exit() while feature.questing(): time.sleep(0.1) #feature.adventure(itopod=True, itopodauto=True) #exit()
def start_challenge(challenge: int) -> None: """Start the selected challenge. Keyword arguments challenge -- The index of the challenge, starting at 1 for Basic challenge, ending at 11 for No TM challenge """ BloodMagic.toggle_auto_spells(drop=False) Navigation.rebirth() Inputs.click(*coords.CHALLENGE_BUTTON) chall = Rebirth.check_challenge(getNum=True) if chall: text = Inputs.ocr(*coords.OCR_CHALLENGE_NAME) print("A challenge is already active: " + text) if "basic" in text.lower(): print("Starting basic challenge script") Basic.start() elif "24 hour" in text.lower(): print("Starting 24 hour challenge script") try: x = coords.CHALLENGE.x y = coords.CHALLENGE.y + challenge * coords.CHALLENGEOFFSET Inputs.click(x, y, button="right") time.sleep(userset.LONG_SLEEP) target = Inputs.ocr(*coords.OCR_CHALLENGE_24HC_TARGET) target = int(Inputs.remove_letters(target)) print(f"Found target boss: {target}") Basic.start() except ValueError: print("Couldn't detect the target level of 24HC") Discord.send_message( "Couldn't detect the" + " target level of 24HC", Discord.ERROR) elif "100 level" in text.lower(): print("Starting 100 level challenge script") print("IMPORTANT") print( "Set target level for energy buster to 67 and charge shot to 33." ) print("Disable 'Advance Energy' in Augmentation") print("Disable beards if you cap ultra fast.") Level.start() elif "blind" in text.lower(): print("Starting blind challenge script") Blind.start() elif "laser" in text.lower(): print("Starting laser sword challenge script") Laser.start() elif "rebirth" in text.lower(): print("Starting no rebirth challenge script") RebirthCh.rebirth_challenge() elif "augs" in text.lower(): print("Starting no augs challenge script") Augment.start() elif "equipment" in text.lower(): print("Starting no equipment challenge script") Equipment.start() elif "time machine" in text.lower(): print("Starting no time machine challenge script") Timemachine.start() elif "ngu" in text.lower(): print("Starting no NGU challenge script") NGU.start() else: print("Couldn't determine which script to start from the OCR", "input") else: x = coords.CHALLENGE.x y = coords.CHALLENGE.y + challenge * coords.CHALLENGEOFFSET if challenge == 1: Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Basic.start() elif challenge == 2: Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Augment.start() elif challenge == 3: try: Inputs.click(x, y, button="right") time.sleep(userset.LONG_SLEEP) target = Inputs.ocr(*coords.OCR_CHALLENGE_24HC_TARGET) target = int(Inputs.remove_letters(target)) print(f"Found target boss: {target}") Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() time.sleep(userset.LONG_SLEEP) Basic.start() except ValueError: print("couldn't detect the target level of 24HC") Discord.send_message( "Couldn't detect the" + "target level of 24HC", Discord.ERROR) elif challenge == 4: print("IMPORTANT") print( "Set target Level for energy buster to 67 and charge shot to 33." ) print("Disable 'Advance Energy' in Augmentation") print("Disable beards if you cap ultra fast.") Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Level.start() elif challenge == 5: Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Equipment.start() elif challenge == 6: print("Nah fam. Do it yourself") while True: Window.shake() elif challenge == 7: Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() RebirthCh.rebirth_challenge() elif challenge == 8: print( "LSC doesn't reset your number, make sure your number is high enough to make laser swords." ) Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Laser.start() elif challenge == 9: print("Starting blind challenge") Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Blind.start() elif challenge == 10: Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() NGU.start() elif challenge == 11: Inputs.click(x, y) time.sleep(userset.LONG_SLEEP) Navigation.confirm() Timemachine.start() else: print(f"invalid challenge: {challenge}")