├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ └── bug_report.md ├── dependabot.yml └── workflows │ ├── ci.yml │ ├── dependabot-auto-merge.yml │ ├── links.yml │ └── wiki.yml ├── .gitignore ├── .shellcheckrc ├── LICENSE ├── README.md ├── _wiki ├── AFK Arena requirements.md ├── Config.md ├── Contribute.md ├── FAQ.md ├── Feature Requests.md ├── Features.md ├── Get started.md ├── Home.md ├── Installation.md ├── Known Issues.md ├── Specific.md ├── Supported Devices.md ├── Tips.md ├── Tools.md ├── Troubleshooting.md ├── Usage.md ├── _Footer.md └── _Sidebar.md ├── afk-daily.sh ├── deploy.sh ├── lib ├── print.sh ├── update_git.sh └── update_setup.sh └── tools ├── afk-daily.ext.sh ├── deploy.ext.sh ├── print.ext.sh └── support_assist.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | *.ini text eol=lf 5 | *.sh text eol=lf 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '[BUG]' 5 | labels: 'Type: Bug :beetle:' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | 12 | A clear and concise description of what the bug is. 13 | 14 | **Expected behavior** 15 | 16 | A clear and concise description of what you expected to happen. 17 | 18 | **Screenshots/Logs** 19 | 20 | If applicable, add screenshots of the console (or send the logs). 21 | 22 | **Desktop (please complete the following information):** 23 | 24 | - OS: [e.g. Windows 10] 25 | 26 | **Smartphone (please complete the following information):** 27 | 28 | - Emulator: [e.g. BlueStacks] 29 | - Version [e.g. 5.3.86.1001 N32] 30 | 31 | **Additional information** 32 | 33 | Add any other information about the problem here. 34 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | 3 | on: 4 | push: 5 | branches: [master, develop] 6 | pull_request: 7 | branches: [master, develop] 8 | 9 | jobs: 10 | Shellcheck: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Dependencies 16 | run: sudo apt install shellcheck -y 17 | 18 | - name: deploy.sh 19 | run: shellcheck -x deploy.sh 20 | 21 | - name: afk-daily.sh 22 | run: shellcheck -x afk-daily.sh 23 | 24 | - name: lib/print.sh 25 | run: shellcheck -x lib/print.sh 26 | 27 | - name: lib/update_git.sh 28 | run: shellcheck -x lib/update_git.sh 29 | 30 | - name: lib/update_setup.sh 31 | run: shellcheck -x lib/update_setup.sh 32 | -------------------------------------------------------------------------------- /.github/workflows/dependabot-auto-merge.yml: -------------------------------------------------------------------------------- 1 | name: Dependabot auto-merge 2 | on: pull_request 3 | 4 | permissions: 5 | contents: write 6 | pull-requests: write 7 | 8 | jobs: 9 | dependabot: 10 | runs-on: ubuntu-latest 11 | if: ${{ github.actor == 'dependabot[bot]' }} 12 | steps: 13 | - name: Dependabot metadata 14 | id: metadata 15 | uses: dependabot/fetch-metadata@v1.5.1 16 | with: 17 | github-token: "${{ secrets.GITHUB_TOKEN }}" 18 | - name: Enable auto-merge for Dependabot PRs 19 | run: gh pr merge --auto --merge "$PR_URL" 20 | env: 21 | PR_URL: ${{github.event.pull_request.html_url}} 22 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 23 | 24 | -------------------------------------------------------------------------------- /.github/workflows/links.yml: -------------------------------------------------------------------------------- 1 | name: Links 2 | 3 | on: 4 | push: 5 | paths: 6 | - '**/*.md' 7 | pull_request: 8 | paths: 9 | - '**/*.md' 10 | schedule: 11 | - cron: '0 0 * * SUN' 12 | 13 | jobs: 14 | linkChecker: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | 19 | - name: Link Checker 20 | uses: lycheeverse/lychee-action@v1.8.0 21 | with: 22 | args: --verbose --no-progress **/*.md **/*.html 23 | env: 24 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} 25 | -------------------------------------------------------------------------------- /.github/workflows/wiki.yml: -------------------------------------------------------------------------------- 1 | name: Wiki 2 | 3 | on: 4 | push: 5 | paths: 6 | # Trigger only when wiki directory changes 7 | - "_wiki/**" 8 | branches: 9 | # And only on master branch 10 | - master 11 | 12 | jobs: 13 | Update: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - name: Push Wiki Changes 18 | uses: Andrew-Chen-Wang/github-wiki-action@v4 19 | env: 20 | # Make sure you have that / at the end. We use rsync 21 | # WIKI_DIR's default is wiki/ 22 | WIKI_DIR: _wiki/ 23 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | GH_MAIL: ${{ secrets.OWNER_EMAIL }} 25 | GH_NAME: ${{ github.repository_owner }} 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # VSCode 2 | .history/ 3 | .vscode/* 4 | #!.vscode/settings.json 5 | *.code-workspace 6 | 7 | # Project specific 8 | account-info 9 | config 10 | #.wiki/ 11 | adb/ 12 | *.bak 13 | *.ini 14 | *.tmp 15 | *.log 16 | -------------------------------------------------------------------------------- /.shellcheckrc: -------------------------------------------------------------------------------- 1 | disable=SC1090,SC1091,SC2009,SC2034,SC2039,SC2154,SC3003,SC3057,SC3060 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Sebastião Barros 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | 15 | 16 | > ## News 17 | > 18 | > **This project is not actively maintained anymore**, I do not have the time to work on it. It'll be archived until further notice. Thanks to every one who contributed to it! 19 | 20 | ## Description 21 | 22 | This script is meant to automate the process of daily activities within the [AFK Arena](https://play.google.com/store/apps/details?id=com.lilithgame.hgame.gp&hl=en_US) game. It uses [ADB](https://developer.android.com/studio/command-line/adb) to analyse pixel colors in screenshots and tap on the screen accordingly. If you like our work, please consider starring this repository (and joining our [Discord](https://discord.gg/Fq2cfqjp8D)) as it lets us know people use the script, which motivates us to keep working on it! 23 | 24 |

Example script output

25 | 26 | 27 | ## Disclaimer 28 | 29 | This is a very fragile script (it relies on pixel accuracy), which means the probability of encountering a new error every time a new patch rolls out by Lilith is pretty high. Keep an eye on the `Patch` badge to check the latest game version this script was tested on. 30 | 31 | **We are not responsible for any type of ban or unintentional purchase! Use this script at your own risk.** We will do our best to try and make it as robust as possible. 32 | 33 | ## Quickstart 34 | 35 | We've created a [Wiki](https://github.com/zebscripts/AFK-Daily/wiki) with all the info you'd need to get started with this script. Head over there to [get started](https://github.com/zebscripts/AFK-Daily/wiki/Get-started)! 36 | 37 | 38 |
39 | 40 | 41 | 42 |
43 | -------------------------------------------------------------------------------- /_wiki/AFK Arena requirements.md: -------------------------------------------------------------------------------- 1 | The script is pretty modular, which means users have a lot of control over which features they want to make use of and which not. Technically speaking, the script could run on a level 1 account, though you'd only be able to use like 10% of the features. Just make sure to select the features your account is capable of doing: 2 | 3 | - **Mercenaries:** Stage 6-40 4 | - **Quick-battle Guild:** VIP 6 or higher 5 | - **Skip battle in the arena:** VIP 6 or higher 6 | - **Bounty Autofill and Dispatch:** VIP 6 or higher 7 | - **Auto-fill Heroes in quests:** VIP 6 or higher (or stage 12-40) 8 | - **Twisted Realm:** Stage 14-40 9 | - **Factional Towers:** Stage 15-1 10 | 11 | Also, **please make sure your game language is English and to have fought in battles at least once before running the script!** If for example, a new Twisted Realm boss gets released, the game does not know which formation you want to use. Though the script doesn't know this and tries to start the fight regardless, which of course won't work. In case you get into this situation, simply start the fight yourself, and the script should pick up whenever the fight has finished. 12 | 13 |
14 | 15 |
16 | Previous page 17 | | 18 | Next page 19 |
20 | -------------------------------------------------------------------------------- /_wiki/Config.md: -------------------------------------------------------------------------------- 1 | The script acts depending on a set of variables. In order to change these, open `config.ini` with a text editor of choice, and update them. If you do not have/see a `config.ini` file, simply run the script with the `-c` flag (`./deploy.sh -c`), and it should get automatically generated for you to edit. 2 | 3 | - [Player](#player) 4 | - [General](#general) 5 | - [Repetitions](#repetitions) 6 | - [Store](#store) 7 | - [Towers](#towers) 8 | - [Campaign](#campaign) 9 | - [Dark Forest](#dark-forest) 10 | - [Ranhorn](#ranhorn) 11 | - [End](#end) 12 | - [Useful config files](#useful-config-files) 13 | 14 | ## Player 15 | 16 | | Variable | Type | Description | Default | 17 | | :-------------------- | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: | 18 | | `canOpenSoren` | `Boolean` | If `true`, player has permission to open Soren. | `false` | 19 | | `arenaHeroesOpponent` | `Number` | Choose which opponent to fight in the Arena of Heroes. Possible entries: `1`, `2`, `3`, `4` or `5`, where `1` is the top opponent and `5` the bottom one. | `5` | 20 | 21 | ## General 22 | 23 | | Variable | Type | Description | Default | 24 | | :-------------------- | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------: | 25 | | `waitForUpdate` | `Boolean` | If `true`, waits until the in-game update has finished. | `true` | 26 | | `endAt` | `String` | Script will end at the chosen location. Possible entries: `oak`, `soren`, `mail`, `chat`, `tavern`, `merchants`, `campaign`, `championship`, `closeApp`. | `championship` | 27 | | `guildBattleType` | `String` | Choose type of Guild fight. Possible entries: `quick` or `challenge`. | `quick` | 28 | | `allowCrystalLevelUp` | `Boolean` | If `true`, allows the Resonating Crystal to be leveled up. | `true` | 29 | 30 | ## Repetitions 31 | 32 | | Variable | Type | Description | Default | 33 | | :--------------------------------- | :------: | :------------------------------------------------------------------------------------------------------------- | :-----: | 34 | | `maxCampaignFights` | `Number` | The maximum amount of lost attempts when fighting in the Campaign. | `5` | 35 | | `maxKingsTowerFights` | `Number` | The maximum amount of lost attempts when fighting in the King's Tower. | `5` | 36 | | `totalAmountArenaTries` | `Number` | The total amount of fights in the Arena of Heroes. The minimum is always 2, that's why its displayed as `2+X`. | `2+0` | 37 | | `totalAmountTournamentTries` | `Number` | The total amount of fights in the Legends' Challenger Tournament. | `0` | 38 | | `totalAmountGuildBossTries` | `Number` | The total amount of fights against a Guild Boss. The minimum is always 2, that's why its displayed as `2+X`. | `2+0` | 39 | | `totalAmountTwistedRealmBossTries` | `Number` | The total amount of fights in the Twisted Realm. | `1` | 40 | 41 | ## Store 42 | 43 | | Variable | Type | Description | Default | Image | 44 | | :------------------------------ | :-------: | :----------------------------------------------------------------- | :-----: | :---------------------------------------------------------------------------------------------------------------------------: | 45 | | `buyStoreDust` | `Boolean` | If `true`, buys Dust for Gold. | `true` | ![Hero's Essence](https://user-images.githubusercontent.com/7203617/132167221-91cfdb08-a624-4ad0-8c6d-d565683298c1.png) | 46 | | `buyStorePoeCoins` | `Boolean` | If `true`, buys Poe Coins for Gold. | `true` | ![Poe Coins](https://user-images.githubusercontent.com/7203617/132167219-2e50cc20-56d3-485c-ae8a-1668e1fb6f9c.png) | 47 | | `buyStorePrimordialEmblem` | `Boolean` | If `true` and possible, buys Primordial Emblems for Gold. | `false` | ![Primordial Emblem](https://user-images.githubusercontent.com/7203617/132167223-8847e3a0-f793-4fd1-a5c6-9c00267e54d1.png) | 48 | | `buyStoreAmplifyingEmblem` | `Boolean` | If `true` and possible, buys Amplifying Emblems for Gold. | `false` | ![Amplifying Emblem](https://user-images.githubusercontent.com/7203617/132167227-82508558-3021-493c-8cfc-bcf2b6071ce8.png) | 49 | | `buyStoreSoulstone` | `Boolean` | If `true` and possible, buys Elite Soulstones for Diamonds. | `false` | ![Elite Hero Soulstone](https://user-images.githubusercontent.com/7203617/132287360-45c1eb6d-9ddf-45a8-9060-64aa867737b2.png) | 50 | | `buyStoreLimitedElementalShard` | `Boolean` | If `true`, buys Limited Elemental Shard. | `false` | ![Limited Shard](https://user-images.githubusercontent.com/7203617/132167224-49b5dfb6-fce5-4a95-a702-9423ec23939e.png) | 51 | | `buyStoreLimitedElementalCore` | `Boolean` | If `true`, buys Limited Elemental Core. | `false` | ![Limited Core](https://user-images.githubusercontent.com/7203617/132167220-86102296-3e75-49f9-a7e1-cff87ff0f4f3.png) | 52 | | `buyStoreLimitedTimeEmblem` | `Boolean` | If `true`, buys Limited Time Emblem. | `false` | | 53 | | `buyWeeklyGuild` | `Boolean` | If `true`, buys one Stone from Guild Coins once a Week. | `false` | | 54 | | `buyWeeklyLabyrinth` | `Boolean` | If `true`, buys Rare Soulstones from Labyrinth Tokens once a Week. | `false` | ![Rare Soulstones](https://user-images.githubusercontent.com/7203617/132167981-baac849d-613a-4716-881e-ee21a9b2d4a1.png) | 55 | 56 | ## Towers 57 | 58 | | Variable | Type | Description | Default | 59 | | :------------------------ | :-------: | :---------------------------------------------------- | :-----: | 60 | | `doMainTower` | `Boolean` | If `true`, tries to battle in Main Tower | `true` | 61 | | `doTowerOfLight` | `Boolean` | If `true`, tries to battle in Tower of Light | `true` | 62 | | `doTheBrutalCitadel` | `Boolean` | If `true`, tries to battle in The Brutal Citadel | `true` | 63 | | `doTheWorldTree` | `Boolean` | If `true`, tries to battle in The World Tree | `true` | 64 | | `doCelestialSanctum` | `Boolean` | If `true`, tries to battle in Celestial Sanctum | `true` | 65 | | `doTheForsakenNecropolis` | `Boolean` | If `true`, tries to battle in The Forsaken Necropolis | `true` | 66 | | `doInfernalFortress` | `Boolean` | If `true`, tries to battle in InfernalFortress | `true` | 67 | 68 | ## Campaign 69 | 70 | | Variable | Type | Description | Default | 71 | | :------------------------------- | :-------: | :--------------------------------------------------------------- | :-----: | 72 | | `doLootAfkChest` | `Boolean` | If `true`, collects rewards from AFK chest. | `true` | 73 | | `doChallengeBoss` | `Boolean` | If `true`, enters current campaign level. | `true` | 74 | | `doFastRewards` | `Boolean` | If `true`, collects free fast rewards. | `true` | 75 | | `doCollectFriendsAndMercenaries` | `Boolean` | If `true`, collects Companion Points and auto-lends mercenaries. | `true` | 76 | 77 | ## Dark Forest 78 | 79 | | Variable | Type | Description | Default | 80 | | :-------------------- | :-------: | :------------------------------------------------------- | :-----: | 81 | | `doSoloBounties` | `Boolean` | If `true`, collects and dispatches Solo Bounties. | `true` | 82 | | `doTeamBounties` | `Boolean` | If `true`, collects and dispatches Team Bounties. | `true` | 83 | | `doArenaOfHeroes` | `Boolean` | If `true`, fights in the Arena of Heroes. | `true` | 84 | | `doLegendsTournament` | `Boolean` | If `true`, fights in the Legends' Challenger Tournament. | `true` | 85 | | `doKingsTower` | `Boolean` | If `true`, fights in the King's Towers. | `true` | 86 | 87 | ## Ranhorn 88 | 89 | | Variable | Type | Description | Default | 90 | | :------------------------ | :-------: | :------------------------------------------------- | :-----: | 91 | | `doGuildHunts` | `Boolean` | If `true`, fights Wrizz and if possible, Soren. | `true` | 92 | | `doTwistedRealmBoss` | `Boolean` | If `true`, fights current Twisted Realm boss. | `true` | 93 | | `doBuyFromStore` | `Boolean` | If `true`, buys items from store. | `true` | 94 | | `doStrengthenCrystal` | `Boolean` | If `true`, strengthens the resonating Crystal. | `true` | 95 | | `doTempleOfAscension` | `Boolean` | If `true` and possible, auto ascends heroes. | `false` | 96 | | `doCompanionPointsSummon` | `Boolean` | If `true`, summons one hero with Companion Points. | `false` | 97 | | `doCollectOakPresents` | `Boolean` | If `true`, collects Oak Inn presents. | `true` | 98 | 99 | ## End 100 | 101 | | Variable | Type | Description | Default | 102 | | :-------------------------- | :-------: | :------------------------------------------------------------------------------------------ | :-----: | 103 | | `doCollectQuestChests` | `Boolean` | If `true`, collects daily quest chests. | `true` | 104 | | `doCollectMail` | `Boolean` | If `true` and possible, collects mail rewards. | `true` | 105 | | `doCollectMerchantFreebies` | `Boolean` | If `true` and possible, collects free daily/weekly/monthly rewards from the Merchants page. | `false` | 106 | 107 | ## Useful config files 108 | 109 |
110 | config-Arena.ini 111 | 112 | ```ini 113 | # --- CONFIG: Modify accordingly to your game! --- # 114 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 115 | # Player 116 | canOpenSoren=false 117 | arenaHeroesOpponent=5 118 | 119 | # General 120 | waitForUpdate=true 121 | endAt=championship 122 | guildBattleType=quick 123 | allowCrystalLevelUp=false 124 | 125 | # Repetitions 126 | maxCampaignFights=0 127 | maxKingsTowerFights=0 128 | totalAmountArenaTries=25 129 | totalAmountTournamentTries=0 130 | totalAmountGuildBossTries=0 131 | totalAmountTwistedRealmBossTries=0 132 | 133 | # Store 134 | buyStoreDust=false 135 | buyStorePoeCoins=false 136 | buyStorePrimordialEmblem=false 137 | buyStoreAmplifyingEmblem=false 138 | buyStoreSoulstone=false 139 | buyStoreLimitedElementalShard=false 140 | buyStoreLimitedElementalCore=false 141 | buyStoreLimitedTimeEmblem=false 142 | buyWeeklyGuild=false 143 | buyWeeklyLabyrinth=false 144 | 145 | # Towers 146 | doMainTower=false 147 | doTowerOfLight=false 148 | doTheBrutalCitadel=false 149 | doTheWorldTree=false 150 | doCelestialSanctum=false 151 | doTheForsakenNecropolis=false 152 | doInfernalFortress=false 153 | 154 | # --- Actions --- # 155 | # Campaign 156 | doLootAfkChest=false 157 | doChallengeBoss=false 158 | doFastRewards=false 159 | doCollectFriendsAndMercenaries=false 160 | 161 | # Dark Forest 162 | doSoloBounties=false 163 | doTeamBounties=false 164 | doArenaOfHeroes=true 165 | doLegendsTournament=false 166 | doKingsTower=false 167 | 168 | # Ranhorn 169 | doGuildHunts=false 170 | doTwistedRealmBoss=false 171 | doBuyFromStore=false 172 | doStrengthenCrystal=false 173 | doTempleOfAscension=false 174 | doCompanionPointsSummon=false 175 | doCollectOakPresents=false 176 | 177 | # End 178 | doCollectQuestChests=false 179 | doCollectMail=false 180 | doCollectMerchantFreebies=false 181 | 182 | ``` 183 | 184 |
185 | 186 |
187 | config-Push_Campaign.ini 188 | 189 | Need to be run with `-f` flag! 190 | 191 | ```ini 192 | # --- CONFIG: Modify accordingly to your game! --- # 193 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 194 | # Player 195 | canOpenSoren=false 196 | arenaHeroesOpponent=5 197 | 198 | # General 199 | waitForUpdate=true 200 | endAt=campaign 201 | guildBattleType=quick 202 | allowCrystalLevelUp=false 203 | 204 | # Repetitions 205 | maxCampaignFights=500 206 | maxKingsTowerFights=0 207 | totalAmountArenaTries=0 208 | totalAmountTournamentTries=0 209 | totalAmountGuildBossTries=0 210 | totalAmountTwistedRealmBossTries=0 211 | 212 | # Store 213 | buyStoreDust=false 214 | buyStorePoeCoins=false 215 | buyStorePrimordialEmblem=false 216 | buyStoreAmplifyingEmblem=false 217 | buyStoreSoulstone=false 218 | buyStoreLimitedElementalShard=false 219 | buyStoreLimitedElementalCore=false 220 | buyStoreLimitedTimeEmblem=false 221 | buyWeeklyGuild=false 222 | buyWeeklyLabyrinth=false 223 | 224 | # Towers 225 | doMainTower=false 226 | doTowerOfLight=false 227 | doTheBrutalCitadel=false 228 | doTheWorldTree=false 229 | doCelestialSanctum=false 230 | doTheForsakenNecropolis=false 231 | doInfernalFortress=false 232 | 233 | # --- Actions --- # 234 | # Campaign 235 | doLootAfkChest=false 236 | doChallengeBoss=true 237 | doFastRewards=false 238 | doCollectFriendsAndMercenaries=false 239 | 240 | # Dark Forest 241 | doSoloBounties=false 242 | doTeamBounties=false 243 | doArenaOfHeroes=false 244 | doLegendsTournament=false 245 | doKingsTower=false 246 | 247 | # Ranhorn 248 | doGuildHunts=false 249 | doTwistedRealmBoss=false 250 | doBuyFromStore=false 251 | doStrengthenCrystal=false 252 | doTempleOfAscension=false 253 | doCompanionPointsSummon=false 254 | doCollectOakPresents=false 255 | 256 | # End 257 | doCollectQuestChests=false 258 | doCollectMail=false 259 | doCollectMerchantFreebies=false 260 | 261 | ``` 262 | 263 |
264 | 265 |
266 | config-Push_Towers.ini 267 | 268 | ```ini 269 | # --- CONFIG: Modify accordingly to your game! --- # 270 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 271 | # Player 272 | canOpenSoren=false 273 | arenaHeroesOpponent=5 274 | 275 | # General 276 | waitForUpdate=true 277 | endAt=campaign 278 | guildBattleType=quick 279 | allowCrystalLevelUp=false 280 | 281 | # Repetitions 282 | maxCampaignFights=0 283 | maxKingsTowerFights=500 284 | totalAmountArenaTries=0 285 | totalAmountTournamentTries=0 286 | totalAmountGuildBossTries=0 287 | totalAmountTwistedRealmBossTries=0 288 | 289 | # Store 290 | buyStoreDust=false 291 | buyStorePoeCoins=false 292 | buyStorePrimordialEmblem=false 293 | buyStoreAmplifyingEmblem=false 294 | buyStoreSoulstone=false 295 | buyStoreLimitedElementalShard=false 296 | buyStoreLimitedElementalCore=false 297 | buyStoreLimitedTimeEmblem=false 298 | buyWeeklyGuild=false 299 | buyWeeklyLabyrinth=false 300 | 301 | # Towers 302 | doMainTower=true 303 | doTowerOfLight=true 304 | doTheBrutalCitadel=true 305 | doTheWorldTree=true 306 | doCelestialSanctum=true 307 | doTheForsakenNecropolis=true 308 | doInfernalFortress=true 309 | 310 | # --- Actions --- # 311 | # Campaign 312 | doLootAfkChest=false 313 | doChallengeBoss=false 314 | doFastRewards=false 315 | doCollectFriendsAndMercenaries=false 316 | 317 | # Dark Forest 318 | doSoloBounties=false 319 | doTeamBounties=false 320 | doArenaOfHeroes=false 321 | doLegendsTournament=false 322 | doKingsTower=true 323 | 324 | # Ranhorn 325 | doGuildHunts=false 326 | doTwistedRealmBoss=false 327 | doBuyFromStore=false 328 | doStrengthenCrystal=false 329 | doTempleOfAscension=false 330 | doCompanionPointsSummon=false 331 | doCollectOakPresents=false 332 | 333 | # End 334 | doCollectQuestChests=false 335 | doCollectMail=false 336 | doCollectMerchantFreebies=false 337 | 338 | ``` 339 | 340 |
341 | 342 |
343 | 344 |
345 | Previous page 346 | | 347 | Next page 348 |
349 | -------------------------------------------------------------------------------- /_wiki/Contribute.md: -------------------------------------------------------------------------------- 1 | Thank you for thinking about contributing! Help is always welcome. 2 | 3 | - [Join the project](#join-the-project) 4 | - [Editor](#editor) 5 | - [Extensions](#extensions) 6 | - [Settings](#settings) 7 | - [Check before a pull request](#check-before-a-pull-request) 8 | - [Clean code](#clean-code) 9 | - [Markdown - MarkdownLint](#markdown---markdownlint) 10 | - [Shell - ShellCheck](#shell---shellcheck) 11 | - [Best Practices](#best-practices) 12 | - [Useful config files](#useful-config-files) 13 | 14 | ## Join the project 15 | 16 | Here are the first steps to your first contributions. You can either use the command line or GitHub Desktop: 17 | 18 | - [GitHub - First Contributions](https://github.com/firstcontributions/first-contributions) 19 | - [GitHub Desktop - First Contributions](https://github.com/firstcontributions/first-contributions/blob/master/gui-tool-tutorials/github-desktop-tutorial.md) 20 | 21 | ## Editor 22 | 23 | We use [![Visual Studio Code](https://img.shields.io/badge/Visual_Studio_Code-0078D4?style=flat-square&logo=visual%20studio%20code&logoColor=white)](https://code.visualstudio.com/) to develop this project. 24 | 25 | ### Extensions 26 | 27 | Mandatory extensions: 28 | 29 | - [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) 30 | - [ShellCheck](https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck) 31 | 32 | Some other useful extensions: 33 | 34 | - [Guides](https://marketplace.visualstudio.com/items?itemName=spywhere.guides) 35 | - [Todo Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree) 36 | - [Trailing Spaces](https://marketplace.visualstudio.com/items?itemName=shardulm94.trailing-spaces) 37 | 38 | ### Settings 39 | 40 | Visual Studio Code generates a custom file inside repositories (`.vscode/settings.json`) for settings regarding the IDE and extensions. If you want, you can use our settings: 41 | 42 | ```js 43 | { 44 | // Global > Ruller 45 | "workbench.colorCustomizations": { 46 | "editorRuler.foreground": "#333" // rulers color 47 | }, 48 | // Global > EOL > LF 49 | "files.eol": "\n", 50 | // shellscript 51 | "[shellscript]": { 52 | // Ruller 53 | "editor.rulers": [ 54 | 80, // Terminal windows 55 | 125 // GitHub diff view 56 | ], 57 | // Tab 58 | "editor.insertSpaces": true, 59 | "editor.tabSize": 4, 60 | // EOL > LF 61 | "files.eol": "\n" 62 | }, 63 | // Extension - markdownlint > https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint 64 | "markdownlint.config": { 65 | "default": true, 66 | "MD033": false, // https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md033 67 | "MD036": false, // https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md036 68 | "MD041": false // https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md041 69 | }, 70 | // Extension - shellcheck > https://marketplace.visualstudio.com/items?itemName=timonwong.shellcheck 71 | "shellcheck.customArgs": [ 72 | "-x" // https://github.com/koalaman/shellcheck/wiki/SC1091 73 | ], 74 | "shellcheck.exclude": [ 75 | "1017", // https://github.com/koalaman/shellcheck/wiki/SC1017 76 | "1090", // https://github.com/koalaman/shellcheck/wiki/SC1090 77 | "1091", // https://github.com/koalaman/shellcheck/wiki/SC1091 78 | "2009", // https://github.com/koalaman/shellcheck/wiki/SC2009 79 | "2034", // https://github.com/koalaman/shellcheck/wiki/SC2034 80 | "2039", // https://github.com/koalaman/shellcheck/wiki/SC2039 81 | "2154", // https://github.com/koalaman/shellcheck/wiki/SC2154 82 | "3003", // https://github.com/koalaman/shellcheck/wiki/SC3003 83 | "3057", // https://github.com/koalaman/shellcheck/wiki/SC3057 84 | "3060" // https://github.com/koalaman/shellcheck/wiki/SC3060 85 | ], 86 | // Extension - Todo Tree > https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree 87 | "todo-tree.general.tags": [ 88 | "FIXME", 89 | "TODO", 90 | "WARN" 91 | ], 92 | "todo-tree.highlights.customHighlight": { 93 | "FIXME": { 94 | "foreground": "white", 95 | "background": "red", 96 | "icon": "flame", 97 | "iconColour": "red" 98 | }, 99 | "TODO": { 100 | "foreground": "black", 101 | "background": "green", 102 | "icon": "check", 103 | "iconColour": "green" 104 | }, 105 | "WARN": { 106 | "foreground": "black", 107 | "background": "yellow", 108 | "icon": "alert", 109 | "iconColour": "yellow" 110 | } 111 | } 112 | // Extension - Guides > https://marketplace.visualstudio.com/items?itemName=spywhere.guides 113 | // Extension - shell-format > https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format 114 | // Extension - Trailing Spaces > https://marketplace.visualstudio.com/items?itemName=shardulm94.trailing-spaces 115 | } 116 | ``` 117 | 118 | ## Check before a pull request 119 | 120 | Before doing a pull request, please check that everything is still working, and that your development is clean and has comments. 121 | 122 | You can use tools like [![WinMerge](https://img.shields.io/badge/WinMerge-yellow?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALiUExURTB9v////+/y9n+w2+by/N/t+9nr+9Ln+svj+cHc87jT7a3L5qLC3Zq51OHh4U19pm2i0oy33e32/c7l+cHe97PX9aXP85jI8YS552+n2VuXzUSDuZaxyJWqvC12tL3X7PX5/u72/Z64zUJ0nl6bzs3g8fr9/+nz/dvs+s/m+ViSx6a90oaes4243czf8r5fYt/v+z1zoUWKxpK7350IDapNUC55uev0/b3M2nqYsKggIerHxKVQUCFSiff39+Hv+7DG2VF/prK/zFyCo5aWlq8sI/js7Nqdm14iKtPS0/b396q/08bKzU9ic3B7hX9/f/Xl4/HW0c15cKNIQcni+H+So2BygnCElba2trEnE7c3JO3NyPPe2+e5rtWKf40uCqtnANiUAOCcAOCZANqXAM+OAL2DAMKHAO3t7bs+I+i8s+SsnMttXa1WOdLLsvTv0fz32MJJJvDRyOe0pOezo+Cdh+Cbh9aCatDGn/Ppu/vxweGmAMlTJ/HLu+mvleeni+eoi+KVdNNoSqM6C8tYAPd+AP+FAP+CAPTRP89dKOyuiOOKUuaVY+edbuqkeOKJWN10QuB/QddmJaNPGpyJOtnCUfDWWfDXWeGvANVnKvC2gOeKMuV/HuBmGOBwGos5C0kyBqVhAOeFAP+WAP+TAPDZbuG1ANtwKPTAde+iNO6dJO+dJO+bJOuHHaJWG1pQL42BTMi3bOjVfvHcguO7BeF2Jt9uGPW8LPa/NvKqH+2fI5NHD4VwGL2fIty5JuO/KOK+J3BwcOeBKvzme/vcP6tlKT1DSGJsdI2bpqm2wrbAyrzEysLHy+2LLv76iodMHF9dXH6lyJrF66jQ9LHV9bnZ9tfp+uvz+/GRLLh7OhEmN5WVlfH4/vSPH8qNR2FgXxxJcLXU7oC774i/75DE8aHN8+qrXo6Niyhon7fY9r7c98bh+OPw+2iu63Gz7Xm37avS9Fel6V2n67rb98Pf9wAAAOGw/W4AAAD2dFJOU///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AEo/IKkAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAJUSURBVDhPY/hKACAUMKACqCiyAkYEYGJghkkgK2BhZWPn4OTi5uHl4xcQhMogKxASFhEVE5eQlJKWkZWTh6pAVqCgCDNDiU9ZRRWiAlmBmrqGJsQMLW0dBl09sAqoAn2QAkY1oBkGYDO0+QyNjMEqoApMTL+agRSYs0LcIWBhyWBkZKTCAFNgZW1jawf0H9AMdXsNoBkOfAyOTk7ODC5QBa5u7h6eXiAF6qxgdzB78/n4+lkw+MMUBAQGBYNUwMwIcQgNCwuPACqIjAKB6Bjr2Lj4hMSkZBBISkpOSklNS0/NACrIDISArOzYnNy8/AJkkMQIVFBYFFsMBCXZpdll5bkVlVVIoBqkoKa2rr6+ob6+vrGhsb6puaW1rb29va2tDYg7wAo6u7q7e3r7+vr6eyZMnDR5ytRp06dPmzZtOhBOmwFSMHPW7DlgMHfO3HnzFyxctHjx4iUgvGTJ0mUgBctXrFy1etWaNavWrpm3bv2GjZs2I8AWkIJ5W+dt27Zt+47tO3ftXrBn7779B/YfOADGQBKk4KvLQSA4dPjIzqPHjp846XTq1OnTZ874+PicOXP6NFgBGJw913H+QvjFS5evXBUJEb7GymIudF2dRQih4Mbhm7duK3GGCLNf02C1Z1EXuqOgoHDnDkLB3Xv3H3g+fPT4ifhTsCHsbKwsLCxICp49d3lh9/LqK5HXEEPeAO24g2wCEJgxXnn77j2yIQaKKAoYGD9cEUUzBE3B5Y+f3sIM+XDl8xcOdTQFYpc/oBmCpgALQFGAFSAp+OqPBfj7AwB9xPbYOIb0FQAAAABJRU5ErkJggg==)](https://winmerge.org/) to check every modification. 123 | 124 | ## Clean code 125 | 126 | The principles of [Clean Code](https://www.pearson.com/us/higher-education/program/Martin-Clean-Code-A-Handbook-of-Agile-Software-Craftsmanship/PGM63937.html) apply to Bash as well. It really helps in having a robust script. 127 | 128 | > Many people hack together shell scripts quickly to do simple tasks, but these soon take on a life of their own. Unfortunately shell scripts are full of subtle effects which result in scripts failing in unusual ways. It’s possible to write scripts which minimise these problems. 129 | 130 | *[source](https://www.davidpashley.com/articles/writing-robust-shell-scripts/)* 131 | 132 | ### Markdown - MarkdownLint 133 | 134 | It's a bit useless, but well, if we are trying to do robust code, why not have robust Markdown too? 135 | 136 | We are using [MarkdownLint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint). Please try to have 0 warnings and/or errors. 137 | 138 | I did remove some rules because they are too restrictive for a good looking ReadMe on GitHub: 139 | 140 | - [MD033](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md033): As you know, Markdown can't center elements. Because of this, we are using HTML instead. 141 | - [MD036](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md036): Without removing it you can't do `**Lorem ipsum dolor sit amet**`. 142 | - [MD041](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md041): We are using HTML header because it's sexy instead of the classic `# AFK-Daily`. 143 | 144 | ### Shell - ShellCheck 145 | 146 | We are using [ShellCheck](https://github.com/koalaman/shellcheck). Please try to have 0 warnings and/or errors. 147 | 148 | If you need to remove rules, please be certain that is your only choice. Here the list of the already removes rules: 149 | 150 | - [1090](https://github.com/koalaman/shellcheck/wiki/SC1090): Can't follow non-constant source 151 | - [1091](https://github.com/koalaman/shellcheck/wiki/SC1091): Not following (Source not found) -> link to the previous one 152 | - [2009](https://github.com/koalaman/shellcheck/wiki/SC2009): `pgrep` doesn't exixts in Git Bash 153 | - [2034](https://github.com/koalaman/shellcheck/wiki/SC2034): `foo` appears unused. Verify it or export it 154 | - [2039](https://github.com/koalaman/shellcheck/wiki/SC2039): In POSIX `sh`, string ... is undefined. 155 | - [2154](https://github.com/koalaman/shellcheck/wiki/SC2154): var is referenced but not assigned -> link to the previous one 156 | - [3057](https://github.com/koalaman/shellcheck/wiki/SC3057): In POSIX `sh`, string `$'..'` is undefined (Well, it works, required for Nox) 157 | - [3057](https://github.com/koalaman/shellcheck/wiki/SC3057): In POSIX `sh`, string indexing is undefined (Well, it works) 158 | - [3060](https://github.com/koalaman/shellcheck/wiki/SC3060): In POSIX `sh`, string replacement is undefined (Well, it works) 159 | 160 | ### Best Practices 161 | 162 | Here is the [source](https://www.javacodegeeks.com/2013/10/shell-scripting-best-practices.html) of our best practices. We edited some of it for more portability and maintainability. 163 | 164 | 1. Use functions 165 | 166 | > Unless you’re writing a very small script, use functions to modularise your code and make it more readable, reusable and maintainable. 167 | 168 | ```sh 169 | myfunc() { 170 | if [ $DEBUG -ge 3 ]; then echo "[DEBUG] myfunc" >&1; fi 171 | } 172 | ``` 173 | 174 | If you want more info: [source](https://unix.stackexchange.com/questions/73750/difference-between-function-foo-and-foo). 175 | 176 | 2. Document your functions 177 | 178 | > Add sufficient documentation to your functions to specify what they do and what arguments are required to invoke them. 179 | 180 | Please complete this comment to explain every function: 181 | 182 | ```sh 183 | # ############################################################################## 184 | # Function Name : myfunc 185 | # Description : Test function 186 | # Args : 187 | # Return : 188 | # Remark : 189 | # ############################################################################## 190 | myfunc() { 191 | if [ $DEBUG -ge 3 ]; then echo "[DEBUG] myfunc" >&1; fi 192 | test 800 600 # do test 193 | } 194 | ``` 195 | 196 | Or at least: 197 | 198 | ```sh 199 | # myfunc 200 | # description if not explicit name 201 | # return values 202 | myfunc() { 203 | if [ $DEBUG -ge 3 ]; then echo "[DEBUG] myfunc" >&1; fi 204 | test 800 600 # do test 205 | } 206 | ``` 207 | 208 | - Try to comment everything, every click, condition, loop. It really helps maintain the code. 209 | - Try to align comments, it helps for the visibility of them. 210 | 211 | 3. ~~Use `shift` to read function arguments~~ 212 | 4. *Declare your variables* 213 | 214 | Instead of `local`, prefix your variable with the name of the function (`local` is undefined in `sh`). 215 | 216 | ```sh 217 | myfunc() { 218 | _myfunc_local=0 219 | } 220 | ``` 221 | 222 | 5. Quote all parameter expansions 223 | 224 | > To prevent word-splitting and file globbing you must quote all variable expansions. In particular, you must do this if you are dealing with filenames that may contain whitespace (or other special characters). 225 | 226 | 6. ~~Use arrays where appropriate~~ 227 | 7. Use `"$@"` to refer to all arguments 228 | 229 | > Don’t use `$*`. 230 | 231 | The only exception is a direct output like in Debug (`$@` is an array where `$*` is a string). 232 | 233 | 8. Use uppercase variable names for environment variables only 234 | 235 | > My personal preference is that all variables should be lowercase, except for environment variables. 236 | 237 | 9. Prefer shell builtins over external programs 238 | 239 | > The shell has the ability to manipulate strings and perform simple arithmetic... 240 | 241 | 10. Avoid unnecessary pipelines 242 | 243 | > Pipelines add extra overhead to your script so try to keep your pipelines small. Common examples of useless pipelines are `cat` and `echo`... 244 | 245 | 11. ~~Avoid parsing ls~~ 246 | 12. ~~Use globbing~~ 247 | 13. ~~Use null delimited output where possible~~ 248 | 14. Don’t use backticks 249 | 250 | > Use `$(command)` instead of `` `command` `` because it is easier to nest multiple commands and makes your code more readable. 251 | 252 | 15. ~~Use process substitution instead of creating temporary files~~ 253 | 16. Use `mktemp` if you have to create temporary files 254 | 255 | > Try to avoid creating temporary files. If you must, use `mktemp` to create a temporary directory and then write your files to it. Make sure you remove the directory after you are done. 256 | 257 | 17. ~~Use [[ and (( for test conditions~~ 258 | 259 | > Note that if you desire portability, you have to stick to the old-fashioned `[ ... ]` 260 | 261 | If you want more info: [source](https://unix.stackexchange.com/questions/382003/what-are-the-differences-between-and-in-conditional-expressions). 262 | 263 | 18. Use commands in test conditions instead of exit status 264 | 265 | > If you want to check whether a command succeeded before doing something, use the command directly in the condition of your if-statement instead of checking the command’s exit status. 266 | 267 | 19. ~~Use set -e~~ 268 | 20. Write error messages to stderr 269 | 270 | > Error messages belong on stderr not stdout. 271 | 272 | ```sh 273 | echo "[ERROR]" >&2 274 | ``` 275 | 276 | Some other useful documentation: 277 | 278 | - [The Art of Command Line](https://github.com/jlevy/the-art-of-command-line#the-art-of-command-line) 279 | - [Pure Bash Bible](https://github.com/dylanaraps/pure-bash-bible#pure-bash-bible) 280 | 281 | *If you have any doubt, just ask, there will always be someone to answer (well, I hope so)!* 282 | 283 | ## Useful config files 284 | 285 |
286 | config-Debug.ini 287 | 288 | ```ini 289 | # --- CONFIG: Modify accordingly to your game! --- # 290 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 291 | # Player 292 | canOpenSoren=false 293 | arenaHeroesOpponent=5 294 | 295 | # General 296 | waitForUpdate=false 297 | endAt=mail 298 | guildBattleType=quick 299 | allowCrystalLevelUp=false 300 | 301 | # Repetitions 302 | maxCampaignFights=0 303 | maxKingsTowerFights=0 304 | totalAmountArenaTries=0 305 | totalAmountTournamentTries=0 306 | totalAmountGuildBossTries=0 307 | totalAmountTwistedRealmBossTries=0 308 | 309 | # Store 310 | buyStoreDust=false 311 | buyStorePoeCoins=false 312 | buyStorePrimordialEmblem=false 313 | buyStoreAmplifyingEmblem=false 314 | buyStoreSoulstone=false 315 | buyStoreLimitedElementalShard=false 316 | buyStoreLimitedElementalCore=false 317 | buyStoreLimitedTimeEmblem=false 318 | buyWeeklyGuild=false 319 | buyWeeklyLabyrinth=false 320 | 321 | # Towers 322 | doMainTower=false 323 | doTowerOfLight=false 324 | doTheBrutalCitadel=false 325 | doTheWorldTree=false 326 | doCelestialSanctum=false 327 | doTheForsakenNecropolis=false 328 | doInfernalFortress=false 329 | 330 | # --- Actions --- # 331 | # Campaign 332 | doLootAfkChest=false 333 | doChallengeBoss=false 334 | doFastRewards=false 335 | doCollectFriendsAndMercenaries=false 336 | 337 | # Dark Forest 338 | doSoloBounties=false 339 | doTeamBounties=false 340 | doArenaOfHeroes=false 341 | doLegendsTournament=false 342 | doKingsTower=false 343 | 344 | # Ranhorn 345 | doGuildHunts=false 346 | doTwistedRealmBoss=false 347 | doBuyFromStore=false 348 | doStrengthenCrystal=false 349 | doTempleOfAscension=false 350 | doCompanionPointsSummon=false 351 | doCollectOakPresents=false 352 | 353 | # End 354 | doCollectQuestChests=false 355 | doCollectMail=false 356 | doCollectMerchantFreebies=false 357 | 358 | ``` 359 | 360 |
361 | 362 |
363 | config-Test_Campaign.ini 364 | 365 | ```ini 366 | # --- CONFIG: Modify accordingly to your game! --- # 367 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 368 | # Player 369 | canOpenSoren=false 370 | arenaHeroesOpponent=5 371 | 372 | # General 373 | waitForUpdate=true 374 | endAt=campaign 375 | guildBattleType=quick 376 | allowCrystalLevelUp=false 377 | 378 | # Repetitions 379 | maxCampaignFights=500 380 | maxKingsTowerFights=0 381 | totalAmountArenaTries=0 382 | totalAmountTournamentTries=0 383 | totalAmountGuildBossTries=0 384 | totalAmountTwistedRealmBossTries=0 385 | 386 | # Store 387 | buyStoreDust=false 388 | buyStorePoeCoins=false 389 | buyStorePrimordialEmblem=false 390 | buyStoreAmplifyingEmblem=false 391 | buyStoreSoulstone=false 392 | buyStoreLimitedElementalShard=false 393 | buyStoreLimitedElementalCore=false 394 | buyStoreLimitedTimeEmblem=false 395 | buyWeeklyGuild=false 396 | buyWeeklyLabyrinth=false 397 | 398 | # Towers 399 | doMainTower=false 400 | doTowerOfLight=false 401 | doTheBrutalCitadel=false 402 | doTheWorldTree=false 403 | doCelestialSanctum=false 404 | doTheForsakenNecropolis=false 405 | doInfernalFortress=false 406 | 407 | # --- Actions --- # 408 | # Campaign 409 | doLootAfkChest=false 410 | doChallengeBoss=true 411 | doFastRewards=false 412 | doCollectFriendsAndMercenaries=false 413 | 414 | # Dark Forest 415 | doSoloBounties=false 416 | doTeamBounties=false 417 | doArenaOfHeroes=false 418 | doLegendsTournament=false 419 | doKingsTower=false 420 | 421 | # Ranhorn 422 | doGuildHunts=false 423 | doTwistedRealmBoss=false 424 | doBuyFromStore=false 425 | doStrengthenCrystal=false 426 | doTempleOfAscension=false 427 | doCompanionPointsSummon=false 428 | doCollectOakPresents=false 429 | 430 | # End 431 | doCollectQuestChests=false 432 | doCollectMail=false 433 | doCollectMerchantFreebies=false 434 | 435 | ``` 436 | 437 |
438 | 439 |
440 | config-Test_Dark_Forest.ini 441 | 442 | ```ini 443 | # --- CONFIG: Modify accordingly to your game! --- # 444 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 445 | # Player 446 | canOpenSoren=false 447 | arenaHeroesOpponent=5 448 | 449 | # General 450 | waitForUpdate=true 451 | endAt=mail 452 | guildBattleType=quick 453 | allowCrystalLevelUp=false 454 | 455 | # Repetitions 456 | maxCampaignFights=0 457 | maxKingsTowerFights=10 458 | totalAmountArenaTries=2+6+2 459 | totalAmountTournamentTries=5 460 | totalAmountGuildBossTries=0 461 | totalAmountTwistedRealmBossTries=0 462 | 463 | # Store 464 | buyStoreDust=false 465 | buyStorePoeCoins=false 466 | buyStorePrimordialEmblem=false 467 | buyStoreAmplifyingEmblem=false 468 | buyStoreSoulstone=false 469 | buyStoreLimitedElementalShard=false 470 | buyStoreLimitedElementalCore=false 471 | buyStoreLimitedTimeEmblem=false 472 | buyWeeklyGuild=false 473 | buyWeeklyLabyrinth=false 474 | 475 | # Towers 476 | doMainTower=true 477 | doTowerOfLight=true 478 | doTheBrutalCitadel=true 479 | doTheWorldTree=true 480 | doCelestialSanctum=true 481 | doTheForsakenNecropolis=true 482 | doInfernalFortress=true 483 | 484 | # --- Actions --- # 485 | # Campaign 486 | doLootAfkChest=false 487 | doChallengeBoss=false 488 | doFastRewards=false 489 | doCollectFriendsAndMercenaries=false 490 | 491 | # Dark Forest 492 | doSoloBounties=true 493 | doTeamBounties=true 494 | doArenaOfHeroes=true 495 | doLegendsTournament=true 496 | doKingsTower=true 497 | 498 | # Ranhorn 499 | doGuildHunts=false 500 | doTwistedRealmBoss=false 501 | doBuyFromStore=false 502 | doStrengthenCrystal=false 503 | doTempleOfAscension=false 504 | doCompanionPointsSummon=false 505 | doCollectOakPresents=false 506 | 507 | # End 508 | doCollectQuestChests=false 509 | doCollectMail=false 510 | doCollectMerchantFreebies=false 511 | 512 | ``` 513 | 514 |
515 | 516 |
517 | config-Test_Ranhorn.ini 518 | 519 | ```ini 520 | # --- CONFIG: Modify accordingly to your game! --- # 521 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 522 | # Player 523 | canOpenSoren=false 524 | arenaHeroesOpponent=5 525 | 526 | # General 527 | waitForUpdate=true 528 | endAt=mail 529 | guildBattleType=quick 530 | allowCrystalLevelUp=true 531 | 532 | # Repetitions 533 | maxCampaignFights=0 534 | maxKingsTowerFights=0 535 | totalAmountArenaTries=0 536 | totalAmountTournamentTries=0 537 | totalAmountGuildBossTries=3 538 | totalAmountTwistedRealmBossTries=3 539 | 540 | # Store 541 | buyStoreDust=true 542 | buyStorePoeCoins=true 543 | buyStorePrimordialEmblem=true 544 | buyStoreAmplifyingEmblem=true 545 | buyStoreSoulstone=true 546 | buyStoreLimitedElementalShard=true 547 | buyStoreLimitedElementalCore=true 548 | buyStoreLimitedTimeEmblem=false 549 | buyWeeklyGuild=true 550 | buyWeeklyLabyrinth=true 551 | 552 | # Towers 553 | doMainTower=false 554 | doTowerOfLight=false 555 | doTheBrutalCitadel=false 556 | doTheWorldTree=false 557 | doCelestialSanctum=false 558 | doTheForsakenNecropolis=false 559 | doInfernalFortress=false 560 | 561 | # --- Actions --- # 562 | # Campaign 563 | doLootAfkChest=false 564 | doChallengeBoss=false 565 | doFastRewards=false 566 | doCollectFriendsAndMercenaries=false 567 | 568 | # Dark Forest 569 | doSoloBounties=false 570 | doTeamBounties=false 571 | doArenaOfHeroes=false 572 | doLegendsTournament=false 573 | doKingsTower=false 574 | 575 | # Ranhorn 576 | doGuildHunts=true 577 | doTwistedRealmBoss=true 578 | doBuyFromStore=true 579 | doStrengthenCrystal=true 580 | doTempleOfAscension=true 581 | doCompanionPointsSummon=true 582 | doCollectOakPresents=true 583 | 584 | # End 585 | doCollectQuestChests=false 586 | doCollectMail=false 587 | doCollectMerchantFreebies=false 588 | 589 | ``` 590 | 591 |
592 | 593 |
594 | config-Test_End.ini 595 | 596 | ```ini 597 | # --- CONFIG: Modify accordingly to your game! --- # 598 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 599 | # Player 600 | canOpenSoren=false 601 | arenaHeroesOpponent=5 602 | 603 | # General 604 | waitForUpdate=true 605 | endAt=mail 606 | guildBattleType=quick 607 | allowCrystalLevelUp=false 608 | 609 | # Repetitions 610 | maxCampaignFights=0 611 | maxKingsTowerFights=0 612 | totalAmountArenaTries=0 613 | totalAmountTournamentTries=0 614 | totalAmountGuildBossTries=0 615 | totalAmountTwistedRealmBossTries=0 616 | 617 | # Store 618 | buyStoreDust=false 619 | buyStorePoeCoins=false 620 | buyStorePrimordialEmblem=false 621 | buyStoreAmplifyingEmblem=false 622 | buyStoreSoulstone=false 623 | buyStoreLimitedElementalShard=false 624 | buyStoreLimitedElementalCore=false 625 | buyStoreLimitedTimeEmblem=false 626 | buyWeeklyGuild=false 627 | buyWeeklyLabyrinth=false 628 | 629 | # Towers 630 | doMainTower=false 631 | doTowerOfLight=false 632 | doTheBrutalCitadel=false 633 | doTheWorldTree=false 634 | doCelestialSanctum=false 635 | doTheForsakenNecropolis=false 636 | doInfernalFortress=false 637 | 638 | # --- Actions --- # 639 | # Campaign 640 | doLootAfkChest=false 641 | doChallengeBoss=false 642 | doFastRewards=false 643 | doCollectFriendsAndMercenaries=false 644 | 645 | # Dark Forest 646 | doSoloBounties=false 647 | doTeamBounties=false 648 | doArenaOfHeroes=false 649 | doLegendsTournament=false 650 | doKingsTower=false 651 | 652 | # Ranhorn 653 | doGuildHunts=false 654 | doTwistedRealmBoss=false 655 | doBuyFromStore=false 656 | doStrengthenCrystal=false 657 | doTempleOfAscension=false 658 | doCompanionPointsSummon=false 659 | doCollectOakPresents=false 660 | 661 | # End 662 | doCollectQuestChests=true 663 | doCollectMail=true 664 | doCollectMerchantFreebies=true 665 | 666 | ``` 667 | 668 |
669 | 670 | 675 | -------------------------------------------------------------------------------- /_wiki/FAQ.md: -------------------------------------------------------------------------------- 1 | ### Q: Can I get banned by using this script? 2 | 3 | **A:** I've tried getting in contact with Lilith through various means, and until this day I did **not** get an answer from them. Their [Terms of Service](https://www.lilithgames.com/termofservice.html) states the following: 4 | 5 | > You agree not to do any of the following while using our Services, Lilith Content, or User Content: [...] Use cheats, exploits, hacks, bots, mods or third party software designed to gain an advantage, perceived or actual, over other Members, or modify or interfere with the Service; [...] 6 | 7 | In my opinion, this does **not** include this script, as players don't gain any type of advantage over other players. Maybe time in their life, but that's about it... I can also let you know there's a really low chance for Lilith to find out you're using this script, unless they actively try to search for it. And I doubt they're willing to spend resources into that. 8 | 9 | Though Lilith has confirmed, that using Bluestacks macros is allowed in the game. This makes me believe this script is also allowed. 10 | 11 |
12 | Example script output 13 |
14 | 15 | Do with this information what you want. I'm *not responsible at all* if anything happens to your account. **Use at your own risk.** 16 | 17 | ### Q: Will this ever be available on iOS? 18 | 19 | **A:** Nope. Install Bluestacks and run this script. 20 | 21 | 28 | -------------------------------------------------------------------------------- /_wiki/Feature Requests.md: -------------------------------------------------------------------------------- 1 | Have a feature in mind? An idea? Something that isn't implemented yet? Maybe even a completely different script for the game? Let me know by writing it in the [discussion board](https://github.com/zebscripts/AFK-Daily/discussions/categories/ideas)! 2 | 3 | Beforehand please check if this feature is not already [planned](https://github.com/zebscripts/AFK-Daily/wiki/Features#there-are-more-features-planned-though-check-them-out-here) or in the [ideas]((https://github.com/zebscripts/AFK-Daily/discussions/categories/ideas)). If it's already present, please upvote it. 4 | 5 |
6 | 7 | 12 | -------------------------------------------------------------------------------- /_wiki/Features.md: -------------------------------------------------------------------------------- 1 | The script is capable of the following: 2 | 3 | * **Campaign** 4 | * Loot AFK chest 5 | * Fight the current campaign level (automatically fight every three days for Mythic Trick) 6 | * Collect Fast Rewards 7 | * Send and receive Companion Points 8 | * Auto-lend Mercenaries 9 | * **Dark Forest** 10 | * Send Heroes on Solo and Team Bounty Quests 11 | * Fight in the Arena of Heroes 12 | * Fight in the Legends Tournament 13 | * Fight in all available King's Towers 14 | * **Ranhorn** 15 | * Fight Wrizz and Soren if available. Can also open Soren for you. 16 | * Fight in the Twisted Realm 17 | * Buy various items from the Store 18 | * Dust 19 | * Poe Coins 20 | * Soulstone 21 | * Primordial Emblem 22 | * Amplifying Emblem 23 | * Limited Gold / Diam offer 24 | * Weekly Guild 25 | * Weekly Labyrinth 26 | * Strengthen the Resonating Crystal 27 | * Summon one Hero with Companion Points 28 | * Collect Oak Inn presents 29 | * **Finish** 30 | * Collect Daily/Weekly/Campaign quest chests 31 | * Collect Mail 32 | * Collect Daily/Weekly/Monthly rewards from Merchants 33 | * **Miscellaneous** 34 | * Pretty script output 35 | * Android emulator compatibility (Bluestacks, Nox, Memu) 36 | 37 | ## Push campaign/towers only 38 | 39 | It is also possible to use the script to push campaign levels or Kings Towers only. In order to do this, simply disable any other feature in the `config.ini`, set `maxCampaignFights` and/or `maxKingsTowerFights` accordingly and use this option: `-f`. 40 | 41 | ## There are more features planned though, check them out here 42 | 43 | * [ ] Compatibility for users who aren't as advanced in the game: 44 | * [x] Mercenaries 45 | * [ ] Bounties without auto-fill 46 | * [x] Arenas without skipping 47 | * [x] Kings Tower without factional towers 48 | * [x] Guild Hunts without quick battle 49 | 50 | 57 | -------------------------------------------------------------------------------- /_wiki/Get started.md: -------------------------------------------------------------------------------- 1 | Here's how you can get started: 2 | 3 | 1. Check if you are even able to run the script by taking a look at the [AFK Arena requirements](https://github.com/zebscripts/AFK-Daily/wiki/AFK-Arena-requirements). 4 | 2. Install the [necessary tools](https://github.com/zebscripts/AFK-Daily/wiki/Tools) to run the script. 5 | 3. [Download and install](https://github.com/zebscripts/AFK-Daily/wiki/Installation) the script. 6 | 4. Change the [script config](https://github.com/zebscripts/AFK-Daily/wiki/Config) to your needs. 7 | 5. Run the script and watch it do stuff for you! It's fun, I promise. 8 | 9 | That is the general order in which you should be doing things. We recommend hitting the `Next page` button at the bottom of each page to navigate to the next one, or you can always quickly jump to a specific guide through the sidebar. 10 | 11 | Also, take a look at the [tips](https://github.com/zebscripts/AFK-Daily/wiki/Tips) or [troubleshooting](https://github.com/zebscripts/AFK-Daily/wiki/Troubleshooting) articles for some more info. 12 | 13 |
14 | 15 |
16 | 18 | Next page 19 |
20 | -------------------------------------------------------------------------------- /_wiki/Home.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 | ## Description 14 | 15 | This script is meant to automate the process of daily activities within the [AFK Arena](https://play.google.com/store/apps/details?id=com.lilithgame.hgame.gp&hl=en_US) game. It uses [ADB](https://developer.android.com/studio/command-line/adb) to analyse pixel colors in screenshots and tap on the screen accordingly. If you like our work, please consider starring this repository (and joining our [Discord](https://discord.gg/Fq2cfqjp8D)) as it lets us know people use the script, which motivates us to keep working on it! 16 | 17 |

Example script output

18 | 19 | 20 | ## Disclaimer 21 | 22 | This is a very fragile script (it relies on pixel accuracy), which means the probability of encountering a new error every time a new patch rolls out by Lilith is pretty high. Keep an eye on the `Patch` badge to check the latest game version this script was tested on. 23 | 24 | **We are not responsible for any type of ban or unintentional purchase! Use this script at your own risk.** We will do our best to try and make it as robust as possible. 25 | 26 | ## About the project 27 | 28 | It's basically an auto-completer of the AFK Arena daily tasks. If you easily lose interest in playing a game because you have nothing to do, then we **strongly recommend not using this script**, it'll definitely ruin the fun for you. Otherwise, if you enjoy watching a computer perform tasks for you, you've come to the right place! 29 | 30 | The script is capable of various things, [here's a list of all the features](https://github.com/zebscripts/AFK-Daily/wiki/Features). You can technically also use it solely as a "push campaign" or "push towers" script, more info [here](https://github.com/zebscripts/AFK-Daily/wiki/Features#push-campaigntowers-only). 31 | 32 | ## Quickstart 33 | 34 | We've created a wiki article explaining how to get started, check it out [here](https://github.com/zebscripts/AFK-Daily/wiki/Get-started). 35 | 36 | ## Want to contribute? 37 | 38 | Great! It's always nice to have more people take part and make the experience a better one for everyone. If you have a feature request and/or feedback, take a look at [this article](https://github.com/zebscripts/AFK-Daily/wiki/Feature-Requests). If you want to contribute by coding new features, check [here](https://github.com/zebscripts/AFK-Daily/wiki/Contribute) instead! 39 | 40 | ## Discord 41 | 42 | We've created a Discord server! Feel free to join us [here](https://discord.com/invite/Fq2cfqjp8D). 43 | 44 |
45 | 46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /_wiki/Installation.md: -------------------------------------------------------------------------------- 1 | **For advanced users:** 2 | 3 | 1. Clone this repo and `cd` into it. 4 | 2. Connect your device to the computer (or start your emulator of choice). 5 | 3. Run `./deploy.sh -c` to generate [`config.ini`](https://github.com/zebscripts/AFK-Daily/wiki/Config) and change its values if necessary. 6 | 4. Check the [[usage]] page on how to run the script (or run `./deploy.sh` again). 7 | 5. Watch your device magically play for you. It's fun! I promise. 8 | 9 | **For normal users:** 10 | 11 | 1. Create a folder on your machine to save this script in. 12 | 2. Open up a terminal at said directory: 13 | - **Windows:** Open the directory, `Shift+Right Mouse Click` inside it, and click on `Git Bash here`. 14 | - **Mac/Linux:** Open the folder and click on Action on the top right to open a new terminal inside this folder. 15 | 3. Clone this repository by running `git clone https://github.com/zebscripts/AFK-Daily.git` in the terminal (in case of errors, check below). 16 | 4. Run `cd AFK-Daily` in the terminal. 17 | 5. Connect your device to the computer (or start your emulator of choice). 18 | 6. Type `./deploy.sh -c` into your terminal. 19 | 7. Configure [`config.ini`](https://github.com/zebscripts/AFK-Daily/wiki/Config) if necessary. 20 | 8. Check the [[usage]] page on how to run the script. 21 | 9. Watch your device magically play for you. It's fun! I promise. 22 | 23 | **If for whatever reason `git clone https://github.com/zebscripts/AFK-Daily.git` (step 3) returns an error**, simply download this repository as a `.zip` file by clicking [here](https://github.com/zebscripts/AFK-Daily/archive/refs/heads/master.zip), and unzip it into your directory. Then open the "AFK-Daily-master" folder, open a terminal there (step 2) and follow the rest of the steps starting at step 5. Keep in mind automatic updates won't be working then. If you need more help, [join our Discord](https://discord.gg/Fq2cfqjp8D) and ask! We're always happy to help. 24 | 25 |
26 | 27 |
28 | Previous page 29 | | 30 | Next page 31 |
32 | -------------------------------------------------------------------------------- /_wiki/Known Issues.md: -------------------------------------------------------------------------------- 1 | Feel free to [join our Discord](https://discord.com/invite/Fq2cfqjp8D) and let us know there that you're having trouble! 2 | 3 | If you encounter an issue that is *not* listed below or in [issues](https://github.com/zebscripts/AFK-Daily/issues), feel free to [open a new issue](https://github.com/zebscripts/afk-daily/issues/new)! 4 | 5 | - [`#4`](https://github.com/zebscripts/afk-daily/issues/4) - Since the timings are quite hardcoded for now, there's always a chance that the script might skip something because it tried to take an action before the game even loaded it. An example of this is at the beginning when loading the game and switching between the first Tabs, or while fighting in the Legends Tournament. Worst case scenario the script either exits, or you'll have to go fight one extra time at the tournament. 6 | - [`#32`](https://github.com/zebscripts/AFK-Daily/issues/32) - Script breaks whenever resources are full. Please make sure to always collect them/spend them. 7 | - Script not auto-updating - You can easily update the script yourself by typing `git pull` in the terminal. If it still doesn't work, then I recommend deleting every file besides `config.ini` and running `git pull https://github.com/zebscripts/AFK-Daily`. 8 | 9 | - `hexdump: not found` - This is most likely because your personal android device does not have [busybox](https://play.google.com/store/apps/details?id=stericson.busybox) installed. Either install it on your device or try an emulator like Bluestacks out. 10 | 11 | - `protocol fault: stat response has wrong message id` - This most likely happens because you did not enable Android Debug Bridge. Check your devices' [requirements](https://github.com/zebscripts/AFK-Daily/wiki/Supported-Devices) on how to do this. 12 | 13 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /_wiki/Specific.md: -------------------------------------------------------------------------------- 1 | ## Emulator 2 | 3 | ### Nox 4 | 5 | Nox is using a specific `adb` version, called `nox_adb.exe`. There is a high change that it's already running at the start of Nox without you having to do anything, but if it's not the case please check the configuration here: 6 | 7 | - Our wiki: 8 | - More info: 9 | 10 | Run the script using the following command: 11 | 12 | ```console 13 | deploy.sh -d Nox 14 | ``` 15 | 16 | *If you need help with `nox_adb.exe` please contact us on our [Discord](https://discord.gg/Fq2cfqjp8D) server with the result of this command `ps -W | grep -i nox_adb.exe`.* 17 | 18 | ### MEmu 19 | 20 | MEmu has `adb` enabled by default, so there are no requirements other than opening Memu before running the script. Run the script on MEmu with the following command: 21 | 22 | ```console 23 | deploy.sh -d memu 24 | ``` 25 | 26 | ## OS 27 | 28 | ### Mac 29 | 30 | 1. First of all, make sure your AFK Arena account meets the requirements to even run the script: 31 | 2. Start by creating a folder called for example Scripts where you want this script to be placed in. 32 | 3. Open the folder and click on Action on the top right to open a new terminal inside this folder. 33 | 4. Next, run the following command inside the terminal: 34 | 35 | ```console 36 | git clone 37 | ``` 38 | 39 | 5. Close your terminal when the previous command is done and navigate to the newly created folder AFK-daily. Open a new terminal the same way you did on step 2. 40 | 6. Run the following command: 41 | 42 | ```console 43 | bash deploy.sh 44 | ``` 45 | 46 | 7. If you get an `Error: Couldn't find OS.` error, please download the necessary files from the link in the terminal for the MacOS. After downloading it, unzip the content of the downloaded file into the newly created adb folder inside `AFK-daily`. In the end, you should have a file structure like `AFK-daily/adb/platform-tools` that has various files and folders inside, like for example the file adb (`AFK-daily/adb/platform-tools/adb`). 47 | 8. Open the newly created `config.ini` file by double-clicking it and edit its variables to your liking. Here's a link explaining what each one does: 48 | 9. Save the file and exit. 49 | 10. Install Bluestacks (as of writing this guide, BS5 is not yet available for Mac, so you'll have to install BS4), and make sure to apply the settings present in this section under Bluestacks 5 (most settings should exist in BS4 as well): . You can access BS settings like this: 50 | 11. Install AFK Arena in Bluestacks and make sure you have your account set up. 51 | 12. Now it's finally time to try and run the script by executing `bash deploy.sh` again. 52 | 53 | If everything worked as expected, you should see the game restart and then play on it's own and attempt to do daily stuff for you! From this point on, all you have to do to run the script again is open a terminal inside the AFK-daily folder and then run `bash deploy.sh`. 54 | 55 |
56 | 57 |
58 | Previous page 59 | 61 |
62 | -------------------------------------------------------------------------------- /_wiki/Supported Devices.md: -------------------------------------------------------------------------------- 1 | Theoretically, anything that supports `adb` and is capable of running the latest AFK Arena game version with a resolution of `1080x1920` should be supported. We do, however, **recommend using Bluestacks** as it's our emulator of choice to test the script on. It's impossible for us to test the script on every other platform, which means at least Bluestacks will most likely always work. 2 | 3 | Here's a list of devices where the script has been successfully run at least once: 4 | 5 | - [Bluestacks 5](#bluestacks-5) 6 | - [MEmu](#memu) 7 | - [Nox](#nox) 8 | - [Personal Android device](#personal-android-device) 9 | 10 |
11 | 12 | ## [Bluestacks 5](https://www.bluestacks.com/) 13 | 14 | 1. **Display:** 15 | - Change the resolution to `1080x1920` (Portrait) or `1920x1080` (Landscape) 16 | - *Optional:* Change from Landscape (Tablet mode) to Portrait (Phone mode) 17 | - *Recommended:* Use `240 DPI` (shouldn't affect the script, but you never know) 18 | 2. **Device Settings:** 19 | - *Recommended:* Samsung Galaxy S8 Plus 20 | 3. **Advanced:** 21 | - Enable Android Debug Bridge (ADB) 22 | 23 |
24 | 25 | ## [MEmu](https://www.memuplay.com/) 26 | 27 | 1. **Display:** 28 | - Change the resolution to `1080x1920` (Portrait) or `1920x1080` (Landscape) 29 | - *Optional:* Change from Landscape (Tablet mode) to Portrait (Phone mode) 30 | 31 |
32 | 33 | ## [Nox](https://www.bignox.com/) 34 | 35 | > Nox is most likely broken again, we do **not** recommend using it. 36 | 37 | 1. **Settings:** Under Nox settings, make sure to make the following changes: 38 | 1. **General:** 39 | - Enable Root 40 | 2. **Performance:** 41 | - Change the resolution to `1080x1920` (Portrait) or `1920x1080` (Landscape) 42 | - *Optional:* Mobile Phone (instead of Tablet) 43 | 2. **USB Debugging:** Visit [this link](https://www.xda-developers.com/install-adb-windows-macos-linux/) on how to enable USB Debugging. It's in the beginning, under the `Phone Setup` part. *The settings on Nox are inside a folder called Tools.* 44 | 45 |
46 | 47 | ## Personal Android device 48 | 49 | 1. **USB Debugging:** Visit [this link](https://www.xda-developers.com/install-adb-windows-macos-linux/) on how to enable USB Debugging. It's in the beginning, under the `Phone Setup` part. *The settings on Nox are inside a folder called Tools.* 50 | 2. **Resolution:** Make sure your Device is set to `1080x1920`. 51 | 3. **Root:** Unfortunately root is necessary. If you don't have root access, please use an emulator (Bluestacks). 52 | 4. **[BusyBox](https://play.google.com/store/apps/details?id=stericson.busybox):** This will install one specific command that the script uses for pixel analysis. 53 | 54 | 61 | -------------------------------------------------------------------------------- /_wiki/Tips.md: -------------------------------------------------------------------------------- 1 | Here are some tips to keep in mind: 2 | 3 | - Don't try to run the script with more than one device connected. 4 | - Whenever something happens that you don't want to happen, just hit `Control+C` on the terminal and the script will instantly stop! *Note: If you happen to `Ctrl+C` while the script is `sleeping`, the terminal never exits. Please close and reopen it.* 5 | - If for some reason the script returns errors like `: not found[0]: syntax error`, it's probably because one of the files is not saved with `LF` line endings. Supposedly the script already does the conversion for you, but it appears you'll have to [do it yourself](https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings). Apologies. 6 | 7 | 14 | -------------------------------------------------------------------------------- /_wiki/Tools.md: -------------------------------------------------------------------------------- 1 | Here's a list of tools you need to have/install to be able to run this script: 2 | 3 | 1. An Android device/emulator 4 | 2. Being able to run `.sh` scripts 5 | 6 | Do not worry, it's not as complicated as it seems. 7 | 8 | Let's start with your Android device/emulator! Check [this wiki page](https://github.com/zebscripts/AFK-Daily/wiki/Supported-Devices) out for a list of all the devices the script successfully got tested on. Simply pick one. **If you don't know which one, pick Bluestacks.** Navigate to its website to download the emulator and install it. 9 | 10 | Next up is being able to run/execute `.sh` files. This shouldn't be a problem for macOS or Linux, *but Windows definitely needs extra software for that*. If you're running Windows, I recommend installing [Git Bash](https://gitforwindows.org/), as it's the easiest method in my opinion. I'm also going to assume you installed Git Bash for the rest of the installation. 11 | 12 |
13 | 14 |
15 | Previous page 16 | | 17 | Next page 18 |
19 | -------------------------------------------------------------------------------- /_wiki/Troubleshooting.md: -------------------------------------------------------------------------------- 1 | If you're having trouble and would like some personal help, [join our Discord server](https://discord.gg/Fq2cfqjp8D)! We'd be happy to help. 2 | 3 |
4 | 5 | The script is developed in a way to exit whenever something doesn't go as planned. In case it does *not* exit though, it's either still OK and you'll have to correct it yourself after it's finished, or (in very rare occasions) it just straight up breaks stuff. I have never had someone "call me" while the script was running for example, so I have no idea what would happen there... 6 | 7 | Either way, if something doesn't go as planned, be sure to hit `Control+C` in the terminal to stop the script from executing! 8 | 9 |
10 | 11 | The script is not finding BlueStacks? Then most likely you need to specify the port with the `-p` flag. You can easily find the port of BlueStacks under its `Settings` -> `Advanced` tab. You should see something like "Connect to Android at `127.0.0.1:`". That last part after the `:` is the port number. Try running the script again with the `-p` flag: 12 | ```sh 13 | ./deploy.sh -p # For example with port 52080: ./deploy.sh -p 52080 14 | ``` 15 | 16 |
17 | 18 | If you are creating a [Github Issue](https://github.com/zebscripts/AFK-Daily/issues) report or you want to troubleshoot some problem with AFK-Daily, logs are the way to go and they are mandatory if you are creating a [Github Issue](https://github.com/zebscripts/AFK-Daily/issues) report. 19 | 20 | - Add the option `-v 9` to your command: `./deploy.sh -v 9` 21 | - Reproduce the issue 22 | - Take a screenshot of the problem 23 | - Copy/paste the log 24 | - Open the [issue](https://github.com/zebscripts/AFK-Daily/issues) 25 | 26 | 33 | -------------------------------------------------------------------------------- /_wiki/Usage.md: -------------------------------------------------------------------------------- 1 | While creating this repository and script, we wanted to make it as easy as possible for anyone to use it. That's why we've implemented various checks in order to run the script, so you don't have to! These include: 2 | 3 | - Install `adb` locally if necessary 4 | - Check for File line-endings 5 | - Check what type of device is connected per ADB, and connect accordingly 6 | - Auto-update the script if a new version is found 7 | 8 | Here's the most basic way to run the script: 9 | 10 | ```sh 11 | ./deploy.sh 12 | ``` 13 | 14 | *Note: By running the above command, the script will automatically try to figure out what platform you want to run the script on! If this doesn't work, please specify the platform with the `-d` flag.* 15 | 16 | ## Flags 17 | 18 | There are more features though and it's possible to execute the script with the following optional parameters: 19 | 20 | ```text 21 | $ ./deploy.sh -h 22 | 23 | _ ___ _ __ ___ _ _ 24 | /_\ | __| | |/ / ___ | \ __ _ (_) | | _ _ 25 | / _ \ | _| | ' < |___| | |) | / _` | | | | | | || | 26 | /_/ \_\ |_| |_|\_\ |___/ \__,_| |_| |_| \_, | 27 | |__/ 28 | 29 | USAGE: deploy.sh [OPTIONS] 30 | 31 | DESCRIPTION 32 | Automate daily activities within the AFK Arena game. 33 | More info: https://github.com/zebscripts/AFK-Daily 34 | 35 | OPTIONS 36 | -h, --help 37 | Show help 38 | 39 | -a, --account [ACCOUNT] 40 | Specify account: "acc-[ACCOUNT].ini" 41 | Remark: Please don't use spaces! 42 | 43 | -d, --device [DEVICE] 44 | Specify target device. 45 | Values for [DEVICE]: bs (default), nox, memu 46 | 47 | -e, --event [EVENT] 48 | Specify active event. 49 | Values for [EVENT]: hoe 50 | 51 | -f, --fight 52 | Force campaign battle (ignore 3-day optimisation). 53 | 54 | -i, --ini [CONFIG] 55 | Specify config: "config-[CONFIG].ini" 56 | Remark: Please don't use spaces! 57 | 58 | -n 59 | Disable heads-up notifications while script is running. 60 | 61 | -p, --port [PORT] 62 | Specify ADB port. 63 | 64 | -r 65 | Ignore resolution warning. Use this at your own risk. 66 | 67 | -t, --test 68 | Launch on test server (experimental). 69 | 70 | -w, --weekly 71 | Force weekly. 72 | 73 | DEV OPTIONS 74 | 75 | -b 76 | Dev mode: do not restart adb. 77 | 78 | -c, --check 79 | Check if script is ready to be run. 80 | 81 | -o, --output [OUTPUT_FILE] 82 | Write log in [OUTPUT_FILE] 83 | Remark: Folder needs to be created 84 | 85 | -s ,[,[,[,]]] 86 | Test color of a pixel. 87 | 88 | -v, --verbose [DEBUG] 89 | Show DEBUG informations 90 | DEBUG = 0 Show no debug 91 | DEBUG >= 1 Show getColor calls > value 92 | DEBUG >= 2 Show test calls 93 | DEBUG >= 3 Show all core functions calls 94 | DEBUG >= 4 Show all functions calls 95 | DEBUG >= 9 Show all calls 96 | 97 | -z 98 | Disable auto update. 99 | 100 | EXAMPLES 101 | Run script 102 | ./deploy.sh 103 | 104 | Run script with specific emulator (for example Nox) 105 | ./deploy.sh -d nox 106 | 107 | Run script with specific port (for example 52086) 108 | ./deploy.sh -p 52086 109 | 110 | Run script on test server 111 | ./deploy.sh -t 112 | 113 | Run script forcing fight & weekly 114 | ./deploy.sh -fw 115 | 116 | Run script with custom config.ini file named 'config-Push_Campaign.ini' 117 | ./deploy.sh -i "Push_Campaign" 118 | 119 | Run script for color testing 120 | ./deploy.sh -s 800,600 121 | 122 | Run script with output file and with disabled notifications 123 | ./deploy.sh -no ".history/$(date +%Y%m%d).log" 124 | 125 | Run script on test server with output file and with disabled notifications 126 | ./deploy.sh -nta "test" -i "test" -o ".history/$(date +%Y%m%d).test.log" 127 | ``` 128 | 129 |
130 | 131 |
132 | Previous page 133 | | 134 | Next page 135 |
136 | -------------------------------------------------------------------------------- /_wiki/_Footer.md: -------------------------------------------------------------------------------- 1 | **Thank you very much to everyone who has contributed to this project.** Without you this wouldn't be what it is now, and I can't thank you enough! 2 | -------------------------------------------------------------------------------- /_wiki/_Sidebar.md: -------------------------------------------------------------------------------- 1 | ## General 2 | 3 | 1. [[Home]] 4 | 2. [[Features]] 5 | 3. [[Supported Devices]] 6 | 7 | ## [[Get started]] 8 | 9 | 1. [[AFK Arena requirements]] 10 | 2. [[Tools]] 11 | 3. [[Installation]] 12 | 4. [[Config]] 13 | 5. [[Usage]] 14 | 6. [[Specific]] 15 | 16 | ## Help 17 | 18 | - [[Tips]] 19 | - [[FAQ]] 20 | - [[Known Issues]] 21 | - [[Troubleshooting]] 22 | 23 | ## Development 24 | 25 | - [[Feature Requests]] 26 | - [[Contribute]] 27 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ############################################################################## 3 | # Script Name : deploy.sh 4 | # Description : Used to run afk-daily on phone 5 | # Args : [-h, --help] [-a, --account [ACCOUNT]] [-c, --check] 6 | # [-d, --device [DEVICE]] [-e, --event [EVENT]] [-f, --fight] 7 | # [-i, --ini [SUB]] [-n] [-o, --output [OUTPUT_FILE]] 8 | # [-p, --port [PORT]] [-r] 9 | # [-s ,[,[,[,]]]] 10 | # [-t, --test] [-v, --verbose [DEBUG]] [-w, --weekly] 11 | # GitHub : https://github.com/zebscripts/AFK-Daily 12 | # License : MIT 13 | # ############################################################################## 14 | 15 | # Has to be saved with LF line endings! 16 | 17 | # Source 18 | source ./lib/print.sh 19 | 20 | # ############################################################################## 21 | # Section : Variables 22 | # ############################################################################## 23 | # Probably you don't need to modify this. Do it if you know what you're doing, 24 | # I won't blame you (unless you blame me). 25 | personalDirectory="storage/emulated/0" 26 | bluestacksDirectory="storage/emulated/0" 27 | memuDirectory="storage/emulated/0" 28 | noxDirectory="data" 29 | configFile="config/config.ini" 30 | tempFile="account-info/acc.ini" 31 | device="default" 32 | evt="" # Default dev evt 33 | 34 | # Do not modify 35 | script_scr="$0" 36 | script_args="$*" 37 | adb=adb 38 | devMode=false 39 | doCheckGitUpdate=true 40 | forceFightCampaign=false 41 | forceWeekly=false 42 | hexdumpSu=false 43 | ignoreResolution=false 44 | disableNotif=false 45 | testServer=false 46 | debug=0 47 | output="" 48 | totest="" 49 | custom_port="" 50 | 51 | # ############################################################################## 52 | # Section : Functions 53 | # ############################################################################## 54 | 55 | # ############################################################################## 56 | # Function Name : checkFolders 57 | # Description : Check if folders are present in the Repo 58 | # ############################################################################## 59 | checkFolders() { 60 | printTask "Checking folders..." 61 | if [ ! -d "account-info" ]; then 62 | mkdir account-info 63 | fi 64 | if [ ! -d "config" ]; then 65 | mkdir config 66 | fi 67 | printSuccess "Done!" 68 | } 69 | 70 | # ############################################################################## 71 | # Function Name : checkAdb 72 | # Description : Checks for ADB and installs if not present 73 | # ############################################################################## 74 | checkAdb() { 75 | if [ $device = "Nox" ]; then 76 | printTask "Checking for nox_adb.exe" 77 | if [ -f "$adb" ]; then 78 | printSuccess "Found!" 79 | else 80 | printSuccess "Not found!" 81 | fi 82 | return 0 83 | fi 84 | printTask "Checking for adb..." 85 | if [ ! -d "./adb/platform-tools" ]; then # Check for custom adb directory 86 | if command -v adb &>/dev/null; then # Check if ADB is already installed (with Path) 87 | printSuccess "Found in PATH!" 88 | else # If not, install it locally for this script 89 | printWarn "Not found!" 90 | printTask "Installing adb..." 91 | echo 92 | echo 93 | mkdir -p adb # Create directory 94 | cd ./adb || exit 1 # Change to new directory 95 | 96 | case "$OSTYPE" in # Install depending on installed OS 97 | "msys") 98 | curl -LO https://dl.google.com/android/repository/platform-tools-latest-windows.zip # Windows 99 | unzip -qq ./platform-tools-latest-windows.zip # Unzip 100 | rm ./platform-tools-latest-windows.zip # Delete .zip 101 | ;; 102 | "darwin") 103 | curl -LO https://dl.google.com/android/repository/platform-tools-latest-darwin.zip # MacOS 104 | unzip -qq ./platform-tools-latest-darwin.zip # Unzip 105 | rm ./platform-tools-latest-darwin.zip # Delete .zip 106 | ;; 107 | "linux-gnu") 108 | curl -LO https://dl.google.com/android/repository/platform-tools-latest-linux.zip # Linux 109 | unzip -qq ./platform-tools-latest-linux.zip # Unzip 110 | rm ./platform-tools-latest-linux.zip # Delete .zip 111 | ;; 112 | *) 113 | printError "Couldn't find OS." 114 | printInfo "Please download platform-tools for your respective OS, unzip it into the ./adb folder and" 115 | printInfo "run this script again." 116 | printInfo " Windows: https://dl.google.com/android/repository/platform-tools-latest-windows.zip" 117 | printInfo " MacOS: https://dl.google.com/android/repository/platform-tools-latest-darwin.zip" 118 | printInfo " Linux: https://dl.google.com/android/repository/platform-tools-latest-linux.zip" 119 | exit 120 | ;; 121 | esac 122 | 123 | cd .. || exit 1 # Change directory back 124 | adb=./adb/platform-tools/adb # Set adb path 125 | echo 126 | printSuccess "Installed!" 127 | fi 128 | else 129 | printSuccess "Found locally!" 130 | adb=./adb/platform-tools/adb 131 | fi 132 | } 133 | 134 | # ############################################################################## 135 | # Function Name : checkDate 136 | # Description : Check date to decide whether to beat campaign or not. 137 | # ############################################################################## 138 | checkDate() { 139 | printTask "Checking last time script was run..." 140 | if [ -f $tempFile ]; then 141 | source $configFile 142 | source $tempFile 143 | if [ "$doChallengeBoss" = true ] && [ "$(datediff "$lastCampaign")" -le -3 ]; then 144 | forceFightCampaign=true 145 | fi 146 | if [ "$(datediff "$lastWeekly")" -lt -7 ]; then 147 | forceWeekly=true 148 | fi 149 | else 150 | if [ "$doChallengeBoss" = true ]; then 151 | forceFightCampaign=true 152 | fi 153 | forceWeekly=true 154 | fi 155 | printSuccess "Done!" 156 | } 157 | 158 | # ############################################################################## 159 | # Function Name : checkDevice 160 | # Description : Check if adb recognizes a device. 161 | # Args : 162 | # ############################################################################## 163 | checkDevice() { 164 | if [ "$#" -gt "0" ]; then # If parameters are sent 165 | if [ "$1" = "Bluestacks" ]; then # Bluestacks 166 | # Use custom port if set 167 | if [ -n "$custom_port" ]; then 168 | "$adb" connect localhost:"$custom_port" 1>/dev/null 169 | fi 170 | 171 | printTask "Searching for Bluestacks through ADB... " 172 | if ! "$adb" get-state 1>/dev/null 2>/dev/null; then 173 | printError "Not found!" 174 | exit 175 | else 176 | printSuccess "Found Bluestacks!" 177 | deploy "Bluestacks" "$bluestacksDirectory" 178 | fi 179 | elif [ "$1" = "Memu" ]; then # Memu 180 | printTask "Searching for Memu through ADB..." 181 | # Use custom port if set 182 | if [ -n "$custom_port" ]; then 183 | "$adb" connect localhost:"$custom_port" 1>/dev/null 184 | else 185 | "$adb" connect localhost:21503 1>/dev/null 186 | fi 187 | 188 | # Check for device 189 | if ! "$adb" get-state 1>/dev/null 2>/dev/null; then 190 | printError "Not found!" 191 | exit 192 | else 193 | printSuccess "Found Memu!" 194 | deploy "Memu" "$memuDirectory" 195 | fi 196 | elif [ "$1" = "Nox" ]; then # Nox 197 | printTask "Searching for Nox through ADB..." 198 | # Use custom port if set 199 | if [ -n "$custom_port" ]; then 200 | "$adb" connect localhost:"$custom_port" 1>/dev/null 201 | else 202 | "$adb" connect localhost:62001 1>/dev/null # If it's not working, try with 127.0.0.1 instead of localhost 203 | fi 204 | 205 | # Check for device 206 | if ! "$adb" get-state 1>/dev/null 2>/dev/null; then 207 | printError "Not found!" 208 | exit 209 | else 210 | printSuccess "Found Nox!" 211 | deploy "Nox" "$noxDirectory" 212 | fi 213 | fi 214 | else # If parameters aren't sent 215 | printTask "Searching for device through ADB..." 216 | # Use custom port if set 217 | if [ -n "$custom_port" ]; then 218 | "$adb" connect localhost:"$custom_port" 1>/dev/null 219 | fi 220 | 221 | # Check for device 222 | if ! "$adb" get-state 1>/dev/null 2>&1; then # Checks if adb finds device 223 | printError "No device found!" 224 | printInfo "Please make sure it's connected." 225 | exit 226 | else 227 | if [[ $("$adb" devices) =~ emulator ]]; then # Bluestacks 228 | printSuccess "Emulator found!" 229 | deploy "Emulator" "$bluestacksDirectory" 230 | else # Personal 231 | printSuccess "Device found!" 232 | deploy "Personal" "$personalDirectory" 233 | fi 234 | fi 235 | fi 236 | } 237 | 238 | # ############################################################################## 239 | # Function Name : checkEOL 240 | # Description : Check if afk-daily.sh has correct Line endings (LF) 241 | # Args : 242 | # ############################################################################## 243 | checkEOL() { 244 | if [ -f "$1" ]; then 245 | printTask "Checking Line endings of file ${cCyan}$1${cNc}..." 246 | if [[ $(head -1 "$1" | cat -A) =~ \^M ]]; then 247 | printWarn "Found CLRF!" 248 | printTask "Converting to LF..." 249 | dos2unix "$1" 2>/dev/null 250 | 251 | if [[ $(head -1 "$1" | cat -A) =~ \^M ]]; then 252 | printError "Failed to convert $1 to LF. Please do it yourself." 253 | exit 254 | else 255 | printSuccess "Converted!" 256 | fi 257 | else 258 | printSuccess "Passed!" 259 | fi 260 | fi 261 | } 262 | 263 | # ############################################################################## 264 | # Function Name : checkResolution 265 | # Description : Check device resolution 266 | # ############################################################################## 267 | checkResolution() { 268 | # Prints info related to debugging the resolution 269 | printDebugResolution() { 270 | printInfo "$("$adb" shell wm size)" 271 | printInfo "$("$adb" shell wm density)" 272 | # "$adb" shell dumpsys display 273 | printWarn "In case you're having trouble, join our Discord server and ask in the #need-help channel." 274 | printWarn "If you're sure your device settings are correct and want to force the script to run regardless, use the -r flag." 275 | printWarn "The script does NOT work on resolutions other than 1080x1920 (Portrait) or 1920x1080 (Landscape)!" 276 | exit 277 | } 278 | 279 | if [[ $("$adb" shell wm size) != *"Physical size: 1080x1920"* ]] && [[ $("$adb" shell wm size) != *"Physical size: 1920x1080"* ]]; then # Check for resolution 280 | echo 281 | printError "It seems like your device does not have the correct resolution!" 282 | printWarn "Please use a resolution of 1080x1920 (Portrait) or 1920x1080 (Landscape)." 283 | 284 | if [ $ignoreResolution = false ]; then 285 | printDebugResolution 286 | else 287 | printWarn "Running script regardless..." 288 | fi 289 | elif [[ $("$adb" shell wm size) == *"Override"* ]]; then # Check for Override 290 | echo 291 | printError "It seems like your device is overriding the default resolution!" 292 | printWarn "This may break the script." 293 | 294 | if [ $ignoreResolution = false ]; then 295 | if printQuestion "Do you want the script to try to fix the resolution for you? (y/n)"; then 296 | resetResolution 297 | else 298 | printDebugResolution 299 | fi 300 | else 301 | printWarn "Running script regardless..." 302 | fi 303 | fi 304 | } 305 | 306 | # ############################################################################## 307 | # Function Name : resetResolution 308 | # Description : Reset device resolution and density 309 | # ############################################################################## 310 | resetResolution() { 311 | printTask "Reseting screen resolution..." 312 | "$adb" shell wm size reset # Reset resolution 313 | printSuccess "Done!" 314 | } 315 | 316 | # ############################################################################## 317 | # Function Name : checkHexdump 318 | # Description : Check if device is able to run hexdump command 319 | # ############################################################################## 320 | checkHexdump() { 321 | printTask "Checking hexdump support..." 322 | 323 | # Check if hexdump is found 324 | if ! "$adb" shell 'command -v hexdump 1>/dev/null'; then 325 | echo 326 | printError "Hexdump not found on device." 327 | printInfo "If you are runing the script on your personal device, make sure BusyBox is installed." 328 | printInfo "More info here: https://github.com/zebscripts/AFK-Daily/wiki/Supported-Devices#personal-android-device" 329 | exit 1 330 | fi 331 | 332 | # Check if hexdump needs to be run with su 333 | if "$adb" shell 'hexdump --help 2>&1' | grep -q 'Permission denied'; then 334 | hexdumpSu=true 335 | fi 336 | 337 | printSuccess "Done!" 338 | } 339 | 340 | # ############################################################################## 341 | # Function Name : checkGitUpdate 342 | # Description : Checks for script update (with git) 343 | # ############################################################################## 344 | checkGitUpdate() { 345 | printTask "Checking for updates..." 346 | 347 | # Check if there's a new script version 348 | if ./lib/update_git.sh; then 349 | printSuccess "Checked!" 350 | else 351 | printSuccess "Update found!" 352 | 353 | # Check if git is installed and there's a .git folder 354 | if command -v git &>/dev/null && [ -d "./.git" ]; then 355 | # Fetch latest script version 356 | git fetch --all &>/dev/null 357 | 358 | # Check if there are local modifications present 359 | if [ -n "$(git status --porcelain)" ]; then 360 | # Ask if user wants to overwrite local changes 361 | if printQuestion "Local changes found! Do you want \ 362 | to overwrite them and get the latest script version? Config files will not be overwritten. (y/n)"; then 363 | git reset --hard origin/master &>/dev/null 364 | else 365 | printInfo "Alright, not updating. Use -z flag to not check for updates." 366 | return 0 367 | fi 368 | fi 369 | 370 | # Update script with git 371 | printTask "Updating..." 372 | if git pull origin master &>/dev/null; then 373 | printSuccess "Updated!" 374 | else 375 | printError "Failed to update script." 376 | printInfo "Refer to: https://github.com/zebscripts/AFK-Daily/wiki/Troubleshooting" 377 | if printQuestion "Do you want to run the script regardless? (y/n)"; then return 0; else exit 1; fi 378 | fi 379 | 380 | # Force script restart to update correctly 381 | # shellcheck disable=SC2086 382 | exec "$script_scr" $script_args 383 | else 384 | # git is not installed/available 385 | printWarn "git is not installed/available." 386 | printTask "Attempting to auto-update..." 387 | 388 | cd .. 389 | curl -sLO https://github.com/zebscripts/AFK-Daily/archive/master.zip 390 | unzip -qqo master.zip 391 | rm master.zip 392 | 393 | printSuccess "Done!" 394 | 395 | # Force script restart to update correctly 396 | # shellcheck disable=SC2086 397 | exec "$script_scr" $script_args 398 | fi 399 | fi 400 | } 401 | 402 | # ############################################################################## 403 | # Function Name : checkSetupUpdate 404 | # Description : Checks for setup update (.*afkscript.ini, config*.ini) 405 | # ############################################################################## 406 | checkSetupUpdate() { 407 | checkSetupUpdate_updated=false 408 | printTask "Checking for setup updates..." 409 | # .*afkscript.ini 410 | for f in .*afkscript.* ./account-info/acc*.ini; do 411 | if [ -e "$f" ]; then 412 | printInNewLine "$(./lib/update_setup.sh -a)" 413 | break 414 | fi 415 | done 416 | # config 417 | for f in config*.* ./config/config*.ini; do 418 | if [ -e "$f" ]; then 419 | checkSetupUpdate_config="$(./lib/update_setup.sh -c)" 420 | printInNewLine "$checkSetupUpdate_config" 421 | if [[ $checkSetupUpdate_config =~ "updated" ]]; then 422 | checkSetupUpdate_updated=true 423 | fi 424 | break 425 | fi 426 | done 427 | if [ "$checkSetupUpdate_updated" = false ]; then 428 | printSuccess "Checked!" 429 | else 430 | printSuccess "Updated!" 431 | printInfo "Please edit ${cCyan}$configFile${cNc} if necessary and run this script again." 432 | exit 433 | fi 434 | } 435 | 436 | # ############################################################################## 437 | # Function Name : datediff 438 | # Args : [] 439 | # Description : Quickly calculate date differences 440 | # Output : stdout 441 | # ############################################################################## 442 | datediff() { 443 | if date -v -1d >/dev/null 2>&1; then 444 | d1=$(date -v "${1:-"$(date +%Y%m%d)"}" +%s) 445 | d2=$(date -v "${2:-"$(date +%Y%m%d)"}" +%s) 446 | else 447 | d1=$(date -d "${1:-"$(date +%Y%m%d)"}" +%s) 448 | d2=$(date -d "${2:-"$(date +%Y%m%d)"}" +%s) 449 | fi 450 | echo $(((d1 - d2) / 86400)) 451 | } 452 | 453 | # ############################################################################## 454 | # Function Name : deploy 455 | # Description : Makes a Dir (if it doesn't exist), pushes script into Dir, Executes script in Dir. 456 | # Args : 457 | # ############################################################################## 458 | deploy() { 459 | checkResolution # Check Resolution 460 | checkHexdump # Check if hexdump should be run with su 461 | 462 | echo 463 | printInfo "Platform: ${cCyan}$1${cNc}" 464 | printInfo "Script Directory: ${cCyan}$2/scripts/afk-arena${cNc}" 465 | if [ $disableNotif = true ]; then 466 | "$adb" shell settings put global heads_up_notifications_enabled 0 467 | printInfo "Notifications: ${cCyan}OFF${cNc}" 468 | fi 469 | printInfo "Latest tested patch: ${cCyan}$testedPatch${cNc}\n" 470 | 471 | "$adb" shell mkdir -p "$2"/scripts/afk-arena # Create directories if they don't already exist 472 | "$adb" push afk-daily.sh "$2"/scripts/afk-arena 1>/dev/null # Push script to device 473 | "$adb" push $configFile "$2"/scripts/afk-arena 1>/dev/null # Push config to device 474 | 475 | args="-v $debug -i $configFile -l $2" 476 | if [ $hexdumpSu = true ]; then args="$args -g"; fi 477 | if [ $forceFightCampaign = true ]; then args="$args -f"; fi 478 | if [ $forceWeekly = true ]; then args="$args -w"; fi 479 | if [ $testServer = true ]; then args="$args -t"; fi 480 | if [ "$device" == "Nox" ]; then args="$args -c"; fi 481 | if [ -n "$totest" ]; then args="$args -s $totest"; fi 482 | if [ -n "$evt" ]; then args="$args -e $evt"; fi 483 | "$adb" shell sh "$2"/scripts/afk-arena/afk-daily.sh "$args" && saveDate 484 | 485 | # Enable notifications in case they got deactivated before 486 | if [ $disableNotif = true ]; then 487 | "$adb" shell settings put global heads_up_notifications_enabled 1 488 | printInfo "Notifications: ${cCyan}ON${cNc}\n" 489 | fi 490 | } 491 | 492 | # ############################################################################## 493 | # Function Name : getLatestPatch 494 | # Description : Get latest patch script was tested on 495 | # ############################################################################## 496 | getLatestPatch() { 497 | while IFS= read -r line; do 498 | if [[ "$line" == *"badge/Patch-"* ]]; then 499 | testedPatch=${line:90:7} 500 | break 501 | fi 502 | done <"README.md" 503 | } 504 | 505 | # ############################################################################## 506 | # Function Name : restartAdb 507 | # Description : Restarts ADB server 508 | # ############################################################################## 509 | restartAdb() { 510 | printTask "Restarting ADB..." 511 | printInNewLine "$($adb kill-server 1>/dev/null 2>&1)" 512 | printInNewLine "$($adb start-server 1>/dev/null 2>&1)" 513 | printSuccess "Restarted!" 514 | } 515 | 516 | # ############################################################################## 517 | # Function Name : saveDate 518 | # Description : Overwrite temp file with date if has been greater than 3 days or it doesn't exist 519 | # ############################################################################## 520 | saveDate() { 521 | if [ $forceFightCampaign = true ] || [ $forceWeekly = true ] || [ ! -f $tempFile ]; then 522 | if [ $forceFightCampaign = true ] || [ ! -f $tempFile ]; then 523 | newLastCampaign=$(date +%Y%m%d) 524 | fi 525 | if [ $forceWeekly = true ] || [ ! -f $tempFile ]; then 526 | if date -v -1d >/dev/null 2>&1; then 527 | newLastWeekly=$(date -v -sat +%Y%m%d) 528 | else 529 | newLastWeekly=$(date -dlast-saturday +%Y%m%d) 530 | fi 531 | fi 532 | 533 | echo -e "# afk-daily\n\ 534 | lastCampaign=${newLastCampaign:-$lastCampaign}\n\ 535 | lastWeekly=${newLastWeekly:-$lastWeekly}" >"$tempFile" 536 | fi 537 | } 538 | 539 | # ############################################################################## 540 | # Section : Script Start 541 | # ############################################################################## 542 | 543 | # ############################################################################## 544 | # Function Name : check_all 545 | # ############################################################################## 546 | check_all() { 547 | checkFolders 548 | checkAdb 549 | if [ $doCheckGitUpdate = true ]; then checkGitUpdate; fi 550 | touch $configFile # Create if not already existing 551 | checkSetupUpdate 552 | checkEOL $tempFile 553 | checkEOL $configFile 554 | checkEOL "afk-daily.sh" 555 | checkDate 556 | } 557 | 558 | # ############################################################################## 559 | # Function Name : run 560 | # ############################################################################## 561 | run() { 562 | check_all 563 | getLatestPatch 564 | 565 | if [ "$devMode" = false ]; then 566 | restartAdb 567 | fi 568 | 569 | if [ "$device" == "Bluestacks" ]; then 570 | checkDevice "Bluestacks" 571 | elif [ "$device" == "Memu" ]; then 572 | checkDevice "Memu" 573 | elif [ "$device" == "Nox" ]; then 574 | checkDevice "Nox" 575 | else checkDevice; fi 576 | } 577 | 578 | # ############################################################################## 579 | # Function Name : show_help 580 | # ############################################################################## 581 | show_help() { 582 | echo -e "${cWhite}" 583 | echo -e " _ ___ _ __ ___ _ _ " 584 | echo -e " /_\ | __| | |/ / ___ | \ __ _ (_) | | _ _ " 585 | echo -e " / _ \ | _| | ' < |___| | |) | / _\` | | | | | | || | " 586 | echo -e " /_/ \_\ |_| |_|\_\ |___/ \__,_| |_| |_| \_, | " 587 | echo -e " |__/ " 588 | echo -e 589 | echo -e "USAGE: ${cYellow}deploy.sh${cWhite} ${cCyan}[OPTIONS]${cWhite}" 590 | echo -e 591 | echo -e "DESCRIPTION" 592 | echo -e " Automate daily activities within the AFK Arena game." 593 | echo -e " More info: https://github.com/zebscripts/AFK-Daily" 594 | echo -e 595 | echo -e "OPTIONS" 596 | echo -e " ${cCyan}-h${cWhite}, ${cCyan}--help${cWhite}" 597 | echo -e " Show help" 598 | echo -e 599 | echo -e " ${cCyan}-a${cWhite}, ${cCyan}--account${cWhite} ${cGreen}[ACCOUNT]${cWhite}" 600 | echo -e " Specify account: \"acc-${cGreen}[ACCOUNT]${cWhite}.ini\"" 601 | echo -e " Remark: Please don't use spaces!" 602 | echo -e 603 | echo -e " ${cCyan}-d${cWhite}, ${cCyan}--device${cWhite} ${cGreen}[DEVICE]${cWhite}" 604 | echo -e " Specify target device." 605 | echo -e " Values for ${cGreen}[DEVICE]${cWhite}: bs (default), nox, memu" 606 | echo -e 607 | echo -e " ${cCyan}-e${cWhite}, ${cCyan}--event${cWhite} ${cGreen}[EVENT]${cWhite}" 608 | echo -e " Specify active event." 609 | echo -e " Values for ${cGreen}[EVENT]${cWhite}:" 610 | echo -e " hoe Heroes of Esperia" 611 | echo -e " ts Treasure Scramble" 612 | echo -e 613 | echo -e " ${cCyan}-f${cWhite}, ${cCyan}--fight${cWhite}" 614 | echo -e " Force campaign battle (ignore 3-day optimisation)." 615 | echo -e 616 | echo -e " ${cCyan}-i${cWhite}, ${cCyan}--ini${cWhite} ${cGreen}[CONFIG]${cWhite}" 617 | echo -e " Specify config: \"config-${cGreen}[CONFIG]${cWhite}.ini\"" 618 | echo -e " Remark: Please don't use spaces!" 619 | echo -e 620 | echo -e " ${cCyan}-n${cWhite}" 621 | echo -e " Disable heads-up notifications while script is running." 622 | echo -e 623 | echo -e " ${cCyan}-p${cWhite}, ${cCyan}--port${cWhite} ${cGreen}[PORT]${cWhite}" 624 | echo -e " Specify ADB port." 625 | echo -e 626 | echo -e " ${cCyan}-r${cWhite}" 627 | echo -e " Ignore resolution warning. Use this at your own risk." 628 | echo -e 629 | echo -e " ${cCyan}-t${cWhite}, ${cCyan}--test${cWhite}" 630 | echo -e " Launch on test server (experimental)." 631 | echo -e 632 | echo -e " ${cCyan}-w${cWhite}, ${cCyan}--weekly${cWhite}" 633 | echo -e " Force weekly." 634 | echo -e 635 | echo -e "DEV OPTIONS" 636 | echo -e 637 | echo -e " ${cCyan}-b${cWhite}" 638 | echo -e " Dev mode: do not restart adb." 639 | echo -e 640 | echo -e " ${cCyan}-c${cWhite}, ${cCyan}--check${cWhite}" 641 | echo -e " Check if script is ready to be run." 642 | echo -e 643 | echo -e " ${cCyan}-o${cWhite}, ${cCyan}--output${cWhite} ${cGreen}[OUTPUT_FILE]${cWhite}" 644 | echo -e " Write log in ${cGreen}[OUTPUT_FILE]${cWhite}" 645 | echo -e " Remark: Folder needs to be created" 646 | echo -e 647 | echo -e " ${cCyan}-s${cWhite} ${cGreen},[,[,[,]]]${cWhite}" 648 | echo -e " Test color of a pixel." 649 | echo -e 650 | echo -e " ${cCyan}-v${cWhite}, ${cCyan}--verbose${cWhite} ${cGreen}[DEBUG]${cWhite}" 651 | echo -e " Show DEBUG informations" 652 | echo -e " DEBUG = 0 Show no debug" 653 | echo -e " DEBUG >= 1 Show getColor calls > value" 654 | echo -e " DEBUG >= 2 Show test calls" 655 | echo -e " DEBUG >= 3 Show all core functions calls" 656 | echo -e " DEBUG >= 4 Show all functions calls" 657 | echo -e " DEBUG >= 9 Show all calls" 658 | echo -e 659 | echo -e " ${cCyan}-z${cWhite}" 660 | echo -e " Disable auto update." 661 | echo -e 662 | echo -e "EXAMPLES" 663 | echo -e " Run script" 664 | echo -e " ${cYellow}./deploy.sh${cWhite}" 665 | echo -e 666 | echo -e " Run script with specific emulator (for example Nox)" 667 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-d${cWhite} ${cGreen}nox${cWhite}" 668 | echo -e 669 | echo -e " Run script with specific port (for example 52086)" 670 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-p${cWhite} ${cGreen}52086${cWhite}" 671 | echo -e 672 | echo -e " Run script on test server" 673 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-t${cWhite}" 674 | echo -e 675 | echo -e " Run script forcing fight & weekly" 676 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-fw${cWhite}" 677 | echo -e 678 | echo -e " Run script with custom config.ini file named 'config-Push_Campaign.ini'" 679 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-i${cWhite} ${cGreen}\"Push_Campaign\"${cWhite}" 680 | echo -e 681 | echo -e " Run script for color testing" 682 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-s${cWhite} ${cGreen}800,600${cWhite}" 683 | echo -e 684 | echo -e " Run script with output file and with disabled notifications" 685 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-no${cWhite} ${cGreen}\".history/\$(date +%Y%m%d).log\"${cWhite}" 686 | echo -e 687 | echo -e " Run script on test server with output file and with disabled notifications" 688 | echo -e " ${cYellow}./deploy.sh${cWhite} ${cCyan}-nta${cWhite} ${cGreen}\"test\"${cWhite} ${cCyan}-i${cWhite} ${cGreen}\"test\"${cWhite} ${cCyan}-o${cWhite} ${cGreen}\".history/\$(date +%Y%m%d).test.log\"${cNc}" 689 | } 690 | 691 | for arg in "$@"; do 692 | shift 693 | case "$arg" in 694 | "--help") set -- "$@" "-h" ;; 695 | "--account") set -- "$@" "-a" ;; 696 | "--check") set -- "$@" "-c" ;; 697 | "--device") set -- "$@" "-d" ;; 698 | "--event") set -- "$@" "-e" ;; 699 | "--fight") set -- "$@" "-f" ;; 700 | "--ini") set -- "$@" "-i" ;; 701 | "--notifications") set -- "$@" "-n" ;; 702 | "--output") set -- "$@" "-o" ;; 703 | "--port") set -- "$@" "-p" ;; 704 | "--resolution") set -- "$@" "-r" ;; 705 | "--hex") set -- "$@" "-s" ;; 706 | "--test") set -- "$@" "-t" ;; 707 | "--verbose") set -- "$@" "-v" ;; 708 | "--weekly") set -- "$@" "-w" ;; 709 | *) set -- "$@" "$arg" ;; 710 | esac 711 | done 712 | 713 | while getopts ":a:bcd:e:fhi:no:p:rs:tv:wz" option; do 714 | case $option in 715 | a) 716 | tempFile="account-info/acc-${OPTARG}.ini" 717 | ;; 718 | b) 719 | devMode=true 720 | ;; 721 | c) 722 | check_all 723 | exit 724 | ;; 725 | d) 726 | if [ "$OPTARG" == "Bluestacks" ] || [ "$OPTARG" == "bluestacks" ] || [ "$OPTARG" == "bs" ]; then 727 | device="Bluestacks" 728 | elif [ "$OPTARG" == "Memu" ] || [ "$OPTARG" == "memu" ]; then 729 | device="Memu" 730 | elif [ "$OPTARG" == "Nox" ] || [ "$OPTARG" == "nox" ]; then 731 | device="Nox" 732 | case "$(uname -s)" in # Check OS 733 | Darwin | Linux) # Mac / Linux 734 | adb="$(ps | grep -i nox_adb.exe | tr -s ' ' | cut -d ' ' -f 9-100 | sed -e 's/^/\//' -e 's/://' -e 's#\\#/#g')" 735 | ;; 736 | CYGWIN* | MINGW32* | MSYS* | MINGW*) # Windows 737 | adb="$(ps -W | grep -i nox_adb.exe | tr -s ' ' | cut -d ' ' -f 9-100 | sed -e 's/^/\//' -e 's/://' -e 's#\\#/#g')" 738 | ;; 739 | esac 740 | if [ -z "$adb" ]; then 741 | printError "nox_adb.exe not found, please check your Nox settings" 742 | exit 1 743 | fi 744 | fi 745 | ;; 746 | e) 747 | evt="${OPTARG}" 748 | ;; 749 | f) 750 | forceFightCampaign=true 751 | ;; 752 | h) 753 | show_help 754 | exit 0 755 | ;; 756 | i) 757 | configFile="config/config-${OPTARG}.ini" 758 | ;; 759 | n) 760 | disableNotif=true 761 | ;; 762 | o) 763 | output="${OPTARG}" 764 | ;; 765 | p) 766 | custom_port="${OPTARG}" 767 | ;; 768 | r) 769 | ignoreResolution=true 770 | ;; 771 | s) 772 | totest=${OPTARG} 773 | ;; 774 | t) 775 | testServer=true 776 | ;; 777 | v) 778 | debug=${OPTARG} 779 | ;; 780 | w) 781 | forceWeekly=true 782 | ;; 783 | z) 784 | doCheckGitUpdate=false 785 | ;; 786 | :) 787 | printWarn "Argument required by this option: $OPTARG" 788 | exit 1 789 | ;; 790 | \?) 791 | printError "$OPTARG : Invalid option" 792 | exit 1 793 | ;; 794 | esac 795 | done 796 | 797 | clear 798 | if [ "$output" != "" ]; then 799 | mkdir -p "$(dirname "$output")" 800 | touch "$output" 801 | run 2>&1 | tee -a "$output" 802 | else 803 | run 804 | fi 805 | -------------------------------------------------------------------------------- /lib/print.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ############################################################################## 3 | # Script Name : print.sh 4 | # Description : Small lib containing basic print functions 5 | # GitHub : https://github.com/zebscripts/AFK-Daily 6 | # License : MIT 7 | # ############################################################################## 8 | # Colors 9 | cNc="\033[0m" # Text Reset 10 | cRed="\033[0;91m" # Red 11 | cGreen="\033[0;92m" # Green 12 | cYellow="\033[0;93m" # Yellow 13 | cBlue="\033[0;94m" # Blue 14 | cPurple="\033[0;95m" # Purple 15 | cCyan="\033[0;96m" # Cyan 16 | cWhite="\033[0;97m" # White 17 | 18 | # Variables 19 | withoutNewLine=false 20 | 21 | checkNewLine() { 22 | if [ $withoutNewLine = true ]; then echo; fi 23 | withoutNewLine=false 24 | } 25 | 26 | printInNewLine() { 27 | if [ -n "$1" ]; then 28 | checkNewLine 29 | echo "$1" 30 | fi 31 | } 32 | 33 | # Task 34 | printTask() { 35 | checkNewLine 36 | withoutNewLine=true 37 | echo -n -e "${cBlue}[TASK]${cWhite} $1${cNc} " 38 | } 39 | 40 | # Info 41 | printInfo() { 42 | checkNewLine 43 | echo -e "${cBlue}[INFO]${cWhite} $1${cNc}" 44 | } 45 | 46 | # Tip 47 | printTip() { 48 | checkNewLine 49 | echo -e "${cPurple}[TIP]${cWhite} $1${cNc}" 50 | } 51 | 52 | # Success 53 | printSuccess() { 54 | if [ $withoutNewLine = false ]; then 55 | echo -n -e "${cGreen}[DONE] ${cNc}" 56 | else 57 | withoutNewLine=false 58 | fi 59 | echo -e "${cGreen}$1${cNc}" 60 | } 61 | 62 | # Error 63 | printError() { 64 | checkNewLine 65 | echo -e "${cRed}[ERROR]${cWhite} $1${cNc}" 66 | } 67 | 68 | # Warn 69 | printWarn() { 70 | checkNewLine 71 | echo -e "${cYellow}[WARN]${cWhite} $1${cNc}" 72 | } 73 | 74 | # Ask user a yes or no question 75 | # Returns 0 when yes, 1 when no 76 | # Might not be possible to use in .sh scripts! 77 | printQuestion() { 78 | checkNewLine 79 | echo -ne "${cYellow}[WARN]${cWhite} $1 ${cNc}" 80 | read -r answer 81 | if [ "$answer" != "${answer#[Yy]}" ]; then return 0; else return 1; fi 82 | } 83 | -------------------------------------------------------------------------------- /lib/update_git.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ############################################################################## 3 | # Script Name : update_git.sh 4 | # Description : Tools to work with git 5 | # Output : return 0/1 6 | # GitHub : https://github.com/zebscripts/AFK-Daily 7 | # License : MIT 8 | # ############################################################################## 9 | 10 | # Consts 11 | headRowVersion=8 12 | headRowPatch=9 13 | remoteURL="https://raw.githubusercontent.com/zebscripts/AFK-Daily/master/README.md" 14 | 15 | # ############################################################################## 16 | # Function Name : checkUpdate 17 | # Descripton : Check for update 18 | # Output : return 0/1 19 | # ############################################################################## 20 | checkUpdate() { 21 | localVersion=$(./account-info/acc.ini 33 | case "$(uname -s)" in # Check OS 34 | Darwin | Linux) # Mac / Linux 35 | echo "lastCampaign=$(date -r "$(cat "$f")" +%Y%m%d)" >>./account-info/acc.ini 36 | ;; 37 | CYGWIN* | MINGW32* | MSYS* | MINGW*) # Windows 38 | echo "lastCampaign=$(date -d "@$(cat "$f")" +%Y%m%d)" >>./account-info/acc.ini 39 | ;; 40 | esac 41 | printInfo "${cCyan}$f${cNc} converted" 42 | done 43 | } 44 | 45 | # ############################################################################## 46 | # Function Name : updateAFKScript 47 | # Descripton : Update file, add new params 48 | # ############################################################################## 49 | updateAFKScript() { 50 | # Date 3 days ago 51 | # Saturday 2 weeks ago 52 | if date -v -1d >/dev/null 2>&1; then 53 | lastCampaign_default=$(date -v -3d +%Y%m%d) 54 | lastWeekly_default=$(date -v -sat +%Y%m%d) 55 | else 56 | lastCampaign_default=$(date -d 'now - 3day' +%Y%m%d) 57 | lastWeekly_default=$(date -dlast-saturday +%Y%m%d) 58 | fi 59 | 60 | for f in ./account-info/acc*.ini; do 61 | if [ ! -f "$f" ]; then continue; fi 62 | source "$f" # Load the file 63 | echo -e "# afk-daily\n\ 64 | lastCampaign=${lastCampaign:-$lastCampaign_default}\n\ 65 | lastWeekly=${lastWeekly:-$lastWeekly_default}" >"$f.tmp" 66 | 67 | # Unset all values 68 | while read -r line; do 69 | if [[ $line =~ ^(.*)= ]]; then 70 | unset "${BASH_REMATCH[1]}" 71 | fi 72 | done <"$f" 73 | 74 | # Check for differences 75 | if cmp --silent -- "$f" "$f.tmp"; then 76 | rm -f "$f.tmp" 77 | else 78 | mv "$f.tmp" "$f" 79 | printInfo "${cCyan}$f${cNc} updated" 80 | fi 81 | done 82 | } 83 | 84 | # ############################################################################## 85 | # Section : Config 86 | # ############################################################################## 87 | 88 | # ############################################################################## 89 | # Function Name : cleanConfig 90 | # Descripton : Remove old file 91 | # ############################################################################## 92 | cleanConfig() { 93 | rm -f config*.sh 94 | } 95 | 96 | # ############################################################################## 97 | # Function Name : convertConfigSHtoINI 98 | # Descripton : Convert old file 99 | # ############################################################################## 100 | convertConfigSHtoINI() { 101 | for f in config*.sh; do 102 | if [ ! -f "$f" ]; then continue; fi 103 | cp "$f" ./config/config.ini # Copy new files 104 | printInfo "${cCyan}$f${cNc} converted" 105 | done 106 | } 107 | 108 | # ############################################################################## 109 | # Function Name : updateConfig 110 | # Descripton : Update file, add new params 111 | # ############################################################################## 112 | updateConfig() { 113 | for f in ./config/config*.ini; do 114 | if [ ! -f "$f" ]; then continue; fi 115 | source "$f" # Load the file 116 | echo -e "# --- CONFIG: Modify accordingly to your game! --- #\n\ 117 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- #\n\ 118 | # Player\n\ 119 | canOpenSoren=${canOpenSoren:-"false"}\n\ 120 | arenaHeroesOpponent=${arenaHeroesOpponent:-"5"}\n\ 121 | \n\ 122 | # General\n\ 123 | waitForUpdate=${waitForUpdate:-"true"}\n\ 124 | endAt=${endAt:-"championship"}\n\ 125 | guildBattleType=${guildBattleType:-"quick"}\n\ 126 | allowCrystalLevelUp=${allowCrystalLevelUp:-"true"}\n\ 127 | \n\ 128 | # Repetitions\n\ 129 | maxCampaignFights=${maxCampaignFights:-"5"}\n\ 130 | maxKingsTowerFights=${maxKingsTowerFights:-"5"}\n\ 131 | totalAmountArenaTries=${totalAmountArenaTries:-"2+0"}\n\ 132 | totalAmountTournamentTries=${totalAmountTournamentTries:-"0"}\n\ 133 | totalAmountGuildBossTries=${totalAmountGuildBossTries:-"2+0"}\n\ 134 | totalAmountTwistedRealmBossTries=${totalAmountTwistedRealmBossTries:-"1"}\n\ 135 | \n\ 136 | # Store\n\ 137 | buyStoreDust=${buyStoreDust:-"true"}\n\ 138 | buyStorePoeCoins=${buyStorePoeCoins:-"true"}\n\ 139 | buyStorePrimordialEmblem=${buyStorePrimordialEmblem:-"false"}\n\ 140 | buyStoreAmplifyingEmblem=${buyStoreAmplifyingEmblem:-"false"}\n\ 141 | buyStoreSoulstone=${buyStoreSoulstone:-"false"}\n\ 142 | buyStoreLimitedElementalShard=${buyStoreLimitedElementalShard:-"false"}\n\ 143 | buyStoreLimitedElementalCore=${buyStoreLimitedElementalCore:-"false"}\n\ 144 | buyStoreLimitedTimeEmblem=${buyStoreLimitedTimeEmblem:-"false"}\n\ 145 | buyWeeklyGuild=${buyWeeklyGuild:-"false"}\n\ 146 | buyWeeklyLabyrinth=${buyWeeklyLabyrinth:-"false"}\n\ 147 | \n\ 148 | # Towers\n\ 149 | doMainTower=${doMainTower:-"true"}\n\ 150 | doTowerOfLight=${doTowerOfLight:-"true"}\n\ 151 | doTheBrutalCitadel=${doTheBrutalCitadel:-"true"}\n\ 152 | doTheWorldTree=${doTheWorldTree:-"true"}\n\ 153 | doCelestialSanctum=${doCelestialSanctum:-"true"}\n\ 154 | doTheForsakenNecropolis=${doTheForsakenNecropolis:-"true"}\n\ 155 | doInfernalFortress=${doInfernalFortress:-"true"}\n\ 156 | \n\ 157 | # --- Actions --- #\n\ 158 | # Campaign\n\ 159 | doLootAfkChest=${doLootAfkChest:-"true"}\n\ 160 | doChallengeBoss=${doChallengeBoss:-"true"}\n\ 161 | doFastRewards=${doFastRewards:-"true"}\n\ 162 | doCollectFriendsAndMercenaries=${doCollectFriendsAndMercenaries:-"true"}\n\ 163 | \n\ 164 | # Dark Forest\n\ 165 | doSoloBounties=${doSoloBounties:-"true"}\n\ 166 | doTeamBounties=${doTeamBounties:-"true"}\n\ 167 | doArenaOfHeroes=${doArenaOfHeroes:-"true"}\n\ 168 | doLegendsTournament=${doLegendsTournament:-"true"}\n\ 169 | doKingsTower=${doKingsTower:-"true"}\n\ 170 | \n\ 171 | # Ranhorn\n\ 172 | doGuildHunts=${doGuildHunts:-"true"}\n\ 173 | doTwistedRealmBoss=${doTwistedRealmBoss:-"true"}\n\ 174 | doBuyFromStore=${doBuyFromStore:-"true"}\n\ 175 | doStrengthenCrystal=${doStrengthenCrystal:-"true"}\n\ 176 | doTempleOfAscension=${doTempleOfAscension:-"false"}\n\ 177 | doCompanionPointsSummon=${doCompanionPointsSummon:-"false"}\n\ 178 | doCollectOakPresents=${doCollectOakPresents:-"true"}\n\ 179 | \n\ 180 | # End\n\ 181 | doCollectQuestChests=${doCollectQuestChests:-"true"}\n\ 182 | doCollectMail=${doCollectMail:-"true"}\n\ 183 | doCollectMerchantFreebies=${doCollectMerchantFreebies:-"false"}" >"$f.tmp" 184 | 185 | # Unset all values 186 | while read -r line; do 187 | if [[ $line =~ ^(.*)= ]]; then 188 | unset "${BASH_REMATCH[1]}" 189 | fi 190 | done <"$f" 191 | 192 | # Check for differences 193 | if cmp --silent -- "$f" "$f.tmp"; then 194 | rm -f "$f.tmp" 195 | else 196 | mv "$f.tmp" "$f" 197 | printInfo "${cCyan}$f${cNc} updated" 198 | fi 199 | done 200 | } 201 | 202 | # ############################################################################## 203 | # Section : Main 204 | # ############################################################################## 205 | 206 | # ############################################################################## 207 | # Function Name : runAFKScript 208 | # ############################################################################## 209 | runAFKScript() { 210 | convertAKFScriptTMPtoINI 211 | cleanAKFScript 212 | touch "account-info/acc.ini" # Create default file 213 | updateAFKScript 214 | } 215 | 216 | # ############################################################################## 217 | # Function Name : runConfig 218 | # ############################################################################## 219 | runConfig() { 220 | convertConfigSHtoINI 221 | cleanConfig 222 | touch "config/config.ini" # Create default file 223 | updateConfig 224 | } 225 | 226 | # ############################################################################## 227 | # Function Name : show_help 228 | # ############################################################################## 229 | show_help() { 230 | echo -e "Usage: update_setup.sh [-h] [-a] [-c] [-l]\n" 231 | echo -e "Description:" 232 | echo -e " - Convert file to new format (.tmp/.sh > .ini)" 233 | echo -e " - Clean the folder (remove old .tmp/.sh files)" 234 | echo -e " - Init with a file if run for the first time" 235 | echo -e " - Update for new values\n" 236 | echo -e "Options:" 237 | echo -e " h\tShow help" 238 | echo -e " a\tSetup afkscript files" 239 | echo -e " c\tSetup config files" 240 | echo -e " l\tList setup files" 241 | } 242 | 243 | if [ -z "$1" ]; then 244 | show_help 245 | exit 0 246 | fi 247 | 248 | while getopts ":hacl" opt; do 249 | case $opt in 250 | h) 251 | show_help 252 | exit 0 253 | ;; 254 | a) 255 | runAFKScript 256 | ;; 257 | c) 258 | runConfig 259 | ;; 260 | l) 261 | ls -al account-info/acc-*.ini config/config*.ini 262 | ;; 263 | \?) 264 | echo "$OPTARG : Invalid option" 265 | exit 1 266 | ;; 267 | esac 268 | done 269 | -------------------------------------------------------------------------------- /tools/afk-daily.ext.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # ############################################################################## 3 | # Script Name : afk-daily.ext.sh 4 | # Description : Extension of the afk-daily.sh script, used for backup & tools 5 | # GitHub : https://github.com/zebscripts/AFK-Daily 6 | # License : MIT 7 | # ############################################################################## 8 | 9 | # ############################################################################## 10 | # Section : Ranhorn 11 | # ############################################################################## 12 | 13 | # ############################################################################## 14 | # Function Name : oakInn 15 | # Descripton : Collect Oak Inn 16 | # ############################################################################## 17 | oakInn() { 18 | if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn" >&2; fi 19 | inputTapSleep 780 270 5 # Oak Inn 20 | 21 | _oakInn_COUNT=0 22 | until [ "$_oakInn_COUNT" -ge "$totalAmountOakRewards" ]; do 23 | inputTapSleep 1050 950 # Friends 24 | inputTapSleep 1025 400 5 # Top Friend 25 | sleep 5 26 | 27 | oakInn_tryCollectPresent 28 | if [ "$oakRes" = 0 ]; then # If return value is still 0, no presents were found at first friend 29 | # Switch friend and search again 30 | inputTapSleep 1050 950 # Friends 31 | inputTapSleep 1025 530 5 # Second friend 32 | 33 | oakInn_tryCollectPresent 34 | if [ "$oakRes" = 0 ]; then # If return value is again 0, no presents were found at second friend 35 | # Switch friend and search again 36 | inputTapSleep 1050 950 # Friends 37 | inputTapSleep 1025 650 5 # Third friend 38 | 39 | oakInn_tryCollectPresent 40 | if [ "$oakRes" = 0 ]; then # If return value is still freaking 0, I give up 41 | printInColor "WARN" "Couldn't collect Oak Inn presents, sowy." >&2 42 | break 43 | fi 44 | fi 45 | fi 46 | 47 | sleep 2 48 | _oakInn_COUNT=$((_oakInn_COUNT + 1)) # Increment 49 | done 50 | 51 | inputTapSleep 70 1810 3 52 | inputTapSleep 70 1810 0 53 | 54 | wait 55 | verifyHEX 20 1775 d49a61 "Attempted to collect Oak Inn presents." "Failed to collect Oak Inn presents." 56 | } 57 | 58 | # ############################################################################## 59 | # Function Name : oakInn_presentTab 60 | # Descripton : Search available present tabs in Oak Inn 61 | # ############################################################################## 62 | oakInn_presentTab() { 63 | if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_presentTab" >&2; fi 64 | oakInn_presentTabs=0 65 | if testColorOR 270 1800 c79663; then # 1 gift c79663 66 | oakInn_presentTabs=$((oakInn_presentTabs + 1000)) # Increment 67 | fi 68 | if testColorOR 410 1800 bb824f; then # 2 gift bb824f 69 | oakInn_presentTabs=$((oakInn_presentTabs + 200)) # Increment 70 | fi 71 | if testColorOR 550 1800 af6e3b; then # 3 gift af6e3b 72 | oakInn_presentTabs=$((oakInn_presentTabs + 30)) # Increment 73 | fi 74 | if testColorOR 690 1800 b57b45; then # 4 gift b57b45 75 | oakInn_presentTabs=$((oakInn_presentTabs + 4)) # Increment 76 | fi 77 | } 78 | 79 | # ############################################################################## 80 | # Function Name : oakInn_searchPresent 81 | # Descripton : Searches for a "good" present in oak Inn 82 | # ############################################################################## 83 | oakInn_searchPresent() { 84 | if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_searchPresent " >&2; fi 85 | inputSwipe 400 1600 400 310 50 # Swipe all the way down 86 | sleep 1 87 | 88 | if testColorOR 540 990 833f0e; then # 1 red 833f0e blue 903da0 89 | inputTapSleep 540 990 3 # Tap present 90 | inputTapSleep 540 1650 1 # Ok 91 | inputTapSleep 540 1650 0 # Collect reward 92 | oakRes=1 93 | else 94 | if testColorOR 540 800 a21a1a; then # 2 red a21a1a blue 9a48ab 95 | inputTapSleep 540 800 3 96 | inputTapSleep 540 1650 1 # Ok 97 | inputTapSleep 540 1650 0 # Collect reward 98 | oakRes=1 99 | else 100 | if testColorOR 540 610 aa2b27; then # 3 red aa2b27 blue b260aa 101 | inputTapSleep 540 610 3 102 | inputTapSleep 540 1650 1 # Ok 103 | inputTapSleep 540 1650 0 # Collect reward 104 | oakRes=1 105 | else 106 | if testColorOR 540 420 bc3f36; then # 4 red bc3f36 blue c58c7b 107 | inputTapSleep 540 420 3 108 | inputTapSleep 540 1650 1 # Ok 109 | inputTapSleep 540 1650 0 # Collect reward 110 | oakRes=1 111 | else 112 | if testColorOR 540 220 bb3734; then # 5 red bb3734 blue 9442a5 113 | inputTapSleep 540 220 3 114 | inputTapSleep 540 1650 1 # Ok 115 | inputTapSleep 540 1650 0 # Collect reward 116 | oakRes=1 117 | else # If no present found, search for other tabs 118 | oakRes=0 119 | fi 120 | fi 121 | fi 122 | fi 123 | fi 124 | } 125 | 126 | # ############################################################################## 127 | # Function Name : oakInn_tryCollectPresent 128 | # Descripton : Tries to collect a present from one Oak Inn friend 129 | # ############################################################################## 130 | oakInn_tryCollectPresent() { 131 | if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_tryCollectPresent" >&2; fi 132 | oakInn_searchPresent # Search for a "good" present 133 | if [ $oakRes = 0 ]; then 134 | oakInn_presentTab # If no present found, search for other tabs 135 | case $oakInn_presentTabs in 136 | 0) 137 | oakRes=0 138 | ;; 139 | 4) 140 | inputTapSleep 690 1800 3 141 | oakInn_searchPresent 142 | ;; 143 | 30) 144 | inputTapSleep 550 1800 3 145 | oakInn_searchPresent 146 | ;; 147 | 34) 148 | inputTapSleep 550 1800 3 149 | oakInn_searchPresent 150 | if [ $oakRes = 0 ]; then 151 | inputTapSleep 690 1800 3 152 | oakInn_searchPresent 153 | fi 154 | ;; 155 | 200) 156 | inputTapSleep 410 1800 3 157 | oakInn_searchPresent 158 | ;; 159 | 204) 160 | inputTapSleep 410 1800 3 161 | oakInn_searchPresent 162 | if [ $oakRes = 0 ]; then 163 | inputTapSleep 690 1800 3 164 | oakInn_searchPresent 165 | fi 166 | ;; 167 | 230) 168 | inputTapSleep 410 1800 3 169 | oakInn_searchPresent 170 | if [ $oakRes = 0 ]; then 171 | inputTapSleep 550 1800 3 172 | oakInn_searchPresent 173 | fi 174 | ;; 175 | 234) 176 | inputTapSleep 410 1800 3 177 | oakInn_searchPresent 178 | if [ $oakRes = 0 ]; then 179 | inputTapSleep 550 1800 3 180 | oakInn_searchPresent 181 | if [ $oakRes = 0 ]; then 182 | inputTapSleep 690 1800 3 183 | oakInn_searchPresent 184 | fi 185 | fi 186 | ;; 187 | 1000) 188 | inputTapSleep 270 1800 3 189 | oakInn_searchPresent 190 | ;; 191 | 1004) 192 | inputTapSleep 270 1800 3 193 | oakInn_searchPresent 194 | if [ $oakRes = 0 ]; then 195 | inputTapSleep 690 1800 3 196 | oakInn_searchPresent 197 | fi 198 | ;; 199 | 1030) 200 | inputTapSleep 270 1800 3 201 | oakInn_searchPresent 202 | if [ $oakRes = 0 ]; then 203 | inputTapSleep 550 1800 3 204 | oakInn_searchPresent 205 | fi 206 | ;; 207 | 1034) 208 | inputTapSleep 270 1800 3 209 | oakInn_searchPresent 210 | if [ $oakRes = 0 ]; then 211 | inputTapSleep 550 1800 3 212 | oakInn_searchPresent 213 | if [ $oakRes = 0 ]; then 214 | inputTapSleep 690 1800 3 215 | oakInn_searchPresent 216 | fi 217 | fi 218 | ;; 219 | 1200) 220 | inputTapSleep 270 1800 3 221 | oakInn_searchPresent 222 | if [ $oakRes = 0 ]; then 223 | inputTapSleep 410 1800 3 224 | oakInn_searchPresent 225 | fi 226 | ;; 227 | 1204) 228 | inputTapSleep 270 1800 3 229 | oakInn_searchPresent 230 | if [ $oakRes = 0 ]; then 231 | inputTapSleep 410 1800 3 232 | oakInn_searchPresent 233 | if [ $oakRes = 0 ]; then 234 | inputTapSleep 690 1800 3 235 | oakInn_searchPresent 236 | fi 237 | fi 238 | ;; 239 | 1230) 240 | inputTapSleep 270 1800 3 241 | oakInn_searchPresent 242 | if [ $oakRes = 0 ]; then 243 | inputTapSleep 410 1800 3 244 | oakInn_searchPresent 245 | if [ $oakRes = 0 ]; then 246 | inputTapSleep 550 1800 3 247 | oakInn_searchPresent 248 | fi 249 | fi 250 | ;; 251 | 1234) 252 | inputTapSleep 270 1800 3 253 | oakInn_searchPresent 254 | if [ $oakRes = 0 ]; then 255 | inputTapSleep 410 1800 3 256 | oakInn_searchPresent 257 | if [ $oakRes = 0 ]; then 258 | inputTapSleep 550 1800 3 259 | oakInn_searchPresent 260 | if [ $oakRes = 0 ]; then 261 | inputTapSleep 690 1800 3 262 | oakInn_searchPresent 263 | fi 264 | fi 265 | fi 266 | ;; 267 | esac 268 | fi 269 | } 270 | 271 | # ############################################################################## 272 | # Section : Test 273 | # ############################################################################## 274 | 275 | # ############################################################################## 276 | # Function Name : colorTest 277 | # Description : Print all colors 278 | # Output : stdout colors test 279 | # ############################################################################## 280 | colorTest() { 281 | for clfg in 30 31 32 33 34 35 36 37 90 91 92 93 94 95 96 97 39; do 282 | str="" 283 | for attr in 0 1 2 4 5 7; do 284 | str="$str\033[${attr};${clfg}m[attr=${attr};clfg=${clfg}]\033[0m" 285 | done 286 | echo "$str${cNc}" 287 | done 288 | } 289 | 290 | # ############################################################################## 291 | # Function Name : printInColorTest 292 | # Description : Print all types of messages 293 | # Output : stdout colors test 294 | # ############################################################################## 295 | printInColorTest() { 296 | printInColor "DEBUG" "Lorem ipsum ${cCyan}dolor${cNc} sit amet [${cGreen}25 W${cNc} / ${cRed}10 L${cNc}]" 297 | printInColor "DONE" "Lorem ipsum ${cCyan}dolor${cNc} sit amet [${cGreen}25${cNc} W / ${cRed}10${cNc} L]" 298 | printInColor "ERROR" "Lorem ipsum ${cCyan}dolor${cNc} sit amet [25 ${cGreen}W${cNc} / 10 ${cRed}L${cNc}]" 299 | printInColor "INFO" "Lorem ipsum ${cCyan}dolor${cNc} sit amet [${cGreen}25 W${cNc}]" 300 | printInColor "TEST" "Lorem ipsum ${cCyan}dolor${cNc} sit amet $(getCountersInColor 25)" 301 | printInColor "WARN" "Lorem ipsum ${cCyan}dolor${cNc} sit amet $(getCountersInColor 25 10)" 302 | printInColor "" "Lorem ipsum ${cCyan}dolor${cNc} sit amet $(getCountersInColor 0 0)" 303 | } 304 | -------------------------------------------------------------------------------- /tools/deploy.ext.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ############################################################################## 3 | # Script Name : deploy.ext.sh 4 | # Description : Extension of the deploy script, used for backup & tools 5 | # GitHub : https://github.com/zebscripts/AFK-Daily 6 | # License : MIT 7 | # ############################################################################## 8 | 9 | # ############################################################################## 10 | # Function Name : checkConfig 11 | # Description : Creates a $configFile file if not found 12 | # ############################################################################## 13 | checkConfig() { 14 | printTask "Searching for ${cCyan}$configFile${cNc}..." 15 | if [ -f "$configFile" ]; then 16 | printSuccess "Found!" 17 | else 18 | printWarn "Not found!" 19 | printTask "Creating new ${cCyan}$configFile${cNc}..." 20 | printf '# --- CONFIG: Modify accordingly to your game! --- # 21 | # --- Use this link for help: https://github.com/zebscripts/AFK-Daily/wiki/Config --- # 22 | 23 | # Player 24 | canOpenSoren=false 25 | arenaHeroesOpponent=5 26 | 27 | # General 28 | waitForUpdate=true 29 | endAt="championship" 30 | guildBattleType=quick 31 | allowCrystalLevelUp=false 32 | 33 | # Repetitions 34 | maxCampaignFights=5 35 | maxKingsTowerFights=5 36 | totalAmountArenaTries=2+0 37 | totalAmountTournamentTries=0 38 | totalAmountGuildBossTries=2+0 39 | totalAmountTwistedRealmBossTries=1 40 | 41 | # Store 42 | buyStoreDust=true 43 | buyStorePoeCoins=true 44 | buyStorePrimordialEmblem=false 45 | buyStoreAmplifyingEmblem=false 46 | buyStoreSoulstone=false 47 | buyStoreLimitedElementalShard=false 48 | buyStoreLimitedElementalCore=false 49 | buyStoreLimitedTimeEmblem=false 50 | buyWeeklyGuild=false 51 | buyWeeklyLabyrinth=false 52 | 53 | # Towers 54 | doMainTower=true 55 | doTowerOfLight=true 56 | doTheBrutalCitadel=true 57 | doTheWorldTree=true 58 | doCelestialSanctum=true 59 | doTheForsakenNecropolis=true 60 | doInfernalFortress=true 61 | 62 | # --- Actions --- # 63 | # Campaign 64 | doLootAfkChest=true 65 | doChallengeBoss=true 66 | doFastRewards=true 67 | doCollectFriendsAndMercenaries=true 68 | 69 | # Dark Forest 70 | doSoloBounties=true 71 | doTeamBounties=true 72 | doArenaOfHeroes=true 73 | doLegendsTournament=true 74 | doKingsTower=true 75 | 76 | # Ranhorn 77 | doGuildHunts=true 78 | doTwistedRealmBoss=true 79 | doBuyFromStore=true 80 | doStrengthenCrystal=true 81 | doTempleOfAscension=false 82 | doCompanionPointsSummon=false 83 | doCollectOakPresents=true 84 | 85 | # End 86 | doCollectQuestChests=true 87 | doCollectMail=true 88 | doCollectMerchantFreebies=false 89 | ' >$configFile 90 | printSuccess "Created!\n" 91 | printInfo "Please edit ${cCyan}$configFile${cNc} if necessary and run this script again." 92 | exit 93 | fi 94 | } 95 | 96 | # ############################################################################## 97 | # Function Name : validateConfig 98 | # Description : Checks for every necessary variable that needs to be defined in $configFile 99 | # ############################################################################## 100 | validateConfig() { 101 | source $configFile 102 | printTask "Validating ${cCyan}$configFile${cNc}..." 103 | if [[ -z $canOpenSoren || -z \ 104 | $arenaHeroesOpponent || -z \ 105 | $waitForUpdate || -z \ 106 | $endAt || -z \ 107 | $maxCampaignFights || -z \ 108 | $maxKingsTowerFights || -z \ 109 | $totalAmountArenaTries || -z \ 110 | $totalAmountTournamentTries || -z \ 111 | $totalAmountGuildBossTries || -z \ 112 | $totalAmountTwistedRealmBossTries || -z \ 113 | $buyStoreDust || -z \ 114 | $buyStorePoeCoins || -z \ 115 | $buyStorePrimordialEmblem || -z \ 116 | $buyStoreAmplifyingEmblem || -z \ 117 | $buyStoreSoulstone || -z \ 118 | $buyStoreLimitedElementalShard || -z \ 119 | $buyStoreLimitedElementalCore || -z \ 120 | $buyStoreLimitedTimeEmblem || -z \ 121 | $buyWeeklyGuild || -z \ 122 | $buyWeeklyLabyrinth || -z \ 123 | $doMainTower || -z \ 124 | $doTowerOfLight || -z \ 125 | $doTheBrutalCitadel || -z \ 126 | $doTheWorldTree || -z \ 127 | $doCelestialSanctum || -z \ 128 | $doTheForsakenNecropolis || -z \ 129 | $doInfernalFortress || -z \ 130 | $doLootAfkChest || -z \ 131 | $doChallengeBoss || -z \ 132 | $doFastRewards || -z \ 133 | $doCollectFriendsAndMercenaries || -z \ 134 | $doSoloBounties || -z \ 135 | $doTeamBounties || -z \ 136 | $doArenaOfHeroes || -z \ 137 | $doLegendsTournament || -z \ 138 | $doKingsTower || -z \ 139 | $doGuildHunts || -z \ 140 | $guildBattleType || -z \ 141 | $doTwistedRealmBoss || -z \ 142 | $doBuyFromStore || -z \ 143 | $doStrengthenCrystal || -z \ 144 | $allowCrystalLevelUp || -z \ 145 | $doTempleOfAscension || -z \ 146 | $doCompanionPointsSummon || -z \ 147 | $doCollectOakPresents || -z \ 148 | $doCollectQuestChests || -z \ 149 | $doCollectMail || -z \ 150 | $doCollectMerchantFreebies ]]; then 151 | printError "${cCyan}$configFile${cNc} has missing/wrong entries." 152 | echo 153 | printInfo "Please either delete ${cCyan}$configFile${cNc} and run the script again to generate a new one," 154 | printInfo "or run ./lib/update_setup.sh -c" 155 | printInfo "or check the following link for help:" 156 | printInfo "https://github.com/zebscripts/AFK-Daily/wiki/Config" 157 | exit 158 | fi 159 | printSuccess "Passed!" 160 | } 161 | -------------------------------------------------------------------------------- /tools/print.ext.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ############################################################################## 3 | # Script Name : print.ext.sh 4 | # Description : Extension print.sh 5 | # GitHub : https://github.com/zebscripts/AFK-Daily 6 | # License : MIT 7 | # ############################################################################## 8 | 9 | colorTest() { 10 | for clfg in 30 31 32 33 34 35 36 37 90 91 92 93 94 95 96 97 39; do 11 | str="" 12 | for attr in 0 1 2 4 5 7; do 13 | str="$str\033[${attr};${clfg}m[attr=${attr};clfg=${clfg}]\033[0m" 14 | done 15 | echo -e "$str" 16 | done 17 | } 18 | 19 | printInColorTest() { 20 | printTask "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 21 | printSuccess "Lorem ipsum dolor sit amet" 22 | printTask "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 23 | printWarn "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 24 | printTask "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 25 | printError "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 26 | printInfo "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 27 | printTip "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 28 | printSuccess "Lorem ipsum ${cCyan}dolor${cNc} sit amet" 29 | } 30 | -------------------------------------------------------------------------------- /tools/support_assist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # ############################################################################## 3 | # Script Name : support_assist.sh 4 | # Description : Tool to check things about your emulator, network, ... 5 | # GitHub : https://github.com/zebscripts/AFK-Daily 6 | # License : MIT 7 | # ############################################################################## 8 | 9 | Color_Off="\033[0m" # Text Reset 10 | IRed="\033[0;91m" # Red 11 | IGreen="\033[0;92m" # Green 12 | IYellow="\033[0;93m" # Yellow 13 | IBlue="\033[0;94m" # Blue 14 | ICyan="\033[0;96m" # Cyan 15 | IWhite="\033[0;97m" # White 16 | 17 | # ############################################################################## 18 | # Function Name : checkEmulator 19 | # Description : Check emulator performance. 20 | # Args : 21 | # Return : 0 (OK), 1 (ADB not found), 2 (Emulator not found) 22 | # ############################################################################## 23 | checkEmulator() { 24 | echo -e "${IWhite}Checking Emulator${Color_Off}" 25 | 26 | # Auto detect nox & emulator <3 27 | case "$(uname -s)" in # Check OS 28 | Darwin | Linux) # Mac / Linux 29 | adb="$(ps | grep -i nox_adb.exe | tr -s ' ' | cut -d ' ' -f 9-100 | sed -e 's/^/\//' -e 's/://' -e 's#\\#/#g')" 30 | ;; 31 | CYGWIN* | MINGW32* | MSYS* | MINGW*) # Windows 32 | adb="$(ps -W | grep -i nox_adb.exe | tr -s ' ' | cut -d ' ' -f 9-100 | sed -e 's/^/\//' -e 's/://' -e 's#\\#/#g')" 33 | ;; 34 | esac 35 | if [ -n "$adb" ]; then # nox_adb.exe is running :) 36 | echo -e "${Color_Off}Using:\t\t\t${IBlue}Nox ADB${Color_Off}" 37 | "$adb" connect localhost:62001 1>/dev/null 38 | if "$adb" get-state 1>/dev/null; then # Check if Nox is running 39 | echo -e "${Color_Off}Emulator:\t\t${IBlue}Nox${Color_Off}" 40 | else # Nox not found 41 | echo -e "${Color_Off}Emulator:\t\t${IRed}not found!${Color_Off}" 42 | return 2 43 | fi 44 | else 45 | # Else let's find ADB 46 | if command -v adb &>/dev/null; then # Check if ADB is already installed (with Path) 47 | adb="adb" 48 | echo -e "${Color_Off}Using:\t\t\t${IBlue}Path adb${Color_Off}" 49 | elif [ -d "./adb" ]; then 50 | adb="./adb/platform-tools/adb.exe" 51 | echo -e "${Color_Off}Using:\t\t\t${IBlue}./adb/platform-tools/adb.exe${Color_Off}" 52 | elif [ -d "../adb" ]; then 53 | adb="../adb/platform-tools/adb.exe" 54 | echo -e "${Color_Off}Using:\t\t\t${IBlue}../adb/platform-tools/adb.exe${Color_Off}" 55 | else # ADB folder not found 56 | echo -e "${IRed}ADB not found!${Color_Off}" 57 | return 1 58 | fi 59 | 60 | # Restart ADB 61 | "$adb" kill-server 1>/dev/null 2>&1 62 | "$adb" start-server 1>/dev/null 2>&1 63 | 64 | if "$adb" get-state 1>/dev/null 2>/dev/null; then # Check if BlueStacks is running 65 | echo -e "${Color_Off}Emulator:\t\t${IBlue}BlueStacks${Color_Off}" 66 | else # BlueStacks not found 67 | "$adb" connect localhost:21503 1>/dev/null 2>/dev/null # Try to connect to memu 68 | if "$adb" get-state 1>/dev/null 2>/dev/null; then # Check if Memu is running 69 | echo -e "${Color_Off}Emulator:\t\t${IBlue}Memu${Color_Off}" 70 | echo -e "${Yellow}Memu is a liar! So config is not the true one, please send a capture of your settings.${Color_Off}" 71 | # Memu is doing magic with CPU, instead of CPU Cores it's separated CPUs, RAM is also IDK it's strange ... 72 | #$(($($adb shell "grep 'processor' /proc/cpuinfo | tail -n1 | tr -s ' ' | cut -d ' ' -f 2") + 1)) # Return number of processor 73 | else # Memu not found 74 | echo -e "${Color_Off}Emulator:\t\t${IRed}not found!${Color_Off}" 75 | return 2 76 | fi 77 | fi 78 | fi 79 | 80 | # Check config 81 | echo -n -e "${Color_Off}CPU Cores:${Color_Off}\t\t" 82 | cpuCores=$("$adb" shell "grep 'cpu cores' /proc/cpuinfo | uniq | tr -s ' ' | cut -d ' ' -f3") # Return number of CPU cores 83 | if [ "$cpuCores" -lt 2 ]; then 84 | echo -e "${IRed}$cpuCores${Color_Off}" 85 | elif [ "$cpuCores" -lt 4 ]; then 86 | echo -e "${IYellow}$cpuCores${Color_Off}" 87 | else echo -e "${IGreen}$cpuCores${Color_Off}"; fi 88 | 89 | echo -n -e "${Color_Off}RAM Total:${Color_Off}\t\t" 90 | memTotal=$("$adb" shell "grep 'MemTotal' /proc/meminfo | tr -s ' ' | cut -d ' ' -f 2") # Return memory capacity in kB 91 | if [ $((memTotal / 1048576)) -le 1 ]; then 92 | echo -e "${IRed}$(numfmt --from=iec --to=iec "${memTotal}K")${Color_Off}" 93 | elif [ $((memTotal / 1048576)) -le 2 ]; then 94 | echo -e "${IYellow}$(numfmt --from=iec --to=iec "${memTotal}K")${Color_Off}" 95 | else echo -e "${IGreen}$(numfmt --from=iec --to=iec "${memTotal}K")${Color_Off}"; fi 96 | 97 | echo -n -e "${Color_Off}Resolution:${Color_Off}\t\t" 98 | resolution=$("$adb" shell wm size | cut -d ' ' -f3) 99 | if [ "$resolution" = "1080x1920" ]; then 100 | echo -e "${IGreen}$resolution${Color_Off}" 101 | elif [ "$resolution" = "1920x1080" ]; then 102 | echo -e "${IYellow}$resolution${Color_Off}" 103 | else echo -e "${IRed}$resolution${Color_Off}"; fi 104 | 105 | if [ -n "$("$adb" shell pm list packages com.lilithgame.hgame.gp)" ]; then 106 | echo -e "${Color_Off}AFK Arena:\t\t${IGreen}installed${Color_Off}" 107 | else 108 | echo -e "${Color_Off}AFK Arena:\t\t${IRed}installed${Color_Off}" 109 | fi 110 | 111 | if [ -n "$("$adb" shell pm list packages com.lilithgames.hgame.gp.id)" ]; then 112 | echo -e "${Color_Off}AFK Arena Test Server:\t${IGreen}installed${Color_Off}" 113 | else 114 | echo -e "${Color_Off}AFK Arena Test Server:\t${IRed}not installed${Color_Off}" 115 | fi 116 | 117 | return 0 118 | } 119 | 120 | # ############################################################################## 121 | # Function Name : checkNetwork 122 | # Description : Check network speed with different size files. 123 | # Args : 124 | # ############################################################################## 125 | checkNetwork() { 126 | echo -e "${IWhite}Checking Network with a maximum of 5 seconds per request:${Color_Off}" 127 | 128 | output10G=$(curl -s --max-time 5 -4 -o /dev/null https://bouygues.testdebit.info/10G.iso -w "%{speed_download}") 129 | echo -e "${Color_Off}10GB average speed: $(checkNetwork_colorOutputSpeed "${output10G:-0}")${Color_Off}" 130 | 131 | output1G=$(curl -s --max-time 5 -4 -o /dev/null https://bouygues.testdebit.info/1G.iso -w "%{speed_download}") 132 | echo -e "${Color_Off}1GB average speed: $(checkNetwork_colorOutputSpeed "${output1G:-0}")${Color_Off}" 133 | 134 | output100M=$(curl -s --max-time 5 -4 -o /dev/null https://bouygues.testdebit.info/100M.iso -w "%{speed_download}") 135 | echo -e "${Color_Off}100MB average speed: $(checkNetwork_colorOutputSpeed "${output100M:-0}")${Color_Off}" 136 | 137 | echo 138 | echo -e "${Color_Off}Global average speed: $(checkNetwork_colorOutputSpeed $(((output10G + output1G + output100M) / 3)))${Color_Off} " 139 | } 140 | 141 | # ############################################################################## 142 | # Function Name : checkNetwork_colorOutputSpeed 143 | # Description : Color & format output speed 144 | # Args : 145 | # Return : Echo Speed colorized & formated 146 | # ############################################################################## 147 | checkNetwork_colorOutputSpeed() { 148 | if [ "$#" -ne 1 ]; then 149 | echo "Usage: checkNetwork_colorOutputSpeed " >&2 150 | return 1 151 | fi 152 | if [ $(($1 / 1048576)) -le 1 ]; then 153 | echo -e "${IRed}$(numfmt --to=iec "$1")/s${Color_Off}" 154 | elif [ $(($1 / 1048576)) -le 2 ]; then 155 | echo -e "${IYellow}$(numfmt --to=iec "$1")/s${Color_Off}" 156 | else echo -e "${IGreen}$(numfmt --to=iec "$1")/s${Color_Off}"; fi 157 | } 158 | 159 | # ############################################################################## 160 | # Function Name : killAll 161 | # Description : Kill everything linked to the script (Emulator & ADB) 162 | # ############################################################################## 163 | killAll() { 164 | # Bluestacks 4 & 5 165 | killAll_facto "Bluestacks" 166 | killAll_facto "BstkSVC" 167 | 168 | # Memu 169 | killAll_facto "MEmu" 170 | 171 | # Nox 172 | killAll_facto "Nox" 173 | 174 | # ADB 175 | killAll_facto "adb" 176 | } 177 | 178 | # ############################################################################## 179 | # Function Name : killAll_facto 180 | # Description : I hate to write the same line 10 times :) 181 | # ############################################################################## 182 | killAll_facto() { 183 | case "$(uname -s)" in # Check OS 184 | Darwin | Linux) # Mac / Linux 185 | ps | awk "/$1/,NF=1" | xargs kill -f 186 | ;; 187 | CYGWIN* | MINGW32* | MSYS* | MINGW*) # Windows 188 | KILL_PID=$(ps -W | grep -i "$1" | tr -s ' ' | cut -d ' ' -f2) 189 | if [ -n "$KILL_PID" ]; then 190 | echo "Killing $1 processes..." 191 | # Do not put quotes around $KILL_PID as kill won't kill every process returned 192 | /bin/kill -f $KILL_PID 193 | fi 194 | ;; 195 | esac 196 | } 197 | 198 | # ############################################################################## 199 | # Function Name : run 200 | # Description : Run all checks 201 | # ############################################################################## 202 | run() { 203 | checkEmulator 204 | echo 205 | checkNetwork 206 | } 207 | 208 | # ############################################################################## 209 | # Function Name : show_help 210 | # ############################################################################## 211 | show_help() { 212 | echo -e "${Color_Off}" 213 | echo -e " ___ _ _ _ _ " 214 | echo -e " / __| _ _ _ __ _ __ ___ _ _ | |_ /_\ ___ ___ (_) ___ | |_ " 215 | echo -e " \__ \ | || | | '_ \ | '_ \ / _ \ | '_| | _| / _ \ (_-< (_-< | | (_-< | _|" 216 | echo -e " |___/ \_,_| | .__/ | .__/ \___/ |_| \__| /_/ \_\ /__/ /__/ |_| /__/ \__|" 217 | echo -e " |_| |_| " 218 | echo 219 | echo -e "USAGE: ${IYellow}support_assist.sh ${ICyan}[OPTIONS]${Color_Off}" 220 | echo 221 | echo -e "DESCRIPTION" 222 | echo -e " Automate check to support assistance." 223 | echo -e " More info: https://github.com/zebscripts/AFK-Daily" 224 | echo 225 | echo -e "REMARKS" 226 | echo -e " Need to be run from AFK-Daily or tools folder." 227 | echo -e " Require the emulator and ADB to be running." 228 | echo 229 | echo -e "OPTIONS" 230 | echo -e " ${ICyan}-h${Color_Off}" 231 | echo -e " Show help." 232 | echo -e " ${ICyan}-e${Color_Off}" 233 | echo -e " Check Emulator." 234 | echo -e " ${ICyan}-k${Color_Off}" 235 | echo -e " Kill everything linked to the script (Emulator & ADB)." 236 | echo -e " ${ICyan}-n${Color_Off}" 237 | echo -e " Check Network." 238 | echo -e " Remark: May take a few seconds." 239 | } 240 | 241 | if [ -z "$1" ]; then 242 | run 243 | exit 0 244 | fi 245 | 246 | while getopts ":hekn" opt; do 247 | case $opt in 248 | h) 249 | show_help 250 | exit 0 251 | ;; 252 | e) 253 | checkEmulator 254 | ;; 255 | k) 256 | killAll 257 | ;; 258 | n) 259 | checkNetwork 260 | ;; 261 | \?) 262 | echo "$OPTARG : Invalid option" 263 | exit 1 264 | ;; 265 | esac 266 | done 267 | --------------------------------------------------------------------------------