Skip to content

Commit

Permalink
* **V7.3**
Browse files Browse the repository at this point in the history
 * Add Auto Update for Normal and Builder Base and Builder Base Stats (thx to DocOC team and ViperZ)
 * Add MEmu 3.5.0.2 DirectX support
 * Add Clash Of Magic support, https://www.clashofmagic.net/
   Server 3: http://download825.mediafireuserdownload.com/g29mv74piaqg/jeab7w484b77n86/Magic-CoC_S3-9.105-R1.apk
   http://www.tomzpot.com/android-games/clash-of-magic-9-105-10-private-server-september-2017/
 * Add Mini GUI mode to run launch more 10 bots (can be also enabled with command line option /minigui or /mg)
   New title bar icon to switch between normal and mini GUI mode
 * Add automatic Android reboot after configured run-time hours (default is 24) to prevent severy Android issues like memory leak, graphics error etc.
 * Add /? command line option to show help on additonal command line paramter and options
 * Fix wall upgrade not saving resources for enabled non-repeated building upgrades when a builder is available
 * Fix Wait For Clan Castle Spell not getting detected sometimes
 * Fix Log Messages when Heroes are not enabled to auto Upgrade
 * Fix Balloon Donation Issues
 * Fix Wall Upgrade Ignoring Auto Warden Upgrade when checking if enough Elixir is available
 * Fix Several Bugs and outdated values by @NguyenAnhHD
 * Fix Clone Spell not getting brewed before going to Attack by @ViperZ
 * Improve Weak Base Eagle Lvl 2 Detection
 * Improve Dead Base Collector Lvl 11 Detection
 * Improve village measuring with secondary images to fix zoom out loop when village cannot be measured
 * Improve remaing attack time calculation
 * Improve bot launch time when no Android Emulator command line parameter was specified
 * Improve Android reboot on time lag after 2 detections
 * Improve watchdog process restarting unresponsive bots after 3 Minutes (was 2 Minutes) and Bot API window communication
 * Improve ADB Click&Drag for input drag mode (when not accurate Click&Drag script is used)
 * Update ProfileReport Code & OCR
 * Show bot window when Android Window activated (both ways)
 * Bot start/stop/pause and resume added to tray menu
 * New MyBot.run.MiniGui "reference app for modders/devs" controlling bot backend process using Window Messages
  • Loading branch information
cosote committed Oct 29, 2017
1 parent b149fa2 commit abb5b13
Show file tree
Hide file tree
Showing 265 changed files with 51,236 additions and 35,260 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
* **V7.3**
* Add Auto Update for Normal and Builder Base and Builder Base Stats (thx to DocOC team and ViperZ)
* Add MEmu 3.5.0.2 DirectX support
* Add Clash Of Magic support, https://www.clashofmagic.net/
Server 3: http://download825.mediafireuserdownload.com/g29mv74piaqg/jeab7w484b77n86/Magic-CoC_S3-9.105-R1.apk
http://www.tomzpot.com/android-games/clash-of-magic-9-105-10-private-server-september-2017/
* Add Mini GUI mode to run launch more 10 bots (can be also enabled with command line option /minigui or /mg)
New title bar icon to switch between normal and mini GUI mode
* Add automatic Android reboot after configured run-time hours (default is 24) to prevent severy Android issues like memory leak, graphics error etc.
* Add /? command line option to show help on additonal command line paramter and options
* Fix wall upgrade not saving resources for enabled non-repeated building upgrades when a builder is available
* Fix Wait For Clan Castle Spell not getting detected sometimes
* Fix Log Messages when Heroes are not enabled to auto Upgrade
* Fix Balloon Donation Issues
* Fix Wall Upgrade Ignoring Auto Warden Upgrade when checking if enough Elixir is available
* Fix Several Bugs and outdated values by @NguyenAnhHD
* Fix Clone Spell not getting brewed before going to Attack by @ViperZ
* Improve Weak Base Eagle Lvl 2 Detection
* Improve Dead Base Collector Lvl 11 Detection
* Improve village measuring with secondary images to fix zoom out loop when village cannot be measured
* Improve remaing attack time calculation
* Improve bot launch time when no Android Emulator command line parameter was specified
* Improve Android reboot on time lag after 2 detections
* Improve watchdog process restarting unresponsive bots after 3 Minutes (was 2 Minutes) and Bot API window communication
* Improve ADB Click&Drag for input drag mode (when not accurate Click&Drag script is used)
* Update ProfileReport Code & OCR
* Show bot window when Android Window activated (both ways)
* Bot start/stop/pause and resume added to tray menu
* New MyBot.run.MiniGui "reference app for modders/devs" controlling bot backend process using Window Messages

* **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
Expand Down
150 changes: 78 additions & 72 deletions COCBot/GUI/MBR GUI Control BOT Options.au3
Original file line number Diff line number Diff line change
Expand Up @@ -206,67 +206,67 @@ EndFunc ;==>txtThreads
; #DEBUG FUNCTION# ==============================================================================================================

Func chkDebugClick()
$g_iDebugClick = (GUICtrlRead($g_hChkDebugClick) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugClick " & ($g_iDebugClick = 1 ? "enabled" : "disabled"))
$g_bDebugClick = (GUICtrlRead($g_hChkDebugClick) = $GUI_CHECKED)
SetDebugLog("DebugClick " & ($g_bDebugClick ? "enabled" : "disabled"))
EndFunc ;==>chkDebugClick

Func chkDebugSetlog()
$g_iDebugSetlog = (GUICtrlRead($g_hChkDebugSetlog) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugSetlog " & ($g_iDebugSetlog = 1 ? "enabled" : "disabled"))
$g_bDebugSetlog = (GUICtrlRead($g_hChkDebugSetlog))
SetDebugLog("DebugSetlog " & ($g_bDebugSetlog ? "enabled" : "disabled"))
EndFunc ;==>chkDebugSetlog

Func chkDebugDisableZoomout()
$g_iDebugDisableZoomout = (GUICtrlRead($g_hChkDebugDisableZoomout) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugDisableZoomout " & ($g_iDebugDisableZoomout = 1 ? "enabled" : "disabled"))
$g_bDebugDisableZoomout = (GUICtrlRead($g_hChkDebugDisableZoomout) = $GUI_CHECKED)
SetDebugLog("DebugDisableZoomout " & ($g_bDebugDisableZoomout ? "enabled" : "disabled"))
EndFunc ;==>chkDebugDisableZoomout

Func chkDebugDisableVillageCentering()
$g_iDebugDisableVillageCentering = (GUICtrlRead($g_hChkDebugDisableVillageCentering) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugDisableVillageCentering " & ($g_iDebugDisableVillageCentering = 1 ? "enabled" : "disabled"))
$g_bDebugDisableVillageCentering = (GUICtrlRead($g_hChkDebugDisableVillageCentering) = $GUI_CHECKED)
SetDebugLog("DebugDisableVillageCentering " & ($g_bDebugDisableVillageCentering ? "enabled" : "disabled"))
EndFunc ;==>chkDebugDisableVillageCentering

Func chkDebugDeadbaseImage()
$g_iDebugDeadBaseImage = (GUICtrlRead($g_hChkDebugDeadbaseImage) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugDeadbaseImage " & ($g_iDebugDeadBaseImage = 1 ? "enabled" : "disabled"))
$g_bDebugDeadBaseImage = (GUICtrlRead($g_hChkDebugDeadbaseImage) = $GUI_CHECKED)
SetDebugLog("DebugDeadbaseImage " & ($g_bDebugDeadBaseImage ? "enabled" : "disabled"))
EndFunc ;==>chkDebugDeadbaseImage

Func chkDebugOcr()
$g_iDebugOcr = (GUICtrlRead($g_hChkDebugOCR) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugOcr " & ($g_iDebugOcr = 1 ? "enabled" : "disabled"))
$g_bDebugOcr = (GUICtrlRead($g_hChkDebugOCR) = $GUI_CHECKED)
SetDebugLog("DebugOcr " & ($g_bDebugOcr ? "enabled" : "disabled"))
EndFunc ;==>chkDebugOcr

Func chkDebugImageSave()
$g_iDebugImageSave = (GUICtrlRead($g_hChkDebugImageSave) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugImageSave " & ($g_iDebugImageSave = 1 ? "enabled" : "disabled"))
$g_bDebugImageSave = (GUICtrlRead($g_hChkDebugImageSave) = $GUI_CHECKED)
SetDebugLog("DebugImageSave " & ($g_bDebugImageSave ? "enabled" : "disabled"))
EndFunc ;==>chkDebugImageSave

Func chkDebugBuildingPos()
$g_iDebugBuildingPos = (GUICtrlRead($g_hChkdebugBuildingPos) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugBuildingPos " & ($g_iDebugBuildingPos = 1 ? "enabled" : "disabled"))
$g_bDebugBuildingPos = (GUICtrlRead($g_hChkdebugBuildingPos) = $GUI_CHECKED)
SetDebugLog("DebugBuildingPos " & ($g_bDebugBuildingPos ? "enabled" : "disabled"))
EndFunc ;==>chkDebugBuildingPos

Func chkDebugTrain()
$g_iDebugSetlogTrain = (GUICtrlRead($g_hChkdebugTrain) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugTrain " & ($g_iDebugSetlogTrain = 1 ? "enabled" : "disabled"))
$g_bDebugSetlogTrain = (GUICtrlRead($g_hChkdebugTrain) = $GUI_CHECKED)
SetDebugLog("DebugTrain " & ($g_bDebugSetlogTrain ? "enabled" : "disabled"))
EndFunc ;==>chkDebugTrain

Func chkdebugOCRDonate()
$g_iDebugOCRdonate = (GUICtrlRead($g_hChkDebugOCRDonate) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugOCRDonate " & ($g_iDebugOCRdonate = 1 ? "enabled" : "disabled"))
$g_bDebugOCRdonate = (GUICtrlRead($g_hChkDebugOCRDonate) = $GUI_CHECKED)
SetDebugLog("DebugOCRDonate " & ($g_bDebugOCRdonate ? "enabled" : "disabled"))
EndFunc ;==>chkdebugOCRDonate

Func chkdebugAttackCSV()
$g_iDebugAttackCSV = (GUICtrlRead($g_hChkdebugAttackCSV) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("DebugAttackCSV " & ($g_iDebugAttackCSV = 1 ? "enabled" : "disabled"))
$g_bDebugAttackCSV = (GUICtrlRead($g_hChkdebugAttackCSV) = $GUI_CHECKED)
SetDebugLog("DebugAttackCSV " & ($g_bDebugAttackCSV ? "enabled" : "disabled"))
EndFunc ;==>chkdebugAttackCSV

Func chkmakeIMGCSV()
$g_iDebugMakeIMGCSV = (GUICtrlRead($g_hChkMakeIMGCSV) = $GUI_CHECKED ? 1 : 0)
SetDebugLog("MakeIMGCSV " & ($g_iDebugMakeIMGCSV = 1 ? "enabled" : "disabled"))
$g_bDebugMakeIMGCSV = (GUICtrlRead($g_hChkMakeIMGCSV) = $GUI_CHECKED)
SetDebugLog("MakeIMGCSV " & ($g_bDebugMakeIMGCSV ? "enabled" : "disabled"))
EndFunc ;==>chkmakeIMGCSV

Func btnTestTrain()
Local $currentOCR = $g_iDebugOcr
Local $currentOCR = $g_bDebugOcr
Local $currentRunState = $g_bRunState
$g_bRunState = True
BeginImageTest()
Expand All @@ -285,18 +285,18 @@ Func btnTestTrain()

EndImageTest()

$g_iDebugOcr = $currentOCR
$g_bDebugOcr = $currentOCR
$g_bRunState = $currentRunState
EndFunc ;==>btnTestTrain

Func btnTestDonateCC()
Local $currentOCR = $g_iDebugOcr
Local $currentOCR = $g_bDebugOcr
Local $currentRunState = $g_bRunState
Local $currentSetlog = $g_iDebugSetlog
Local $currentSetlog = $g_bDebugSetlog
_GUICtrlTab_ClickTab($g_hTabMain, 0)
$g_iDebugOcr = 1
$g_bDebugOcr = True
$g_bRunState = True
$g_iDebugSetlog = 1
$g_bDebugSetlog = True
ForceCaptureRegion()
DebugImageSave("donateCC_")

Expand All @@ -320,9 +320,9 @@ Func btnTestDonateCC()
SetLog(_PadStringCenter(" Test DonateCC end ", 54, "="), $COLOR_INFO)
ShellExecute($g_sProfileTempDebugPath & "donateCC_")

$g_iDebugOcr = $currentOCR
$g_bDebugOcr = $currentOCR
$g_bRunState = $currentRunState
$g_iDebugSetlog = $currentSetlog
$g_bDebugSetlog = $currentSetlog
EndFunc ;==>btnTestDonateCC

Func btnTestRequestCC()
Expand All @@ -346,11 +346,11 @@ Func btnTestSendText()
EndFunc ;==>btnTestSendText

Func btnTestAttackBar()
Local $currentOCR = $g_iDebugOcr
Local $currentOCR = $g_bDebugOcr
Local $currentRunState = $g_bRunState
_GUICtrlTab_ClickTab($g_hTabMain, 0)

$g_iDebugOcr = 1
$g_bDebugOcr = True
$g_bRunState = True
ForceCaptureRegion()
SetLog(_PadStringCenter(" Test Attack Bar begin (" & $g_sBotVersion & ")", 54, "="), $COLOR_INFO)
Expand Down Expand Up @@ -387,7 +387,7 @@ Func btnTestAttackBar()
SetLog(_PadStringCenter(" Test Attack Bar end ", 54, "="), $COLOR_INFO)
ShellExecute($savefolder)

$g_iDebugOcr = $currentOCR
$g_bDebugOcr = $currentOCR
$g_bRunState = $currentRunState
EndFunc ;==>btnTestAttackBar

Expand Down Expand Up @@ -485,22 +485,24 @@ Func btnTestVillageSize()
_CaptureRegion()
_CaptureRegion2Sync()

SetLog("Testing GetVillageSize()", $COLOR_INFO)
Local $hTimer = __TimerInit()
Local $village = GetVillageSize(True)
Local $ms = __TimerDiff($hTimer)
If $village = 0 Then
SetLog("Village not found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
Else
SetLog("Village found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
SetLog("Village size: " & $village[0])
SetLog("Village zoom level: " & $village[1])
SetLog("Village offset x: " & $village[2])
SetLog("Village offset y: " & $village[3])
SetLog("Village stone " & $village[6] & ": " & $village[4] & ", " & $village[5])
SetLog("Village tree " & $village[9] & ": " & $village[7] & ", " & $village[8])
EndIf

Local $a[2][2] = [["stone", "tree"], ["2stone", "2tree"]]
For $i = 0 To 1
SetLog("Testing GetVillageSize(True, """ & $a[$i][0] & """, """ & $a[$i][1] & """)", $COLOR_INFO)
Local $hTimer = __TimerInit()
Local $village = GetVillageSize(True, $a[$i][0], $a[$i][1])
Local $ms = __TimerDiff($hTimer)
If $village = 0 Then
SetLog("Village not found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
Else
SetLog("Village found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
SetLog("Village size: " & $village[0])
SetLog("Village zoom level: " & $village[1])
SetLog("Village offset x: " & $village[2])
SetLog("Village offset y: " & $village[3])
SetLog("Village stone " & $village[6] & ": " & $village[4] & ", " & $village[5])
SetLog("Village tree " & $village[9] & ": " & $village[7] & ", " & $village[8])
EndIf
Next
EndImageTest()

$g_bRunState = $currentRunState
Expand Down Expand Up @@ -565,17 +567,17 @@ Func btnTestAttackCSV()
BeginImageTest() ; get image for testing

Local $currentRunState = $g_bRunState
Local $currentDebugAttackCSV = $g_iDebugAttackCSV
Local $currentMakeIMGCSV = $g_iDebugMakeIMGCSV
Local $currentDebugAttackCSV = $g_bDebugAttackCSV
Local $currentMakeIMGCSV = $g_bDebugMakeIMGCSV
Local $currentiMatchMode = $g_iMatchMode
Local $currentdebugsetlog = $g_iDebugSetlog
Local $currentDebugBuildingPos = $g_iDebugBuildingPos
Local $currentdebugsetlog = $g_bDebugSetlog
Local $currentDebugBuildingPos = $g_bDebugBuildingPos

$g_bRunState = True
$g_iDebugAttackCSV = 1
$g_iDebugMakeIMGCSV = 1
$g_iDebugSetlog = 1
$g_iDebugBuildingPos = 1
$g_bDebugAttackCSV = True
$g_bDebugMakeIMGCSV = True
$g_bDebugSetlog = True
$g_bDebugBuildingPos = True

$g_iMatchMode = $DB ; define which script to use

Expand All @@ -595,11 +597,11 @@ Func btnTestAttackCSV()
EndImageTest() ; clear test image handle

$g_bRunState = $currentRunState
$g_iDebugAttackCSV = $currentDebugAttackCSV
$g_iDebugMakeIMGCSV = $currentMakeIMGCSV
$g_bDebugAttackCSV = $currentDebugAttackCSV
$g_bDebugMakeIMGCSV = $currentMakeIMGCSV
$g_iMatchMode = $currentiMatchMode
$g_iDebugSetlog = $currentdebugsetlog
$g_iDebugBuildingPos = $currentDebugBuildingPos
$g_bDebugSetlog = $currentdebugsetlog
$g_bDebugBuildingPos = $currentDebugBuildingPos

EndFunc ;==>btnTestAttackCSV

Expand All @@ -611,11 +613,11 @@ Func btnTestGetLocationBuilding()

; Store variables changed, set test values
Local $currentRunState = $g_bRunState
Local $currentDebugBuildingPos = $g_iDebugBuildingPos
Local $currentdebugsetlog = $g_iDebugSetlog
Local $currentDebugBuildingPos = $g_bDebugBuildingPos
Local $currentdebugsetlog = $g_bDebugSetlog
$g_bRunState = True
$g_iDebugBuildingPos = 1
$g_iDebugSetlog = 1
$g_bDebugBuildingPos = True
$g_bDebugSetlog = True

SearchZoomOut($aCenterEnemyVillageClickDrag, True, "btnTestAttackCSV")
ResetTHsearch()
Expand Down Expand Up @@ -651,8 +653,8 @@ Func btnTestGetLocationBuilding()

; restore changed variables
$g_bRunState = $currentRunState
$g_iDebugBuildingPos = $currentDebugBuildingPos
$g_iDebugSetlog = $currentdebugsetlog
$g_bDebugBuildingPos = $currentDebugBuildingPos
$g_bDebugSetlog = $currentdebugsetlog

EndFunc ;==>btnTestGetLocationBuilding

Expand Down Expand Up @@ -789,7 +791,7 @@ Func btnTestGetLocationBuildingImage()
_GDIPlus_BitmapDispose($EditedImage)

; open image
If TestCapture() = True Then
If TestCapture() Then
ShellExecute($filename)
EndIf

Expand Down Expand Up @@ -841,7 +843,7 @@ Func BeginImageTest($directory = $g_sProfileTempPath)
Local $sImageFile = FileOpenDialog("Select CoC screenshot to test, cancel to use live screenshot", $directory, "Image (*.png)", $FD_FILEMUSTEXIST, "", $g_hFrmBot)
If @error <> 0 Then
SetLog("Testing image cancelled, taking screenshot from " & $g_sAndroidEmulator, $COLOR_INFO)
ZoomOut()
;ZoomOut()
_CaptureRegion()
$hHBMP = $g_hHBitmap
TestCapture($hHBMP)
Expand Down Expand Up @@ -891,7 +893,7 @@ Func btnTestOcrMemory()
_CaptureRegion2(162, 200, 162 + 120, 200 + 27)

For $i = 1 To 5000
DllCall($g_hLibMyBot, "str", "ocr", "ptr", $g_hHBitmap2, "str", "coc-DonTroops", "int", $g_iDebugOcr)
DllCall($g_hLibMyBot, "str", "ocr", "ptr", $g_hHBitmap2, "str", "coc-DonTroops", "int", $g_bDebugOcr ? 1 : 0)
;getOcr($g_hHBitmap2, "coc-DonTroops")
;getOcrAndCapture("coc-DonTroops", 162, 200, 120, 27, True)

Expand All @@ -907,3 +909,7 @@ Func btnTestWeakBase()
EndImageTest()
$g_bRunState = $currentRunState
EndFunc ;==>btnTestWeakBase

Func btnTestClickAway()
ClickP($aAway, 2, 0)
EndFunc ;==>btnTestClickAway
Loading

0 comments on commit abb5b13

Please sign in to comment.