Skip to content

Commit

Permalink
* **V7.2.5**
Browse files Browse the repository at this point in the history
 * Add Inferno Lvl 5 to Weak Base Images/GUI settings, add Lvl 4 tile and lowered tolerance
 * Lower Eagle Lvl 1 tolerance for better Weak Base detection
 * Fix Weak Base
 * Fix Wait for Heroes Queen and Warden
 * Fix train Balloon
 * Fix upgrades possible when bot is paused
 * Fix rare redline variable not declared error
 * Update Arabic Language By @awssaad
  • Loading branch information
cosote committed Sep 10, 2017
1 parent 5a0c65e commit b149fa2
Show file tree
Hide file tree
Showing 40 changed files with 384 additions and 221 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
* **V7.2.5**
* Add Inferno Lvl 5 to Weak Base Images/GUI settings, add Lvl 4 tile and lowered tolerance
* Lower Eagle Lvl 1 tolerance for better Weak Base detection
* Fix Weak Base
* Fix Wait for Heroes Queen and Warden
* Fix train Balloon
* Fix upgrades possible when bot is paused
* Fix rare redline variable not declared error
* Update Arabic Language By @awssaad

* **V7.2.4**
* Add Bot / Android Option to select preferred Android Background Mode
* Add BlueStacks2/3 and iTools support for ADB screencap Background Mode
Expand Down
15 changes: 12 additions & 3 deletions COCBot/GUI/MBR GUI Control BOT Options.au3
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ EndFunc ;==>chkBotAutoSlideClick

Func chkDisableNotifications()
$g_bDisableNotifications = (GUICtrlRead($g_hChkDisableNotifications) = $GUI_CHECKED)
EndFunc
EndFunc ;==>chkDisableNotifications

Func chkUseRandomClick()
$g_bUseRandomClick = (GUICtrlRead($g_hChkUseRandomClick) = $GUI_CHECKED)
Expand Down Expand Up @@ -621,7 +621,7 @@ Func btnTestGetLocationBuilding()
ResetTHsearch()
SetLog("Testing FindTownhall()", $COLOR_INFO)
SetLog("FindTownhall() = " & FindTownhall(True), $COLOR_INFO)
; SetLog("$g_sImglocRedline = " & $g_sImglocRedline, $COLOR_INFO)
; SetLog("$g_sImglocRedline = " & $g_sImglocRedline, $COLOR_INFO)

_LogObjList($g_oBldgAttackInfo) ; log dictionary contents

Expand Down Expand Up @@ -897,4 +897,13 @@ Func btnTestOcrMemory()

Next

EndFunc ;==>btnTestOcrMemory
EndFunc ;==>btnTestOcrMemory

Func btnTestWeakBase()
Local $currentRunState = $g_bRunState
$g_bRunState = True
BeginImageTest()
IsWeakBase()
EndImageTest()
$g_bRunState = $currentRunState
EndFunc ;==>btnTestWeakBase
2 changes: 2 additions & 0 deletions COCBot/GUI/MBR GUI Control Notify.au3
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Func chkPBTGenabled()
GUICtrlSetState($g_hChkNotifyAlertMaintenance, $GUI_ENABLE)
GUICtrlSetState($g_hChkNotifyAlertBAN, $GUI_ENABLE)
GUICtrlSetState($g_hChkNotifyBOTUpdate, $GUI_ENABLE)
GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $GUI_ENABLE)
Else
GUICtrlSetState($g_hChkNotifyRemote, $GUI_DISABLE)
GUICtrlSetState($g_hTxtNotifyOrigin, $GUI_DISABLE)
Expand All @@ -84,6 +85,7 @@ Func chkPBTGenabled()
GUICtrlSetState($g_hChkNotifyDeleteAllPBPushes, $GUI_DISABLE)
GUICtrlSetState($g_hChkNotifyDeleteOldPBPushes, $GUI_DISABLE)
GUICtrlSetState($g_hBtnNotifyDeleteMessages, $GUI_DISABLE)
GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $GUI_DISABLE)
EndIf
EndFunc ;==>chkPBTGenabled

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Func CreateAttackSearchActiveBaseSearch()
$g_ahCmbWeakInferno[$LB] = GUICtrlCreateCombo("", $x + 19, $y, 50, -1, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$sTxtTip = GetTranslatedFileIni("MBR GUI Design Child Attack - Search", "CmbMaxInferno_Info_01", -1)
_GUICtrlSetTip(-1, $sTxtTip)
GUICtrlSetData(-1, "-|Lvl 1|Lvl 2|Lvl 3|Lvl 4", "Lvl 2")
GUICtrlSetData(-1, "-|Lvl 1|Lvl 2|Lvl 3|Lvl 4|Lvl 5", "Lvl 2")
GUICtrlSetState(-1, $GUI_DISABLE)
$g_ahPicWeakInferno[$LB] = _GUICtrlCreateIcon($g_sLibIconPath, $eIcnInferno4, $x + 75, $y - 2, 24, 24)
_GUICtrlSetTip(-1, $sTxtTip)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Func CreateAttackSearchDeadBaseSearch()
$g_ahCmbWeakInferno[$DB] = GUICtrlCreateCombo("", $x + 19, $y, 50, -1, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
$sTxtTip = GetTranslatedFileIni("MBR GUI Design Child Attack - Search", "CmbMaxInferno_Info_01", "Set the Max. level of the Inferno Tower to search for on a village to attack.")
_GUICtrlSetTip(-1, $sTxtTip)
GUICtrlSetData(-1, "-|Lvl 1|Lvl 2|Lvl 3|Lvl 4", "Lvl 2")
GUICtrlSetData(-1, "-|Lvl 1|Lvl 2|Lvl 3|Lvl 4|Lvl 5", "Lvl 2")
GUICtrlSetState(-1, $GUI_DISABLE)
$g_ahPicWeakInferno[$DB] = _GUICtrlCreateIcon($g_sLibIconPath, $eIcnInferno4, $x + 75, $y - 2, 24, 24)
_GUICtrlSetTip(-1, $sTxtTip)
Expand Down
5 changes: 4 additions & 1 deletion COCBot/GUI/MBR GUI Design Child Bot - Debug.au3
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Global $g_hChkdebugAttackCSV = 0, $g_hChkMakeIMGCSV = 0, $g_hChkDebugDisableZoom
Global $g_hBtnTestTrain = 0, $g_hBtnTestDonateCC = 0, $g_hBtnTestRequestCC = 0, $g_hBtnTestSendText = 0, $g_hBtnTestAttackBar = 0, $g_hBtnTestClickDrag = 0, $g_hBtnTestImage = 0
Global $g_hBtnTestVillageSize = 0, $g_hBtnTestDeadBase = 0, $g_hBtnTestTHimgloc = 0, $g_hBtnTestTrainsimgloc = 0, $g_hBtnTestQuickTrainsimgloc = 0, $g_hTxtTestFindButton = 0
Global $g_hBtnTestFindButton = 0, $g_hBtnTestDeadBaseFolder = 0, $g_hBtnTestCleanYard = 0, $g_hBtnTestAttackCSV = 0, $g_hBtnTestimglocTroopBar = 0, $g_hBtnTestBuildingLocation = 0
Global $g_hBtnTestConfigSave = 0, $g_hBtnTestConfigApply = 0, $g_hBtnTestConfigRead = 0, $g_hBtnTestOcrMemory = 0
Global $g_hBtnTestConfigSave = 0, $g_hBtnTestConfigApply = 0, $g_hBtnTestConfigRead = 0, $g_hBtnTestOcrMemory = 0, $g_hBtnTestWeakBase = 0

Func CreateBotDebug()
Local $x = 25, $y = 45
Expand Down Expand Up @@ -157,6 +157,9 @@ Func CreateBotDebug()

$g_hBtnTestSendText = GUICtrlCreateButton("Send Text", $x + 20, $y, 120, 25)
$y -= $yNext

$g_hBtnTestWeakBase = GUICtrlCreateButton(GetTranslatedFileIni("MBR GUI Design Child Bot - Debug", "TestWeakBase", "Test Weak Base"), $x + 20, $y, 120, 25)
$y -= $yNext
GUICtrlCreateGroup("", -99, -99, 1, 1)
EndFunc

4 changes: 2 additions & 2 deletions COCBot/GUI/MBR GUI Design Child Bot - Options.au3
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Func CreateBotOptions()
GUICtrlSetOnEvent(-1, "txtGlobalThreads")
GUICtrlSetLimit(-1, 2)
_GUICtrlSetTip(-1, $sTxtTip)
GUICtrlCreateLabel(GetTranslatedFileIni("MBR GUI Design Child Bot - Options", "LblGlobalThreads_Info_01", "Img processing threads for all bots"), $x + 30, $y + 3)
GUICtrlCreateLabel(GetTranslatedFileIni("MBR GUI Design Child Bot - Options", "LblGlobalThreads_Info_01", "Image Threads for all bots"), $x + 30, $y + 3)
_GUICtrlSetTip(-1, $sTxtTip)

$y += 20
Expand All @@ -159,7 +159,7 @@ Func CreateBotOptions()
GUICtrlSetOnEvent(-1, "txtThreads")
GUICtrlSetLimit(-1, 2)
_GUICtrlSetTip(-1, $sTxtTip)
GUICtrlCreateLabel(GetTranslatedFileIni("MBR GUI Design Child Bot - Options", "LblThreads_Info_01", "Img processing threads for this bot"), $x + 30, $y + 3)
GUICtrlCreateLabel(GetTranslatedFileIni("MBR GUI Design Child Bot - Options", "LblThreads_Info_01", "Image Threads for this bot"), $x + 30, $y + 3)
_GUICtrlSetTip(-1, $sTxtTip)
GUICtrlCreateGroup("", -99, -99, 1, 1)

Expand Down
5 changes: 4 additions & 1 deletion COCBot/GUI/MBR GUI Design Child Village - Notify.au3
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Global $g_hChkNotifyDeleteAllPBPushes = 0, $g_hBtnNotifyDeleteMessages = 0, $g_h
$g_hChkNotifyAlertMatchFound = 0, $g_hChkNotifyAlertLastRaidIMG = 0, $g_hChkNotifyAlertLastRaidTXT = 0, $g_hChkNotifyAlertCampFull = 0, _
$g_hChkNotifyAlertUpgradeWall = 0, $g_hChkNotifyAlertOutOfSync = 0, $g_hChkNotifyAlertTakeBreak = 0, $g_hChkNotifyAlertBuilderIdle = 0, _
$g_hChkNotifyAlertVillageStats = 0, $g_hChkNotifyAlertLastAttack = 0, $g_hChkNotifyAlertAnotherDevice = 0, $g_hChkNotifyAlertMaintenance = 0, _
$g_hChkNotifyAlertBAN = 0, $g_hChkNotifyBOTUpdate = 0
$g_hChkNotifyAlertBAN = 0, $g_hChkNotifyBOTUpdate = 0, $g_hChkNotifyAlertSmartWaitTime = 0

Global $g_hChkNotifyOnlyHours = 0, $g_hChkNotifyOnlyWeekDays = 0, $g_hChkNotifyhours[24] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], _
$g_hChkNotifyWeekdays[7] = [0,0,0,0,0,0,0]
Expand Down Expand Up @@ -148,6 +148,9 @@ Func CreatePushBulletTelegramSubTab()
$g_hChkNotifyAlertAnotherDevice = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertAnotherDevice", "Another device"), $x + 210, $y, -1, -1)
_GUICtrlSetTip(-1, GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertAnotherDevice_Info_01", "Send an Alert when your village is connected to from another device."))
GUICtrlSetState(-1, $GUI_DISABLE)
$g_hChkNotifyAlertSmartWaitTime = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertSmartWaitTime", "Smart Wait Time"), $x + 315, $y, -1, -1)
_GUICtrlSetTip(-1, GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertSmartWaitTime_Info_02", "Send an Alert when your village take wait troops."))
GUICtrlSetState(-1, $GUI_DISABLE)

$y += 20
$g_hChkNotifyAlertMaintenance = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertMaintenance", "Maintenance"), $x + 10, $y, -1, -1)
Expand Down
1 change: 1 addition & 0 deletions COCBot/MBR GUI Control Variables.au3
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ Func InitializeControlVariables()
$oAlwaysEnabledControls($g_hBtnTestConfigSave) = 1
$oAlwaysEnabledControls($g_hBtnTestConfigRead) = 1
$oAlwaysEnabledControls($g_hBtnTestConfigApply) = 1
$oAlwaysEnabledControls($g_hBtnTestWeakBase) = 1

$oAlwaysEnabledControls($g_hBtnMakeScreenshot) = 1
$oAlwaysEnabledControls($g_hDivider) = 1
Expand Down
2 changes: 2 additions & 0 deletions COCBot/MBR GUI Control.au3
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ Func GUIControl_WM_COMMAND($hWind, $iMsg, $wParam, $lParam)
readConfig()
Case $g_hBtnTestConfigApply
applyConfig()
Case $g_hBtnTestWeakBase
btnTestWeakBase()
EndSwitch

If $lParam = $g_hCmbGUILanguage Then
Expand Down
7 changes: 5 additions & 2 deletions COCBot/MBR Global Variables.au3
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ Global $g_bAndroidEmbedded = False
Global $g_aiAndroidEmbeddedCtrlTarget[10] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Global $g_avAndroidShieldStatus[5] = [Default, 0, 0, Default, Default] ; Current Android Shield status (0: True = Shield Up, False = Shield Down, Default only for init; 1: Color; 2: Transparency = 0-255; 3: Invisible Shield; 4: Detached Shield)

Global $g_bPoliteCloseCoC = False ; True: PoliteCloseCoC() function will try to perform a polite close by going back and press exit button, False am force-stop to kill game
Global Const $g_bAndroidBackgroundLaunchEnabled = False ; Headless mode not finished yet (2016-07-13, cosote)
Global $g_bAndroidCheckTimeLagEnabled = True ; Checks every 60 Seconds or later in main loops (Bot Run, Idle and SearchVillage) is Android needs reboot due to time lag (see $g_iAndroidTimeLagThreshold)
Global $g_iAndroidAdbAutoTerminate = 0 ; Steady ADB shell instance is automatically closed after this number of executed commands, 0 = disabled (test for BS to fix frozen screen situation!)
Expand Down Expand Up @@ -329,6 +330,8 @@ Global $g_bAndroidEmbed ; Enable Android Docking
Global $g_iAndroidEmbedMode ; Android Dock Mode: -1 = Not available, 0 = Normal docking, 1 = Simulated docking
Global $g_bAndroidBackgroundLaunch ; Enabled Android Background launch using Windows Scheduled Task
Global $g_bAndroidBackgroundLaunched ; True when Android was launched in headless mode without a window
Global $g_iAndroidControlClickDelay = 10 ; 10 is Default (Milliseconds)
Global $g_iAndroidControlClickDownDelay = 0 ; 10 is Default (Milliseconds)
Global $g_iAndroidControlClickWindow = 0 ; 0 = Click the Android Control, 1 = Click the Android Window
Global $g_iAndroidControlClickMode = 0 ; 0 = Use AutoIt ControlClick, 1 = Use _SendMessage

Expand Down Expand Up @@ -844,7 +847,7 @@ Global $g_bNotifyRemoteEnable = False, $g_sNotifyOrigin = "", $g_bNotifyDeleteAl
Global $g_bNotifyAlertMatchFound = False, $g_bNotifyAlerLastRaidIMG = False, $g_bNotifyAlerLastRaidTXT = False, $g_bNotifyAlertCampFull = False, _
$g_bNotifyAlertUpgradeWalls = False, $g_bNotifyAlertOutOfSync = False, $g_bNotifyAlertTakeBreak = False, $g_bNotifyAlertBulderIdle = False, _
$g_bNotifyAlertVillageReport = False, $g_bNotifyAlertLastAttack = False, $g_bNotifyAlertAnotherDevice = False, $g_bNotifyAlertMaintenance = False, _
$g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False
$g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False
;Schedule
Global $g_bNotifyScheduleHoursEnable = False, $g_bNotifyScheduleWeekDaysEnable = False
Global $g_abNotifyScheduleHours[24] = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False]
Expand Down Expand Up @@ -1479,7 +1482,7 @@ Func _FilloBldgLevels()
$g_oBldgLevels.add($eBldgDarkS, $aBldgDarkStorage)
Local Const $aBldgEagle[11] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
$g_oBldgLevels.add($eBldgEagle, $aBldgEagle)
Local Const $aBldgInferno[11] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4]
Local Const $aBldgInferno[11] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5]
$g_oBldgLevels.add($eBldgInferno, $aBldgInferno)
Local Const $aBldgMortar[11] = [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10]
$g_oBldgLevels.add($eBldgMortar, $aBldgMortar)
Expand Down
140 changes: 73 additions & 67 deletions COCBot/functions/Android/Close_OpenCoC.au3
Original file line number Diff line number Diff line change
Expand Up @@ -149,78 +149,84 @@ EndFunc ;==>WaitnOpenCoC
; Link ..........: https://github.com/MyBotRun/MyBot/wiki
; Example .......: No
; ===============================================================================================================================
Func PoliteCloseCoC($sSource = "Unknown_")
Func PoliteCloseCoC($sSource = "Unknown_", $bPoliteCloseCoC = $g_bPoliteCloseCoC)
$g_bSkipFirstZoomout = False
If $g_sAndroidGameDistributor = $g_sGoogle Then
Local $i = 0 ; Reset Loop counter
While 1
checkObstacles()
AndroidBackButton()
If _Sleep($DELAYCLOSEOPEN1000) Then Return ; wait for window to open
If ClickOkay("ExitOkay_" & $sSource, True) = True Then ExitLoop ; Confirm okay to exit
If $i > 10 Then
Setlog("Can not find Okay button to exit CoC, Forcefully Closing CoC", $COLOR_ERROR)
If $g_iDebugImageSave = 1 Then DebugImageSave($sSource)
CloseCoC()
ExitLoop
EndIf
$i += 1
WEnd
Else
Local $btnExit
Local $i = 0 ; Reset Loop counter
While 1
checkObstacles()
AndroidBackButton()
If _Sleep($DELAYCLOSEOPEN1000) Then Return ; wait for window to open
Switch $g_sAndroidGameDistributor
Case "Kunlun", "Huawei", "Kaopu", "Microvirt", "Yeshen", "Qihoo", "Baidu", "OPPO", "Anzhi", "Lenovo", "Aiyouxi"
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1])
ExitLoop
EndIf
Case "9game"
If _Sleep($DELAYCLOSEOPEN2000) Then Return ; wait more
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0] + 71, $btnExit[1] + 64) ; click offsets for the transparent window
If $g_iDebugSetlog Then Setlog($g_sAndroidGameDistributor & " Click offset X|Y = 71|64", $COLOR_DEBUG)
ExitLoop
EndIf
Case "VIVO", "Xiaomi"
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1], 2, $DELAYCLOSEOPEN3000) ; has to click twice slowly
ExitLoop
EndIf
Case "Guopan"
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1])
EndIf
If _Sleep($DELAYCLOSEOPEN2000) Then Return ; wait for second window
$btnExit = FindExitButton("Kunlun")
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1])
If $bPoliteCloseCoC Then
; polite close
If $g_sAndroidGameDistributor = $g_sGoogle Then
Local $i = 0 ; Reset Loop counter
While 1
checkObstacles()
AndroidBackButton()
If _Sleep($DELAYCLOSEOPEN1000) Then Return ; wait for window to open
If ClickOkay("ExitOkay_" & $sSource, True) = True Then ExitLoop ; Confirm okay to exit
If $i > 10 Then
Setlog("Can not find Okay button to exit CoC, Forcefully Closing CoC", $COLOR_ERROR)
If $g_iDebugImageSave = 1 Then DebugImageSave($sSource)
CloseCoC()
ExitLoop
EndIf
$i += 1
WEnd
Else
Local $btnExit
Local $i = 0 ; Reset Loop counter
While 1
checkObstacles()
AndroidBackButton()
If _Sleep($DELAYCLOSEOPEN1000) Then Return ; wait for window to open
Switch $g_sAndroidGameDistributor
Case "Kunlun", "Huawei", "Kaopu", "Microvirt", "Yeshen", "Qihoo", "Baidu", "OPPO", "Anzhi", "Lenovo", "Aiyouxi"
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1])
ExitLoop
EndIf
Case "9game"
If _Sleep($DELAYCLOSEOPEN2000) Then Return ; wait more
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0] + 71, $btnExit[1] + 64) ; click offsets for the transparent window
If $g_iDebugSetlog Then Setlog($g_sAndroidGameDistributor & " Click offset X|Y = 71|64", $COLOR_DEBUG)
ExitLoop
EndIf
Case "VIVO", "Xiaomi"
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1], 2, $DELAYCLOSEOPEN3000) ; has to click twice slowly
ExitLoop
EndIf
Case "Guopan"
$btnExit = FindExitButton($g_sAndroidGameDistributor)
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1])
EndIf
If _Sleep($DELAYCLOSEOPEN2000) Then Return ; wait for second window
$btnExit = FindExitButton("Kunlun")
If IsArray($btnExit) Then
Click($btnExit[0], $btnExit[1])
ExitLoop
EndIf
Case "Wandoujia/Downjoy", "Haimawan", "Leshi", "Tencent"
ContinueCase
Case Else
Setlog("Polite Close Unsupported - " & $g_sAndroidGameDistributor & ", Forcefully Closing CoC", $COLOR_ERROR)
If $g_iDebugImageSave = 1 Then DebugImageSave($sSource)
CloseCoC()
ExitLoop
EndIf
Case "Wandoujia/Downjoy", "Haimawan", "Leshi", "Tencent"
ContinueCase
Case Else
Setlog("Polite Close Unsupported - " & $g_sAndroidGameDistributor & ", Forcefully Closing CoC", $COLOR_ERROR)
EndSwitch
If $i > 10 Then
Setlog("Can not find exit button: " & $g_sAndroidGameDistributor & ", Forcefully Closing CoC", $COLOR_ERROR)
If $g_iDebugImageSave = 1 Then DebugImageSave($sSource)
CloseCoC()
ExitLoop
EndSwitch
If $i > 10 Then
Setlog("Can not find exit button: " & $g_sAndroidGameDistributor & ", Forcefully Closing CoC", $COLOR_ERROR)
If $g_iDebugImageSave = 1 Then DebugImageSave($sSource)
CloseCoC()
ExitLoop
EndIf
$i += 1
WEnd
EndIf
$i += 1
WEnd
EndIf
Else
; force-kill Game
CloseCoC()
EndIf
ResetAndroidProcess()
ReduceBotMemory()
Expand Down
7 changes: 6 additions & 1 deletion COCBot/functions/Attack/PrepareAttack.au3
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ Func PrepareAttack($pMatchMode, $Remaining = False) ;Assigns troops

; Attack CSV has debug option to save attack line image, save have png of current $g_hHBitmap2
If ($pMatchMode = $DB And $g_aiAttackAlgorithm[$DB] = 1) Or ($pMatchMode = $LB And $g_aiAttackAlgorithm[$LB] = 1) Then
If $g_iDebugMakeIMGCSV = 1 And $Remaining = False And TestCapture() = 0 Then DebugImageSave("clean", False) ; make clean snapshot as well
If $g_iDebugMakeIMGCSV = 1 And $Remaining = False And TestCapture() = 0 Then
If $g_iSearchTH = "-" Then ; If TH is unknown, try again to find as it is needed for filename
imglocTHSearch(True, False, False)
EndIf
DebugImageSave("clean", False, Default, Default, "TH" & $g_iSearchTH & "-") ; make clean snapshot as well
EndIf
EndIf

If $Remaining = False Then ; reset Hero variables before attack if not checking remaining troops
Expand Down
Loading

0 comments on commit b149fa2

Please sign in to comment.