From 9b37445f37face83b5ebac1bc8790657ae856cd7 Mon Sep 17 00:00:00 2001 From: kevingrillet Date: Mon, 27 Sep 2021 16:49:58 +0200 Subject: [PATCH 01/15] Add VIP & Campaign in config --- .tools/afk-faily.ext.sh | 262 --------------------------------------- _wiki/Config.md | 2 + afk-daily.sh | 266 +++++++++++++++++++++++++++++++++++++++- deploy.sh | 8 ++ lib/update_setup.sh | 2 + 5 files changed, 277 insertions(+), 263 deletions(-) diff --git a/.tools/afk-faily.ext.sh b/.tools/afk-faily.ext.sh index aa723af..f126290 100644 --- a/.tools/afk-faily.ext.sh +++ b/.tools/afk-faily.ext.sh @@ -6,268 +6,6 @@ # License : MIT # ############################################################################## -# ############################################################################## -# Section : Ranhorn -# ############################################################################## - -# ############################################################################## -# Function Name : oakInn -# Descripton : Collect Oak Inn -# ############################################################################## -oakInn() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn" >&2; fi - inputTapSleep 780 270 5 # Oak Inn - - _oakInn_COUNT=0 - until [ "$_oakInn_COUNT" -ge "$totalAmountOakRewards" ]; do - inputTapSleep 1050 950 # Friends - inputTapSleep 1025 400 5 # Top Friend - sleep 5 - - oakInn_tryCollectPresent - if [ "$oakRes" = 0 ]; then # If return value is still 0, no presents were found at first friend - # Switch friend and search again - inputTapSleep 1050 950 # Friends - inputTapSleep 1025 530 5 # Second friend - - oakInn_tryCollectPresent - if [ "$oakRes" = 0 ]; then # If return value is again 0, no presents were found at second friend - # Switch friend and search again - inputTapSleep 1050 950 # Friends - inputTapSleep 1025 650 5 # Third friend - - oakInn_tryCollectPresent - if [ "$oakRes" = 0 ]; then # If return value is still freaking 0, I give up - printInColor "WARN" "Couldn't collect Oak Inn presents, sowy." >&2 - break - fi - fi - fi - - sleep 2 - _oakInn_COUNT=$((_oakInn_COUNT + 1)) # Increment - done - - inputTapSleep 70 1810 3 - inputTapSleep 70 1810 0 - - wait - verifyHEX 20 1775 d49a61 "Attempted to collect Oak Inn presents." "Failed to collect Oak Inn presents." -} - -# ############################################################################## -# Function Name : oakInn_presentTab -# Descripton : Search available present tabs in Oak Inn -# ############################################################################## -oakInn_presentTab() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_presentTab" >&2; fi - oakInn_presentTabs=0 - if testColorOR 270 1800 c79663; then # 1 gift c79663 - oakInn_presentTabs=$((oakInn_presentTabs + 1000)) # Increment - fi - if testColorOR 410 1800 bb824f; then # 2 gift bb824f - oakInn_presentTabs=$((oakInn_presentTabs + 200)) # Increment - fi - if testColorOR 550 1800 af6e3b; then # 3 gift af6e3b - oakInn_presentTabs=$((oakInn_presentTabs + 30)) # Increment - fi - if testColorOR 690 1800 b57b45; then # 4 gift b57b45 - oakInn_presentTabs=$((oakInn_presentTabs + 4)) # Increment - fi -} - -# ############################################################################## -# Function Name : oakInn_searchPresent -# Descripton : Searches for a "good" present in oak Inn -# ############################################################################## -oakInn_searchPresent() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_searchPresent " >&2; fi - inputSwipe 400 1600 400 310 50 # Swipe all the way down - sleep 1 - - if testColorOR 540 990 833f0e; then # 1 red 833f0e blue 903da0 - inputTapSleep 540 990 3 # Tap present - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 800 a21a1a; then # 2 red a21a1a blue 9a48ab - inputTapSleep 540 800 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 610 aa2b27; then # 3 red aa2b27 blue b260aa - inputTapSleep 540 610 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 420 bc3f36; then # 4 red bc3f36 blue c58c7b - inputTapSleep 540 420 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 220 bb3734; then # 5 red bb3734 blue 9442a5 - inputTapSleep 540 220 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else # If no present found, search for other tabs - oakRes=0 - fi - fi - fi - fi - fi -} - -# ############################################################################## -# Function Name : oakInn_tryCollectPresent -# Descripton : Tries to collect a present from one Oak Inn friend -# ############################################################################## -oakInn_tryCollectPresent() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_tryCollectPresent" >&2; fi - oakInn_searchPresent # Search for a "good" present - if [ $oakRes = 0 ]; then - oakInn_presentTab # If no present found, search for other tabs - case $oakInn_presentTabs in - 0) - oakRes=0 - ;; - 4) - inputTapSleep 690 1800 3 - oakInn_searchPresent - ;; - 30) - inputTapSleep 550 1800 3 - oakInn_searchPresent - ;; - 34) - inputTapSleep 550 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - ;; - 200) - inputTapSleep 410 1800 3 - oakInn_searchPresent - ;; - 204) - inputTapSleep 410 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - ;; - 230) - inputTapSleep 410 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 550 1800 3 - oakInn_searchPresent - fi - ;; - 234) - inputTapSleep 410 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 550 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - fi - ;; - 1000) - inputTapSleep 270 1800 3 - oakInn_searchPresent - ;; - 1004) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - ;; - 1030) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 550 1800 3 - oakInn_searchPresent - fi - ;; - 1034) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 550 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - fi - ;; - 1200) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 410 1800 3 - oakInn_searchPresent - fi - ;; - 1204) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 410 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - fi - ;; - 1230) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 410 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 550 1800 3 - oakInn_searchPresent - fi - fi - ;; - 1234) - inputTapSleep 270 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 410 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 550 1800 3 - oakInn_searchPresent - if [ $oakRes = 0 ]; then - inputTapSleep 690 1800 3 - oakInn_searchPresent - fi - fi - fi - ;; - esac - fi -} - # ############################################################################## # Section : Test # ############################################################################## diff --git a/_wiki/Config.md b/_wiki/Config.md index d6968c4..b8da75b 100644 --- a/_wiki/Config.md +++ b/_wiki/Config.md @@ -17,6 +17,8 @@ The script acts depending on a set of variables. In order to change these, open | :-------------------- | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: | | `canOpenSoren` | `Boolean` | If `true`, player has permission to open Soren. | `false` | | `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` | +| `vipLevel` | `Number` | Current VIP level of the account. | `0` | +| `campaignStage` | `Number` | Current campaign stage of the account. | `0` | ## General diff --git a/afk-daily.sh b/afk-daily.sh index b3dc3ad..66c18ba 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -1469,6 +1469,264 @@ oakInnSpeedy() { "Failed to collect Oak Inn presents. [${cCyan}$_oakInn_COLLECTED${cNc}]" } +# ############################################################################## +# Function Name : oakInn_Old +# Descripton : Collect Oak Inn +# ############################################################################## +oakInn_Old() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn" >&2; fi + inputTapSleep 780 270 5 # Oak Inn + + _oakInn_COUNT=0 + until [ "$_oakInn_COUNT" -ge "$totalAmountOakRewards" ]; do + inputTapSleep 1050 950 # Friends + inputTapSleep 1025 400 5 # Top Friend + sleep 5 + + oakInn_tryCollectPresent + if [ "$oakRes" = 0 ]; then # If return value is still 0, no presents were found at first friend + # Switch friend and search again + inputTapSleep 1050 950 # Friends + inputTapSleep 1025 530 5 # Second friend + + oakInn_tryCollectPresent + if [ "$oakRes" = 0 ]; then # If return value is again 0, no presents were found at second friend + # Switch friend and search again + inputTapSleep 1050 950 # Friends + inputTapSleep 1025 650 5 # Third friend + + oakInn_tryCollectPresent + if [ "$oakRes" = 0 ]; then # If return value is still freaking 0, I give up + printInColor "WARN" "Couldn't collect Oak Inn presents, sowy." >&2 + break + fi + fi + fi + + sleep 2 + _oakInn_COUNT=$((_oakInn_COUNT + 1)) # Increment + done + + inputTapSleep 70 1810 3 + inputTapSleep 70 1810 0 + + wait + verifyHEX 20 1775 d49a61 "Attempted to collect Oak Inn presents." "Failed to collect Oak Inn presents." +} + +# ############################################################################## +# Function Name : oakInn_presentTab +# Descripton : Search available present tabs in Oak Inn +# ############################################################################## +oakInn_presentTab() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_presentTab" >&2; fi + oakInn_presentTabs=0 + if testColorOR 270 1800 c79663; then # 1 gift c79663 + oakInn_presentTabs=$((oakInn_presentTabs + 1000)) # Increment + fi + if testColorOR 410 1800 bb824f; then # 2 gift bb824f + oakInn_presentTabs=$((oakInn_presentTabs + 200)) # Increment + fi + if testColorOR 550 1800 af6e3b; then # 3 gift af6e3b + oakInn_presentTabs=$((oakInn_presentTabs + 30)) # Increment + fi + if testColorOR 690 1800 b57b45; then # 4 gift b57b45 + oakInn_presentTabs=$((oakInn_presentTabs + 4)) # Increment + fi +} + +# ############################################################################## +# Function Name : oakInn_searchPresent +# Descripton : Searches for a "good" present in oak Inn +# ############################################################################## +oakInn_searchPresent() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_searchPresent " >&2; fi + inputSwipe 400 1600 400 310 50 # Swipe all the way down + sleep 1 + + if testColorOR 540 990 833f0e; then # 1 red 833f0e blue 903da0 + inputTapSleep 540 990 3 # Tap present + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 800 a21a1a; then # 2 red a21a1a blue 9a48ab + inputTapSleep 540 800 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 610 aa2b27; then # 3 red aa2b27 blue b260aa + inputTapSleep 540 610 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 420 bc3f36; then # 4 red bc3f36 blue c58c7b + inputTapSleep 540 420 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 220 bb3734; then # 5 red bb3734 blue 9442a5 + inputTapSleep 540 220 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else # If no present found, search for other tabs + oakRes=0 + fi + fi + fi + fi + fi +} + +# ############################################################################## +# Function Name : oakInn_tryCollectPresent +# Descripton : Tries to collect a present from one Oak Inn friend +# ############################################################################## +oakInn_tryCollectPresent() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_tryCollectPresent" >&2; fi + oakInn_searchPresent # Search for a "good" present + if [ $oakRes = 0 ]; then + oakInn_presentTab # If no present found, search for other tabs + case $oakInn_presentTabs in + 0) + oakRes=0 + ;; + 4) + inputTapSleep 690 1800 3 + oakInn_searchPresent + ;; + 30) + inputTapSleep 550 1800 3 + oakInn_searchPresent + ;; + 34) + inputTapSleep 550 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + ;; + 200) + inputTapSleep 410 1800 3 + oakInn_searchPresent + ;; + 204) + inputTapSleep 410 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + ;; + 230) + inputTapSleep 410 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 550 1800 3 + oakInn_searchPresent + fi + ;; + 234) + inputTapSleep 410 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 550 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + fi + ;; + 1000) + inputTapSleep 270 1800 3 + oakInn_searchPresent + ;; + 1004) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + ;; + 1030) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 550 1800 3 + oakInn_searchPresent + fi + ;; + 1034) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 550 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + fi + ;; + 1200) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 410 1800 3 + oakInn_searchPresent + fi + ;; + 1204) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 410 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + fi + ;; + 1230) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 410 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 550 1800 3 + oakInn_searchPresent + fi + fi + ;; + 1234) + inputTapSleep 270 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 410 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 550 1800 3 + oakInn_searchPresent + if [ $oakRes = 0 ]; then + inputTapSleep 690 1800 3 + oakInn_searchPresent + fi + fi + fi + ;; + esac + fi +} + # ############################################################################## # Function Name : strengthenCrystal # Descripton : Strenghen Crystal @@ -1888,7 +2146,13 @@ run() { if checkToDo doStrengthenCrystal; then strengthenCrystal; fi if checkToDo doTempleOfAscension; then templeOfAscension; fi if checkToDo doCompanionPointsSummon; then nobleTavern; fi - if checkToDo doCollectOakPresents; then oakInnSpeedy; fi + if checkToDo doCollectOakPresents; then + if [ "$campaignStage" -ge 18 ] || [ "$campaignStage" -eq 0 ]; then + oakInnSpeedy; + else + oakInn_Old; + fi + fi # END if checkToDo doCollectQuestChests; then collectQuestChests; fi diff --git a/deploy.sh b/deploy.sh index 8ea41f3..3f678be 100644 --- a/deploy.sh +++ b/deploy.sh @@ -529,6 +529,8 @@ validateConfig() { printTask "Validating ${cCyan}$configFile${cNc}..." if [[ -z $canOpenSoren || -z \ $arenaHeroesOpponent || -z \ + $vipLevel || -z \ + $campaignStage || -z \ $waitForUpdate || -z \ $endAt || -z \ $maxCampaignFights || -z \ @@ -582,6 +584,12 @@ validateConfig() { printInfo "https://github.com/zebscripts/AFK-Daily/wiki/Config" exit fi + if [ "$vipLevel" -eq 0 ]; then + printWarn "vipLevel should be edited in ${cCyan}$configFile${cNc} to your current VIP level."; + fi + if [ "$campaignStage" -eq 0 ]; then + printWarn "campaignStage should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; + fi printSuccess "Passed!" } diff --git a/lib/update_setup.sh b/lib/update_setup.sh index 3e60ddb..2c38223 100644 --- a/lib/update_setup.sh +++ b/lib/update_setup.sh @@ -121,6 +121,8 @@ updateConfig() { # Player\n\ canOpenSoren=${canOpenSoren:-"false"}\n\ arenaHeroesOpponent=${arenaHeroesOpponent:-"5"}\n\ +vipLevel=${vipLevel:-"0"}\n\ +campaignStage=${campaignStage:-"0"}\n\ \n\ # General\n\ waitForUpdate=${waitForUpdate:-"true"}\n\ From 8918dee0ee9a3034dc07fc4ec1363936c969f5b0 Mon Sep 17 00:00:00 2001 From: Zebiano Date: Wed, 29 Sep 2021 22:03:31 +0100 Subject: [PATCH 02/15] Update Config.md --- _wiki/Config.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/_wiki/Config.md b/_wiki/Config.md index b8da75b..c70e24a 100644 --- a/_wiki/Config.md +++ b/_wiki/Config.md @@ -17,8 +17,8 @@ The script acts depending on a set of variables. In order to change these, open | :-------------------- | :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: | | `canOpenSoren` | `Boolean` | If `true`, player has permission to open Soren. | `false` | | `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` | -| `vipLevel` | `Number` | Current VIP level of the account. | `0` | -| `campaignStage` | `Number` | Current campaign stage of the account. | `0` | +| `vipLevel` | `Number` | Current account VIP level. | `0` | +| `campaignStage` | `String` | Current account campaign stage. | `0-0` | ## General @@ -42,29 +42,29 @@ The script acts depending on a set of variables. In order to change these, open ## Store -| Variable | Type | Description | Default | Image | +| Variable | Type | Description | Default | Image | | :------------------------- | :-------: | :----------------------------------------------------------------- | :-----: | :---------------------------------------------------------------------------------------------------------------------------: | -| `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) | -| `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) | -| `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) | -| `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) | +| `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) | +| `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) | +| `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) | +| `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) | | `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) | -| `buyStoreLimitedGoldOffer` | `Boolean` | If `true`, buys Limited offer for Gold. | `false` | ![Limited Gold Offer](https://user-images.githubusercontent.com/7203617/132167224-49b5dfb6-fce5-4a95-a702-9423ec23939e.png) | -| `buyStoreLimitedDiamOffer` | `Boolean` | If `true`, buys Limited offer for Diamonds. | `false` | ![Limited Diam Offer](https://user-images.githubusercontent.com/7203617/132167220-86102296-3e75-49f9-a7e1-cff87ff0f4f3.png) | +| `buyStoreLimitedGoldOffer` | `Boolean` | If `true`, buys Limited offer for Gold. | `false` | ![Limited Gold Offer](https://user-images.githubusercontent.com/7203617/132167224-49b5dfb6-fce5-4a95-a702-9423ec23939e.png) | +| `buyStoreLimitedDiamOffer` | `Boolean` | If `true`, buys Limited offer for Diamonds. | `false` | ![Limited Diam Offer](https://user-images.githubusercontent.com/7203617/132167220-86102296-3e75-49f9-a7e1-cff87ff0f4f3.png) | | `buyWeeklyGuild` | `Boolean` | If `true`, buys one Stone from Guild Coins once a Week. | `false` | | -| `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) | +| `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) | ## Towers -| Variable | Type | Description | Default | -| :------------------------------- | :-------: | :--------------------------------------------------------------- | :-----: | -| `doMainTower` | `Boolean` | If `true`, tries to battle in Main Tower | `true` | -| `doTowerOfLight` | `Boolean` | If `true`, tries to battle in Tower of Light | `true` | -| `doTheBrutalCitadel` | `Boolean` | If `true`, tries to battle in The Brutal Citadel | `true` | -| `doTheWorldTree` | `Boolean` | If `true`, tries to battle in The World Tree | `true` | -| `doCelestialSanctum` | `Boolean` | If `true`, tries to battle in Celestial Sanctum | `true` | -| `doTheForsakenNecropolis` | `Boolean` | If `true`, tries to battle in The Forsaken Necropolis | `true` | -| `doInfernalFortress` | `Boolean` | If `true`, tries to battle in InfernalFortress | `true` | +| Variable | Type | Description | Default | +| :------------------------ | :-------: | :---------------------------------------------------- | :-----: | +| `doMainTower` | `Boolean` | If `true`, tries to battle in Main Tower | `true` | +| `doTowerOfLight` | `Boolean` | If `true`, tries to battle in Tower of Light | `true` | +| `doTheBrutalCitadel` | `Boolean` | If `true`, tries to battle in The Brutal Citadel | `true` | +| `doTheWorldTree` | `Boolean` | If `true`, tries to battle in The World Tree | `true` | +| `doCelestialSanctum` | `Boolean` | If `true`, tries to battle in Celestial Sanctum | `true` | +| `doTheForsakenNecropolis` | `Boolean` | If `true`, tries to battle in The Forsaken Necropolis | `true` | +| `doInfernalFortress` | `Boolean` | If `true`, tries to battle in InfernalFortress | `true` | ## Campaign From f93355cfc4350fe588bc91de84e2f2b182a081c1 Mon Sep 17 00:00:00 2001 From: kevingrillet Date: Thu, 21 Oct 2021 10:17:14 +0200 Subject: [PATCH 03/15] Add campaignChapter - Add af-daily > requiredLevel - Deploy > checkConfig - Switch to campaignChapter and campaignStage --- _wiki/Config.md | 3 ++- afk-daily.sh | 37 ++++++++++++++++++++++++++++++++++++- deploy.sh | 4 ++++ lib/update_setup.sh | 1 + 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/_wiki/Config.md b/_wiki/Config.md index c70e24a..5c67e98 100644 --- a/_wiki/Config.md +++ b/_wiki/Config.md @@ -18,7 +18,8 @@ The script acts depending on a set of variables. In order to change these, open | `canOpenSoren` | `Boolean` | If `true`, player has permission to open Soren. | `false` | | `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` | | `vipLevel` | `Number` | Current account VIP level. | `0` | -| `campaignStage` | `String` | Current account campaign stage. | `0-0` | +| `campaignChapter` | `String` | Current account campaign chapter. | `0` | +| `campaignStage` | `String` | Current account campaign stage. | `0` | ## General diff --git a/afk-daily.sh b/afk-daily.sh index b893e19..2a3b1ba 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -317,6 +317,41 @@ readHEX() { HEX="${HEX// /}" } + +# ############################################################################## +# Function Name : requiredLevel +# Descripton : Gets pixel color +# Args : +# Output : if true, return 0, else 1 +# ############################################################################## +requiredLevel() { + if [ "$#" -ne 2 ]; then + echo "Usage: requiredLevel " >&2 + return + fi + if [ "$DEBUG" -ge 2 ]; then printInColor "DEBUG" "requiredLevel ${cPurple}$*${cNc}" >&2; fi + + # If nothing initialized, just ignore this test + if [ "$vipLevel" -eq 0 ] || [ "$campaignChapter" -eq 0 ] || [ "$campaignStage" -eq 0 ]; then + return 0 + else + # Check if VIP is asked & compare to player config vipLevel + if [ "$1" -ge 0 ] && [ "$vipLevel" -ge "$1" ]; then + return 0 + fi + # Check if Chapter is asked & compare to player config campaignChapter + if [ "$2" -ge 0 ] && [ "$campaignChapter" -ge "$1" ]; then + # I do not check if Stage is >0 because maybe we could just ask for a specific chapter + # Compare to player config campaignChapter + if [ "$campaignStage" -ge "$1" ]; then + return 0 + fi + fi + fi + + return 1 +} + # ############################################################################## # Function Name : startApp # Descripton : Starts AFK Arena @@ -2147,7 +2182,7 @@ run() { if checkToDo doTempleOfAscension; then templeOfAscension; fi if checkToDo doCompanionPointsSummon; then nobleTavern; fi if checkToDo doCollectOakPresents; then - if [ "$campaignStage" -ge 18 ] || [ "$campaignStage" -eq 0 ]; then + if requiredLevel 0 18 0; then oakInnSpeedy; else oakInn_Old; diff --git a/deploy.sh b/deploy.sh index 672a4a3..7ebcf63 100644 --- a/deploy.sh +++ b/deploy.sh @@ -143,6 +143,9 @@ checkConfig() { # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true @@ -530,6 +533,7 @@ validateConfig() { if [[ -z $canOpenSoren || -z \ $arenaHeroesOpponent || -z \ $vipLevel || -z \ + $campaignChapter || -z \ $campaignStage || -z \ $waitForUpdate || -z \ $endAt || -z \ diff --git a/lib/update_setup.sh b/lib/update_setup.sh index 2c38223..7e9e4f1 100644 --- a/lib/update_setup.sh +++ b/lib/update_setup.sh @@ -122,6 +122,7 @@ updateConfig() { canOpenSoren=${canOpenSoren:-"false"}\n\ arenaHeroesOpponent=${arenaHeroesOpponent:-"5"}\n\ vipLevel=${vipLevel:-"0"}\n\ +campaignChapter=${campaignChapter:-"0"}\n\ campaignStage=${campaignStage:-"0"}\n\ \n\ # General\n\ From 7d3b4d12c34e93f2395b68e32aa2413570e6083b Mon Sep 17 00:00:00 2001 From: kevingrillet Date: Fri, 22 Oct 2021 12:32:05 +0200 Subject: [PATCH 04/15] Fix #118 --- afk-daily.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/afk-daily.sh b/afk-daily.sh index 2a3b1ba..b5811ae 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -93,7 +93,6 @@ while getopts "e:fi:l:s:tv:w" opt; do done . "$INILOCATION$INIFILE" -doLootAfkChest2="$doLootAfkChest" # ############################################################################## # Section : Core Functions @@ -332,7 +331,7 @@ requiredLevel() { if [ "$DEBUG" -ge 2 ]; then printInColor "DEBUG" "requiredLevel ${cPurple}$*${cNc}" >&2; fi # If nothing initialized, just ignore this test - if [ "$vipLevel" -eq 0 ] || [ "$campaignChapter" -eq 0 ] || [ "$campaignStage" -eq 0 ]; then + if [ "$vipLevel" -eq 0 ] && [ "$campaignChapter" -eq 0 ] && [ "$campaignStage" -eq 0 ]; then return 0 else # Check if VIP is asked & compare to player config vipLevel @@ -2101,6 +2100,12 @@ fi # Remark : Can be skipped if you are already in the game # ############################################################################## init() { + # Init values + doLootAfkChest2="$doLootAfkChest" + if [ "$guildBattleType" = "quick" ] && ! requiredLevel 6 0 0; then + guildBattleType="challenge" + fi + closeApp sleep 0.5 startApp From 43c8d9ec2964deb7964f6934281df332c6a1cdd0 Mon Sep 17 00:00:00 2001 From: kevingrillet Date: Mon, 25 Oct 2021 08:08:55 +0200 Subject: [PATCH 05/15] Fix --- afk-daily.sh | 4 ++-- deploy.sh | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/afk-daily.sh b/afk-daily.sh index c185235..df8a526 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -343,11 +343,11 @@ requiredLevel() { return 0 else # Check if VIP is asked & compare to player config vipLevel - if [ "$1" -ge 0 ] && [ "$vipLevel" -ge "$1" ]; then + if [ "$1" -gt 0 ] && [ "$vipLevel" -ge "$1" ]; then return 0 fi # Check if Chapter is asked & compare to player config campaignChapter - if [ "$2" -ge 0 ] && [ "$campaignChapter" -ge "$1" ]; then + if [ "$2" -gt 0 ] && [ "$campaignChapter" -ge "$1" ]; then # I do not check if Stage is >0 because maybe we could just ask for a specific chapter # Compare to player config campaignChapter if [ "$campaignStage" -ge "$1" ]; then diff --git a/deploy.sh b/deploy.sh index ff8b66d..1d1b74b 100644 --- a/deploy.sh +++ b/deploy.sh @@ -595,6 +595,9 @@ validateConfig() { if [ "$campaignStage" -eq 0 ]; then printWarn "campaignStage should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; fi + if [ "$campaignChapter" -eq 0 ]; then + printWarn "campaignChapter should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; + fi printSuccess "Passed!" } From bedc2b3649c06eed4a0ded53871442c15ad3ae21 Mon Sep 17 00:00:00 2001 From: kevingrillet Date: Mon, 25 Oct 2021 08:12:24 +0200 Subject: [PATCH 06/15] Update wiki --- _wiki/Config.md | 9 +++++++++ _wiki/Contribute.md | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/_wiki/Config.md b/_wiki/Config.md index ac7aa33..794cd79 100644 --- a/_wiki/Config.md +++ b/_wiki/Config.md @@ -117,6 +117,9 @@ The script acts depending on a set of variables. In order to change these, open # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true @@ -195,6 +198,9 @@ Need to be run with `-f` flag! # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true @@ -271,6 +277,9 @@ doCollectMerchantFreebies=false # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true diff --git a/_wiki/Contribute.md b/_wiki/Contribute.md index 7e10c51..2de2986 100644 --- a/_wiki/Contribute.md +++ b/_wiki/Contribute.md @@ -291,6 +291,9 @@ Some other useful documentation: # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=false @@ -367,6 +370,9 @@ doCollectMerchantFreebies=false # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true @@ -443,6 +449,9 @@ doCollectMerchantFreebies=false # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true @@ -519,6 +528,9 @@ doCollectMerchantFreebies=false # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true @@ -595,6 +607,9 @@ doCollectMerchantFreebies=false # Player canOpenSoren=false arenaHeroesOpponent=5 +vipLevel=0 +campaignChapter=0 +campaignStage=0 # General waitForUpdate=true From ee0ef4d3de3244de52e76df81614d02c0ba44543 Mon Sep 17 00:00:00 2001 From: Zebiano Date: Tue, 26 Oct 2021 00:38:49 +0100 Subject: [PATCH 07/15] Update: Oak Inn function checks Add: Info to terminal Update: Format files --- _wiki/Config.md | 4 ++-- afk-daily.sh | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/_wiki/Config.md b/_wiki/Config.md index 794cd79..bf29ad0 100644 --- a/_wiki/Config.md +++ b/_wiki/Config.md @@ -18,8 +18,8 @@ The script acts depending on a set of variables. In order to change these, open | `canOpenSoren` | `Boolean` | If `true`, player has permission to open Soren. | `false` | | `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` | | `vipLevel` | `Number` | Current account VIP level. | `0` | -| `campaignChapter` | `String` | Current account campaign chapter. | `0` | -| `campaignStage` | `String` | Current account campaign stage. | `0` | +| `campaignChapter` | `Number` | Current account campaign chapter. | `0` | +| `campaignStage` | `Number` | Current account campaign stage. | `0` | ## General diff --git a/afk-daily.sh b/afk-daily.sh index df8a526..64162d2 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -62,7 +62,7 @@ while getopts "ce:fi:l:s:tv:w" opt; do IFS=',' for i in $OPTARG; do case "$i" in - "hoe") eventHoe=true;; + "hoe") eventHoe=true ;; esac done IFS=$buIFS @@ -324,7 +324,6 @@ readHEX() { HEX="${HEX// /}" } - # ############################################################################## # Function Name : requiredLevel # Descripton : Gets pixel color @@ -2197,10 +2196,16 @@ run() { if checkToDo doTempleOfAscension; then templeOfAscension; fi if checkToDo doCompanionPointsSummon; then nobleTavern; fi if checkToDo doCollectOakPresents; then - if requiredLevel 0 18 0; then - oakInnSpeedy; + # Check if Oak Inn is unlocked + if requiredLevel 0 5 0; then + # Check which oakInn collection type to use + if requiredLevel 0 17 0; then + oakInnSpeedy + else + oakInn_Old + fi else - oakInn_Old; + echo "Your Campaign level is not high enough to collect Oak Inn presents." fi fi @@ -2217,6 +2222,9 @@ run() { printInColor "INFO" "Starting script... ($(date))" if [ "$DEBUG" -gt 0 ]; then printInColor "INFO" "Debug: ${cBlue}ON${cNc} [${cCyan}$DEBUG${cNc}]"; fi +if [ "$vipLevel" -gt 0 ]; then printInColor "INFO" "VIP Level: ${cBlue}$vipLevel${cNc}"; else printInColor "INFO" "VIP Level: ${cBlue}Not set${cNc}"; fi +if [ "$campaignChapter " -gt 0 ]; then printInColor "INFO" "Campaign Chapter: ${cBlue}$campaignChapter ${cNc}"; else printInColor "INFO" "Campaign Chpater: ${cBlue}Not set${cNc}"; fi +if [ "$campaignStage " -gt 0 ]; then printInColor "INFO" "Campaign Stage: ${cBlue}$campaignStage ${cNc}"; else printInColor "INFO" "Campaign Stage: ${cBlue}Not set${cNc}"; fi if [ "$forceFightCampaign" = true ]; then printInColor "INFO" "Fight Campaign: ${cBlue}ON${cNc}"; else printInColor "INFO" "Fight Campaign: ${cBlue}OFF${cNc}"; fi if [ "$forceWeekly" = true ]; then printInColor "INFO" "Weekly: ${cBlue}ON${cNc}"; else printInColor "INFO" "Weekly: ${cBlue}OFF${cNc}"; fi if [ "$testServer" = true ]; then printInColor "INFO" "Test server: ${cBlue}ON${cNc}"; fi From 066751e8968ee43021a286c50fca41843e19176b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A3o=20Barros?= Date: Sat, 30 Oct 2021 12:16:41 +0100 Subject: [PATCH 08/15] Update deploy.sh --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 1d1b74b..c0d1841 100644 --- a/deploy.sh +++ b/deploy.sh @@ -590,7 +590,7 @@ validateConfig() { exit fi if [ "$vipLevel" -eq 0 ]; then - printWarn "vipLevel should be edited in ${cCyan}$configFile${cNc} to your current VIP level."; + printWarn "vipLevel is not defined in the config file ${cCyan}$configFile${cNc}."; fi if [ "$campaignStage" -eq 0 ]; then printWarn "campaignStage should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; From f891639c1f46f62dbe6dcf3774dd1a6483e4405c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A3o=20Barros?= Date: Sat, 30 Oct 2021 12:16:50 +0100 Subject: [PATCH 09/15] Update deploy.sh --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index c0d1841..615bfd7 100644 --- a/deploy.sh +++ b/deploy.sh @@ -593,7 +593,7 @@ validateConfig() { printWarn "vipLevel is not defined in the config file ${cCyan}$configFile${cNc}."; fi if [ "$campaignStage" -eq 0 ]; then - printWarn "campaignStage should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; + printWarn "campaignStage is not defined in the config file ${cCyan}$configFile${cNc}."; fi if [ "$campaignChapter" -eq 0 ]; then printWarn "campaignChapter should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; From 1ea8b8430c27793dc6ffd122a1221751277ea13d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A3o=20Barros?= Date: Sat, 30 Oct 2021 12:16:56 +0100 Subject: [PATCH 10/15] Update deploy.sh --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 615bfd7..feaa9ae 100644 --- a/deploy.sh +++ b/deploy.sh @@ -596,7 +596,7 @@ validateConfig() { printWarn "campaignStage is not defined in the config file ${cCyan}$configFile${cNc}."; fi if [ "$campaignChapter" -eq 0 ]; then - printWarn "campaignChapter should be edited in ${cCyan}$configFile${cNc} to your current campaign stage."; + printWarn "campaignChapter is not defined in the config file ${cCyan}$configFile${cNc}."; fi printSuccess "Passed!" } From dafa715df5564abab404f7196f4093e6af4650a6 Mon Sep 17 00:00:00 2001 From: kevingrillet Date: Sat, 30 Oct 2021 15:36:41 +0200 Subject: [PATCH 11/15] Few fixes Still WIP --- afk-daily.sh | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/afk-daily.sh b/afk-daily.sh index 10f6e80..82c317c 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -331,7 +331,7 @@ readHEX() { # Output : if true, return 0, else 1 # ############################################################################## requiredLevel() { - if [ "$#" -ne 2 ]; then + if [ "$#" -ne 3 ]; then echo "Usage: requiredLevel " >&2 return fi @@ -346,10 +346,9 @@ requiredLevel() { return 0 fi # Check if Chapter is asked & compare to player config campaignChapter - if [ "$2" -gt 0 ] && [ "$campaignChapter" -ge "$1" ]; then - # I do not check if Stage is >0 because maybe we could just ask for a specific chapter - # Compare to player config campaignChapter - if [ "$campaignStage" -ge "$1" ]; then + if [ "$2" -gt 0 ] && [ "$campaignChapter" -ge "$2" ]; then + # Check if Stage is asked & compare to player config campaignStage + if [ "$3" -gt 0 ] && [ "$campaignStage" -ge "$3" ]; then return 0 fi fi @@ -2116,9 +2115,6 @@ fi init() { # Init values doLootAfkChest2="$doLootAfkChest" - if [ "$guildBattleType" = "quick" ] && ! requiredLevel 6 0 0; then - guildBattleType="challenge" - fi closeApp sleep 0.5 @@ -2176,10 +2172,16 @@ run() { # DARK FOREST TAB switchTab "Dark Forest" - if checkToDo doSoloBounties; then - soloBounties - if checkToDo doTeamBounties; then teamBounties; fi - elif checkToDo doTeamBounties; then teamBounties true; fi + if [ "$doSoloBounties" = true ] || [ "$doTeamBounties" = true ]; then + if requiredLevel 6 0 0; then + if checkToDo doSoloBounties; then + soloBounties + if checkToDo doTeamBounties; then teamBounties; fi + elif checkToDo doTeamBounties; then teamBounties true; fi + else + printInColor "INFO" "Your VIP level is not high enough to use Autofill in Bounties." + fi + fi if checkToDo doArenaOfHeroes; then arenaOfHeroes if checkToDo doLegendsTournament; then legendsTournament; fi @@ -2189,8 +2191,21 @@ run() { # RANHORN TAB switchTab "Ranhorn" if checkToDo doGuildHunts; then - guildHunts - if checkToDo doTwistedRealmBoss; then twistedRealmBoss; fi + if [ "$guildBattleType" = "quick" ] && requiredLevel 6 0 0; then + guildHunts + if requiredLevel 0 13 1; then + if checkToDo doTwistedRealmBoss; then twistedRealmBoss; fi + else + printInColor "INFO" "You still haven't unlocked Twisted Realms." + fi + else + printInColor "INFO" "Your VIP level is not high enough to run quick battles in Guild Bosses." + if requiredLevel 0 13 1; then + if checkToDo doTwistedRealmBoss; then twistedRealmBoss true; fi + else + printInColor "INFO" "You still haven't unlocked Twisted Realms." + fi + fi elif checkToDo doTwistedRealmBoss; then twistedRealmBoss true; fi if checkToDo doBuyFromStore; then if [ "$testServer" = true ]; then @@ -2202,9 +2217,9 @@ run() { if checkToDo doCompanionPointsSummon; then nobleTavern; fi if checkToDo doCollectOakPresents; then # Check if Oak Inn is unlocked - if requiredLevel 0 5 0; then + if requiredLevel 0 5 1; then # Check which oakInn collection type to use - if requiredLevel 0 17 0; then + if requiredLevel 0 17 1; then oakInnSpeedy else oakInn_Old From f20be7c136c2c9f9d72b1ff217a0b697c6639bd2 Mon Sep 17 00:00:00 2001 From: Zebiano Date: Mon, 17 Jan 2022 00:07:50 +0000 Subject: [PATCH 12/15] Update: `oakInnSpeedy()` to `oakInn_Speedy()` --- afk-daily.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/afk-daily.sh b/afk-daily.sh index 3c8147f..613f717 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -114,9 +114,12 @@ done # Output : return 0/1 # ############################################################################## checkToDo() { + # Check if variable is false if [ "$(eval echo \$"$1")" = false ]; then return 1 fi + + # Increment tries if necessary if [ "$1" = "$currentPos" ]; then tries=$((tries + 1)) printInColor "DEBUG" "checkToDo > $currentPos [$tries]" @@ -125,6 +128,8 @@ checkToDo() { currentPos="$1" tries=0 fi + + # Check if script should retry operation if [ $tries -lt 3 ]; then return 0 else @@ -1497,11 +1502,11 @@ nobleTavern() { } # ############################################################################## -# Function Name : oakInnSpeedy +# Function Name : oakInn_Speedy # Descripton : Collect Oak Inn faster than oakInn() # Concept : https://github.com/Fortigate/AFK-Daily/blob/master/deploy.sh > collectInnGifts() # ############################################################################## -oakInnSpeedy() { +oakInn_Speedy() { if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn" >&2; fi inputTapSleep 670 320 5 # Oak Inn printInColor "INFO" "Searching for presents to collect..." @@ -2245,7 +2250,7 @@ run() { if requiredLevel 0 5 1; then # Check which oakInn collection type to use if requiredLevel 0 17 1; then - oakInnSpeedy + oakInn_Speedy else oakInn_Old fi From 6dd43679cec60e5dfcbba5e1b687f9b0945d1906 Mon Sep 17 00:00:00 2001 From: Zebiano Date: Fri, 28 Jan 2022 01:30:28 +0000 Subject: [PATCH 13/15] Add: `checkRequirements` function Update: `requiredLevel` function WIP: Pushing changes to not lose them --- afk-daily.sh | 68 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/afk-daily.sh b/afk-daily.sh index 83c66ca..767c489 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -339,35 +339,43 @@ readHEX() { # ############################################################################## # Function Name : requiredLevel -# Descripton : Gets pixel color +# Descripton : Checks if Player has required VIP and Chapter/Stage levels # Args : -# Output : if true, return 0, else 1 +# Output : If true return 0, else 1 # ############################################################################## requiredLevel() { + # Check amount of arguments if [ "$#" -ne 3 ]; then echo "Usage: requiredLevel " >&2 return fi if [ "$DEBUG" -ge 2 ]; then printInColor "DEBUG" "requiredLevel ${cPurple}$*${cNc}" >&2; fi - # If nothing initialized, just ignore this test - if [ "$vipLevel" -eq 0 ] && [ "$campaignChapter" -eq 0 ] && [ "$campaignStage" -eq 0 ]; then - return 0 - else - # Check if VIP is asked & compare to player config vipLevel - if [ "$1" -gt 0 ] && [ "$vipLevel" -ge "$1" ]; then + if [ "$1" -gt 0 ] && [ "$2" -gt 0 ]; then # Both VIP and Chapter matter + if [ "$vipLevel" -ge "$1" ] || [ "$campaignChapter" -ge "$2" ]; then # Player VIP and Chapter high enough + if [ "$3" -gt 0 ] && [ "$campaignStage" -ge "$3" ]; then # Player stage high enough + return 0 + else + return 1 + fi + return 0 + fi + elif [ "$1" -gt 0 ]; then # Only VIP matters + if [ "$vipLevel" -ge "$1" ]; then # Player VIP high enough return 0 fi - # Check if Chapter is asked & compare to player config campaignChapter - if [ "$2" -gt 0 ] && [ "$campaignChapter" -ge "$2" ]; then - # Check if Stage is asked & compare to player config campaignStage - if [ "$3" -gt 0 ] && [ "$campaignStage" -ge "$3" ]; then + elif [ "$2" -gt 0 ]; then # Only Chapter matters + if [ "$campaignChapter" -ge "$2" ]; then # Player chapter high enough + if [ "$3" -gt 0 ] && [ "$campaignStage" -ge "$3" ]; then # Player stage high enough return 0 + else + return 1 fi + return 0 + else + return 1 fi fi - - return 1 } # ############################################################################## @@ -2140,6 +2148,37 @@ fi # Section : Script Start # ############################################################################## +# ############################################################################## +# Function Name : checkRequirements +# Descripton : Checks if it's possible to run current config with given VIP +# level, Chapter and Stage. Any new config entry that is +# dependent on one of the three must be checked here. Let's +# players know that the script cannot run a feature if necessary. +# ############################################################################## +checkRequirements() { + # endAt + # guildBattleType + # Maybe a store item + # doCollectFriendsAndMercenaries (should be split into two differnt things to do or maybe mercenaries should be removed) + # doSoloBounties (collect all or not) + # doTeamBounties (collect all or not) + # doArenaOfHeroes (skip battles) + # doLegendsTournament (maybe...?) + # doKingsTower + # doGuildHunts (Quick battles) + # doTwistedRealmBoss + # doTempleOfAscension (when do you unlock the temple?) + # doCompanionPointsSummon (when do you unlock the tavern?) + # doCollectOakPresents (if at all, and then speedy or not) + + # Check if Oak Inn is unlocked + if ! requiredLevel 0 5 0; then + echo "Your Campaign level is not high enough to collect Oak Inn presents." + # A message for sure, and change config variables if necessary! + # TODO: Needs to be checked again in the oak_inn function to know which function to run (speedy or not). Or have a variable that saves this. Eh. + fi +} + # ############################################################################## # Function Name : init # Descripton : Init the script (close/start app, preload, wait for update) @@ -2287,6 +2326,7 @@ if [ "$eventHoe" = true ]; then activeEvents="${activeEvents}| Heroes of Esperia if [ -n "$activeEvents" ]; then printInColor "INFO" "Active event(s): ${cBlue}${activeEvents}${cNc}"; fi echo +if [ "$vipLevel" -ne 0 ] && [ "$campaignChapter" -ne 0 ] && [ "$campaignStage" -ne 0 ]; then checkRequirements; fi init run From da73cf977cfe5eee3de2d7a4e24556d9e8b2cb3f Mon Sep 17 00:00:00 2001 From: Zebiano Date: Mon, 31 Jan 2022 01:00:17 +0000 Subject: [PATCH 14/15] Add: Logic for various `requiredLevel` checks Update: Default `endAt` entry is now `campaign` Update: `eventHoe=true` Add: `runOakSpeedy` variable for the script to know when to run `oakInn_Speedy` --- _wiki/Config.md | 14 ++++----- afk-daily.sh | 73 ++++++++++++++++++++++++++++++++------------- lib/update_setup.sh | 2 +- tools/deploy.ext.sh | 6 ++-- 4 files changed, 64 insertions(+), 31 deletions(-) diff --git a/_wiki/Config.md b/_wiki/Config.md index d0f930a..f1de0c3 100644 --- a/_wiki/Config.md +++ b/_wiki/Config.md @@ -23,12 +23,12 @@ The script acts depending on a set of variables. In order to change these, open ## General -| Variable | Type | Description | Default | -| :-------------------- | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------: | -| `waitForUpdate` | `Boolean` | If `true`, waits until the in-game update has finished. | `true` | -| `endAt` | `String` | Script will end at the chosen location. Possible entries: `oak`, `soren`, `mail`, `chat`, `tavern`, `merchants`, `campaign`, `championship`, `closeApp`. | `championship` | -| `guildBattleType` | `String` | Choose type of Guild fight. Possible entries: `quick` or `challenge`. | `quick` | -| `allowCrystalLevelUp` | `Boolean` | If `true`, allows the Resonating Crystal to be leveled up. | `true` | +| Variable | Type | Description | Default | +| :-------------------- | :-------: | :------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------: | +| `waitForUpdate` | `Boolean` | If `true`, waits until the in-game update has finished. | `true` | +| `endAt` | `String` | Script will end at the chosen location. Possible entries: `oak`, `soren`, `mail`, `chat`, `tavern`, `merchants`, `campaign`, `championship`, `closeApp`. | `campaign` | +| `guildBattleType` | `String` | Choose type of Guild fight. Possible entries: `quick` or `challenge`. | `quick` | +| `allowCrystalLevelUp` | `Boolean` | If `true`, allows the Resonating Crystal to be leveled up. | `true` | ## Repetitions @@ -124,7 +124,7 @@ campaignStage=0 # General waitForUpdate=true -endAt=championship +endAt=campaign guildBattleType=quick allowCrystalLevelUp=false diff --git a/afk-daily.sh b/afk-daily.sh index a7a562d..7a3e652 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -22,7 +22,7 @@ DEBUG=0 # DEBUG >= 9 Show tap calls DEFAULT_DELTA=3 # Default delta for colors DEFAULT_SLEEP=2 # equivalent to wait (default 2) -eventHoe=false # Set to `true` if "Heroes of Esperia" event is live +eventHoe=true # Set to `true` if "Heroes of Esperia" event is live totalAmountOakRewards=3 # Do not modify @@ -42,6 +42,7 @@ testServer=false SCREENSHOTLOCATION="/storage/emulated/0/scripts/afk-arena/screen.dump" withColors=true hexdumpSu=false +runOakSpeedy=false # Colors cNc="\033[0m" # Text Reset @@ -375,6 +376,8 @@ requiredLevel() { else return 1 fi + else + return 1 fi } @@ -1513,12 +1516,12 @@ nobleTavern() { } # ############################################################################## -# Function Name : oakInnSpeedy +# Function Name : oakInn_Speedy # Descripton : Collect Oak Inn faster than oakInn() # Concept : https://github.com/Fortigate/AFK-Daily/blob/master/deploy.sh > collectInnGifts() # ############################################################################## -oakInnSpeedy() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInnSpeedy" >&2; fi +oakInn_Speedy() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_Speedy" >&2; fi inputTapSleep 670 320 5 # Oak Inn printInColor "INFO" "Searching for presents to collect..." _oakInn_ROW_COUNT=0 @@ -2149,9 +2152,42 @@ fi # players know that the script cannot run a feature if necessary. # ############################################################################## checkRequirements() { + # Player not even in chapter 2-1 + if ! requiredLevel 0 2 1; then + printInColor "ERROR" "You haven't even finished the tutorial yet... Please run this script after doing that." + exit + fi + + # --- CONFIG --- # # endAt + if [ "$endAt" = "oak" ] && ! requiredLevel 0 5 1; then + printInColor "WARN" "Your Chapter/Stage level is not high enough for 'endAt' to be 'oak'! Using 'campaign' instead." + guildBattleType="campaign" + elif [ "$endAt" = "championship" ] && ! requiredLevel 0 3 1; then + printInColor "WARN" "Your Chapter/Stage level is not high enough for 'endAt' to be 'championship'! Using 'campaign' instead." + guildBattleType="campaign" + fi + # guildBattleType - # Maybe a store item + if [ "$guildBattleType" = "quick" ] && ! requiredLevel 6 0 0; then + printInColor "WARN" "Your VIP level is not high enough for 'guildBattleType' to be 'quick'! Using 'challenge' instead." + guildBattleType="challenge" + fi + + # buyStorePoeCoins: Yet to find out when they unlock! Maybe when the Oak Inn unlocks? + + # buyStoreLimitedElementalShard + if [ "$buyStoreLimitedElementalShard" = true ] && ! requiredLevel 0 22 1; then + printInColor "WARN" "Your Chapter/Stage level is not high enough for 'buyStoreLimitedElementalShard' to be 'true'! Using 'false' instead." + buyStoreLimitedElementalShard=false + fi + + # buyStoreLimitedElementalCore + if [ "$buyStoreLimitedElementalCore" = true ] && ! requiredLevel 0 24 1; then + printInColor "WARN" "Your Chapter/Stage level is not high enough for 'buyStoreLimitedElementalCore' to be 'true'! Using 'false' instead." + buyStoreLimitedElementalCore=false + fi + # doCollectFriendsAndMercenaries (should be split into two differnt things to do or maybe mercenaries should be removed) # doSoloBounties (collect all or not) # doTeamBounties (collect all or not) @@ -2163,13 +2199,16 @@ checkRequirements() { # doTempleOfAscension (when do you unlock the temple?) # doCompanionPointsSummon (when do you unlock the tavern?) # doCollectOakPresents (if at all, and then speedy or not) - - # Check if Oak Inn is unlocked - if ! requiredLevel 0 5 0; then - echo "Your Campaign level is not high enough to collect Oak Inn presents." - # A message for sure, and change config variables if necessary! - # TODO: Needs to be checked again in the oak_inn function to know which function to run (speedy or not). Or have a variable that saves this. Eh. + if [ "$doCollectOakPresents" = true ]; then + if ! requiredLevel 0 5 1; then + printInColor "WARN" "Your Chapter/Stage level is not high enough for 'doCollectOakPresents' to be 'true'! Using 'false' instead." + doCollectOakPresents=false + elif requiredLevel 0 17 1; then + runOakSpeedy=true + fi fi + + # --- GAME? --- # } # ############################################################################## @@ -2281,16 +2320,10 @@ run() { if checkToDo doTempleOfAscension; then templeOfAscension; fi if checkToDo doCompanionPointsSummon; then nobleTavern; fi if checkToDo doCollectOakPresents; then - # Check if Oak Inn is unlocked - if requiredLevel 0 5 1; then - # Check which oakInn collection type to use - if requiredLevel 0 17 1; then - oakInnSpeedy - else - oakInn_Old - fi + if [ "$runOakSpeedy" = true ]; then + oakInn_Speedy else - echo "Your Campaign level is not high enough to collect Oak Inn presents." + oakInn_Old fi fi diff --git a/lib/update_setup.sh b/lib/update_setup.sh index 8f0ef25..52ad06c 100644 --- a/lib/update_setup.sh +++ b/lib/update_setup.sh @@ -124,7 +124,7 @@ campaignStage=${campaignStage:-"0"}\n\ \n\ # General\n\ waitForUpdate=${waitForUpdate:-"true"}\n\ -endAt=${endAt:-"championship"}\n\ +endAt=${endAt:-"campaign"}\n\ guildBattleType=${guildBattleType:-"quick"}\n\ allowCrystalLevelUp=${allowCrystalLevelUp:-"true"}\n\ \n\ diff --git a/tools/deploy.ext.sh b/tools/deploy.ext.sh index 5e8f362..63db7f9 100644 --- a/tools/deploy.ext.sh +++ b/tools/deploy.ext.sh @@ -26,7 +26,7 @@ arenaHeroesOpponent=5 # General waitForUpdate=true -endAt="championship" +endAt="campaign" guildBattleType=quick allowCrystalLevelUp=false @@ -86,7 +86,7 @@ doCollectOakPresents=true doCollectQuestChests=true doCollectMail=true doCollectMerchantFreebies=false -' >$configFile +' >"$configFile" printSuccess "Created!\n" printInfo "Please edit ${cCyan}$configFile${cNc} if necessary and run this script again." exit @@ -98,7 +98,7 @@ doCollectMerchantFreebies=false # Description : Checks for every necessary variable that needs to be defined in $configFile # ############################################################################## validateConfig() { - source $configFile + source "$configFile" printTask "Validating ${cCyan}$configFile${cNc}..." if [[ -z $canOpenSoren || -z \ $arenaHeroesOpponent || -z \ From 442282d56890dc574339b2296b0597cb5fece494 Mon Sep 17 00:00:00 2001 From: Zebiano Date: Mon, 31 Jan 2022 02:34:45 +0000 Subject: [PATCH 15/15] Fix: HEX values on `oakInn_Old` Update: Timings Update: Function `requiredLevel()` doesn't differentiate between stage `0` and `1`, which means it's possible to set a VIP and Chapter level without setting a stage --- .markdownlint.json | 5 + _wiki/AFK Arena requirements.md | 13 +-- afk-daily.sh | 183 +++++++++++++++++--------------- 3 files changed, 104 insertions(+), 97 deletions(-) create mode 100644 .markdownlint.json diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..50abd63 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,5 @@ +{ + "MD041": false, + "MD013": false, + "MD033": false +} diff --git a/_wiki/AFK Arena requirements.md b/_wiki/AFK Arena requirements.md index a83ccbb..0b59cc2 100644 --- a/_wiki/AFK Arena requirements.md +++ b/_wiki/AFK Arena requirements.md @@ -1,14 +1,9 @@ -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: +Please keep the following things in mind: -- **Mercenaries:** Stage 6-40 -- **Quick-battle Guild:** VIP 6 or higher -- **Skip battle in the arena:** VIP 6 or higher -- **Bounty Autofill and Dispatch:** VIP 6 or higher -- **Auto-fill Heroes in quests:** VIP 6 or higher (or stage 12-40) -- **Twisted Realm:** Stage 14-40 -- **Factional Towers:** Stage 15-1 +- Game language needs to be "English" +- Make sure there are no "Don't remind me again" pop-up messages -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. +Also, 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. A feature is being developed where the script decides on its own which features it is able to run depending on your VIP and Chapter/Stage levels. However, since it's still in development, please take a look at the necessary levels on [this page](https://github.com/zebscripts/AFK-Daily/discussions/124) and decide for yourself what you want to the script to run.
diff --git a/afk-daily.sh b/afk-daily.sh index 7a3e652..b778c40 100644 --- a/afk-daily.sh +++ b/afk-daily.sh @@ -354,10 +354,12 @@ requiredLevel() { if [ "$1" -gt 0 ] && [ "$2" -gt 0 ]; then # Both VIP and Chapter matter if [ "$vipLevel" -ge "$1" ] || [ "$campaignChapter" -ge "$2" ]; then # Player VIP and Chapter high enough - if [ "$3" -gt 0 ] && [ "$campaignStage" -ge "$3" ]; then # Player stage high enough - return 0 - else - return 1 + if [ "$3" -gt 1 ]; then # Player stage set + if [ "$campaignStage" -ge "$3" ]; then # Player stage high enough + return 0 + else + return 1 + fi fi return 0 fi @@ -365,12 +367,14 @@ requiredLevel() { if [ "$vipLevel" -ge "$1" ]; then # Player VIP high enough return 0 fi - elif [ "$2" -gt 0 ]; then # Only Chapter matters - if [ "$campaignChapter" -ge "$2" ]; then # Player chapter high enough - if [ "$3" -gt 0 ] && [ "$campaignStage" -ge "$3" ]; then # Player stage high enough - return 0 - else - return 1 + elif [ "$2" -gt 0 ]; then # Only Chapter matters + if [ "$campaignChapter" -ge "$2" ]; then # Player chapter high enough + if [ "$3" -gt 1 ]; then # Player stage set + if [ "$campaignStage" -ge "$3" ]; then # Player stage high enough + return 0 + else + return 1 + fi fi return 0 else @@ -1590,74 +1594,6 @@ oakInn_Old() { verifyHEX 20 1775 d49a61 "Attempted to collect Oak Inn presents." "Failed to collect Oak Inn presents." } -# ############################################################################## -# Function Name : oakInn_presentTab -# Descripton : Search available present tabs in Oak Inn -# ############################################################################## -oakInn_presentTab() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_presentTab" >&2; fi - oakInn_presentTabs=0 - if testColorOR 270 1800 c79663; then # 1 gift c79663 - oakInn_presentTabs=$((oakInn_presentTabs + 1000)) # Increment - fi - if testColorOR 410 1800 bb824f; then # 2 gift bb824f - oakInn_presentTabs=$((oakInn_presentTabs + 200)) # Increment - fi - if testColorOR 550 1800 af6e3b; then # 3 gift af6e3b - oakInn_presentTabs=$((oakInn_presentTabs + 30)) # Increment - fi - if testColorOR 690 1800 b57b45; then # 4 gift b57b45 - oakInn_presentTabs=$((oakInn_presentTabs + 4)) # Increment - fi -} - -# ############################################################################## -# Function Name : oakInn_searchPresent -# Descripton : Searches for a "good" present in oak Inn -# ############################################################################## -oakInn_searchPresent() { - if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_searchPresent " >&2; fi - inputSwipe 400 1600 400 310 50 # Swipe all the way down - sleep 1 - - if testColorOR 540 990 833f0e; then # 1 red 833f0e blue 903da0 - inputTapSleep 540 990 3 # Tap present - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 800 a21a1a; then # 2 red a21a1a blue 9a48ab - inputTapSleep 540 800 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 610 aa2b27; then # 3 red aa2b27 blue b260aa - inputTapSleep 540 610 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 420 bc3f36; then # 4 red bc3f36 blue c58c7b - inputTapSleep 540 420 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else - if testColorOR 540 220 bb3734; then # 5 red bb3734 blue 9442a5 - inputTapSleep 540 220 3 - inputTapSleep 540 1650 1 # Ok - inputTapSleep 540 1650 0 # Collect reward - oakRes=1 - else # If no present found, search for other tabs - oakRes=0 - fi - fi - fi - fi - fi -} - # ############################################################################## # Function Name : oakInn_tryCollectPresent # Descripton : Tries to collect a present from one Oak Inn friend @@ -1803,6 +1739,74 @@ oakInn_tryCollectPresent() { fi } +# ############################################################################## +# Function Name : oakInn_searchPresent +# Descripton : Searches for a "good" present in oak Inn +# ############################################################################## +oakInn_searchPresent() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_searchPresent " >&2; fi + inputSwipe 400 1600 400 310 50 # Swipe all the way down + sleep 1 + + if testColorOR 540 990 833f0e; then # 1 red 833f0e blue 903da0 + inputTapSleep 540 990 3 # Tap present + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 800 a21a1a; then # 2 red a21a1a blue 9a48ab + inputTapSleep 540 800 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 610 aa2b27; then # 3 red aa2b27 blue b260aa + inputTapSleep 540 610 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 420 bc3f36; then # 4 red bc3f36 blue c58c7b + inputTapSleep 540 420 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else + if testColorOR 540 220 bb3734; then # 5 red bb3734 blue 9442a5 + inputTapSleep 540 220 3 + inputTapSleep 540 1650 1 # Ok + inputTapSleep 540 1650 0 # Collect reward + oakRes=1 + else # If no present found, search for other tabs + oakRes=0 + fi + fi + fi + fi + fi +} + +# ############################################################################## +# Function Name : oakInn_presentTab +# Descripton : Search available present tabs in Oak Inn +# ############################################################################## +oakInn_presentTab() { + if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "oakInn_presentTab" >&2; fi + oakInn_presentTabs=0 + if testColorOR 276 1806 f2f29e; then # 1 gift f2f29e + oakInn_presentTabs=$((oakInn_presentTabs + 1000)) # Increment + fi + if testColorOR 419 1806 f9f9a4; then # 2 gift f9f9a4 + oakInn_presentTabs=$((oakInn_presentTabs + 200)) # Increment + fi + if testColorOR 557 1806 f2f29e; then # 3 gift f2f29e + oakInn_presentTabs=$((oakInn_presentTabs + 30)) # Increment + fi + if testColorOR 699 1806 f2f29e; then # 4 gift f2f29e + oakInn_presentTabs=$((oakInn_presentTabs + 4)) # Increment + fi +} + # ############################################################################## # Function Name : strengthenCrystal # Descripton : Strenghen Crystal @@ -1968,11 +1972,11 @@ collectQuestChests() { # WARN: and closed the warning message. Might not be a problem anymore. inputTapSleep 960 250 # Quests collectQuestChests_quick - sleep 4 + sleep 5 inputTapSleep 650 1650 # Weeklies collectQuestChests_quick - sleep 4 + sleep 5 #WARN: May break if the reward is a new champ... inputTapSleep 930 1650 # Campaign @@ -2039,9 +2043,9 @@ collectMail() { # ############################################################################## collectMerchants() { if [ "$DEBUG" -ge 4 ]; then printInColor "DEBUG" "collectMerchants" >&2; fi - inputTapSleep 120 300 3 # Merchants + inputTapSleep 120 300 6 # Merchants # WARN: Breaks if a pop-up message shows up - inputTapSleep 780 1820 2 # Merchant Ship + inputTapSleep 780 1820 4 # Merchant Ship if testColorNAND 375 940 0b080a; then # Checks for Special Daily Bundles inputTapSleep 200 1200 1 # Free @@ -2162,10 +2166,10 @@ checkRequirements() { # endAt if [ "$endAt" = "oak" ] && ! requiredLevel 0 5 1; then printInColor "WARN" "Your Chapter/Stage level is not high enough for 'endAt' to be 'oak'! Using 'campaign' instead." - guildBattleType="campaign" + endAt="campaign" elif [ "$endAt" = "championship" ] && ! requiredLevel 0 3 1; then printInColor "WARN" "Your Chapter/Stage level is not high enough for 'endAt' to be 'championship'! Using 'campaign' instead." - guildBattleType="campaign" + endAt="campaign" fi # guildBattleType @@ -2174,7 +2178,7 @@ checkRequirements() { guildBattleType="challenge" fi - # buyStorePoeCoins: Yet to find out when they unlock! Maybe when the Oak Inn unlocks? + # buyStorePoeCoins: Am yet to find out when they unlock! Maybe when the Oak Inn unlocks? # buyStoreLimitedElementalShard if [ "$buyStoreLimitedElementalShard" = true ] && ! requiredLevel 0 22 1; then @@ -2209,6 +2213,7 @@ checkRequirements() { fi # --- GAME? --- # + echo } # ############################################################################## @@ -2339,10 +2344,13 @@ run() { } printInColor "INFO" "Starting script... ($(date))" -if [ "$DEBUG" -gt 0 ]; then printInColor "INFO" "Debug: ${cBlue}ON${cNc} [${cCyan}$DEBUG${cNc}]"; fi + +# Player levels if [ "$vipLevel" -gt 0 ]; then printInColor "INFO" "VIP Level: ${cBlue}$vipLevel${cNc}"; else printInColor "INFO" "VIP Level: ${cBlue}Not set${cNc}"; fi if [ "$campaignChapter " -gt 0 ]; then printInColor "INFO" "Campaign Chapter: ${cBlue}$campaignChapter ${cNc}"; else printInColor "INFO" "Campaign Chpater: ${cBlue}Not set${cNc}"; fi if [ "$campaignStage " -gt 0 ]; then printInColor "INFO" "Campaign Stage: ${cBlue}$campaignStage ${cNc}"; else printInColor "INFO" "Campaign Stage: ${cBlue}Not set${cNc}"; fi +echo +if [ "$DEBUG" -gt 0 ]; then printInColor "INFO" "Debug: ${cBlue}ON${cNc} [${cCyan}$DEBUG${cNc}]"; fi if [ "$forceFightCampaign" = true ]; then printInColor "INFO" "Fight Campaign: ${cBlue}ON${cNc}"; else printInColor "INFO" "Fight Campaign: ${cBlue}OFF${cNc}"; fi if [ "$forceWeekly" = true ]; then printInColor "INFO" "Weekly: ${cBlue}ON${cNc}"; else printInColor "INFO" "Weekly: ${cBlue}OFF${cNc}"; fi if [ "$testServer" = true ]; then printInColor "INFO" "Test server: ${cBlue}ON${cNc}"; fi @@ -2351,8 +2359,7 @@ if [ "$testServer" = true ]; then printInColor "INFO" "Test server: ${cBlue}ON${ if [ "$eventHoe" = true ]; then activeEvents="${activeEvents}| Heroes of Esperia |"; fi if [ -n "$activeEvents" ]; then printInColor "INFO" "Active event(s): ${cBlue}${activeEvents}${cNc}"; fi -echo -if [ "$vipLevel" -ne 0 ] && [ "$campaignChapter" -ne 0 ] && [ "$campaignStage" -ne 0 ]; then checkRequirements; fi +if [ "$vipLevel" -ne 0 ] && [ "$campaignChapter" -ne 0 ]; then checkRequirements; fi init run