Skip to content

Commit

Permalink
v34.3.6116 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
wazam authored Apr 29, 2023
1 parent 4bd6a04 commit 690956a
Show file tree
Hide file tree
Showing 109 changed files with 958 additions and 861 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/autohotkey-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# https://github.com/marketplace/actions/ahk2exe

name: Test an AutoHotKey application.

on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:

jobs:
test:

runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Test with Ahk2Exe
uses: nekocodeX/GitHub-Action-Ahk2Exe@main
with:
in: main.ahk
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vscode/
Other/
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 wazam
Copyright (c) 2020 wazam

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
113 changes: 113 additions & 0 deletions Lib/AssignMapVariables.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
AssignMapVariables() {
global
If (Map = "Monkey Meadow") {
SafeX := 962, SafeY := 50
HeroX := 407, HeroY := 434
DartX := , DartY :=
BoomerangX := , BoomerangY :=
BombX := , BombY :=
TackX := , TackY :=
IceX := , IceY :=
GlueX := , GlueY :=
SniperX := , SniperY :=
SubX := , SubY :=
BuccaneerX := , BuccaneerY :=
AceX := , AceY :=
HeliX := , HeliY :=
MortarX := , MortarY :=
DartlingX := , DartlingY :=
WizardX := , WizardY :=
SuperX := , SuperY :=
NinjaX := 524, NinjaY := 426
Ninja2X := Ninja2Y :=
AlchemistX := 526, AlchemistY := 330
DruidX := , DruidY :=
FarmX := , FarmY :=
SpikeX := , SpikeY :=
VillageX := , VillageY :=
EngineerX := , EngineerY :=
} Else If (Map = "Tree Stump") { ; NOT AVALIABLE
} Else If (Map = "Town Center") { ; NOT AVALIABLE
} Else If (Map = "One Two Tree") { ; NOT AVALIABLE
} Else If (Map = "Scrapyard") { ; NOT AVALIABLE
} Else If (Map = "The Cabin") { ; NOT AVALIABLE
} Else If (Map = "Resort") { ; NOT AVALIABLE
} Else If (Map = "Skates") { ; NOT AVALIABLE
} Else If (Map = "Lotus Island") { ; NOT AVALIABLE
} Else If (Map = "Candy Falls") { ; NOT AVALIABLE
} Else If (Map = "Winter Park") { ; NOT AVALIABLE
} Else If (Map = "Carved") { ; NOT AVALIABLE
} Else If (Map = "Park Path") { ; NOT AVALIABLE
} Else If (Map = "Alpine Run") { ; NOT AVALIABLE
} Else If (Map = "Frozen Over") { ; NOT AVALIABLE
} Else If (Map = "In The Loop") { ; NOT AVALIABLE
} Else If (Map = "Cubism") { ; NOT AVALIABLE
} Else If (Map = "Four Circles") { ; NOT AVALIABLE
} Else If (Map = "Hedge") { ; NOT AVALIABLE
} Else If (Map = "End Of The Road") { ; NOT AVALIABLE
} Else If (Map = "Logs") {
SafeX := 458, SafeY := 235
HeroX := 430, HeroY := 470
IceX := 483, IceY := 487
HeliX := 266, HeliY := 586
WizardX := 534, WizardY := 437
NinjaX := 530, NinjaY := 470
AlchemistX := 473, AlchemistY := 578
FarmX := 261, FarmY := 597
SpikeX := 284, SpikeY := 703
VillageX := 396, VillageY := 578
} Else If (Map = "Covered Garden") { ; NOT AVALIABLE
} Else If (Map = "Quarry") { ; NOT AVALIABLE
} Else If (Map = "Quiet Street") {
SafeX := 711, SafeY := 36
HeroX := 389, HeroY := 594
NinjaX := 476, NinjaY := 330
AlchemistX := 420, AlchemistY := 329
VillageX := 433, VillageY := 256
} Else If (Map = "Bloonarius Prime") { ; NOT AVALIABLE
} Else If (Map = "Balance") { ; NOT AVALIABLE
} Else If (Map = "Encrypted") { ; NOT AVALIABLE
} Else If (Map = "Bazaar") { ; NOT AVALIABLE
} Else If (Map = "Adora's Temple") { ; NOT AVALIABLE
} Else If (Map = "Spring Spring") { ; NOT AVALIABLE
} Else If (Map = "KartsNDarts") { ; NOT AVALIABLE
} Else If (Map = "Moon Landing") { ; NOT AVALIABLE
} Else If (Map = "Haunted") { ; NOT AVALIABLE
} Else If (Map = "Downstream") { ; NOT AVALIABLE
} Else If (Map = "Firing Range") { ; NOT AVALIABLE
} Else If (Map = "Cracked") { ; NOT AVALIABLE
} Else If (Map = "Streambed") { ; NOT AVALIABLE
} Else If (Map = "Chutes") { ; NOT AVALIABLE
} Else If (Map = "Rake") { ; NOT AVALIABLE
} Else If (Map = "Spice Islands") { ; NOT AVALIABLE
} Else If (Map = "Midnight Mansion") { ; NOT AVALIABLE
} Else If (Map = "Sunken Columns") { ; NOT AVALIABLE
} Else If (Map = "X Factor") { ; NOT AVALIABLE
} Else If (Map = "Mesa") { ; NOT AVALIABLE
} Else If (Map = "Geared") { ; NOT AVALIABLE
} Else If (Map = "Spillway") { ; NOT AVALIABLE
} Else If (Map = "Cargo") { ; NOT AVALIABLE
} Else If (Map = "Pat's Pond") { ; NOT AVALIABLE
} Else If (Map = "Peninsula") { ; NOT AVALIABLE
} Else If (Map = "High Finance") { ; NOT AVALIABLE
} Else If (Map = "Another Brick") { ; NOT AVALIABLE
} Else If (Map = "Off The Coast") { ; NOT AVALIABLE
} Else If (Map = "Cornfield") { ; NOT AVALIABLE
} Else If (Map = "Underground") { ; NOT AVALIABLE
} Else If (Map = "Sanctuary") { ; NOT AVALIABLE
} Else If (Map = "Ravine") { ; NOT AVALIABLE
} Else If (Map = "Flooded Valley") { ; NOT AVALIABLE
} Else If (Map = "Infernal") { ; NOT AVALIABLE
} Else If (Map = "Bloddy Puddles") { ; NOT AVALIABLE
} Else If (Map = "Workshop") { ; NOT AVALIABLE
} Else If (Map = "Quad") { ; NOT AVALIABLE
} Else If (Map = "Dark Castle") {
SafeX := 680, SafeY := 100
HeroX := 620, HeroY := 600
NinjaX := 620, NinjaY := 350
AlchemistX := 700, AlchemistY := 350
} Else If (Map = "Muddy Puddles") { ; NOT AVALIABLE
} Else If (Map = "#Ouch") { ; NOT AVALIABLE
}
Return
}
30 changes: 30 additions & 0 deletions Lib/AutoClickDifficulty.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
AutoClickDifficulty() {
global
If (Difficulty = "Standard (Easy)" or Difficulty = "Primary Monkeys Only" or Difficulty = "Deflation") {
CustomClick(518,334)
} Else If (Difficulty = "Standard (Medium)" or Difficulty = "Military Monkeys Only" or Difficulty = "Apopalypse" or Difficulty = "Reverse") {
CustomClick(800,334)
} Else If (Difficulty = "Standard (Hard)" or Difficulty = "Magic Monkeys Only" or Difficulty = "Double HP MOABs" or Difficulty = "Half Cash" or Difficulty = "Alternate Bloons Round" or Difficulty = "Impoppable" or Difficulty = "CHIMPS") {
CustomClick(1075,334)
}
If (Difficulty = "Standard (Easy)" or Difficulty = "Standard (Medium)" or Difficulty = "Standard (Hard)") {
CustomClick(525,486)
} Else If (Difficulty = "Primary Monkeys Only" or Difficulty = "Military Monkeys Only" or Difficulty = "Magic Monkeys Only") {
CustomClick(800,400)
} Else If (Difficulty = "Reverse" or Difficulty = "Alternate Bloons Round") {
CustomClick(800,610)
} Else If (Difficulty = "Deflation" or Difficulty = "Apopalypse" or Difficulty = "Double HP MOABs") {
CustomClick(1067,400)
} Else If (Difficulty = "Impoppable") {
CustomClick(1067,610)
} Else If (Difficulty = "Half Cash") {
CustomClick(1337,400)
} Else If (Difficulty = "CHIMPS") {
CustomClick(1337,610)
}
Sleep, 20
CustomClick(945,607) ; "Ok" overwirte save popup box
Sleep, 5000 ; Wait for map to load
CustomClick(800,610) ; "Ok" map rules popup box
Return
}
22 changes: 22 additions & 0 deletions Lib/AutoClickHero.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
AutoClickHero() {
global
BlockInput On
nextX := 100/1920*ClientWidth
nextY := 990/1080*ClientHeight
Click, %nextX% %nextY% ; "Change Hero"
Sleep, 200
HeroStepX := Mod(HasVal(OrderedHeros,Hero)-1,3)
nextX := (100/1920*ClientWidth)+(HeroStepX*(160/1920*ClientWidth))
HeroStepY := Floor((HasVal(OrderedHeros,Hero)-1)/3)
nextY := (230/1080*ClientHeight)+(HeroStepY*(190/1080*ClientHeight))
Click, %nextX% %nextY% ; click Hero
Sleep, 20
nextX := 1110/1920*ClientWidth
nextY := 610/1080*ClientHeight
Click, %nextX% %nextY% ; "Select"
Sleep, 20
SendInput, {Esc} ; back to map menu
Sleep, 200
BlockInput Off
Return
}
31 changes: 31 additions & 0 deletions Lib/AutoClickMap.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
AutoClickMap() {
global
ClickNextMapPage := Floor((HasVal(OrderedMaps,Map)-1)/6)
ClickMap := Mod(HasVal(OrderedMaps,Map),6)
Loop, % ClickNextMapPage {
nextX := 1644/1920*ClientWidth
nextY := 428/1080*ClientHeight
Click, %nextX% %nextY%
}
If (ClickMap = 1) {
nextX := 540/1920*ClientWidth
nextY := 250/1080*ClientHeight
} Else If (ClickMap = 2) {
nextX := 960/1920*ClientWidth
nextY := 250/1080*ClientHeight
} Else If (ClickMap = 3) {
nextX := 1380/1920*ClientWidth
nextY := 250/1080*ClientHeight
} Else If (ClickMap = 4) {
nextX := 540/1920*ClientWidth
nextY := 570/1080*ClientHeight
} Else If (ClickMap = 5) {
nextX := 960/1920*ClientWidth
nextY := 570/1080*ClientHeight
} Else If (ClickMap = 0) {
nextX := 1380/1920*ClientWidth
nextY := 570/1080*ClientHeight
}
Click, %nextX% %nextY%
Return
}
83 changes: 83 additions & 0 deletions Lib/BotGUI.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
BotGUI() {
global

Gui, Font, cBlack s11 Calibri ; Set default font

Gui, Add, GroupBox, w280 h85 cBlue, Information:

Gui, Add, Button, xp+10 yp+20 w80 h25 vInstructions gInfo, Instructions
Gui, Add, Button, xp+90 yp wp hp vHelp gInfo, Help
Gui, Add, Button, xp+90 yp wp hp vHints gInfo, Hints
Gui, Add, Button, xp-180 yp+30 wp hp vScripting gInfo, Scripting
Gui, Add, Button, xp+90 yp wp hp vAbout gInfo, About
Gui, Add, Button, xp+90 yp wp hp vLicense gInfo, License

Gui, Add, GroupBox, xp-190 yp+40 w280 h110 cBlue, Configuration:

Gui, Add, Text, xp+10 yp+20, Map:
OrderedMapsArrayTrimmed := OrderedMaps.Clone()
Loop % OrderedMapsArrayTrimmed.Length()
For Index, Value In OrderedMapsArrayTrimmed
If (Value = "")
OrderedMapsArrayTrimmed.RemoveAt(Index)
OrderedMapsArrayTrimmedList := ""
For Index, Value In OrderedMapsArrayTrimmed
OrderedMapsArrayTrimmedList .= "|" . Value
OrderedMapsArrayTrimmedList := LTrim(OrderedMapsArrayTrimmedList, "|")
Gui, Add, DropDownList, xp+94 yp-4 +Sort vMap, %OrderedMapsArrayTrimmedList%
GuiControl, ChooseString, Map, %DefaultMap%

Gui, Add, Text, xp-94 yp+34, Difficulty:
Gui, Add, DropDownList, xp+94 yp-4 vDifficulty, Alternate Bloons Round|Apopalypse|CHIMPS|Deflation|Double HP MOABs|Half Cash|Impoppable|Magic Monkeys Only|Military Monkeys Only|Primary Monkeys Only|Reverse|Standard (Easy)|Standard (Medium)|Standard (Hard)
GuiControl, ChooseString, Difficulty, %DefaultDifficulty%

Gui, Add, Text, xp-94 yp+34, Hero:
OrderedHerosArrayTrimmed := OrderedHeros.Clone()
For Index, Value In OrderedHerosArrayTrimmed
If (Value = "")
OrderedHerosArrayTrimmed.RemoveAt(Index)
OrderedHerosArrayTrimmedList := ""
For Index, Value In OrderedHerosArrayTrimmed
OrderedHerosArrayTrimmedList .= "|" . Value
OrderedHerosArrayTrimmedList := LTrim(OrderedHerosArrayTrimmedList, "|")
Gui, Add, DropDownList, xp+94 yp-4 +Sort vHero, %OrderedHerosArrayTrimmedList%
GuiControl, ChooseString, Hero, %DefaultHero%

Gui, Add, GroupBox, xp-104 yp+40 w280 h260 cBlue, Preferences:

Gui, Add, Text, xp+10 yp+20, Start on: ; Skips SelectHero() Map() Difficulty() and Restarts to begin Round 1 ASAP
Gui, Add, DropDownList, xp+94 yp-4 +Choose1 vStartOn, Main Menu|Map

Gui, Add, Text, xp-94 yp+34, End on: ; Continue to play extra rounds (for less xp) after completing the map difficulty's objective
Gui, Add, DropDownList, xp+94 yp-4 +Choose1 vEndOn, Victory|Defeat

Gui, Add, Text, xp-94 yp+34, Cash Mode:
Gui, Add, DropDownList, xp+94 yp-4 +Choose1 vCashMode, Regular|Double

Gui, Add, Text, xp-94 yp+34, Custom Script:
Gui, Add, DropDownList, xp+94 yp-4 +Choose1 vCustomScript, No
Loop, %A_ScriptDir%\scripts\*.txt {
LastDotPos := InStr(A_LoopFileName,".",0,0) ; get position of last occurrence of "."
result := SubStr(A_LoopFileName,1,LastDotPos-1) ; get substring from start to last dot
GuiControl, , CustomScript, %result%
}
Gui, Add, Text, xp-94 yp+34, Resolution:
Gui, Add, DropDownList, xp+94 yp-4 +Choose1 vResolution, 1600x900|1920x1080

Gui, Add, Text, xp-94 yp+34, Storefront:
Gui, Add, DropDownList, xp+94 yp-4 +Choose1 vStorefront, Steam|Epic Games Store|Microsoft Store|BlueStacks

Gui, Add, Text, xp-94 yp+34, Loop Amount:
Gui, Add, Edit, xp+94 yp-3 w165 +Number vLoopAmount, 1000

Gui, Add, CheckBox, xp-94 yp+33 vDebugMode, Debug Mode ; Records screenshots for analysis after each purchase/upgrade

Gui, Font, Bold
Gui, Add, Button, xp yp+34 w80 h25 gF2, Start (F2)
Gui, Add, Button, xp+85 yp w90 h25 gF3, Pause (F3)
Gui, Add, Button, xp+95 yp w80 h25 gF4, Exit (F4)

Gui, Show, AutoSize Center, BotTD6
WinActivate, BotTD6
Return
}
10 changes: 10 additions & 0 deletions Lib/BotPause.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
BotPause() {
If (A_IsPaused) {
Pause, Off, 1
Menu, Tray, Rename, 4&, Pause (F3)
} Else {
Pause, On, 1
Menu, Tray, Rename, 4&, Unpause (F3)
}
Return
}
39 changes: 39 additions & 0 deletions Lib/BotStart.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
BotStart() {
global
LockGUI()
WinActivate, %GameTitle%
If (StartOn = "Main Menu") {
CustomClick(700,780) ; "Play" on main menu
AutoClickHero()
AutoClickMap()
AutoClickDifficulty()
}
AssignMapVariables()
Loop, %LoopAmount% {
Sleep, 100
Send, {SPACE} ; Start round
Sleep, 20
Send, {SPACE} ; Speed up round
PlayGame()
CustomClick(801,759) ; "Next" in victory pop-up
Sleep, 1300
CustomClick(1015,707) ; "Freeplay" in victory pop-up
Sleep, 1350 ; Wait for freeplay rules pop-up
CustomClick(802,632) ; "Ok" in free play pop-up
Sleep, 1300 ; Wait for freeplay rules pop-up
If DebugMode
SendInput, {F12} ; Screenshot final tower placements on map for analysis
If (EndOn = "Defeat") {
Send, {SPACE} ; Resume at double speed
Rest(420) ; Wait 7 minutes for "Defeat" pop-up
CustomClick(694, 679) ; "Restart" in defeat pop-up
} Else {
SendInput, {Esc} ; Pause menu
Sleep, 1300 ; Wait for pause pop-up
CustomClick(898, 704) ; "Restart" in victory pop-up
}
CustomClick(948, 603) ; "Restart" in restart? pop-up
Sleep, 1500 ; Wait for map to re-load
}
ExitApp
}
Loading

0 comments on commit 690956a

Please sign in to comment.