def init(printCoords: bool = False) -> None: """Initialize Window class variables. Helper.init() should go at the very top of any script, straight after imports. """ rect = Window.init() w = rect[2] - rect[0] h = rect[3] - rect[1] cds = Inputs.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, w, h) if cds is None: raise RuntimeError("Game window not found. Maybe it's minimized?") Window.setPos(*cds) # Sometimes the very first click is ignored, this makes sure the first click is unimportant. Inputs.click(*coords.WASTE_CLICK) if printCoords: print(f"Top left found at: {Window.x}, {Window.y}")
def loop(scenario, iterations, debug, simulate): MainWindow = None results = [] if (simulate is True): MainWindow = Window() for i in range(1, iterations + 1): result = setupNew(scenario, MainWindow, debug) bisect.insort_left(results, result) print('Iteration ', i, ' Time:\t', result) if (simulate is True): MainWindow.MainLoop() print('-------------------') print('Performed', iterations, 'iterations of scenario', scenario) print('Average time:\t', sum(results) / iterations) print('Worst time:\t', results[-1]) print('-------------------')
def init(printCoords: bool = False) -> None: """Initialize Window class variables. Helper.init() should go at the very top of any script, straight after imports. """ rects = Window.init() for window_id, rect in rects.items(): if printCoords: print(f"Scanning window id: {window_id}") w = rect[2] - rect[0] h = rect[3] - rect[1] Window.id = window_id cds = Inputs.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, w, h) if cds: Window.setPos(*cds) break if cds is None: raise RuntimeError( "Game window not found. Maybe it's minimized or the game is not fully visible?" ) # Sometimes the very first click is ignored, this makes sure the first click is unimportant. Inputs.click(*coords.WASTE_CLICK) if printCoords: print(f"Top left found at: {Window.x}, {Window.y}")
def get_pixel_color(x: int, y: int, debug: bool = False) -> str: """Get the color of selected pixel in HEX.""" dc = win32gui.GetWindowDC(Window.id) x, y = Window.coord_manager(x, y) rgba = win32gui.GetPixel(dc, x, y) win32gui.ReleaseDC(Window.id, dc) r = rgba & 0xff g = rgba >> 8 & 0xff b = rgba >> 16 & 0xff if debug: print(Inputs.rgb_to_hex((r, g, b))) return Inputs.rgb_to_hex((r, g, b))
u.buy() # print("Buy!") 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)
from classes.window import Window import classes.shapes2D as shapes2D if __name__ == '__main__': window = Window(1300, 768, 'House 2D simulation') window.addElement(shapes2D.Roof1, [-1, 0.8, 1]) window.addElement(shapes2D.Roof2, [0, 0.8, 1]) window.addElement(shapes2D.Wall1, [-1, -0.2, 1]) window.addElement(shapes2D.Wall2, [0, -0.2, 1]) window.addElement(shapes2D.Door, [-1.2, -0.2, 1.01]) window.addElement(shapes2D.DoorHandle, [-1.3, -0.35, 1.011]) window.addElement(shapes2D.Path, [-1.2, -0.9, 1.011]) window.addElement(shapes2D.WindowObj, [-0.1, -0.2, 1.01]) window.addElement(shapes2D.WindowObj, [1.3, -0.2, 1.01]) window.addElement(shapes2D.Garden, [-1.2, -0.3, 1.0]) # Stars window.addElement(shapes2D.Star, [1, 2, -3]) window.addElement(shapes2D.Star, [2, 2, -4]) window.addElement(shapes2D.Star, [3, 2, -3]) window.addElement(shapes2D.Star, [3.1, 2, -4]) window.addElement(shapes2D.Star, [-1, 2.2, -5]) window.addElement(shapes2D.Star, [-3, 2, -3]) window.addElement(shapes2D.Star, [-4, 2, -4]) window.addElement(shapes2D.Star, [3, 2, 0]) window.addElement(shapes2D.Moon, [2.9, 1.5, -1]) window.addElement(shapes2D.Cloud, [1, 1.5, -1]) window.addElement(shapes2D.Cloud, [-2.2, 1.0, -1]) window.addElement(shapes2D.Sun, [3, 1.7, -1])
def set_cur_pos(x: int, y: int) -> None: """Fake position returned by user32.GetCursorPos""" """hook_get_cur_pos needed""" x, y = Window.coord_manager(x, y) Com.pipe.write(struct.pack('<bhh', 0x0, x, y)) Com.sync()
import win32api import win32gui import time import cv2 import numpy from classes.window import Window from classes.inputs import Inputs import ngucon as ncon w = "derp" try: w = Window(debug=True) except: print("Could not find debug game window") a = input("Do you want me to use main window? (Y/N)") if a.lower() == "y": w = Window() else: print("closing script") quit() i = Inputs() Window.x, Window.y = i.pixel_search(ncon.TOP_LEFT_COLOR, 10, 10, 400, 600) def find_multi_image_search(scanImagePath, matchImagePath): img_rgb = cv2.imread(scanImagePath) img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) template = cv2.imread(matchImagePath, 0) w, h = template.shape[::-1]
def init() -> None: Window.init() Com.init() Com.hook()
def init(printCoords: bool = False) -> None: Window.init() Com.init() Com.hook()
from classes.window import Window from classes.grid import Grid from constants import settings from constants.enums import Locations import pygame play_area_resolution = tuple(dimension * settings.BLOCK_SIZE for dimension in settings.PLAY_AREA_DIMENSIONS) main_display = Window(resolution=settings.RESOLUTION, surface=pygame.display.set_mode(settings.RESOLUTION), color=settings.BACKGROUND_MAIN) play_area = Grid(rel_location=Locations.TOP_LEFT, visible=True, parent=main_display) score_board = Window(resolution=settings.SCORE_BOARD_RESOLUTION, visible=True, rel_location=settings.SCORE_BOARD_LOCATION, color=settings.BACKGROUND_SCORE, parent=main_display) main_menu = Window(resolution=settings.MAIN_MENU_RESOLUTION, color=settings.BACKGROUND_MAIN_MENU, rel_location=settings.MAIN_MENU_LOCATION, parent=main_display) pause_menu = Window(resolution=settings.PAUSE_MENU_RESOLUTION, color=settings.BACKGROUND_PAUSE_MENU, rel_location=settings.PAUSE_MENU_LOCATION, parent=main_display) game_settings = Window(resolution=settings.GAME_SETTINGS_RESOLUTION, color=settings.BACKGROUND_GAME_SETTINGS,
if rt.timestamp.tm_hour > 0 or rt.timestamp.tm_min >= 13: print("assigning adv training") else: duration = (12.5 - rt.timestamp.tm_min) * 60 print(f"doing itopod for {duration} seconds while waiting for adv training to activate") f.itopod_snipe(duration) f.advanced_training(2e12) f.gold_diggers([x for x in range(1, 13)]) f.reclaim_bm() f.wandoos(True) f.assign_ngu(f.get_idle_cap(2), [x for x in range(1, 10)]) f.assign_ngu(f.get_idle_cap(1), [x for x in range(1, 8)], True) Window.__init__(object) feature = Features() Window.x, Window.y = i.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, 400, 600) nav.menu("inventory") import requirements rt = feature.get_rebirth_time() start_procedure(feature, rt) while True: rt = feature.get_rebirth_time() feature.nuke() feature.gold_diggers([x for x in range(1, 13)]) feature.merge_inventory(8) # merge uneqipped guffs spells = feature.check_spells_ready() if spells: # check if any spells are off CD
from classes.window import Window import classes.shapes3D as shapes3D import classes.shapes2D as shapes2D from OpenGL.GL import glClearColor def setBackground(parameter): glClearColor(0, 0.1, 0.1, 1) if __name__ == '__main__': window = Window(1300, 768, 'House 3D simulation', True) window.setSky = setBackground window.addElement(shapes3D.House, [-1, 0, 0]) window.addElement(shapes3D.Roof, [-1, 3, 0]) window.addElement(shapes3D.Floor, [0, 0, 0]) window.addElement(shapes2D.Door, [-1, 0.51, 2.01]) window.addElement(shapes2D.DoorHandle, [-1.1, 0.3, 2.011]) window.addElement(shapes3D.Window, [0.81, 0.5, 1]) window.addElement(shapes3D.Window, [0.81, 0.5, -1]) window.addElement(shapes3D.Window, [-2.81, 0.5, 1]) window.addElement(shapes3D.Window, [-2.81, 0.5, -1]) window.execute()
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}")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 10 16:17:09 2018 @author: nathan """ print("************") print("Hello world") print("************") from classes.window import Window w = Window() w.go()