Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

Commit 7fbc11f

Browse files
committed
Artifact using in push functions and some small bugfixes
1 parent 5a9fe25 commit 7fbc11f

5 files changed

Lines changed: 30 additions & 14 deletions

File tree

AutoAFK.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
latest_release = 'Cannot retrieve!'
4444

4545

46-
version = "0.15.2"
46+
version = "0.15.3"
4747

4848
#Main Window
4949
class App(customtkinter.CTk):
@@ -771,23 +771,23 @@ def activityManager():
771771
if app.activityFormationDropdown.get() == "Fight of Fates":
772772
buttonState('disabled')
773773
connect_device()
774-
handleFightOfFates(config.getint('EVENTS', 'activitybattles'))
774+
handleFightOfFates(config.getint('ACTIVITY', 'activitybattles'))
775775
buttonState('normal')
776776
print('')
777777
return
778778

779779
if app.activityFormationDropdown.get() == "Battle of Blood":
780780
buttonState('disabled')
781781
connect_device()
782-
handleBattleofBlood(config.getint('EVENTS', 'activitybattles'))
782+
handleBattleofBlood(config.getint('ACTIVITY', 'activitybattles'))
783783
buttonState('normal')
784784
print('')
785785
return
786786

787787
if app.activityFormationDropdown.get() == "Arena of Heroes":
788788
buttonState('disabled')
789789
connect_device()
790-
handleArenaOfHeroes(config.getint('EVENTS', 'activitybattles'), config.getint('ARENA', 'arenaopponent'))
790+
handleArenaOfHeroes(config.getint('ACTIVITY', 'activitybattles'), config.getint('ARENA', 'arenaopponent'))
791791
buttonState('normal')
792792
print('')
793793
return
@@ -837,7 +837,6 @@ def serverCheck():
837837
def dailies():
838838
connect_device()
839839
serverCheck() # Change server slot if defined before doing dailies
840-
useBagConsumables()
841840
if config.getboolean('DAILIES', 'collectrewards') is True:
842841
collectAFKRewards()
843842
if config.getboolean('DAILIES', 'collectmail') is True:
@@ -900,7 +899,6 @@ def push():
900899
pushCampaign(formation=formation, duration=int(config.get('PUSH', 'victoryCheck')))
901900
else:
902901
printBlue('Auto-Pushing ' + str(app.pushLocationDropdown.get()) + ' using using the ' + str(app.pushFormationDropdown.get()) + ' formation')
903-
# openTower(app.pushLocationDropdown.get())
904902
if str(app.pushFormationDropdown.get()) != config.get('PUSH', 'formation'):
905903
config.set('PUSH', 'formation', app.pushFormationDropdown.get())
906904
updateSettings()

activities.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,9 @@ def useBagConsumables():
322322
click('buttons/back', region=boundaries['backMenu'])
323323
click('buttons/back', region=boundaries['backMenu'])
324324
return
325-
clickXY(550, 1800)
326-
clickXY(950, 1750)
327-
click('buttons/back', region=boundaries['backMenu'])
325+
clickXY(550, 1800) # Use
326+
clickXY(950, 1700) # 'All' Bag button to clear loot
327+
click('buttons/back', region=boundaries['backMenu'], suppress=True)
328328
printGreen(' Bag consumables used!')
329329
else:
330330
printError(' Bag not found, attempting to recover')
@@ -463,6 +463,8 @@ def pushCampaign(formation=3, duration=1):
463463
recover()
464464

465465
def configureBattleFormation(formation):
466+
artifacts = None
467+
counter = 0
466468
if config.getboolean('ADVANCED', 'ignoreformations') is True:
467469
printWarning('ignoreformations enabled, skipping formation selection')
468470
click('buttons/autobattle', suppress=True, retry=3, region=boundaries['autobattle']) # So we don't hit it in the background while autobattle is active
@@ -473,9 +475,20 @@ def configureBattleFormation(formation):
473475
clickXY(800, 1650, seconds=2) # Change to 'Popular' tab
474476
clickXY(850, 425 + (formation * 175), seconds=2)
475477
click('buttons/use', retry=3, region=boundaries['useAB'], seconds=2)
476-
artifacts = isVisible('buttons/checkbox_checked', region=(230, 1100, 80, 80), confidence=0.85) # Check checkbox status
477-
if artifacts != config.getboolean('PUSH', 'useartifacts'):
478+
479+
# Configure Artifacts
480+
while artifacts is None and counter <= 5: # loop because sometimes isVisible returns None here
481+
artifacts = isVisible('buttons/checkbox_checked', region=(230, 1100, 80, 80)) # Check checkbox status
482+
counter += 1
483+
if counter >= 5: # If still None after 5 tries give error and contiue without configuring
484+
printError('Couldn\'t read artifact status')
485+
if artifacts is not config.getboolean('PUSH', 'useartifacts') and artifacts is not None:
486+
if config.getboolean('PUSH', 'useartifacts'):
487+
printBlue('Enabling Artifact copying')
488+
else:
489+
printBlue('Disabling Artifact copying')
478490
clickXY(275, 1150) # clickXY not ideal here but my brain is fried so it'll do for now
491+
479492
click('buttons/confirm_small', retry=3, region=boundaries['confirmAB'])
480493
click('buttons/autobattle', retry=3, region=boundaries['autobattle']) # So we don't hit it in the background while autobattle is active
481494
clickSecure('buttons/activate', 'labels/autobattle', region=boundaries['activateAB'], secureregion=boundaries['autobattleLabel'])
@@ -781,6 +794,7 @@ def handleTwistedRealm():
781794
printError(' Challenge button not found, attempting to recover')
782795
else:
783796
printError(' Error opening Twisted Realm, attempting to recover')
797+
# TODO Add 'Calculating' confirmation to exit safely
784798
recover()
785799

786800
# Opens a Fight of Fates battle and then cycles between dragging heroes and dragging skills until we see the battle end screen
@@ -1385,3 +1399,6 @@ def returnBattleResults(type, firstOfMulti=False):
13851399
return False
13861400
else:
13871401
return 'Unknown'
1402+
1403+
def handleHeroesofEsperia():
1404+
print('soon')

img/buttons/confirm_stageexit.png

10.3 KB
Loading

settings.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ gold_emblem = False
5656
poe = True
5757

5858
[PUSH]
59-
formation = 5th
59+
formation = 2nd
6060
victorycheck = 1
6161
suppressspam = True
6262
useartifacts = False

tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def waitUntilGameActive():
211211
loaded = 1
212212

213213
while loadingcounter < loaded:
214-
clickXY(400, 50) # Neutral location for closing reward pop ups etc, should never be an in game button here
214+
clickXY(420, 50) # Neutral location for closing reward pop ups etc, should never be an in game button here
215215
buttons = [os.path.join('buttons', 'campaign_unselected'), os.path.join('buttons', 'exitmenu_trial'), os.path.join('buttons', 'back')]
216216
for button in buttons:
217217
click(button, seconds=0, suppress=True)
@@ -517,9 +517,10 @@ def recover():
517517
click('buttons/back', suppress=True, seconds=0.5, region=(0, 1500, 250, 419))
518518
click('buttons/exitmenu', suppress=True, seconds=0.5, region=(700, 0, 379, 500))
519519
click('buttons/confirm_small', suppress=True, seconds=0.5, region=(200, 750, 600, 649))
520+
click('buttons/confirm_stageexit', suppress=True, seconds=0.5, region=(200, 750, 600, 649))
520521
click('buttons/exit', suppress=True, seconds=0.5, region=(578, 1250, 290, 88))
521522
click('buttons/campaign_unselected', suppress=True, seconds=0.5, region=(424, 1750, 232, 170))
522-
clickXY(400, 50) # Neutral location for closing reward pop ups etc, should never be an in game button here
523+
clickXY(420, 50) # Neutral location for closing reward pop ups etc, should never be an in game button here
523524
recoverCounter += 1
524525
if recoverCounter > 8:
525526
break

0 commit comments

Comments
 (0)