Example #1
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
Example #2
0
def clearInventory():
    if iconPresent(porterIconPath):
        print("Equipped sign of porter")
        utils.spamPress(PORTER_KEY)
    sleep(np.random.normal(2, 0.1))
    utils.spamPress(BOX_KEY)
    print("Filled ore box")
    return
Example #3
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
Example #4
0
def disassemble(itemLoc, logoLoc):
	if itemLoc.isEmpty():
		newLoc = pyautogui.locateOnScreen(itemPath)
		if newLoc == None:
			return False
		print(newLoc)
		itemLoc.setLoc(newLoc)

	utils.spamPress(DA_KEY)
	sleep(1)
	x, y, size = getBox(itemLoc.getLoc())
	mouse.move(x, y, size)
	pyautogui.click()

	if logoLoc.isEmpty():
		newLoc = pyautogui.locateOnScreen(logoPath)
		if newLoc == None:
			return False
		print(newLoc)
		logoLoc.setLoc(newLoc)

	return not utils.checkLocation(logoLoc, logoPath) == None
Example #5
0
 def keyPressAction():
     utils.spamPress(key)
Example #6
0
def doHourly():  #This method needs to be reworked!!!
    utils.spamPress(JUJU_KEY, conservative=True)
Example #7
0
 def foo():
     if randint(0, 100) % 2 == 0:
         utils.spamPress('left')
     else:
         utils.spamPress('right')
Example #8
0
def avoidTimeout():
    directions = ['left', 'right', 'up', 'down']
    direction = directions[int(np.random.normal(100, 20) % 4)]
    utils.spamPress(direction)