Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This script was made by Evildeliverance. Message me on Reddit if you need help.
- #Credit to Reddit user Dewarim for introducing me to this tool with his Fish autoclicker.
- #---
- #The core (original script): Version 2.0 by evildeliverance
- #
- #New Features Edition by TheWhiteAvatar - Version 5
- #Added Midas start, laptop resolutions support, short active mode before ascension, and some additional fixes
- #New in version 5:
- # - the core of the script changed to version 2.0 Final (released by evildeliverance)
- # - optimization: Midas start get canceled if a clickable suddenly appears (the script uses a clickable instead)
- #------
- #Midas start always takes around 3 minutes before instakilling will start after ascension.
- #But Midas start has a lot more HS gain efficiency during speed runs than waiting for a clickable,
- #because often while waiting for a clickable you will stop instakilling for 5, 10, 15 or even 20 minutes.
- #
- #To enable Midas start just set Settings.MidasStart to True and set Settings.WaitForFishBeforeAscending to False
- #
- #To enable usage of active skills for 90 seconds before ascension for more efficiency
- #(assuming you can instakill with all skills activated if used after you stop instakilling in your speed run),
- #set Settings.ActivateAllSkillsWithEnergizedLuckyStrikesBeforeAscension to True
- #------
- #Feel free to modify this script to suit your needs but if you redistribute it, please leave my name up here somewhere.
- #Scroll down to line 175 for the beginning of the script. Read that portion then come back to the top and read the rest.
- #These variables are meant to be edited by you to tweak the performance of the script.
- #True and False are CASE SENSITIVE
- Settings.CheckForAscend = True #Set to False if you do not want the script to ascend for you.
- Settings.AscendNextLevelClicks = 12 #Set this lower if the script advances through levels too fast during ascension. Set it higher if it is too slow.
- Settings.WaitForMoney = 0 #Set this higher if the script attempts to purchase things it can't afford during ascend
- #!!!!Increase the value of the next variable if you ascend too fast or if you do not have Iris.
- Settings.TimeToLookForMovementBeforeAscending = 2 #this is the number of seconds you must remain on a level before the script will decide you are leveling too slowly and you should ascend. Make it higher or lower if it ascends too early or too late.
- Settings.StartGildedSearchFromBottom = True #Change this to false if your preferred gilded hero is towards the top of the list.
- Settings.IHaveIris = True
- Settings.NoGildedHeroesAvailable = True #Set this to False if no gilded heroes are purchasable at the beginning of an ascension.
- Settings.IHaveMoreThanTwoGildedHeroes = True #If this is true, we will periodically scroll to the bottom and look for a lower gilded hero. These heroes must all be in a row for this to work!
- Settings.BuyAllHeroesFaster = True #Remove the mouse delay while going through and purchasing all heroes for their skills. Set to False if it tries to buy them faster than the money is coming in.
- Settings.EDR = True #EDR after ascending?
- Settings.TurnProgressionBackOn = 0 #Number of minutes inbetween making sure progression mode is on. Good for deep runs. 0 for do not check.
- Settings.EDR_ER = False #EDR then ER then EDR then ER etc
- Settings.StopOnGoodRelic = False #Set this true to find +4 or +5% primal relics.
- Settings.SomeHeroesGetSkipped = False #Turn this on only if some heroes get leveled 0 times.
- Settings.WaitForFishBeforeAscending = False #Set this True if Iris is a high level (if set False it will use Midas start)
- #Settings added by TheWhiteAvatar
- #------
- Settings.MidasStart = True #Uses Midas start after ascension.
- #Will work if set True and if Settings.WaitForFishBeforeAscending from above is set to False
- Settings.ActivateAllSkillsWithEnergizedLuckyStrikesBeforeAscension = True #For more efficiency go active for 90 secods before ascension
- Settings.ActivatePowersurgeAndMetalDetectorInAdditionToEDR = True #After ascension with EDR combo (EDR would break Idle mode anyways)
- Settings.TryToSpeedUpMidasStart = True #Instakilling after ascension will start around 30 seconds faster than without this option
- #It also will cause EDR combo to delay a bit more after ascension so it wouldn't slow you down at all when used because you'd be stronger already
- #-------------------
- #Deep Run Mode instead of ascending after a speed run (beta, and probably won't be finished anyways)
- #This setting functionality wasn't tested properly yet. You may use it on your own risk!
- #If you'd want to add some fast autoclicking, you'll need to use any separate autoclicking program,
- #but try not to set it to more than 30 clicks per second.
- #This was tested without autocliking, just with automatic using skills from time to time, so it might not support fast autoclicking at all.
- #It would stay in a deep run mode until you ascend manually (before it you should stop the script and change this setting back to False)
- Settings.DeepRunInsteadOfAscension = False #Goes on a deep run with skills usage, if True and if Settings.CheckForAscend was set to True
- #---
- Settings.AlternativeFrostLeafSearch = False #It's slower.
- #Set it True only if the script for some reason can't identify when to stop buying 200 levels of each hero after ascension.
- #------------------------
- #------------------------
- #These variables should be left alone. They are initialized here with their correct starting values and will change on their own.
- Settings.Times=0
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = True#Don't change this.
- Settings.MoveMouseDelay = 0.5
- Settings.AscendStartTime = int(time.time())
- Settings.EDRTime = int(time.time()) - 500
- Settings.AscendRequirementsMet = False
- Settings.ProgressionLastVerified = int(time.time())
- Settings.EDR_ER_State = "NONE"
- Settings.AdditionalBuyAllUpgrades = 12
- Settings.IfQuickMidasStartHappened = False
- Settings.EDRDelayValueIfQuickMidasStartHappened = 10
- Settings.EDRDelayCounterIfQuickMidasStartHappened = 0
- Settings.DeepRunStartPositionTemporary = Env.getMouseLocation()
- if (Settings.WaitForFishBeforeAscending == True):
- Settings.MidasStart = False
- from guide import *#Not currently used but it can do some nice highlighting stuff I might use later so it is still here.
- import java.awt.Robot as JRobot#JRobot is used for identifying the color of a pixel.
- myRobot = JRobot()
- def FindAndClick(Picture, ModifierVar = 0, CheckStart = True): #Function to find an image and click it. ModifierVar is for Ctrl+Clicking and such. CheckStart tests if the mouse moved.
- if exists(Picture,0) and (StartPosition == Env.getMouseLocation() or CheckStart == False):
- click( getLastMatch(), ModifierVar)
- if Settings.DeepRunInsteadOfAscension == False:
- hover(Location(StartPosition))
- else:
- hover(Location(Settings.DeepRunStartPositionTemporary))
- return True
- else:
- return False
- def goClick(ClickLocation, ModifierVar = 0, CheckStart = True):#checks if the mouse has moved, if it has not, clicks the location specified
- if StartPosition == Env.getMouseLocation() or CheckStart == False:
- #Region(ClickLocation.getX()-2,ClickLocation.getY()-2,4,4).highlight(5)
- click( ClickLocation, ModifierVar)
- hover(Location(StartPosition))
- return True
- else:
- return False
- def FindAndClickAll(Picture):#This function clicks every occurance of an image on the screen.
- try:
- FA = findAll(Picture)
- for i in FA:
- click( i)
- hover(Location(StartPosition))
- return True
- except:
- return False
- def TryToFind(Picture): #This function just checks to see if an image is on screen at all. Added this so I could modify the delay globally without needing to find and replace all.
- if exists(Picture,0):
- return True
- else:
- return False
- def CollectCoins():
- StoreSpeed = Settings.MoveMouseDelay
- Settings.MoveMouseDelay = .5
- ShowTheGameBottomForSmallScreenResolutions()
- if exists(Pattern("1434493975401.png").targetOffset(-315,-187),0):
- hover(getLastMatch())
- wait(.1)
- hover(Pattern("1434493975401.png").targetOffset(329,-180))
- hover(Location(StartPosition))
- wait(.5)
- Settings.MoveMouseDelay = StoreSpeed
- ShowTheGameTopForSmallScreenResolutions()
- def ShowTheGameTopForSmallScreenResolutions():
- if not exists(Pattern("1432967930862.png").similar(0.85),0):
- spd = Settings.MoveMouseDelay
- if exists(Pattern("shop-button.png").similar(0.90),0):
- Settings.MoveMouseDelay = 0
- FindAndClick(Pattern("shop-button.png").similar(0.90).targetOffset(-898,-6))
- else:
- ShowTheGameBottomForSmallScreenResolutions()
- Settings.MoveMouseDelay = 0
- FindAndClick(Pattern("shop-button.png").similar(0.90).targetOffset(-898,-6))
- Settings.MoveMouseDelay = spd
- i=0
- while i < 2:
- i = i + 1
- if exists(Pattern("1432967930862.png").similar(0.85),0):
- i = 2
- else:
- if exists(Pattern("shop-button.png").similar(0.90),0):
- wheel(Pattern("shop-button.png").similar(0.90).targetOffset(-898,-6),WHEEL_UP,1)
- if exists(Pattern("scroll-bar.png").similar(0.95),0):
- FindAndClick(Pattern("scroll-bar.png").similar(0.95).targetOffset(1,24))
- else:
- if exists(Pattern("1432970628554.png").similar(0.90),0):
- wheel(Pattern("1432960811209.png").targetOffset(-70,-2),WHEEL_UP,1)
- if exists(Pattern("scroll-bar.png").similar(0.95),0):
- FindAndClick(Pattern("scroll-bar.png").similar(0.95).targetOffset(1,24))
- def ShowTheGameBottomForSmallScreenResolutions():
- if not exists(Pattern("shop-button.png").similar(0.90),0):
- if exists(Pattern("1432970628554.png").similar(0.90),0):
- FindAndClick(Pattern("1432960811209.png").targetOffset(-70,-2))
- i=0
- while i < 2:
- i = i + 1
- if exists(Pattern("shop-button.png").similar(0.90),0):
- i = 2
- else:
- if exists(Pattern("1432970628554.png").similar(0.90),0):
- wheel(Pattern("1432960811209.png").targetOffset(-70,-2),WHEEL_DOWN,1)
- def Clicker_Heroes():#The Clicker Heroes Automation function.
- ShowTheGameTopForSmallScreenResolutions()
- if exists(Pattern("1432970628554.png").similar(0.90),0) and exists(Pattern("1434935522523.png").similar(0.90),0):#Clicker Heroes is on screen
- if exists(Pattern("1433101398754.png").similar(0.90),0):
- popError("Low quality mode detected. Please click the button for high quality mode for the script to function properly")
- wait(10)
- # keyDown(Key_Z) #Unused for now. I was going to use this to upgrade heroes in increments of 25 but Sikuli OCR is not up to par yet.
- if exists(Pattern("1434935407800.png").targetOffset(0,112),0):
- print "Relic found at: " + str(int(int(time.time() - Settings.AscendStartTime)/60)) + " Minutes and " + str(int(int(time.time() - Settings.AscendStartTime)-(int(int(time.time() - Settings.AscendStartTime)/60)*60))) + " Seconds"
- FindAndClick(Pattern("1434935407800.png").targetOffset(-3,118))
- wait(1)
- FindAndClick(Pattern("1434935593790.png").similar(0.90).targetOffset(3,-2))
- if Settings.EDR == True and Settings.IfQuickMidasStartHappened == True:
- if Settings.EDRDelayCounterIfQuickMidasStartHappened > 0:
- Settings.EDRDelayCounterIfQuickMidasStartHappened = Settings.EDRDelayCounterIfQuickMidasStartHappened - 1
- else:
- Settings.IfQuickMidasStartHappened = False
- Settings.EDRDelayCounterIfQuickMidasStartHappened = 0
- ShowTheGameTopForSmallScreenResolutions()
- ShowTheGameBottomForSmallScreenResolutions()
- Settings.MoveMouseDelay = .5
- EDR()
- if exists(Pattern("1433042803072.png").similar(0.95),0) and StartPosition == Env.getMouseLocation():#The user has manually ascended. Start the 'I just ascended' loop.
- AscendLoop()
- else:
- if exists("1432960442630.png",0):
- if Settings.AscendRequirementsMet == True:
- Settings.AscendRequirementsMet = False
- print 'Can see a clickable. Initiate ascending:'
- print time.localtime(time.time())
- Ascend()
- else:
- FindAndClick("1432960442630.png")
- if StartPosition == Env.getMouseLocation():
- if exists(Pattern("1432972961822.png").similar(0.95).targetOffset(41,16),0):#The left edge of a gilded hero
- if Settings.IHaveMoreThanTwoGildedHeroes:
- BuyStrongestGildedHero()#End-Game players will need to utilize multiple gilded heroes in order to reach their hero of choice more quickly.
- if Settings.AdditionalBuyAllUpgrades < 1:
- Settings.AdditionalBuyAllUpgrades = 12
- hover(Location(StartPosition))#Move the mouse back to the original position.
- wait(1)
- FindAndClick("1432960811209.png")
- wheel("1432960811209.png",WHEEL_UP,2) #Scroll up
- wheel("1432960811209.png",WHEEL_DOWN,30)
- FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False)
- ShowTheGameTopForSmallScreenResolutions()
- else:
- Settings.AdditionalBuyAllUpgrades = Settings.AdditionalBuyAllUpgrades - 1;
- hover(Location(StartPosition))#Move the mouse back to the original position.
- else:
- p = getLastMatch().getTarget()#Targets the blue portion of a button. The target may need to be adjusted in the future.
- if myRobot.getPixelColor(p.x, p.y).getBlue() > 200:#If the pixel is blue, the button is clickable
- if Settings.NoGildedHeroesAvailable == False:#The pixel is blue but we have not yet detected that it is clickable below.
- goClick(getLastMatch().getTarget(),KEY_META)
- else:
- goClick(getLastMatch().getTarget(),KEY_META)
- Settings.NoGildedHeroesAvailable = False
- wheel(Pattern("1432960811209.png").targetOffset(2,0),WHEEL_UP,1)
- wheel("1432960811209.png",WHEEL_DOWN,5)
- ShowTheGameTopForSmallScreenResolutions()
- hover(Location(StartPosition))
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = False
- else:#The pixel is not blue
- if Settings.NoGildedHeroesAvailable == True:#We have never clicked the gilded hero and we can't yet
- BuyBottom2Heroes()
- else:#There are no gilded heroes on screen.
- if Settings.NoGildedHeroesAvailable == True:
- BuyBottom2Heroes()
- else:
- PositionCH()
- ShowTheGameTopForSmallScreenResolutions()
- Settings.Times=Settings.Times + 1#The following operations could cause a delay so only run them every 4 times the Clicker_Heroes function runs.
- if Settings.Times > 3 and StartPosition == Env.getMouseLocation():
- Settings.Times = 0
- if Settings.TurnProgressionBackOn > 0:
- if int(time.time()) > (Settings.ProgressionLastVerified + (Settings.TurnProgressionBackOn * 60)):
- Settings.ProgressionLastVerified = int(time.time())
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)
- if Settings.EDR_ER == True:
- if TryToFind(Pattern("1434520013436.png").similar(0.95)):
- if Settings.EDR_ER_State == "ER":
- if TryToFind(Pattern("1433037474843.png").similar(0.90)):
- FindAndClick(Pattern("1434520013436.png").similar(0.95),0,False)
- FindAndClick(Pattern("1433037474843.png").similar(0.90),0,False)
- Settings.EDR_ER_State = "EDR"
- else:
- if TryToFind(Pattern("1432961445894.png").similar(0.90)):
- EDR()
- if Settings.NoGildedHeroesAvailable == True:
- wheel("1432960811209.png",WHEEL_UP,2)
- wait(0.5)
- wheel("1432960811209.png",WHEEL_DOWN,20)
- hover(Location(StartPosition))#Move the mouse back to the original position.
- FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False)
- ShowTheGameTopForSmallScreenResolutions()
- else:#Don't ascend if we have never seen a gilded hero.
- if Settings.GildedHeroBelowFrostleafUpgradesPurchased == False:
- if Settings.IHaveMoreThanTwoGildedHeroes == False:
- if exists(Pattern("1432972961822.png").similar(0.95).targetOffset(-6,-8),0):
- SearchRegion = Region(getLastMatch().getX(),getLastMatch().getY(),460,110)
- SearchRegion.highlight(5)
- if SearchRegion.exists(Pattern("1433059287778.png").exact(),0):
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = True
- else:
- if FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False) == False:
- FindAndClick("1432960811209.png")
- wheel("1432960811209.png",WHEEL_UP,20) #Scroll to the top of the heroes list.
- wait(1)
- wheel("1432960811209.png",WHEEL_DOWN,30)
- FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False)
- ShowTheGameTopForSmallScreenResolutions()
- PositionCH(True)
- else:
- PositionCH()
- else:
- try:
- wait(2)
- FindAndClick("1432960811209.png")
- wheel("1432960811209.png",WHEEL_UP,20) #Scroll to the top of the heroes list.
- wait(1)
- wheel("1432960811209.png",WHEEL_DOWN,30)
- FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False)
- ShowTheGameTopForSmallScreenResolutions()
- except:
- return True
- else:#We have located a gilded hero and all it's upgrades have been purchased
- if Settings.CheckForAscend == True and Settings.EDRTime < int(time.time()):#If the global variable is set to true, check if the current level changes. Ascend when it stays the same for 4 seconds.
- if exists(Pattern("1432967930862.png").similar(0.85),0):
- MovementRegion = Region(getLastMatch().getX(),getLastMatch().getY(),200,50)#This is the region on my screen where the current level image is.
- #MovementRegion.highlight(4)#Turn this on to see where the region is located.
- Settings.somethingChanged = False
- MovementRegion.onChange(20,ChangeHandler)#Tells the observer to check the defined region for a change. Calls the ChangeHandler function if a change occurs
- #The ChangeHandler function only performs one action. It sets the variable Settings.somethingChanged = True
- MovementRegion.observe(Settings.TimeToLookForMovementBeforeAscending)#Activates the observer which calls the ChangeHandler function. Observer stays active for 4 seconds.
- #4 seconds seems to work well for me but you can tweak this to suit your needs if you find you Ascend too quickly/slowly.
- if Settings.somethingChanged == False: #If somethingChanged remains false, Nothing changed for the defined time. Time to Ascend!
- if Settings.WaitForFishBeforeAscending == True:
- Settings.AscendRequirementsMet = True
- print 'Ready for ascending:'
- print time.localtime(time.time())
- else:
- Ascend()
- # keyUp(Key_Z)
- return True #the clicker heroes logo is on screen
- else:
- return False#the clicker heroes logo is not on screen
- def BuyStrongestGildedHero(TimesToClick = 1):
- ShowTheGameTopForSmallScreenResolutions()
- if exists(Pattern("1432972961822.png").similar(0.95).targetOffset(41,16)):#As long as a single 'Buy this hero' button is on the screen, Find all occurances of it.
- #try:
- if True:
- FA = findAll(Pattern("1432972961822.png").similar(0.95).targetOffset(41,16))
- LowestY=0
- SecondLowestY=0
- LowestFound = getLastMatch()
- AbsoluteLowestY = 0
- AbsoluteLowest = getLastMatch()
- SecondLowest = LowestFound
- StrongestIsNotPurchasable = False
- for i in FA:
- if LowestY < i.getY():
- p = i.getTarget()
- SearchRegion = Region(p.x - 5,p.y - 10,125,60)
- if SearchRegion.exists(Pattern("1433201935503.png").similar(0.95),0):#Check if the lowest gilded hero found has a clickable hire button
- #p = i.getTarget()
- if myRobot.getPixelColor(i.getTarget().x, i.getTarget().y).getBlue() > 200:#If the pixel is blue, the button is clickable
- SecondLowestY = LowestY
- LowestY = i.getY()
- SecondLowest = LowestFound
- LowestFound = i
- else:
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = False
- StrongestIsNotPurchasable = True
- else:
- p = i.getTarget()
- if myRobot.getPixelColor(p.x, p.y).getBlue() > 200:#If the pixel is blue, the button is clickable
- SecondLowestY = LowestY
- LowestY = i.getY()
- SecondLowest = LowestFound
- LowestFound = i
- else:
- if SecondLowestY < i.getY():
- p = i.getTarget()
- if myRobot.getPixelColor(p.x, p.y).getBlue() > 200:#If the pixel is blue, the button is clickable
- SecondLowestY = i.getY()
- SecondLowest = i
- if AbsoluteLowestY < i.getY():
- AbsoluteLowestY = i.getY()
- AbsoluteLowest = i
- if StrongestIsNotPurchasable:
- #Click the two above it.
- if LowestY > 0:
- i=0
- while i < TimesToClick:
- click(LowestFound,KEY_META)#Click the bottom purchasable gilded buy hero button.
- i = i + 1
- Settings.NoGildedHeroesAvailable = False
- if SecondLowestY > 0:
- click(SecondLowest,KEY_META)#Click the second lowest purchasable gilded buy hero button.
- if Settings.DeepRunInsteadOfAscension == False:
- hover(Location(StartPosition))#Move the mouse back to the original position.
- else:
- hover(Location(Settings.DeepRunStartPositionTemporary))
- else:
- p = AbsoluteLowest.getTarget()
- if myRobot.getPixelColor(p.x, p.y).getBlue() > 200:#If the pixel is blue, the button is clickable
- Settings.NoGildedHeroesAvailable = False
- i=0
- while i < TimesToClick:
- click(AbsoluteLowest,KEY_META)#Click the bottom purchasable gilded buy hero button 3 times.
- i=i+1
- click(AbsoluteLowest,KEY_META)
- if Settings.AdditionalBuyAllUpgrades == (Settings.AdditionalBuyAllUpgrades - 2):
- click(AbsoluteLowest,KEY_META)
- if Settings.DeepRunInsteadOfAscension == False:
- hover(Location(StartPosition))#Move the mouse back to the original position.
- else:
- hover(Location(Settings.DeepRunStartPositionTemporary))
- SearchRegion = Region(AbsoluteLowest.getTarget().x,AbsoluteLowest.getTarget().y,470,80)
- if SearchRegion.exists(Pattern("1433830152654.png").similar(0.90),0) or SearchRegion.exists(Pattern("1435270411325.png").similar(0.90),0):#The strongest found hero does not have all his upgrades yet.
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = True
- else:
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = False
- return True
- # except:
- #
- # popError("Error while trying to buy strongest hero!")
- # return False
- else:
- ShowTheGameBottomForSmallScreenResolutions()
- BuyBottom2Heroes()
- def ChangeHandler(event):
- Settings.somethingChanged = True
- event.Region.stopObserver()
- def PositionCH(BottomUp = False): #Scrolls down until a gilded hero is on screen
- ShowTheGameTopForSmallScreenResolutions()
- if StartPosition == Env.getMouseLocation():
- if Settings.StartGildedSearchFromBottom == False:
- wheel(Pattern("1432960811209.png").targetOffset(-70,-2),WHEEL_UP,20)#Scroll web browser to top of page
- FindAndClick("1432960811209.png")
- wheel("1432960811209.png",WHEEL_UP,20) #Scroll to the top of the heroes list.
- else:
- FindAndClick("1432960811209.png")
- wheel("1432960811209.png",WHEEL_DOWN,20) #Scroll to the top of the heroes list.
- Settings.NoGildedHeroesAvailable = False
- i=0
- while i < 20:
- if TryToFind(Pattern("1432972961822.png").similar(0.95)) == False:
- if Settings.StartGildedSearchFromBottom == False:
- if exists(Pattern("1432961206728.png").similar(0.90),0):
- i=19
- ShowTheGameTopForSmallScreenResolutions()
- if i > 0:
- if exists("1432960811209.png"):
- wheel("1432960811209.png",WHEEL_DOWN,1)
- else:
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_DOWN,1)
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_DOWN,1)
- else:
- if exists(Pattern("1433200321414.png").similar(0.95),0):
- i=19
- ShowTheGameTopForSmallScreenResolutions()
- if i > 0:
- if exists("1432960811209.png"):
- wheel("1432960811209.png",WHEEL_UP,1)
- else:
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_UP,1)
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_UP,1)
- wait(.5)
- i=i+1
- if i > 20:#No gilded heroes are available. Upgrade bottom hero instead.
- Settings.NoGildedHeroesAvailable = True
- Settings.GildedHeroBelowFrostleafUpgradesPurchased = False
- else:
- i=20
- ShowTheGameTopForSmallScreenResolutions()
- hover(Location(StartPosition))#Move the mouse back to the original position.
- if exists(Pattern("1432972961822.png").similar(0.95).targetOffset(41,16),0):#The left edge of a gilded hero
- #If we make it here, we have successfully located a gilded hero. This will make ther script click it a bunch of times without running through the main loop.
- #The purpose being to get up to speed more quickly before we start executing the 'Should we ascend' check.
- p = getLastMatch().getTarget()#Targets the blue portion of a button. The target may need to be adjusted in the future.
- i=0
- while myRobot.getPixelColor(p.x, p.y).getBlue() > 200 and i<20:#If the pixel is blue, the button is clickable
- goClick(getLastMatch().getTarget(),KEY_META)
- hover(Location(StartPosition))#Move the mouse back to the original position.
- wait(.1)
- i=i+1
- else:#No gilded heroes found. If we started from the bottom, go back to the bottom.
- if Settings.StartGildedSearchFromBottom:
- wheel("1432960811209.png",WHEEL_DOWN,30) #Scroll to the top of the heroes list.
- ShowTheGameTopForSmallScreenResolutions()
- Settings.NoGildedHeroesAvailable = True
- hover(Location(StartPosition))#Move the mouse back to the original position.
- def BuyBottom2Heroes():#As the name says, This function buys the lowest 2 heroes on the screen at the moment.
- if exists(Pattern("1432963303747.png").similar(0.65)):#As long as a single 'Buy this hero' button is on the screen, Find all occurances of it.
- try:
- FA = findAll(Pattern("1432963303747.png").similar(0.65).targetOffset(0,7))
- LowestY=0
- LowestFound = getLastMatch()
- SecondLowest = LowestFound
- for i in FA:#Go through each occurance of the 'Buy this hero' button on screen and identify the lowest and second lowest.
- if LowestY < i.getY():
- LowestY = i.getY()
- SecondLowest = LowestFound
- LowestFound = i
- click(LowestFound,KEY_META)#Click the bottom buy hero button. Sometimes this screws up and clicks one that is greyed out which is why we have the next line as a backup.
- click(SecondLowest,KEY_META)#Click the second lowest buy hero button.
- if Settings.DeepRunInsteadOfAscension == False:
- hover(Location(StartPosition))#Move the mouse back to the original position.
- else:
- hover(Location(Settings.DeepRunStartPositionTemporary))
- return True
- except:
- return False
- def BuyAllHeroes200Times(ScrollSpeed = 2):
- MouseSpeed = Settings.MoveMouseDelay
- if Settings.BuyAllHeroesFaster == True:
- Settings.MoveMouseDelay = 0
- if Settings.MidasStart == True:
- Settings.MoveMouseDelay = 0
- #AscendLoopBool = True
- #while AscendLoopBool == True:
- ShowTheGameTopForSmallScreenResolutions()
- wheel(Pattern("1432960811209.png").targetOffset(-70,-2),WHEEL_UP,20)#Scroll web browser to top of page
- wheel("1432960811209.png",WHEEL_UP,20)#Scroll to the top of the heroes list.
- for i in range(0,7):#Perform the following 8 times:
- if exists(Pattern("1432963303747.png").similar(0.65)):#As long as one 'Buy hero' button is on screen at this time,
- FA = findAll(Pattern("1432963303747.png").similar(0.65).targetOffset(1,4))#Find all the 'Buy Hero' buttons and ctrl+click each one of them twice.
- for j in FA:
- click(j,KEY_META)
- click(j,KEY_META)
- if Settings.MidasStart == True and Settings.TryToSpeedUpMidasStart == True:
- if Settings.IfQuickMidasStartHappened == False:
- if exists(Pattern("midas-golden-clicks-skills.png").similar(0.95).targetOffset(70,-1),0):
- QuickMidasStart()
- Settings.MoveMouseDelay = MouseSpeed
- if Settings.BuyAllHeroesFaster == True:
- Settings.MoveMouseDelay = 0
- if exists("1432960811209.png"):
- wheel("1432960811209.png",WHEEL_DOWN,ScrollSpeed)#Scroll down 2 times and repeat.
- else:
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_DOWN,ScrollSpeed)#Scroll down 2 times and repeat.
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_DOWN,ScrollSpeed)#Scroll down 2 times and repeat.
- wait(Settings.WaitForMoney + .01)
- Settings.MoveMouseDelay = MouseSpeed
- def LookForSkippedHeroes():
- try:
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_UP,20)#Scroll to the top of the heroes list.
- wheel("1432960811209.png",WHEEL_DOWN,1)
- for i in range(0,8):#Perform the following 9 times:
- if exists(Pattern("1432963303747.png").similar(0.65)):#As long as one 'Buy hero' button is on screen at this time,
- FA = findAll(Pattern("1432963303747.png").similar(0.65).targetOffset(-47,3))#Find all the 'Buy Hero' buttons and ctrl+click each one of them twice.
- for j in FA:
- p = j.getTarget()
- SearchRegion = Region(p.x - 5,p.y - 10,125,60)
- if SearchRegion.exists(Pattern("1433201935503.png").similar(0.95),0):#Check if the lowest gilded hero found has a clickable hire button
- click(j,KEY_META)
- click(j,KEY_META)
- if exists(Pattern("1432961206728.png").similar(0.90),0):
- FindAndClick(Pattern("1432961206728.png").similar(0.95),0,False)
- i=20
- if exists("1432960811209.png"):
- wheel("1432960811209.png",WHEEL_DOWN,2)#Scroll down 2 times and repeat.
- else:
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_DOWN,2)#Scroll down 2 times and repeat.
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_DOWN,2)#Scroll down 2 times and repeat.
- return True
- except:
- return False
- def Ascend():#Our Ascension automation routine
- Settings.IfQuickMidasStartHappened = False
- ShowTheGameTopForSmallScreenResolutions()
- if Settings.ActivateAllSkillsWithEnergizedLuckyStrikesBeforeAscension == True and Settings.DeepRunInsteadOfAscension == False:
- ShowTheGameBottomForSmallScreenResolutions()
- if exists(Pattern("1432970424925.png").targetOffset(-238,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-238,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90).targetOffset(0,52),0,False) #Target Offset changed for Metal Detector
- FindAndClick(Pattern("skill-gold-clicks.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-energize.png").similar(0.95),0,False)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-powersurge.png").similar(0.90).targetOffset(0,-52),0,False) #Target Offset changed for Clickstorm
- FindAndClick(Pattern("skill-powersurge.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-super-clicks.png").similar(0.90),0,False)
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_DOWN,2)
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_DOWN,2)
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_UP,1)
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_UP,1)
- hover(Location(StartPosition))#Move the mouse back to the original position.
- BuyStrongestGildedHero(4)
- hover(Location(StartPosition))#Move the mouse back to the original position.
- for i in range(0,10):
- wait(3)
- FindAndClick(Pattern("skill-energize.png").similar(0.95),0,False)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-super-clicks.png").similar(0.90),0,False)
- BuyStrongestGildedHero(2)
- hover(Location(StartPosition))#Move the mouse back to the original position.
- ShowTheGameTopForSmallScreenResolutions()
- if Settings.DeepRunInsteadOfAscension == False:
- FindAndClick(Pattern("1437791962292.png").similar(0.95),0,False)
- if exists(Pattern("1436958313642.png").similar(0.95).targetOffset(32,-4),0):
- p = getLastMatch().getTarget()
- print "Relic Color: " + str(myRobot.getPixelColor(p.x, p.y))
- hover(getLastMatch())
- if Settings.StopOnGoodRelic == True:
- if TryToFind(Pattern("1438407556096.png").exact()) or TryToFind(Pattern("1438407852229.png").exact()):
- print "Found a relic that matches the search criteria!"
- StopTheScript()#This function does not exist and will cause an error when it reaches this line
- hover(Location(StartPosition))
- wait(4)
- if TryToFind(Pattern("1434944566569.png").exact()):
- FindAndClick(Pattern("1434944566569.png").exact(),0,False)
- wait(3)
- FindAndClick(Pattern("1434944650961.png").exact(),0,False)
- wait(.5)
- FindAndClick(Pattern("1434944701134.png").similar(0.95),0,False)
- wait(1)
- if exists("1432960811209.png",0):
- wheel("1432960811209.png",WHEEL_DOWN,5)#Scroll down 8 times so Amenhotep is on screen
- else:
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_DOWN,5)
- wait(1)
- if FindAndClick("1432960838309.png",0,False):#Click the ascend button.
- wait(3)
- FindAndClick(Pattern("1432960908494.png").similar(0.95),0,False) #Clicks yes to Ascend now.
- wait(3)
- AscendLoop() #Calls the AscendLoop function which performs all of the 'I just ascended' actions.
- else:#Sometimes after scrolling down the ascend button is not on screen so we scroll down a little more and try again.
- TryAgain=0
- while TryAgain <10:
- TryAgain = TryAgain + 1
- if exists("1432960811209.png",0):
- wheel("1432960811209.png",WHEEL_DOWN,1)
- else:
- if exists(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1)):
- wheel(Pattern("top-scroll.png").similar(0.85).targetOffset(-18,1),WHEEL_DOWN,1)
- else:
- if exists(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1)):
- wheel(Pattern("bottom-scroll.png").similar(0.85).targetOffset(-18,-1),WHEEL_DOWN,1)
- wait(1)
- if FindAndClick(Pattern("1432960838309.png").similar(0.80),0,False):
- TryAgain=20
- wait(1)
- FindAndClick(Pattern("1432960908494.png").similar(0.95),0,False)
- AscendLoop()
- if TryAgain == 10:
- BuyAllHeroes200Times(1)
- else:
- DeepRunMode()
- def AscendLoop():#This Function performs all of the 'I just ascended' Actions.
- print "Ascended in: " + str(int(int(time.time() - Settings.AscendStartTime)/60)) + " Minutes and " + str(int(int(time.time() - Settings.AscendStartTime)-(int(int(time.time() - Settings.AscendStartTime)/60)*60))) + " Seconds"
- Settings.AscendStartTime = time.time()
- ShowTheGameTopForSmallScreenResolutions()
- #1.It will Go to Level 19, and click the monster 8 times
- #2.scroll to the bottom of the heroes list and ctrl+click the bottom two heroes.
- #3.It will then Click the 'Advance 2 levels' image 8 times.
- #4.It will repeat steps 2 and 3 until all of frostleaf's upgrades are available. If you hit level 114 before this happens, it turns on 'Progression Mode'
- #5.Scroll through the list of heroes ctrl+clicking each one at least 2 times. This should ensure at least 200 levels each. Often more but this doesn't effect anything.
- #6.Click the 'Buy Available Upgrades' button and activate an energized dark ritual.
- #7.Resumes normal operation.
- Settings.MoveMouseDelay = 0 #Clicking has a default delay of .5 seconds. This removes that so this part goes faster.
- Settings.IfQuickMidasStartHappened = False
- if Settings.WaitForFishBeforeAscending == True and exists("1432960442630.png",0):
- FindAndClick("1432960442630.png",0,False)
- wait(1)
- CollectCoins()
- wait(1)
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#Enable progression mode now.
- Settings.IfQuickMidasStartHappened = True
- Settings.EDRDelayCounterIfQuickMidasStartHappened = Settings.EDRDelayValueIfQuickMidasStartHappened
- else:
- if Settings.MidasStart == True and exists("1432960442630.png",0):
- FindAndClick("1432960442630.png",0,False)
- wait(1)
- CollectCoins()
- wait(2)
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#Enable progression mode now.
- Settings.IfQuickMidasStartHappened = True
- Settings.EDRDelayCounterIfQuickMidasStartHappened = Settings.EDRDelayValueIfQuickMidasStartHappened
- if Settings.IHaveIris == False:
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#Enable progression mode now.
- else:
- if Settings.IfQuickMidasStartHappened == False:
- for i in range(0,9):#Perform the following action 10 times:
- FindAndClick(Pattern("1432965832101.png").similar(0.90).targetOffset(-59,-1),0,False)#Click on the 'Advance 2 levels' button. The point we are clicking is to the left of this button.
- if Settings.IfQuickMidasStartHappened == False:
- #for i in range(0,20):#Click on the monster 21 times to get a good initial base of money.
- if exists(Pattern("1432970424925.png").targetOffset(-180,-2),0):#clicks a ways to the left of this button which should be over the monster.
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-107,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- for i in range(0, 18):
- mouseDown(Button.LEFT)
- mouseUp()
- AscendLoopBool = True
- if Settings.IfQuickMidasStartHappened == True:
- AscendLoopBool = False
- Loopcount = 0
- FoundFrostLeaf = False
- while AscendLoopBool == True:
- if Settings.AlternativeFrostLeafSearch == False:
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_DOWN,15)
- else:
- if FoundFrostLeaf == False:
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_UP,1)
- wheel("1432960811209.png",WHEEL_DOWN,4)
- try:
- if FoundFrostLeaf == False:
- if exists(Pattern("1432963303747.png").similar(0.65)):#As long as a single 'Buy this hero' button is on the screen, Find all occurances of it.
- FA = findAll(Pattern("1432963303747.png").similar(0.65).targetOffset(0,7))
- LowestY=0
- LowestFound = getLastMatch()
- SecondLowest = LowestFound
- for i in FA:#Go through each occurance of the 'Buy this hero' button on screen and identify the lowest and second lowest.
- if LowestY < i.getY():
- LowestY = i.getY()
- SecondLowest = LowestFound
- LowestFound = i
- click(LowestFound,KEY_META)#Click the bottom buy hero button. Sometimes this screws up and clicks one that is greyed out which is why we have the next line as a backup.
- click(LowestFound,KEY_META)#Click the bottom buy hero button. Sometimes this screws up and clicks one that is greyed out which is why we have the next line as a backup.
- click(SecondLowest,KEY_META)#Click the second lowest buy hero button.
- click(SecondLowest,KEY_META)#Click the second lowest buy hero button.
- hover(Location(StartPosition))#Move the mouse back to the original position.
- else:
- FindAndClick("1432960442630.png")
- else:
- if exists(Pattern("1432963303747.png").similar(0.65)):#As long as a single 'Buy this hero' button is on the screen, Find all occurances of it.
- FA = findAll(Pattern("1432963303747.png").similar(0.65).targetOffset(0,7))
- for j in FA:#Go through each occurance of the 'Buy this hero' button on screen and identify the lowest and second lowest.
- click(j,KEY_META)
- hover(Location(StartPosition))#Move the mouse back to the original position.
- else:
- FindAndClick("1432960442630.png")
- except:
- wait(1)
- if exists("1433044030019.png"):#Once FrostLeaf's entire skill set is available, we are probably advanced enough to move on.
- AscendLoopBool = False
- FoundFrostLeaf = False
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#Enable progression mode now.
- else:
- if Settings.AlternativeFrostLeafSearch == True and FoundFrostLeaf == False:
- if exists(Pattern("frostleaf.png").similar(0.95)) or exists(Pattern("frostleaf-gilded.png").similar(0.95)):
- FoundFrostLeaf = True
- if Settings.IHaveIris == True and AscendLoopBool == True:
- ShowTheGameTopForSmallScreenResolutions()
- for i in range(0,Settings.AscendNextLevelClicks): #Click the 'Advance 2 levels' button Settings.AscendNextLevelClicks times. This variable is set at the top of the script
- FindAndClick(Pattern("1432965832101.png").similar(0.90).targetOffset(-59,-1),0,False)#ClickAdvance 2 levels button location
- if Loopcount > 10:
- FindAndClick("1432960442630.png")
- if Settings.MidasStart == True and exists("1432960442630.png",0):
- FindAndClick("1432960442630.png",0,False)
- wait(1)
- CollectCoins()
- wait(2)
- AscendLoopBool = False
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#Enable progression mode now.
- Settings.IfQuickMidasStartHappened = True
- Settings.EDRDelayCounterIfQuickMidasStartHappened = Settings.EDRDelayValueIfQuickMidasStartHappened
- # wait(Settings.WaitForMoney)
- Loopcount = Loopcount + 1
- BuyAllHeroes200Times()
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_DOWN,15) #Scroll to the bottom of the heroes list.
- wait(1)
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#If for some reason progression mode is off, Enable progression mode now.
- if FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False) == False:#Click 'Buy available upgrades'! This should complete your ascension and we can resume normal operation
- #We must have not seen the button. Lets try to fix this.
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_UP,2)
- wait(.5)
- wheel("1432960811209.png",WHEEL_DOWN,15)
- wait(.5)
- FindAndClick(Pattern("1432961206728.png").similar(0.95),0,False)
- wait(1)
- if Settings.SomeHeroesGetSkipped == True or TryToFind(Pattern("1438450514368.png").exact()):
- LookForSkippedHeroes()
- wait(5)
- ShowTheGameTopForSmallScreenResolutions()
- BuyStrongestGildedHero(10)
- else:
- ShowTheGameTopForSmallScreenResolutions()
- BuyStrongestGildedHero(10)
- Settings.MoveMouseDelay = .5 #Set the MouseMoveDelay back to the default. The delay is usually useful.
- #At this point in the progression, we are doing enough damage that even with the 1 minute non-idle, we still level at maximum speed.
- ShowTheGameTopForSmallScreenResolutions()
- ShowTheGameBottomForSmallScreenResolutions()
- wait(1)
- Settings.MoveMouseDelay = .5
- if Settings.MidasStart == True and exists("1432960442630.png",0):
- FindAndClick("1432960442630.png")
- wait(1)
- CollectCoins()
- wait(2)
- FindAndClick(Pattern("1432961136172.png").similar(0.90),0,False)#Enable progression mode now.
- else:
- if Settings.MidasStart == True and Settings.WaitForFishBeforeAscending == False:
- if Settings.IfQuickMidasStartHappened == False:
- #Midas start
- Settings.MoveMouseDelay = 0.2
- if exists(Pattern("1432970424925.png").targetOffset(-180,-2),0):#clicks a ways to the left of this button which should be over the monster.
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-107,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- FindAndClick(Pattern("skill-powersurge.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90).targetOffset(0,52),0,False) #Target Offset changed for Metal Detector
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-gold-clicks.png").similar(0.90),0,False)
- Settings.MoveMouseDelay = 0
- wait(1)
- #for i in range(0,19):#Click on the monster 20 times to get money with Golden Clicks
- if exists(Pattern("1432970424925.png").targetOffset(-180,-2),0):#clicks a ways to the left of this button which should be over the monster.
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-107,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- for i in range(0, 18):
- mouseDown(Button.LEFT)
- mouseUp()
- wait(4)
- if Settings.EDR == True and Settings.IfQuickMidasStartHappened == False:
- EDR()
- Settings.EDRTime = int(time.time()) + 120
- if Settings.MidasStart == True and Settings.WaitForFishBeforeAscending == False:
- ShowTheGameTopForSmallScreenResolutions()
- Settings.MoveMouseDelay = 0
- wait(1)
- wheel("1432960811209.png",WHEEL_UP,2)
- wait(.5)
- wheel("1432960811209.png",WHEEL_DOWN,15)
- wait(.5)
- BuyBottom2Heroes()
- BuyBottom2Heroes()
- BuyBottom2Heroes()
- if FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False) == False:#Click 'Buy available upgrades'! This should complete your ascension and we can resume normal operation
- #We must have not seen the button. Lets try to fix this.
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_UP,2)
- wait(.5)
- wheel("1432960811209.png",WHEEL_DOWN,15)
- wait(.5)
- FindAndClick(Pattern("1432961206728.png").similar(0.95),0,False)
- else:
- Settings.MoveMouseDelay = 0
- wait(1)
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_UP,2)
- wait(.5)
- wheel("1432960811209.png",WHEEL_DOWN,15)
- wait(.5)
- BuyBottom2Heroes()
- if FindAndClick(Pattern("1432961206728.png").similar(0.90),0,False) == False:#Click 'Buy available upgrades'! This should complete your ascension and we can resume normal operation
- #We must have not seen the button. Lets try to fix this.
- ShowTheGameTopForSmallScreenResolutions()
- wheel("1432960811209.png",WHEEL_UP,2)
- wait(.5)
- wheel("1432960811209.png",WHEEL_DOWN,15)
- wait(.5)
- FindAndClick(Pattern("1432961206728.png").similar(0.95),0,False)
- Settings.MoveMouseDelay = .5
- def EDR():
- if Settings.ActivatePowersurgeAndMetalDetectorInAdditionToEDR == True and Settings.EDR_ER_State == "NONE":
- FindAndClick(Pattern("skill-powersurge.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90).targetOffset(0,52),0,False) #Target Offset changed for Metal Detector
- FindAndClick(Pattern("1434520013436.png").similar(0.95),0,False)#Purchase an energized dark ritual once.
- FindAndClick(Pattern("1432961445894.png").similar(0.90),0,False)
- FindAndClick(Pattern("1433037474843.png").similar(0.90),0,False)
- Settings.EDR_ER_State = "ER"
- def QuickMidasStart(): #Experimental. Currently it's not used. (If possible, it would speed up Midas start that happens if Settings.MidasStart = True)
- Settings.IfQuickMidasStartHappened = True
- Settings.EDRDelayCounterIfQuickMidasStartHappened = Settings.EDRDelayValueIfQuickMidasStartHappened
- Settings.MoveMouseDelay = 0.2
- if exists(Pattern("1432970424925.png").targetOffset(-180,-2),0):#clicks a ways to the left of this button which should be over the monster.
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-107,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- if exists(Pattern("midas-golden-clicks-skills.png").targetOffset(70,-1),0) and Settings.MidasStart == True:
- FindAndClick(Pattern("midas-golden-clicks-skills.png").targetOffset(70,-1),0,False)
- wait(1)
- FindAndClick(Pattern("skill-gold-clicks.png").similar(0.90),0,False)
- Settings.MoveMouseDelay = 0
- wait(1)
- #for i in range(0,19):#Click on the monster 20 times to get money with Golden Clicks
- if exists(Pattern("1432970424925.png").targetOffset(-180,-2),0):#clicks a ways to the left of this button which should be over the monster.
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-107,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- for i in range(0, 18):
- mouseDown(Button.LEFT)
- mouseUp()
- wait(4)
- def DeepRunMode(): #(Beta) Deep Run Mode - Not tested properly yet.
- ShowTheGameBottomForSmallScreenResolutions()
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- Settings.DeepRunStartPositionTemporary = getLastMatch().getTarget()
- Settings.MoveMouseDelay = 0
- iii = 26
- sss = 25
- while iii > 0:
- if iii > sss:
- iii = 1
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- wheel(Location(Settings.DeepRunStartPositionTemporary),WHEEL_DOWN,10)
- BuyStrongestGildedHero(2)
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90).targetOffset(0,52),0,False) #Target Offset changed for Metal Detector
- if exists(Pattern("skill-gold-clicks.png").similar(0.90),0) and exists(Pattern("1433037474843.png").similar(0.90),0):
- FindAndClick(Pattern("skill-gold-clicks.png").similar(0.90),0,False)
- FindAndClick(Pattern("1433037474843.png").similar(0.90),0,False)
- else:
- if exists(Pattern("skill-gold-clicks.png").similar(0.90),0):
- FindAndClick(Pattern("skill-gold-clicks.png").similar(0.90),0,False)
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- FindAndClick(Pattern("skill-super-clicks.png").similar(0.90),0,False)
- FindAndClick(Pattern("skill-powersurge.png").similar(0.90).targetOffset(0,-52),0,False) #Target Offset changed for Clickstorm
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- if exists(Pattern("skill-energize.png").similar(0.95),0) and exists(Pattern("skill-lucky-strikes.png").similar(0.90),0):
- FindAndClick(Pattern("skill-energize.png").similar(0.95),0,False)
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90),0,False)
- else:
- if exists(Pattern("skill-lucky-strikes.png").similar(0.90),0):
- FindAndClick(Pattern("skill-lucky-strikes.png").similar(0.90),0,False)
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- FindAndClick(Pattern("skill-powersurge.png").similar(0.90),0,False)
- FindAndClick(Pattern("1432961445894.png").similar(0.90),0,False)
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- else:
- iii = iii + 1
- wheel(Location(Settings.DeepRunStartPositionTemporary),WHEEL_DOWN,10)
- BuyStrongestGildedHero(2)
- if exists(Pattern("1432970424925.png").targetOffset(-248,-2),0):
- click(getLastMatch(),0)
- else:
- if exists(Pattern("1432961136172.png").similar(0.90).targetOffset(-248,-1),0):
- click(getLastMatch(),0)
- else:
- click(Location(1273, 631),0)
- FindAndClick("1432960442630.png",0,False)
- wait(0.5)
- def Throne_Rush():#Throne rush automation, because why not.
- if exists("1434101319534.png",0):#Throne Rush is on screen
- FindAndClick(Pattern("ThroneRush.Sand.png").similar(0.80).targetOffset(-5,-3))
- Settings.MoveMouseDelay = 0
- if TryToFind(Pattern("1433045147103.png").similar(0.98)) == False:
- FindAndClickAll(Pattern("ThroneRush.Gold.png").targetOffset(6,-4))
- if TryToFind(Pattern("ThroneRush.FoodBar.png").similar(0.95)) == False:#Make sure the food capacity bar is not full. Need to add this for gold once my gold is full.
- FindAndClickAll(Pattern("ThroneRush.Food.png").similar(0.80))
- Settings.MoveMouseDelay = .5
- wait(5)
- return True
- else:
- return False
- while True:#This is the main loop of the application.
- StartPosition = Env.getMouseLocation() #This variable is set to detect if you are actively moving the mouse.
- Settings.DeepRunStartPositionTemporary = StartPosition
- if Clicker_Heroes() == False: #This calls the Clicker_Heroes function which returns False if clicker heroes is not present on the screen.
- Throne_Rush() #This is an example of using a single script to automate multiple games. I intend to have it automatically change tabs soon.
- EndPosition = Env.getMouseLocation()
- while StartPosition != EndPosition:#Here we check if the mouse moved at all while the scripts were running. If it has, enter a side loop until the mouse stops moving for 2 seconds.
- Settings.Times = 0 #Custom global variable. Becomes important later.
- StartPosition = Env.getMouseLocation()
- wait(2)
- EndPosition = Env.getMouseLocation()
Advertisement
Add Comment
Please, Sign In to add comment