Exemple #1
0
def runBot():
	sleep(2)
	count = 0
	start = time()
	itemLoc = utils.Location()
	logoLoc = utils.Location()
	while True:
		if time() - start > 14400:
			print("Quitting after 4 hours")
			return
		succ = False
		for _ in range(3):
			sleep(1)
			succ = disassemble(itemLoc, logoLoc)
			if succ: 
				break
		if not succ:
			print(f"Failed on iteration {count}")
			return

		count += 1
		sleepDuration = -1
		while sleepDuration < 0:
			sleepDuration = np.random.normal(72, 9)
		print(f"Sleeping {sleepDuration} seconds")
		sleep(sleepDuration)
Exemple #2
0
def runBot():
    sleep(2)
    findBank()
    count = 0
    divLoc = utils.Location()
    extremeLoc = utils.Location()
    bankLoc = utils.Location()
    while True:
        if count % 2 == 0:
            print("Opening bank")
            succ = performAction(
                openBankAction, makeSuccess(bankLoc, bankInterfacePath, False))
            if not succ:
                print(f"Failed on iteration {count}")
                return
            sleep(1)

            print("Withdrawing energy")
            succ = performAction(makeKeyPressAction(PRESET_KEY),
                                 makeSuccess(bankLoc, bankInterfacePath, True))
            if not succ:
                print(f"Failed on iteration {count}")
                return
            sleep(1)

            print("Drinking potion")
            succ = performAction(
                makeKeyPressAction(POT_KEY),
                makeSuccess(extremeLoc, extremeInterfacePath, True))
            if not succ:
                print(f"Failed on iteration {count}")
                return
        sleep(1)
        succ = performAction(makeKeyPressAction(ENERGY_KEY),
                             makeSuccess(divLoc, divInterfacePath, False))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        sleep(1)
        succ = performAction(makeKeyPressAction('space'),
                             makeSuccess(divLoc, divInterfacePath, True))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        count += 1
        sleepDuration = -1
        while sleepDuration < 0:
            sleepDuration = np.random.normal(144, 5)
        print(f"Sleeping {sleepDuration} seconds")
        sleep(sleepDuration)
Exemple #3
0
def runBot():
    sleep(2)

    interfaceLoc = utils.Location()
    startTime = time()
    while True:
        arrows = ["up", "down", "left", "right"]
        chosenArrow = arrows[randint(0, 3)]
        utils.spamPress(chosenArrow)
        print(f"Spam pressed {chosenArrow}")

        if np.random.uniform(low=0, high=10) < 2:
            try:
                utils.checkXP(xpPath)
                print("Checked xp")
            except:
                print("Xp was not present")

        sleepDuration = np.random.normal(180, 20)
        while sleepDuration > 270 or sleepDuration < 0:
            sleepDuration = np.random.normal(180, 20)

        print(f"Sleeping {sleepDuration} seconds")

        sleep(sleepDuration)
        if time() - startTime > 3600 * 16:
            print("Quitting after 16 hours")
            return
Exemple #4
0
def runBot():
	smithInterfaceLocation = utils.Location()
	furnaceLocation = utils.getBoundingRectangle()
	start = time()
	iteration = 0

	def clickOnFurnace():
		(x, y, xT, yT) = furnaceLocation
		mouse.moveRect(x, y, xT, yT)
		pyautogui.click()
	
	while time() - start < 16 * 3600:
		succ = utils.performAction(clickOnFurnace, 
			utils.makeSuccess(smithInterfaceLocation, smithInterfacePath, False))

		if not succ:
			print(f"Failed to click on furnace, quitting at iteration {iteration}.")
			return

		succ = utils.performAction(utils.makeKeyPressAction('space'), 
			utils.makeSuccess(smithInterfaceLocation, smithInterfacePath, True))

		if not succ:
			print(f"Failed to start smelting, quitting at iteration {iteration}.")
			return

		sleepDuration = -1
		while sleepDuration < 0:
			sleepDuration = np.random.normal(108, 2)
		print(f"Sleeping {sleepDuration} seconds")
		sleep(sleepDuration)

		iteration += 1
Exemple #5
0
def runBot():
    sleep(2)

    def foo():
        if randint(0, 100) % 2 == 0:
            utils.spamPress('left')
        else:
            utils.spamPress('right')

    xpLoc = utils.Location()

    while True:

        succ = utils.performAction(foo,
                                   utils.makeSuccess(xpLoc, xpPath, False))
        if not succ:
            print("Failed, quitting")
            return

        sleep(1)

        if np.random.uniform(low=0, high=10) < 2:
            utils.checkXP(xpPath)
            print("Checked xp")

        sleepDuration = np.random.normal(180, 20)
        while sleepDuration > 270 or sleepDuration < 0:
            sleepDuration = np.random.normal(180, 20)

        print(f"Sleeping {sleepDuration} seconds")

        sleep(sleepDuration)
Exemple #6
0
def runBot():
    initialize()
    sleep(2)
    count = 0
    start = time()
    bankLoc = utils.Location()
    fletchLoc = utils.Location()
    while True:
        if time() - start > 8 * 3600:
            print("Final quit")
            return
        print("Opening bank")
        succ = performAction(openBankAction,
                             makeSuccess(bankLoc, bankInterfacePath, False))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        sleep(1)
        print("Withdrawing logs")
        succ = performAction(makeKeyPressAction(PRESET_KEY),
                             makeSuccess(bankLoc, bankInterfacePath, True))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        sleep(1)
        print("Opening fletching interface")
        succ = performAction(
            makeKeyPressAction(LOG_KEY),
            makeSuccess(fletchLoc, fletchInterfacePath, False))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        sleep(1)
        print("Starting fletching")
        succ = performAction(makeKeyPressAction('space'),
                             makeSuccess(fletchLoc, fletchInterfacePath, True))
        if not succ:
            print(f"Failed on iteration {count}")
            return

        count += 1
        sleepDuration = -1
        while sleepDuration < 0:
            sleepDuration = np.random.normal(55, 4)
        print(f"Sleeping {sleepDuration} seconds")
        sleep(sleepDuration)
Exemple #7
0
def runBot():
    sleep(2)
    count = 0
    divLoc = utils.Location()
    portableLoc = utils.Location()
    portableLoc.setLoc(pyautogui.locateOnScreen(portablePath))
    promptLoc = utils.Location()
    start = time()
    lastAdditionTime = 0
    while True:
        succ = performAction(makeKeyPressAction(ENERGY_KEY),
                             makeSuccess(divLoc, divInterfacePath, False))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        sleep(1)
        succ = performAction(makeKeyPressAction('space'),
                             makeSuccess(divLoc, divInterfacePath, True))
        if not succ:
            print(f"Failed on iteration {count}")
            return
        count += 1
        sleepDuration = -1
        while sleepDuration < 0:
            sleepDuration = np.random.normal(13, 1)
        print(f"Sleeping {sleepDuration} seconds")
        sleep(sleepDuration)

        if randint(0, 100) == 10:
            sleepDuration = np.random.normal(100, 20)
            print(f"Random long sleep: {sleepDuration} seconds")
            sleep(sleepDuration)
        '''
		if time() + randint(600, 1200) - lastAdditionTime > 3600:
			print("Attempting to deploy portables")
			lastAdditionTime = time()
			succ = portable(portableLoc, promptLoc)
			if not succ:
				lastAdditionTime = 100000000000000000000000000000000000000000
			else:
				print(f"Deployed portables on iteration {count}")
		'''
        if time() - start > 3600 * 16:
            print("Finished running, quitting after 16 hours.")
            return
Exemple #8
0
def extendPortable(portableKeyCoordinates, extendInterfaceLocation, tries = 0):
	(x, y, xT, yT) = portableKeyCoordinates
	(x, y, xT, yT) = (5 + x//2, 5 + y//2, -5 + xT//2, -5 + yT//2)

	if tries == 10:
		print("Failed to extend portable")
		return False
	
	def moveToPortableKey():
		mouse.moveRect(x, y, xT, yT)

		sleepDuration = -1
		while sleepDuration < 0:
			sleepDuration = np.random.normal(0.2, 0.01)
		sleep(sleepDuration)

		pyautogui.click(button='right')

	portableClickLocation = utils.Location()

	succ = utils.performAction(moveToPortableKey, 
		utils.makeSuccess(portableClickLocation, portableClickInterfacePath, False))
	if not succ:
		print("Failed to right click portable key, retrying")
		extendPortable(portableKeyCoordinates, extendInterfaceLocation, tries = tries + 1)
		

	sleep(3)

	(x, y, xT, yT) = utils.convert(portableClickLocation.getLoc())
	(x, y, xT, yT) = (x//2, y//2, xT//2, yT//2)
	mouse.moveRect(x, y, xT, yT, teleportRandom=False)
	pyautogui.click()
	
	sleep(3)

	if not utils.checkLocation(extendInterfaceLocation, extendInterfacePath):
		print("Failed to open extend interface, retrying")
		extendPortable(portableKeyCoordinates, extendInterfaceLocation, tries = tries + 1)

	sleepDuration = -1
	while sleepDuration < 0:
		sleepDuration = np.random.normal(0.2, 0.2)
	utils.spamPress('1')
	sleep(sleepDuration)
	utils.spamPress('enter')

	sleep(3)

	if utils.checkLocation(extendInterfaceLocation, extendInterfacePath):
		print("Failed to extend portable, retrying")
		extendPortable(portableKeyCoordinates, extendInterfaceLocation, tries = tries + 1)

	return True
Exemple #9
0
def runBot():
    sleep(2)

    capeLoc = utils.Location()
    interfaceLoc = utils.Location()
    capeLoc.setLoc(pyautogui.locateOnScreen(capePath))
    print(f"Found cape loc at {capeLoc.getLoc()}")
    while True:

        def foo():
            x, y, _, _ = utils.convert(capeLoc.getLoc())
            mouse.move(x // 4, y // 4, 50, teleportRandom=True)
            pyautogui.click()

        succ = utils.performAction(
            foo, utils.makeSuccess(interfaceLoc, interfacePath, False))
        if not succ:
            print("Failed")
            return
        print("Clicked on smelter")

        sleep(1)

        succ = utils.performAction(
            utils.makeKeyPressAction('space'),
            utils.makeSuccess(interfaceLoc, interfacePath, True))
        if not succ:
            print("Failed")
            return
        print("Started smelting")

        sleepDuration = -1
        while sleepDuration < 0:
            sleepDuration = np.random.normal(105, 10)
        print(f"Sleeping {sleepDuration} seconds")
        sleep(sleepDuration)
Exemple #10
0
def extend(silverhawkCoordinates, overloadCoordinates, aggressionCoordinates):
    x, y, xT, yT = silverhawkCoordinates
    mouse.moveRect(x, y, xT, yT)
    pyautogui.click()
    sleep(getSleep(1, 0.3))

    x, y, xT, yT = overloadCoordinates
    mouse.moveRect(x, y, xT, yT)
    pyautogui.click()
    sleep(getSleep(1, 0.3))

    x, y, xT, yT = aggressionCoordinates
    mouse.moveRect(x, y, xT, yT)
    pyautogui.click()
    sleep(getSleep(1, 0.3))

    for _ in range(10):
        ovlLoc = utils.Location()
        if utils.checkLocation(ovlLoc, overloadPath):
            return True

    return False
Exemple #11
0
def runBot():
	sleep(2)
	count = 0
	divLoc = utils.Location()
	start = time()
	while True:
		succ = performAction(makeKeyPressAction(ENERGY_KEY), makeSuccess(divLoc, divInterfacePath, False))
		if not succ:
			print(f"Failed on iteration {count}")
			return
		sleep(1)
		succ = performAction(makeKeyPressAction('space'), makeSuccess(divLoc, divInterfacePath, True))
		if not succ:
			print(f"Failed on iteration {count}")
			return
		count += 1
		sleepDuration = -1
		while sleepDuration < 0:
			sleepDuration = np.random.normal(15, 1)
		print(f"Sleeping {sleepDuration} seconds")
		sleep(sleepDuration)
		if time() - start > 3600 * 8:
			print("Finished running, quitting after 8 hours.")
			return 
Exemple #12
0
import utils

x0 = 2
y0 = 12

map_width = 15
map_height = 15

my_map = utils.generate_map(map_width, map_height)

utils.add_obstacle(my_map, 6, 5, 3, 4)

utils.print_map(my_map)

start_location = utils.Location()
start_location.x = x0
start_location.y = y0

locations = [start_location]
weight = 1
while len(locations) > 0:
    nextLocations = []
    for location in locations:
        utils.set_weight(my_map, location, weight)
        nextLocations += utils.get_neighbors(my_map, location)
    utils.print_map(my_map)
    locations = utils.get_zero_weight_unique_locations(my_map, nextLocations)
    weight += 1
    input("Press Enter to continue ...\n")
Exemple #13
0
def runBot():
	extendInterfaceLocation = utils.Location()
	bankLocation = utils.Location()
	clayInterfaceLocation = utils.Location()
	cookInterfaceLocation = utils.Location()
	silverhawkLocation = utils.Location()
	portableKeyCoordinates = None

	sleep(2)
	portableKeyCoordinates = utils.convert(pyautogui.locateOnScreen(portableKeyPath))
	print(portableKeyCoordinates)

	rangeCoordinates = utils.getBoundingRectangle()
	bankCoordinates = utils.getBoundingRectangle()
	silverhawkCoordinates = utils.getBoundingRectangle()

	def openBank():
		x, y, xT, yT = bankCoordinates
		mouse.moveRect(x, y, xT, yT)
		pyautogui.click()

	def openRange():
		x, y, xT, yT = rangeCoordinates
		mouse.moveRect(x, y, xT, yT)
		pyautogui.click()

	def extendSilverhawk():
		x, y, xT, yT = silverhawkCoordinates
		mouse.moveRect(x, y, xT, yT)
		pyautogui.click()

	succ = extendPortable(portableKeyCoordinates, extendInterfaceLocation)
	if not succ:
		return 
	sleep(2)
	utils.performAction(extendSilverhawk, lambda : True)
	sleep(2)

	portableTimer = time()
	startTime = time()

	while True:

		if time() - portableTimer > 50 * 60:
			succ = utils.performAction(openBank, 
			utils.makeSuccess(bankLocation, bankInterfacePath, False))
			if not succ:
				print("Failed to open bank")
				return False

			sleep(3)

			succ = utils.performAction(utils.makeKeyPressAction(PORTABLE_PRESET), 
				utils.makeSuccess(bankLocation, bankInterfacePath, True))
			if not succ:
				print("Failed to withdraw preset")
				return False

			succ = extendPortable(portableKeyCoordinates, extendInterfaceLocation)
			if not succ:
				return
			sleep(2)
			utils.performAction(extendSilverhawk, lambda : True)
			sleep(2)

			portableTimer = time() - 30

		if time() - startTime > 16 * 3600:
			print("Returning after finishing")
			return

		succ = utils.performAction(openBank, 
		utils.makeSuccess(bankLocation, bankInterfacePath, False))
		print("Opened bank...")
		if not succ:
			print("Failed to open bank")
			return

		sleep(1)

		succ = utils.performAction(utils.makeKeyPressAction(PRESET_KEY), 
			utils.makeSuccess(bankLocation, bankInterfacePath, True))
		print("Withdrew food...")
		if not succ:
			print("Failed to withdraw food")
			return

		sleep(1)

		succ = utils.performAction(openRange, 
			utils.makeSuccess(clayInterfaceLocation, clayInterfacePath, False))
		print("Clicked on portable...")
		if not succ:
			print("Failed to click on portable")
			return

		sleep(1)

		succ = utils.performAction(utils.makeKeyPressAction('1'), 
			utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, False))
		print("Selected shaping clay...")
		if not succ:
			print("Failed to select shaping clay")
			return

		succ = utils.performAction(utils.makeKeyPressAction('space'), 
			utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, True))
		print("Started shaping clay...")
		if not succ:
			print("Failed to start shaping clay")
			return

		sleepDuration = -1
		while sleepDuration < 0:
			sleepDuration = np.random.normal(15.7, 0.6)
		print(f"Sleeping {sleepDuration} seconds")
		sleep(sleepDuration)

		succ = utils.performAction(openRange, 
			utils.makeSuccess(clayInterfaceLocation, clayInterfacePath, False))
		print("Clicked on portable...")
		if not succ:
			print("Failed to click on portable")
			return

		sleep(1)

		succ = utils.performAction(utils.makeKeyPressAction('2'), 
			utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, False))
		print("Selected firing clay...")
		if not succ:
			print("Failed to select shaping clay")
			return

		succ = utils.performAction(utils.makeKeyPressAction('space'), 
			utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, True))
		print("Started firing clay...")
		if not succ:
			print("Failed to start shaping clay")
			return

		sleepDuration = -1
		while sleepDuration < 0:
			sleepDuration = np.random.normal(50, 1.2)
		print(f"Sleeping {sleepDuration} seconds")
		sleep(sleepDuration)
Exemple #14
0
def runBot():
    bankLocation = utils.Location()
    clayInterfaceLocation = utils.Location()
    cookInterfaceLocation = utils.Location()

    rangeCoordinates = utils.getBoundingRectangle()
    bankCoordinates = utils.getBoundingRectangle()

    def openBank():
        x, y, xT, yT = bankCoordinates
        mouse.moveRect(x, y, xT, yT)
        pyautogui.click()

    def openRange():
        x, y, xT, yT = rangeCoordinates
        mouse.moveRect(x, y, xT, yT)
        pyautogui.click()

    startTime = time()

    while True:

        if time() - startTime > 16 * 3600:
            print("Returning after finishing")
            return

        succ = utils.performAction(
            openBank, utils.makeSuccess(bankLocation, bankInterfacePath,
                                        False))
        print("Opened bank...")
        if not succ:
            print("Failed to open bank")
            return

        sleep(1)

        succ = utils.performAction(
            utils.makeKeyPressAction(PRESET_KEY),
            utils.makeSuccess(bankLocation, bankInterfacePath, True))
        print("Withdrew food...")
        if not succ:
            print("Failed to withdraw food")
            return

        sleep(1)

        succ = utils.performAction(
            openRange,
            utils.makeSuccess(clayInterfaceLocation, clayInterfacePath, False))
        print("Clicked on portable...")
        if not succ:
            print("Failed to click on portable")
            return

        sleep(1)

        succ = utils.performAction(
            utils.makeKeyPressAction('1'),
            utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, False))
        print("Selected shaping clay...")
        if not succ:
            print("Failed to select shaping clay")
            return

        succ = utils.performAction(
            utils.makeKeyPressAction('space'),
            utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, True))
        print("Started shaping clay...")
        if not succ:
            print("Failed to start shaping clay")
            return

        sleepDuration = -1
        while sleepDuration < 0:
            sleepDuration = np.random.normal(15.7, 0.6)
        print(f"Sleeping {sleepDuration} seconds")
        sleep(sleepDuration)

        succ = utils.performAction(
            openRange,
            utils.makeSuccess(clayInterfaceLocation, clayInterfacePath, False))
        print("Clicked on portable...")
        if not succ:
            print("Failed to click on portable")
            return

        sleep(1)

        succ = utils.performAction(
            utils.makeKeyPressAction('2'),
            utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, False))
        print("Selected firing clay...")
        if not succ:
            print("Failed to select shaping clay")
            return

        succ = utils.performAction(
            utils.makeKeyPressAction('space'),
            utils.makeSuccess(cookInterfaceLocation, cookInterfacePath, True))
        print("Started firing clay...")
        if not succ:
            print("Failed to start shaping clay")
            return

        sleepDuration = -1
        while sleepDuration < 0:
            sleepDuration = np.random.normal(50, 1.2)
        print(f"Sleeping {sleepDuration} seconds")
        sleep(sleepDuration)