def setUses(skills): showTooltips = takeAndReadImage(670, 530, 710, 570) if showTooltips == 'OFF': clicky(660, 550) for key in skills: skill = skills[key] if skill.avail: x, y = skill.coords try: movey(x, y) uses = takeAndReadImage(x - 382, y - 36, x - 290, y - 16) uses = re.sub(r"[ ‘.]", "", uses) if uses != '': skills[key].uses = int(uses) except ValueError: try: movey(x, y) uses = takeAndReadImage(x - 382, y - 36, x - 310, y - 16) uses = re.sub(r"[ ]", "", uses) if uses != '': skills[key].uses = int(uses) except ValueError: logging.debug(uses) raise clicky(660, 550) saveSkills(skills) return skills
def useMove(self): if self.avail and self.readyUse( ): # and py.pixelMatchesColor(*self.coords, (9, 9, 9), tolerance=10): clicky(*self.coords) x, y = self.coords movey(x - 20, y) self.nextUse = time.time() + self.coolDown self.uses += 1 return True else: return False
def petClone(): coords = [(935, 590), (935, 660), (935, 730)] petMystic = eval(readImage(takeImage(951, 921, 1142, 955))) petBattle = eval(readImage(takeImage(951, 957, 1142, 991))) cloneStats = [ int(max(petBattle * 23 / 11000, 1)), # clonePhysical int(petBattle * 20 // 33), # cloneMystic int(petMystic * 1.1 // 2) # cloneBattle ] #if cloneStats[1] > 50 < cloneStats[2]: # cloneStats[0] = 2 for x in range(len(coords)): clicky(*coords[x]) hotkeyPress("ctrl", "a") keyPress(cloneStats[x]) clicky(1400, 830) return ''
def detectEndFight(skills, fightButtonCoords, nextSkill): evts = poller.poll(1) if len(evts) > 0: msg = socket.recv_string() if msg.lower == "stop": while msg.lower != "run": sleep(5) msg = socket.recv_string() movey(900, 75) # Finish Button text = takeAndReadImage(1044, 393, 1117, 417) if text == 'Finish': clicky(1021, 407) movey(900, 0) sleep(0.5) sleepTime = 0 for key in skills: skills[key].nextUse = time.time() if nextSkill != '': skills = determineAvailSkills(skills, nextSkill, True) nextSkill = '' for key in skills: if not skills[key].avail: nextSkill = key else: break # Shadow Clones button text = takeAndReadImage(660, 379, 1020, 429) if text == 'Fight Shadow Clones': clicky(*fightButtonCoords) movey(900, 0) sleep(0.5) sleepTime = 0 return skills, nextSkill
def startSkillTraining(skills): utils.clicky(900, 75) utils.keyPress("6") utils.clicky(990, 250) utils.hotkeyPress("ctrl", "a") cloneCount = skills['Teleport'].startCap - skills['Teleport'].uses // 3 utils.keyPress(cloneCount) utils.clicky(1500, 460) return
def training(startLevel=500): skills = loadSkills() order = list(reversed(list(skills.keys()))) first = True level = 500 for x in range(len(order)): mousePos = py.position() if x < len(order) - 1: key = order[x + 1] skill = skills[key] #indx = order.index(key) cloneCount = max(skill.startCap - (skill.uses // 3), 1) if level < startLevel: level += 500 lastCloneCount = cloneCount continue forWin = win32gui.GetForegroundWindow() win32gui.SetForegroundWindow( findWindowHandle("Idling to Rule the Gods")) sleep(0.1) clicky(900, 75) keyPress("6") if first: clicky(1500, 460) first = False sleep(0.1) sleepTime = time.time() clicky(1540, 304) movey(*mousePos) hotkeyPress("ctrl", "a") keyPress(str(level)) if cloneCount > 1: print(cloneCount, cloneCount - lastCloneCount) clicky(990, 250) movey(*mousePos) hotkeyPress("ctrl", "a") cloneCount = max(cloneCount, lastCloneCount + 1) keyPress(cloneCount - lastCloneCount + 1) sleep(10) win32gui.SetForegroundWindow(forWin) if x == 27: break sleepTime += level * 30 / 1000 soundOffIn(sleepTime - time.time() - 5) sleepUntil(sleepTime) if x == 26: level = 9500 lastCloneCount = cloneCount level += 500 return ''
def useSkills(fightWhat): idleGodshwdn = findWindowHandle("Idling to Rule The Gods") skills = determineAvailSkills(loadSkills()) fightButtonCoords = { 'Clones': (991, 406), 'Jacky Lee': (1245, 400), 'Cthulhu': (1655, 405), 'Doppelganger': (845, 475), 'D. Evelope': (1245, 470), 'gods': (1640, 470) } if len(sys.argv) <= 1: answer = getInput( "Do you wish to update the number of uses per skill? y/n \n") if answer == 'y': skills = setUses(skills) while True: focus = getInput( "Focus defeating 1) enemy or 2) using non-one cloned skills\n") if focus != '1' and focus != '2': print('Invalid choice, choose 1 or 2') else: break nextSkill = '' for key in skills: if not skills[key].avail: nextSkill = key else: break atkDelay = 0.25 if focus == '1': skillsToUse = [ 'Shadow Fist', 'Invisible Hand', 'Big Bang', 'Unlimited Creation Works', 'Aura Ball', 'High Kick', 'Ionioi Hero Summon', 'Whirling Foot', '108 Fists', 'Double Punch' ] ignore = skillsToUse.copy() else: skillsToUse = orderSkills(skills) ignore = [] # Shadow Clones button if py.pixelMatchesColor(991, 406, (3, 3, 3), tolerance=10): clicky(*fightButtonCoords[fightWhat]) coolDowns = [time.time()] * len(skillsToUse) while True: if detectKeypress(): break if py.pixelMatchesColor(1151, 405, (4, 4, 4), tolerance=10): skills[key].uses -= 1 if min(coolDowns) >= time.time(): sleep(min(coolDowns) - time.time() + 0.5) skills, nextSkill = detectEndFight(skills, fightButtonCoords[fightWhat], nextSkill) if win32gui.GetForegroundWindow() != idleGodshwdn: win32gui.SetForegroundWindow(idleGodshwdn) for x in range(len(skillsToUse)): key = skillsToUse[x] if key in skills and skills[key].useMove(): coolDowns[x] = skills[key].nextUse sleepTime = max(min(coolDowns) - time.time() + 0.3, atkDelay) if 'focused' not in key.lower( ) and key not in ignore and not skills[key].needUse(): ignore.append(key) skillsToUse.append(key) skillsToUse.remove(key) sleep(sleepTime) break else: if key not in skills: print("Key:", key, "not in skills") elif skills[key].nextUse < time.time() and skills[key].avail: print("Skill:", key, "off cooldown but not able to be used") saveSkills(skills) atexit.unregister(saveSkills) return ''
def buildDivGen(): utils.clicky(900, 75) utils.keyPress("1") if utils.takeAndReadImage(1571, 418, 1769, 449) == "Change creation": utils.clicky(1571, 418) utils.clicky(1000, 260) for x in range(12): utils.keyPress('tab') utils.keyPress(5) utils.clicky(1591, 615) text = utils.takeAndReadImage(1733, 245, 1766, 262) if text != "ON" and text != "0N": utils.clicky(1749, 253) text = utils.takeAndReadImage(1733, 290, 1766, 307) if text != "ON" and text != "0N": utils.clicky(1749, 298) while utils.takeAndReadImage(721, 395, 892, 421) != "Shadow clone": sleep(1) utils.keyPress(2) utils.clicky(1600, 463) return
def runAfky(): #TODO: Refactor clickCoords = { speed: (750, 415), power: (650, 520), hp: (650, 570), count: (1245, 470) } stats = {speed: 0, power: 0, hp: 0, count: 0, exp: 0} for key in stats: stats[key] = getStat(key) while True: if detectKeypress(): return '' stats['exp'] = getStat('exp') hpExp = (stats['hp']**2 * 100) // 3 countExp = count**2 * 100 #hpExp + capExp if (hp better than count) else countExp + capExp temp = (hpExp + (count * (hp * count * 2 + count) / 2)) if ( hpExp / (count**0.9) < countExp / (hp**1.1)) else (countExp + (hp * (hp * count * 2 + hp) / 2)) #print(hpExp / (count ** 0.9) < countExp / (hp ** 1.1), ' ', temp) #True if exp >= above else False #print(True if exp > temp else False) neededExp = (hpExp + (count * (hp * count * 2 + count) / 2) ) if hpExp / (count**0.9) < countExp / (hp**1.1) else ( countExp + (hp * (hp * count * 2 + hp) / 2)) print('Exp:', exp, 'hp:', hp, 'hp exp:', hpExp, 'count:', count, 'count exp:', countExp, 'Needed Exp:', neededExp) while exp < neededExp: if detectKeypress(): return '' exp = parseNum(readImage(takeImage(335, 600, 605, 635))) sleep(1) check = True if (exp >= neededExp) else False while check: if detectKeypress(): return '' if hp > 40 and (hp + count) * 10 > speed < 3800 and exp >= ( hp + count) * 10 - speed * ( (hp + count) * 10 - speed + 1) / 2: clicky(*coords[0]) exp = exp - ((hp + count) * 10 - speed * ((hp + count) * 10 - speed + 1) / 2) speed += 10 elif hpExp / (count**0.9) < countExp / (hp**1.1): if count == hp == 1: capExp = 1 else: capExp = (count * (hp * count * 2 + count) / 2) if hpExp + capExp <= exp: clicky(*coords[2]) clicky(*coords[4]) exp = exp - hpExp - capExp hp += 1 else: break elif countExp / (hp**1.1) < hpExp / (count**0.9): if count == hp == 1: capExp = 1 else: capExp = (hp * (hp * count * 2 + hp) / 2) if countExp + capExp <= exp: clicky(*coords[3]) clicky(*coords[4]) exp = exp - countExp - capExp count += 1 else: break else: break hpExp = (hp**2 * 100) // 3 countExp = count**2 * 100 neededExp = ( hpExp + (count * (hp * count * 2 + count) / 2) ) if hpExp / (count**0.9) < countExp / (hp**1.1) else ( countExp + (hp * (hp * count * 2 + hp) / 2)) check = True if (exp >= neededExp) else False return ''