Skip to content

Commit

Permalink
* v8.1.3 **
Browse files Browse the repository at this point in the history
* Fixed Costs OCR in Labs.
* Improved Super Dragon Training.
* Improved 8 red detection in troops queue.
* Improved Close Donate Window speed.
* Added : Read all request lines for donations.
* Updated LatinA OCR for donations
* Improved Full Dark Elixir detection (Was detected as true in some sceneries).
* Fixed Switch Siege -> Clan Castle.
* Improved Siege Machine OCR.
* Improved Donate Super Troops.
* Improved Edrag and Loons Detection While Training.
* Fixed Super Troop icons reset.
* Improved Weekly Deals tab detection.
* Cleaned BB Attack management code.
* Improved Boat Detection in base builder.
* Added New Sieges to Test Donate().
* Updated Portuguese translation file from Eustacio (Fixes array error with new profile)
* Updated donateCCWBL.
* Improved LatinA Lib.
* Improved BB troop Upgrade Time detection.
* Added Support for Grey Search Button.
* Improved Battle Blimp and Stone Slammer Donate.
* Added BB resources and builder(s) check just before suggested upgrade.
* Fixed BB Master Builder Icon Offset.
  • Loading branch information
MonkeyHunter committed Nov 8, 2023
1 parent 6505bba commit 23fb97a
Show file tree
Hide file tree
Showing 55 changed files with 280 additions and 148 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
* v8.1.3 **
* Fixed Costs OCR in Labs.
* Improved Super Dragon Training.
* Improved 8 red detection in troops queue.
* Improved Close Donate Window speed.
* Added : Read all request lines for donations.
* Updated LatinA OCR for donations
* Improved Full Dark Elixir detection (Was detected as true in some sceneries).
* Fixed Switch Siege -> Clan Castle.
* Improved Siege Machine OCR.
* Improved Donate Super Troops.
* Improved Edrag and Loons Detection While Training.
* Fixed Super Troop icons reset.
* Improved Weekly Deals tab detection.
* Cleaned BB Attack management code.
* Improved Boat Detection in base builder.
* Added New Sieges to Test Donate().
* Updated Portuguese translation file from Eustacio (Fixes array error with new profile)
* Updated donateCCWBL.
* Improved LatinA Lib.
* Improved BB troop Upgrade Time detection.
* Added Support for Grey Search Button.
* Improved Battle Blimp and Stone Slammer Donate.
* Added BB resources and builder(s) check just before suggested upgrade.
* Fixed BB Master Builder Icon Offset.

* v8.1.2 **
* Add support for CoC October 9th 2023 game update.
* The game update forced a massive number of MBR changes to support all the game UI changes, including:
Expand Down
2 changes: 2 additions & 0 deletions COCBot/GUI/MBR GUI Control BOT Options.au3
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ Func btnTestDonateCC()
$g_aiCurrentSiegeMachines[$eSiegeStoneSlammer] = 1
$g_aiCurrentSiegeMachines[$eSiegeBarracks] = 1
$g_aiCurrentSiegeMachines[$eSiegeLogLauncher] = 1
$g_aiCurrentSiegeMachines[$eSiegeFlameFlinger] = 1
$g_aiCurrentSiegeMachines[$eSiegeBattleDrill] = 1
DonateCC()
SetLog(_PadStringCenter(" Test DonateCC end ", 54, "="), $COLOR_INFO)

Expand Down
8 changes: 8 additions & 0 deletions COCBot/GUI/MBR GUI Control Bottom.au3
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ Func Initiate()
Local $Compiled = @ScriptName & (@Compiled ? " Executable" : " Script")
SetLog($Compiled & " running on " & @OSVersion & " " & @OSServicePack & " " & @OSArch)

If _Sleep($DELAYRESPOND) Then Return
If StringInStr(@OSVersion, "WIN_11", $STR_NOCASESENSEBASIC) Or _
StringInStr(@OSVersion, "WIN_2019", $STR_NOCASESENSEBASIC) Or _
StringInStr(@OSVersion, "WIN_2022", $STR_NOCASESENSEBASIC) Then
Setlog(" Unsupported Windows 11 OS detected!!", $COLOR_ERROR)
Setlog(" See MBR forum for more information", $COLOR_ERROR)
EndIf

Local $sGameVersion = GetCoCAppVersion()
If Not @error Then SetLog(">> CoC Game App Version = " & $sGameVersion, $COLOR_DEBUG)

Expand Down
2 changes: 1 addition & 1 deletion COCBot/GUI/MBR GUI Control Child Army.au3
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ Func cmbSuperTroops()
If $i = $j Then ContinueLoop
If $g_iCmbSuperTroops[$i] <> 0 And $g_iCmbSuperTroops[$i] = $g_iCmbSuperTroops[$j] Then
_GUICtrlComboBox_SetCurSel($g_ahCmbSuperTroops[$j], 0)
_GUICtrlSetImage($g_ahImgTroopOrder[$j], $g_sLibIconPath, $eIcnOptions)
_GUICtrlSetImage($g_ahPicSuperTroops[$j], $g_sLibIconPath, $eIcnOptions)
EndIf
Next
Next
Expand Down
3 changes: 3 additions & 0 deletions COCBot/MBR GUI Action.au3
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,11 @@ Func BotSearchMode()
If (IsSearchModeActive($DB) And checkCollectors(True, False)) Or IsSearchModeActive($LB) Then
If _Sleep(100) Then Return FuncReturn()
PrepareSearch()
If $g_bOutOfGold Then Return ; Check flag for enough gold to search
If $g_bRestart Then Return
If _Sleep(1000) Then Return FuncReturn()
VillageSearch()
If $g_bOutOfGold Then Return ; Check flag for enough gold to search
If _Sleep(100) Then Return FuncReturn()
Else
SetLog("Your Army is not prepared, check the Attack/train options")
Expand Down
2 changes: 2 additions & 0 deletions COCBot/functions/Attack/Attack Algorithms/SmartFarm.au3
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Func TestSmartFarm()
If (IsSearchModeActive($DB) And checkCollectors(True, False)) Or IsSearchModeActive($LB) Then
If _Sleep(100) Then Return FuncReturn()
PrepareSearch()
If $g_bOutOfGold Then Return ; Check flag for enough gold to search
If $g_bRestart Then Return
If _Sleep(1000) Then Return FuncReturn()
VillageSearch()
If $g_bOutOfGold Then Return ; Check flag for enough gold to search
Expand Down
32 changes: 17 additions & 15 deletions COCBot/functions/Attack/BuilderBase/AttackBB.au3
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,23 @@ Func DoAttackBB()
Local $AttackCount = 0

If $g_iBBAttackCount = 0 Then
Local $count = 1
While PrepareAttackBB()
If Not $g_bRunState Then Return
SetDebugLog("PrepareAttackBB(): Success.", $COLOR_SUCCESS)
SetLog("Attacking For Stars", $COLOR_OLIVE)
SetLog("Attack #" & $count & "/~", $COLOR_INFO)
If $b_AbortedAttack Then $b_AbortedAttack = False ; Reset Value
SetLog("Attack #" & $AttackCount + 1 & "/~", $COLOR_INFO)
_AttackBB()
If Not $g_bRunState Then Return
If Not $b_AbortedAttack Then $AttackCount += 1 ; Count if no Zoom Out fail
If Not $g_bRunState Then ExitLoop
If $IsChallengeCompleted Then ExitLoop
If _Sleep($DELAYATTACKMAIN2) Then Return
checkObstacles()
$count += 1
If $count > 10 Then
$AttackCount += 1
If $AttackCount > 10 Then
SetLog("Already Attack 10 times, continue next time", $COLOR_INFO)
ExitLoop
EndIf
If _Sleep($DELAYATTACKMAIN2) Then ExitLoop
checkObstacles()
WEnd
SetLog("Skip Attack This Time..", $COLOR_DEBUG)
ClickAway()
Else
Local $g_iBBAttackCountFinal = 0
Local $AttackNbDisplay = 0
Expand All @@ -82,6 +78,7 @@ Func DoAttackBB()
$g_iBBAttackCountFinal = $g_iBBAttackCount - 1
EndIf
For $i = 1 To $g_iBBAttackCountFinal
If Not $g_bRunState Then ExitLoop
If PrepareAttackBB() Then
If $AttackNbDisplay = 0 Then
If $g_iBBAttackCount = 1 Then
Expand All @@ -95,7 +92,7 @@ Func DoAttackBB()
SetLog("Attack #" & $i & "/" & $g_iBBAttackCountFinal, $COLOR_INFO)
If $b_AbortedAttack Then $b_AbortedAttack = False ; Reset Value
_AttackBB()
If Not $g_bRunState Then Return
If Not $g_bRunState Then ExitLoop
If Not $b_AbortedAttack Then
$AttackCount += 1 ; Count if no Zoom Out fail
Else
Expand All @@ -106,21 +103,26 @@ Func DoAttackBB()
SetLog("Skip Attack This Time..", $COLOR_DEBUG)
ExitLoop
EndIf
If _Sleep($DELAYATTACKMAIN2) Then Return
checkObstacles()
If $i = $g_iBBAttackCountFinal Then
SetLog("Skip Attack This Time..", $COLOR_DEBUG)
ExitLoop
EndIf
If $AttackCount > 10 Then
SetLog("Already Attack 10 times, continue next time", $COLOR_INFO)
ExitLoop
EndIf
If _Sleep($DELAYATTACKMAIN2) Then ExitLoop
checkObstacles()
Else
SetLog("Skip Attack This Time..", $COLOR_DEBUG)
ClickAway()
ExitLoop
EndIf
Next
EndIf
ZoomOut()
If Not $g_bRunState Then Return
If $AttackCount > 0 Then SetLog("BB Attack Cycle Done", $COLOR_SUCCESS1)
ClickAway()
ZoomOut()
EndFunc ;==>DoAttackBB

Func ClickFindNowButton()
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Attack/PrepareAttack.au3
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ Func SelectCastleOrSiege(ByRef $iTroopIndex, $iX, $iCmbSiege)
If _Sleep(2000) Then Return

; Lets detect the CC & Sieges and click - search window is - X, 530, X + 390, 530 + 30
Local $sSearchArea = GetDiamondFromRect(_Min($iX - 50, 470) & ",539(395,37)") ; x = 470 when Castle is at slot 6+ and there are 5 slots in siege switching window
Local $sSearchArea = GetDiamondFromRect(_Min($iX - 50, 470) & ",539(395,70)") ; x = 470 when Castle is at slot 6+ and there are 5 slots in siege switching window

SetLog("Switch Search Area : " & $sSearchArea)
If $g_bDebugImageSave Then SaveDebugDiamondImage("SelectCastleOrSiege", $sSearchArea)
Expand Down
2 changes: 2 additions & 0 deletions COCBot/functions/Config/ImageDirectories.au3
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Global $g_sImgBoatBB = @ScriptDir & "\imgxml\Boat\BuilderBase\"
Global $g_sImgStartCTBoost = @ScriptDir & "\imgxml\Resources\BuildersBase\ClockTower\ClockTowerAvailable*.xml"
Global $g_sImgCleanBBYard = @ScriptDir & "\imgxml\Resources\ObstaclesBB"
Global $g_sImgIsOnBB = @ScriptDir & "\imgxml\village\Page\BuilderBase\"
Global Const $g_sImgMasterBuilderHead = @ScriptDir & "\imgxml\village\Page\BuilderBase\BuilderEye*"
Global $sImgIsOnBuilderBaseEnemyVillage = @ScriptDir & "\imgxml\village\Page\BuilderBaseEnemyVillage\"
Global $g_sImgStarLaboratory = @ScriptDir & "\imgxml\Resources\BuildersBase\StarLaboratory"
Global $g_sImgStarLabElex = @ScriptDir & "\imgxml\Resources\BuildersBase\StarLabElex\StarLabElex*"
Expand All @@ -127,6 +128,7 @@ Global $g_sImgDonateSpells = @ScriptDir & "\imgxml\DonateCC\Spells\"
Global $g_sImgDonateSiege = @ScriptDir & "\imgxml\DonateCC\SiegeMachines\"
Global $g_sImgChatDivider = @ScriptDir & "\imgxml\DonateCC\donateccwbl\chatdivider_0_98.xml"
Global $g_sImgChatDividerHidden = @ScriptDir & "\imgxml\DonateCC\donateccwbl\chatdividerhidden_0_98.xml"
Global $g_sImgChatDividerWhite = @ScriptDir & "\imgxml\DonateCC\donateccwbl\chatdividerwhite_0_98.xml"
Global $g_sImgChatIUnterstand = @ScriptDir & "\imgxml\DonateCC\donateccwbl\iunderstand_0_95.xml"
#EndRegion DonateCC

Expand Down
3 changes: 2 additions & 1 deletion COCBot/functions/Config/ScreenCoordinates.au3
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Global $g_aArmyCCSpellSize[2] = [473, 437 + $g_iMidOffsetY] ; Training Window, O
Global $aArmyCCRemainTime[2] = [782, 552 + $g_iMidOffsetY] ; Training Window Overviewscreen, Minutes & Seconds remaining till can request again
Global $aIsCampFull[4] = [128, 151 + $g_iMidOffsetY, 0xFFFFFF, 10] ; Training Window, Overview screen White pixel in check mark with camp IS full (can not test for Green, as it has trees under it!)
Global $aBuildersDigits[2] = [424, 21] ; Main Screen, Free/Total Builders
Global $aBuildersDigitsBuilderBase[2] = [502, 21] ; Main Screen on Builders Base Free/Total Builders
Global $aBuildersDigitsBuilderBase[2] = [0, 21] ; Main Screen on Builders Base Free/Total Builders
Global $aTrophies[2] = [69, 84] ; Main Screen, Trophies
Global $aNoCloudsAttack[4] = [25, 606, 0xCD0D0D, 15] ; Attack Screen: No More Clouds
Global $aArmyTrainButton[2] = [40, 525 + $g_iBottomOffsetY] ; Main Screen, Army Train Button
Expand All @@ -66,6 +66,7 @@ Global $aWonTwoStar[4] = [739, 538 + $g_iBottomOffsetY, 0xC0C8C0, 20] ; Center o
Global $aWonThreeStar[4] = [763, 538 + $g_iBottomOffsetY, 0xC0C8C0, 20] ; Center of 3rd Star for winning attack on enemy
Global $aIsAtkDarkElixirFull[4] = [743, 62 + $g_iMidOffsetY, 0x270D33, 10] ; Attack Screen DE Resource bar is full
Global $aIsDarkElixirFull[4] = [709, 102 + $g_iMidOffsetY, 0x270D33, 10] ; Main Screen DE Resource bar is full
Global $aIsDarkElixirFull2[4] = [710, 102 + $g_iMidOffsetY, 0x270D33, 10] ; Main Screen DE Resource bar is full
Global $aIsGoldFull[4] = [660, 2 + $g_iMidOffsetY, 0xE7C00D, 10] ; Main Screen Gold Resource bar is Full
Global $aIsElixirFull[4] = [660, 52 + $g_iMidOffsetY, 0xC027C0, 10] ; Main Screen Elixir Resource bar is Full
Global $aPerkBtn[4] = [95, 243 + $g_iMidOffsetY, 0x7CD8E8, 10] ; Clan Info Page, Perk Button (blue); 800x780
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/CreateArmy/TrainSystem.au3
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ Func SearchArmy($sImageDir = "", $x = 0, $y = 0, $x1 = 0, $y1 = 0, $sArmyType =
ReDim $aResult[UBound($aKeys) + $iResultAddDup][4]
$aResult[$i + $iResultAddDup][0] = $aResult[$i + $iResultAddDup - 1][0] ; same objectname
$aResult[$i + $iResultAddDup][1] = $aCoordsSplit2[0] + $x
$aResult[$i + $iResultAddDup][2] = $aCoordsSplit2[1]
$aResult[$i + $iResultAddDup][2] = $aCoordsSplit2[1] + $y
SetDebugLog($aResult[$i + $iResultAddDup][0] & " | $aCoordArray: " & $aResult[$i + $iResultAddDup][1] & "-" & $aResult[$i + $iResultAddDup][2])
EndIf
Next
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Func getArmyCCSiegeMachines($bOpenArmyWindow = False, $bCloseArmyWindow = False,
$g_aiCurrentCCSiegeMachines = $aCurrentCCSiegeEmpty ; Reset Current Siege Machine Array

; Get CC Siege Capacities
Local $sSiegeInfo = getSiegeCampCap(645, 468, $bNeedCapture) ; OCR read Siege built and total
Local $sSiegeInfo = getCCSiegeCampCap(644, 438 + $g_iMidOffsetY, $bNeedCapture) ; OCR read Siege built and total
If $g_bDebugSetlogTrain Then SetLog("OCR $sSiegeInfo = " & $sSiegeInfo, $COLOR_DEBUG)
Local $aGetSiegeCap = StringSplit($sSiegeInfo, "#", $STR_NOCOUNT) ; split the built Siege number from the total Siege number
If $bSetLog And UBound($aGetSiegeCap) = 2 Then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Func getArmySiegeMachines($bOpenArmyWindow = False, $bCloseArmyWindow = False, $
Local $aCurrentTroopsEmpty[$eSiegeMachineCount] = [0, 0, 0, 0, 0, 0, 0] ; Local Copy to reset Siege Machine Array

; Get Siege Capacities
Local $sSiegeInfo = getSiegeCampCap(749, 144 + $g_iMidOffsetY, $bNeedCapture) ; OCR read Siege built and total
Local $sSiegeInfo = getSiegeCampCap(747, 144 + $g_iMidOffsetY, $bNeedCapture) ; OCR read Siege built and total
If $g_bDebugSetlogTrain Then SetLog("OCR $sSiegeInfo = " & $sSiegeInfo, $COLOR_DEBUG)
Local $aGetSiegeCap = StringSplit($sSiegeInfo, "#", $STR_NOCOUNT) ; split the built Siege number from the total Siege number
If UBound($aGetSiegeCap) = 2 Then
Expand Down
14 changes: 7 additions & 7 deletions COCBot/functions/Image Search/imglocAuxiliary.au3
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ Func GetButtonDiamond($sButtonName)
Case "ObjectButtons", "BoostOne", "BoostCT", "Upgrade", "Research", "Treasury", "RemoveObstacle", "CollectLootCart", "Pets", "THWeapon", "MagicItems" ; Full size of object buttons at the bottom
$btnDiamond = GetDiamondFromRect2(140, 500 + $g_iBottomOffsetY, 720, 590 + $g_iBottomOffsetY)
Case "GEM", "BOOSTBtn" ; Boost window button (full button size)
$btnDiamond = GetDiamondFromRect2(359, 382 + $g_iMidOffsetY, 507, 477 + $g_iMidOffsetY)
$btnDiamond = GetDiamondFromRect2(340, 370 + $g_iMidOffsetY, 525, 495 + $g_iMidOffsetY)
Case "EnterShop"
$btnDiamond = GetDiamondFromRect("359,392(148,66)")
Case "EndBattleSurrender" ;surrender - attackwindow
Expand All @@ -301,11 +301,11 @@ Func GetButtonDiamond($sButtonName)
Case "Collect"
$btnDiamond = "350,450|505,450|505,521|350,521"
Case "BoostBarrack", "BarrackBoosted"
$btnDiamond = GetDiamondFromRect("630,280,850,360")
$btnDiamond = GetDiamondFromRect2(700, 270 + $g_iMidOffsetY, 830, 330 + $g_iMidOffsetY)
Case "ArmyTab", "TrainTroopsTab", "BrewSpellsTab", "BuildSiegeMachinesTab", "QuickTrainTab"
$btnDiamond = GetDiamondFromRect2(30, 80 + $g_iMidOffsetY, 785, 130 + $g_iMidOffsetY)
Case "WeeklyDeals"
$btnDiamond = GetDiamondFromRect2(20, 120 + $g_iMidOffsetY, 130, 320 + $g_iMidOffsetY)
$btnDiamond = GetDiamondFromRect2(30, 115 + $g_iMidOffsetY, 170, 320 + $g_iMidOffsetY)
Case "MessagesButton"
$btnDiamond = GetDiamondFromRect2(0, 0, 90, 170 + $g_iMidOffsetY)
Case "AttackLogTab", "ShareReplayButton"
Expand Down Expand Up @@ -815,11 +815,11 @@ Func Slot($iX, $iY) ; Return Slots for Quantity Reading on Army Window
Case 603 To 670 ; Slot 8
Return 615 ; Siege Machines slot 1

Case 676 To 743 ; Slot 9
Return 688 ; Siege Machines slot 2
Case 675 To 743 ; Slot 9
Return 687 ; Siege Machines slot 2

Case 746 To 813 ; Slot 10
Return 761 ; Siege Machines slot 2
Case 746 To 814 ; Slot 10
Return 758 ; Siege Machines slot 2
EndSwitch
Else ;CC Troops & Spells
Switch $iX
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Main Screen/isOnBuilderBase.au3
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Func isOnBuilderBase($bNeedCaptureRegion = False)
If _Sleep($DELAYISBUILDERBASE) Then Return

Local $sArea = GetDiamondFromRect("455,0,500,54")
Local $sArea = GetDiamondFromRect("445,0,500,54")
Local $asSearchResult = findMultiple($g_sImgIsOnBB, $sArea, $sArea, 0, 1000, 1, "objectname", $bNeedCaptureRegion)

If IsArray($asSearchResult) And UBound($asSearchResult) > 0 Then
Expand Down
8 changes: 7 additions & 1 deletion COCBot/functions/Read Text/getBuilderCount.au3
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ Func getBuilderCount($bSuppressLog = False, $bBuilderBase = False)
If Not $bBuilderBase Then
$sBuilderInfo = getBuilders($aBuildersDigits[0], $aBuildersDigits[1]) ; get builder string with OCR
Else
$sBuilderInfo = getBuilders($aBuildersDigitsBuilderBase[0], $aBuildersDigitsBuilderBase[1]) ; get builder base builder string with OCR
Local $asSearchResult = decodeSingleCoord(FindImageInPlace2("MasterBuilderHead", $g_sImgMasterBuilderHead, 445, 0, 500, 54, True))
If IsArray($asSearchResult) And UBound($asSearchResult) = 2 Then
$sBuilderInfo = getBuilders($asSearchResult[0] + 24, $aBuildersDigitsBuilderBase[1]) ; get builder base builder string with OCR
Else
SetLog("Cannot find Master Builder Head", $COLOR_ERROR)
If $g_bDebugImageSave Then SaveDebugImage("MasterBuilderHead") ; Debug Only
EndIf
EndIf
If StringInStr($sBuilderInfo, "#") > 0 Then ; check for valid OCR read
$aGetBuilders = StringSplit($sBuilderInfo, "#", $STR_NOCOUNT) ; Split into free and total builder strings
Expand Down
8 changes: 6 additions & 2 deletions COCBot/functions/Read Text/getOcr.au3
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Func getBldgUpgradeTime($x_start, $y_start) ; -> Gets complete remain building u
EndFunc ;==>getBldgUpgradeTime

Func getLabUpgradeTime($x_start, $y_start) ; -> Gets complete remain lab upgrade time V3 for Dec2022 update
Return getOcrAndCapture("coc-uptime2", $x_start, $y_start, 95, 22, True) ; 95 is required to upgrades
Return getOcrAndCapture("coc-uptime2", $x_start, $y_start, 100, 22, True) ; 95 is required to upgrades
EndFunc ;==>getLabUpgradeTime

Func getLabUpgradeTime2($x_start, $y_start) ; -> Gets complete remain lab upgrade time V3 for Dec2022 update
Expand Down Expand Up @@ -174,9 +174,13 @@ Func getArmyCampCap($x_start, $y_start, $bNeedCapture = True) ; -> Gets army ca
EndFunc ;==>getArmyCampCap

Func getSiegeCampCap($x_start, $y_start, $bNeedCapture = True) ; -> Gets army camp capacity --> train.au3, and used to read CC request time remaining
Return getOcrAndCapture("coc-camps", $x_start, $y_start, 38, 16, True, False, $bNeedCapture)
Return getOcrAndCapture("coc-camps", $x_start, $y_start, 40, 16, True, False, $bNeedCapture)
EndFunc ;==>getSiegeCampCap

Func getCCSiegeCampCap($x_start, $y_start, $bNeedCapture = True) ; -> Gets army camp capacity --> train.au3, and used to read CC request time remaining
Return getOcrAndCapture("coc-camps", $x_start, $y_start, 34, 16, True, False, $bNeedCapture)
EndFunc ;==>getCCSiegeCampCap

Func getCastleDonateCap($x_start, $y_start) ; -> Gets clan castle capacity, --> donatecc.au3
Return getOcrAndCapture("coc-army", $x_start, $y_start, 30, 14, True)
EndFunc ;==>getCastleDonateCap
Expand Down
18 changes: 15 additions & 3 deletions COCBot/functions/Search/PrepareSearch.au3
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,21 @@ Func PrepareSearch($Mode = $DB) ;Click attack button and find match button, will
SetLog("Unknown Find a Match Button State: " & $sButtonState, $COLOR_WARNING)
Return
EndIf
ElseIf Number($g_aiCurrentLoot[$eLootTrophy]) >= Number($g_asLeagueDetails[21][4]) Then
SetLog("Couldn't find the Attack Button!", $COLOR_ERROR)
Return
Else
Local $g_iFindMatchButtonClassic = _PixelSearch(579, 439 + $g_iMidOffsetY, 581, 441 + $g_iMidOffsetY, Hex(0x838383, 6), 20)
Local $g_iFindMatchButtonLegend = _PixelSearch(579, 489 + $g_iMidOffsetY, 581, 491 + $g_iMidOffsetY, Hex(0x838383, 6), 20)
If IsArray($g_iFindMatchButtonClassic) Or IsArray($g_iFindMatchButtonLegend) Then
SetLog("Couldn't find the Attack Button : Grey Button!", $COLOR_ERROR)
$g_bRestart = True
CloseWindow()
Return
EndIf
If Number($g_aiCurrentLoot[$eLootTrophy]) >= Number($g_asLeagueDetails[21][4]) Then
SetLog("Couldn't find the Attack Button!", $COLOR_ERROR)
$g_bRestart = True
CloseWindow()
Return
EndIf
EndIf
Until Not $bSignedUpLegendLeague

Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Village/BuilderBase/StarLaboratory.au3
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Func StarLabUpgrade($iSelectedUpgrade, $bTestRun = False)
Return False
Else
; get upgrade time from window
$Result = getLabUpgradeTime(595, 493 + $g_iMidOffsetY) ; Try to read white text showing time for upgrade
$Result = getLabUpgradeTime(590, 493 + $g_iMidOffsetY) ; Try to read white text showing time for upgrade
Local $iLabFinishTime = ConvertOCRTime("Lab Time", $Result, False)
SetDebugLog($g_avStarLabTroops[$iSelectedUpgrade][3] & " Upgrade OCR Time = " & $Result & ", $iLabFinishTime = " & $iLabFinishTime & " m", $COLOR_INFO)
$StartTime = _NowCalc() ; what is date:time now
Expand Down
Loading

0 comments on commit 23fb97a

Please sign in to comment.