Skip to content

Commit abb5b13

Browse files
committed
* **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
1 parent b149fa2 commit abb5b13

265 files changed

Lines changed: 51236 additions & 35260 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
* **V7.3**
2+
* Add Auto Update for Normal and Builder Base and Builder Base Stats (thx to DocOC team and ViperZ)
3+
* Add MEmu 3.5.0.2 DirectX support
4+
* Add Clash Of Magic support, https://www.clashofmagic.net/
5+
Server 3: http://download825.mediafireuserdownload.com/g29mv74piaqg/jeab7w484b77n86/Magic-CoC_S3-9.105-R1.apk
6+
http://www.tomzpot.com/android-games/clash-of-magic-9-105-10-private-server-september-2017/
7+
* Add Mini GUI mode to run launch more 10 bots (can be also enabled with command line option /minigui or /mg)
8+
New title bar icon to switch between normal and mini GUI mode
9+
* Add automatic Android reboot after configured run-time hours (default is 24) to prevent severy Android issues like memory leak, graphics error etc.
10+
* Add /? command line option to show help on additonal command line paramter and options
11+
* Fix wall upgrade not saving resources for enabled non-repeated building upgrades when a builder is available
12+
* Fix Wait For Clan Castle Spell not getting detected sometimes
13+
* Fix Log Messages when Heroes are not enabled to auto Upgrade
14+
* Fix Balloon Donation Issues
15+
* Fix Wall Upgrade Ignoring Auto Warden Upgrade when checking if enough Elixir is available
16+
* Fix Several Bugs and outdated values by @NguyenAnhHD
17+
* Fix Clone Spell not getting brewed before going to Attack by @ViperZ
18+
* Improve Weak Base Eagle Lvl 2 Detection
19+
* Improve Dead Base Collector Lvl 11 Detection
20+
* Improve village measuring with secondary images to fix zoom out loop when village cannot be measured
21+
* Improve remaing attack time calculation
22+
* Improve bot launch time when no Android Emulator command line parameter was specified
23+
* Improve Android reboot on time lag after 2 detections
24+
* Improve watchdog process restarting unresponsive bots after 3 Minutes (was 2 Minutes) and Bot API window communication
25+
* Improve ADB Click&Drag for input drag mode (when not accurate Click&Drag script is used)
26+
* Update ProfileReport Code & OCR
27+
* Show bot window when Android Window activated (both ways)
28+
* Bot start/stop/pause and resume added to tray menu
29+
* New MyBot.run.MiniGui "reference app for modders/devs" controlling bot backend process using Window Messages
30+
131
* **V7.2.5**
232
* Add Inferno Lvl 5 to Weak Base Images/GUI settings, add Lvl 4 tile and lowered tolerance
333
* Lower Eagle Lvl 1 tolerance for better Weak Base detection

COCBot/GUI/MBR GUI Control BOT Options.au3

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -206,67 +206,67 @@ EndFunc ;==>txtThreads
206206
; #DEBUG FUNCTION# ==============================================================================================================
207207

208208
Func chkDebugClick()
209-
$g_iDebugClick = (GUICtrlRead($g_hChkDebugClick) = $GUI_CHECKED ? 1 : 0)
210-
SetDebugLog("DebugClick " & ($g_iDebugClick = 1 ? "enabled" : "disabled"))
209+
$g_bDebugClick = (GUICtrlRead($g_hChkDebugClick) = $GUI_CHECKED)
210+
SetDebugLog("DebugClick " & ($g_bDebugClick ? "enabled" : "disabled"))
211211
EndFunc ;==>chkDebugClick
212212

213213
Func chkDebugSetlog()
214-
$g_iDebugSetlog = (GUICtrlRead($g_hChkDebugSetlog) = $GUI_CHECKED ? 1 : 0)
215-
SetDebugLog("DebugSetlog " & ($g_iDebugSetlog = 1 ? "enabled" : "disabled"))
214+
$g_bDebugSetlog = (GUICtrlRead($g_hChkDebugSetlog))
215+
SetDebugLog("DebugSetlog " & ($g_bDebugSetlog ? "enabled" : "disabled"))
216216
EndFunc ;==>chkDebugSetlog
217217

218218
Func chkDebugDisableZoomout()
219-
$g_iDebugDisableZoomout = (GUICtrlRead($g_hChkDebugDisableZoomout) = $GUI_CHECKED ? 1 : 0)
220-
SetDebugLog("DebugDisableZoomout " & ($g_iDebugDisableZoomout = 1 ? "enabled" : "disabled"))
219+
$g_bDebugDisableZoomout = (GUICtrlRead($g_hChkDebugDisableZoomout) = $GUI_CHECKED)
220+
SetDebugLog("DebugDisableZoomout " & ($g_bDebugDisableZoomout ? "enabled" : "disabled"))
221221
EndFunc ;==>chkDebugDisableZoomout
222222

223223
Func chkDebugDisableVillageCentering()
224-
$g_iDebugDisableVillageCentering = (GUICtrlRead($g_hChkDebugDisableVillageCentering) = $GUI_CHECKED ? 1 : 0)
225-
SetDebugLog("DebugDisableVillageCentering " & ($g_iDebugDisableVillageCentering = 1 ? "enabled" : "disabled"))
224+
$g_bDebugDisableVillageCentering = (GUICtrlRead($g_hChkDebugDisableVillageCentering) = $GUI_CHECKED)
225+
SetDebugLog("DebugDisableVillageCentering " & ($g_bDebugDisableVillageCentering ? "enabled" : "disabled"))
226226
EndFunc ;==>chkDebugDisableVillageCentering
227227

228228
Func chkDebugDeadbaseImage()
229-
$g_iDebugDeadBaseImage = (GUICtrlRead($g_hChkDebugDeadbaseImage) = $GUI_CHECKED ? 1 : 0)
230-
SetDebugLog("DebugDeadbaseImage " & ($g_iDebugDeadBaseImage = 1 ? "enabled" : "disabled"))
229+
$g_bDebugDeadBaseImage = (GUICtrlRead($g_hChkDebugDeadbaseImage) = $GUI_CHECKED)
230+
SetDebugLog("DebugDeadbaseImage " & ($g_bDebugDeadBaseImage ? "enabled" : "disabled"))
231231
EndFunc ;==>chkDebugDeadbaseImage
232232

233233
Func chkDebugOcr()
234-
$g_iDebugOcr = (GUICtrlRead($g_hChkDebugOCR) = $GUI_CHECKED ? 1 : 0)
235-
SetDebugLog("DebugOcr " & ($g_iDebugOcr = 1 ? "enabled" : "disabled"))
234+
$g_bDebugOcr = (GUICtrlRead($g_hChkDebugOCR) = $GUI_CHECKED)
235+
SetDebugLog("DebugOcr " & ($g_bDebugOcr ? "enabled" : "disabled"))
236236
EndFunc ;==>chkDebugOcr
237237

238238
Func chkDebugImageSave()
239-
$g_iDebugImageSave = (GUICtrlRead($g_hChkDebugImageSave) = $GUI_CHECKED ? 1 : 0)
240-
SetDebugLog("DebugImageSave " & ($g_iDebugImageSave = 1 ? "enabled" : "disabled"))
239+
$g_bDebugImageSave = (GUICtrlRead($g_hChkDebugImageSave) = $GUI_CHECKED)
240+
SetDebugLog("DebugImageSave " & ($g_bDebugImageSave ? "enabled" : "disabled"))
241241
EndFunc ;==>chkDebugImageSave
242242

243243
Func chkDebugBuildingPos()
244-
$g_iDebugBuildingPos = (GUICtrlRead($g_hChkdebugBuildingPos) = $GUI_CHECKED ? 1 : 0)
245-
SetDebugLog("DebugBuildingPos " & ($g_iDebugBuildingPos = 1 ? "enabled" : "disabled"))
244+
$g_bDebugBuildingPos = (GUICtrlRead($g_hChkdebugBuildingPos) = $GUI_CHECKED)
245+
SetDebugLog("DebugBuildingPos " & ($g_bDebugBuildingPos ? "enabled" : "disabled"))
246246
EndFunc ;==>chkDebugBuildingPos
247247

248248
Func chkDebugTrain()
249-
$g_iDebugSetlogTrain = (GUICtrlRead($g_hChkdebugTrain) = $GUI_CHECKED ? 1 : 0)
250-
SetDebugLog("DebugTrain " & ($g_iDebugSetlogTrain = 1 ? "enabled" : "disabled"))
249+
$g_bDebugSetlogTrain = (GUICtrlRead($g_hChkdebugTrain) = $GUI_CHECKED)
250+
SetDebugLog("DebugTrain " & ($g_bDebugSetlogTrain ? "enabled" : "disabled"))
251251
EndFunc ;==>chkDebugTrain
252252

253253
Func chkdebugOCRDonate()
254-
$g_iDebugOCRdonate = (GUICtrlRead($g_hChkDebugOCRDonate) = $GUI_CHECKED ? 1 : 0)
255-
SetDebugLog("DebugOCRDonate " & ($g_iDebugOCRdonate = 1 ? "enabled" : "disabled"))
254+
$g_bDebugOCRdonate = (GUICtrlRead($g_hChkDebugOCRDonate) = $GUI_CHECKED)
255+
SetDebugLog("DebugOCRDonate " & ($g_bDebugOCRdonate ? "enabled" : "disabled"))
256256
EndFunc ;==>chkdebugOCRDonate
257257

258258
Func chkdebugAttackCSV()
259-
$g_iDebugAttackCSV = (GUICtrlRead($g_hChkdebugAttackCSV) = $GUI_CHECKED ? 1 : 0)
260-
SetDebugLog("DebugAttackCSV " & ($g_iDebugAttackCSV = 1 ? "enabled" : "disabled"))
259+
$g_bDebugAttackCSV = (GUICtrlRead($g_hChkdebugAttackCSV) = $GUI_CHECKED)
260+
SetDebugLog("DebugAttackCSV " & ($g_bDebugAttackCSV ? "enabled" : "disabled"))
261261
EndFunc ;==>chkdebugAttackCSV
262262

263263
Func chkmakeIMGCSV()
264-
$g_iDebugMakeIMGCSV = (GUICtrlRead($g_hChkMakeIMGCSV) = $GUI_CHECKED ? 1 : 0)
265-
SetDebugLog("MakeIMGCSV " & ($g_iDebugMakeIMGCSV = 1 ? "enabled" : "disabled"))
264+
$g_bDebugMakeIMGCSV = (GUICtrlRead($g_hChkMakeIMGCSV) = $GUI_CHECKED)
265+
SetDebugLog("MakeIMGCSV " & ($g_bDebugMakeIMGCSV ? "enabled" : "disabled"))
266266
EndFunc ;==>chkmakeIMGCSV
267267

268268
Func btnTestTrain()
269-
Local $currentOCR = $g_iDebugOcr
269+
Local $currentOCR = $g_bDebugOcr
270270
Local $currentRunState = $g_bRunState
271271
$g_bRunState = True
272272
BeginImageTest()
@@ -285,18 +285,18 @@ Func btnTestTrain()
285285

286286
EndImageTest()
287287

288-
$g_iDebugOcr = $currentOCR
288+
$g_bDebugOcr = $currentOCR
289289
$g_bRunState = $currentRunState
290290
EndFunc ;==>btnTestTrain
291291

292292
Func btnTestDonateCC()
293-
Local $currentOCR = $g_iDebugOcr
293+
Local $currentOCR = $g_bDebugOcr
294294
Local $currentRunState = $g_bRunState
295-
Local $currentSetlog = $g_iDebugSetlog
295+
Local $currentSetlog = $g_bDebugSetlog
296296
_GUICtrlTab_ClickTab($g_hTabMain, 0)
297-
$g_iDebugOcr = 1
297+
$g_bDebugOcr = True
298298
$g_bRunState = True
299-
$g_iDebugSetlog = 1
299+
$g_bDebugSetlog = True
300300
ForceCaptureRegion()
301301
DebugImageSave("donateCC_")
302302

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

323-
$g_iDebugOcr = $currentOCR
323+
$g_bDebugOcr = $currentOCR
324324
$g_bRunState = $currentRunState
325-
$g_iDebugSetlog = $currentSetlog
325+
$g_bDebugSetlog = $currentSetlog
326326
EndFunc ;==>btnTestDonateCC
327327

328328
Func btnTestRequestCC()
@@ -346,11 +346,11 @@ Func btnTestSendText()
346346
EndFunc ;==>btnTestSendText
347347

348348
Func btnTestAttackBar()
349-
Local $currentOCR = $g_iDebugOcr
349+
Local $currentOCR = $g_bDebugOcr
350350
Local $currentRunState = $g_bRunState
351351
_GUICtrlTab_ClickTab($g_hTabMain, 0)
352352

353-
$g_iDebugOcr = 1
353+
$g_bDebugOcr = True
354354
$g_bRunState = True
355355
ForceCaptureRegion()
356356
SetLog(_PadStringCenter(" Test Attack Bar begin (" & $g_sBotVersion & ")", 54, "="), $COLOR_INFO)
@@ -387,7 +387,7 @@ Func btnTestAttackBar()
387387
SetLog(_PadStringCenter(" Test Attack Bar end ", 54, "="), $COLOR_INFO)
388388
ShellExecute($savefolder)
389389

390-
$g_iDebugOcr = $currentOCR
390+
$g_bDebugOcr = $currentOCR
391391
$g_bRunState = $currentRunState
392392
EndFunc ;==>btnTestAttackBar
393393

@@ -485,22 +485,24 @@ Func btnTestVillageSize()
485485
_CaptureRegion()
486486
_CaptureRegion2Sync()
487487

488-
SetLog("Testing GetVillageSize()", $COLOR_INFO)
489-
Local $hTimer = __TimerInit()
490-
Local $village = GetVillageSize(True)
491-
Local $ms = __TimerDiff($hTimer)
492-
If $village = 0 Then
493-
SetLog("Village not found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
494-
Else
495-
SetLog("Village found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
496-
SetLog("Village size: " & $village[0])
497-
SetLog("Village zoom level: " & $village[1])
498-
SetLog("Village offset x: " & $village[2])
499-
SetLog("Village offset y: " & $village[3])
500-
SetLog("Village stone " & $village[6] & ": " & $village[4] & ", " & $village[5])
501-
SetLog("Village tree " & $village[9] & ": " & $village[7] & ", " & $village[8])
502-
EndIf
503-
488+
Local $a[2][2] = [["stone", "tree"], ["2stone", "2tree"]]
489+
For $i = 0 To 1
490+
SetLog("Testing GetVillageSize(True, """ & $a[$i][0] & """, """ & $a[$i][1] & """)", $COLOR_INFO)
491+
Local $hTimer = __TimerInit()
492+
Local $village = GetVillageSize(True, $a[$i][0], $a[$i][1])
493+
Local $ms = __TimerDiff($hTimer)
494+
If $village = 0 Then
495+
SetLog("Village not found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
496+
Else
497+
SetLog("Village found (" & Round($ms, 0) & " ms.)", $COLOR_WARNING)
498+
SetLog("Village size: " & $village[0])
499+
SetLog("Village zoom level: " & $village[1])
500+
SetLog("Village offset x: " & $village[2])
501+
SetLog("Village offset y: " & $village[3])
502+
SetLog("Village stone " & $village[6] & ": " & $village[4] & ", " & $village[5])
503+
SetLog("Village tree " & $village[9] & ": " & $village[7] & ", " & $village[8])
504+
EndIf
505+
Next
504506
EndImageTest()
505507

506508
$g_bRunState = $currentRunState
@@ -565,17 +567,17 @@ Func btnTestAttackCSV()
565567
BeginImageTest() ; get image for testing
566568

567569
Local $currentRunState = $g_bRunState
568-
Local $currentDebugAttackCSV = $g_iDebugAttackCSV
569-
Local $currentMakeIMGCSV = $g_iDebugMakeIMGCSV
570+
Local $currentDebugAttackCSV = $g_bDebugAttackCSV
571+
Local $currentMakeIMGCSV = $g_bDebugMakeIMGCSV
570572
Local $currentiMatchMode = $g_iMatchMode
571-
Local $currentdebugsetlog = $g_iDebugSetlog
572-
Local $currentDebugBuildingPos = $g_iDebugBuildingPos
573+
Local $currentdebugsetlog = $g_bDebugSetlog
574+
Local $currentDebugBuildingPos = $g_bDebugBuildingPos
573575

574576
$g_bRunState = True
575-
$g_iDebugAttackCSV = 1
576-
$g_iDebugMakeIMGCSV = 1
577-
$g_iDebugSetlog = 1
578-
$g_iDebugBuildingPos = 1
577+
$g_bDebugAttackCSV = True
578+
$g_bDebugMakeIMGCSV = True
579+
$g_bDebugSetlog = True
580+
$g_bDebugBuildingPos = True
579581

580582
$g_iMatchMode = $DB ; define which script to use
581583

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

597599
$g_bRunState = $currentRunState
598-
$g_iDebugAttackCSV = $currentDebugAttackCSV
599-
$g_iDebugMakeIMGCSV = $currentMakeIMGCSV
600+
$g_bDebugAttackCSV = $currentDebugAttackCSV
601+
$g_bDebugMakeIMGCSV = $currentMakeIMGCSV
600602
$g_iMatchMode = $currentiMatchMode
601-
$g_iDebugSetlog = $currentdebugsetlog
602-
$g_iDebugBuildingPos = $currentDebugBuildingPos
603+
$g_bDebugSetlog = $currentdebugsetlog
604+
$g_bDebugBuildingPos = $currentDebugBuildingPos
603605

604606
EndFunc ;==>btnTestAttackCSV
605607

@@ -611,11 +613,11 @@ Func btnTestGetLocationBuilding()
611613

612614
; Store variables changed, set test values
613615
Local $currentRunState = $g_bRunState
614-
Local $currentDebugBuildingPos = $g_iDebugBuildingPos
615-
Local $currentdebugsetlog = $g_iDebugSetlog
616+
Local $currentDebugBuildingPos = $g_bDebugBuildingPos
617+
Local $currentdebugsetlog = $g_bDebugSetlog
616618
$g_bRunState = True
617-
$g_iDebugBuildingPos = 1
618-
$g_iDebugSetlog = 1
619+
$g_bDebugBuildingPos = True
620+
$g_bDebugSetlog = True
619621

620622
SearchZoomOut($aCenterEnemyVillageClickDrag, True, "btnTestAttackCSV")
621623
ResetTHsearch()
@@ -651,8 +653,8 @@ Func btnTestGetLocationBuilding()
651653

652654
; restore changed variables
653655
$g_bRunState = $currentRunState
654-
$g_iDebugBuildingPos = $currentDebugBuildingPos
655-
$g_iDebugSetlog = $currentdebugsetlog
656+
$g_bDebugBuildingPos = $currentDebugBuildingPos
657+
$g_bDebugSetlog = $currentdebugsetlog
656658

657659
EndFunc ;==>btnTestGetLocationBuilding
658660

@@ -789,7 +791,7 @@ Func btnTestGetLocationBuildingImage()
789791
_GDIPlus_BitmapDispose($EditedImage)
790792

791793
; open image
792-
If TestCapture() = True Then
794+
If TestCapture() Then
793795
ShellExecute($filename)
794796
EndIf
795797

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

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

@@ -907,3 +909,7 @@ Func btnTestWeakBase()
907909
EndImageTest()
908910
$g_bRunState = $currentRunState
909911
EndFunc ;==>btnTestWeakBase
912+
913+
Func btnTestClickAway()
914+
ClickP($aAway, 2, 0)
915+
EndFunc ;==>btnTestClickAway

0 commit comments

Comments
 (0)