Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial fix to get bot to stay online. #2

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions COCBot/GUI/MBR GUI Control Bottom.au3
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,31 @@ Func Initiate()
Local $BSy = ($BSsize[0] > $BSsize[1]) ? $BSsize[1] : $BSsize[0]
; $RunState = True
DisposeWindows()
If $BSx <> 860 Or $BSy <> 720 Then
If $BSx <> $DEFAULT_WIDTH Or $BSy <> $DEFAULT_HEIGHT Then
SetLog("BlueStacks resolution is " & $BSx & "x" & $BSy & " but it should be " & $DEFAULT_WIDTH & "x" & $DEFAULT_HEIGHT, $COLOR_PURPLE)

CloseBS() ; BS must die!
If _Sleep(1000) Then Return
RunWait("net stop BstHdAndroidSvc") ;jp restart bluestacks service
If _Sleep(500) Then Return

RegWrite($REGISTRY_KEY_DIRECTORY, "FullScreen", "REG_DWORD", "0")
RegWrite($REGISTRY_KEY_DIRECTORY, "GuestHeight", "REG_DWORD", $DEFAULT_HEIGHT)
RegWrite($REGISTRY_KEY_DIRECTORY, "GuestWidth", "REG_DWORD", $DEFAULT_WIDTH)
RegWrite($REGISTRY_KEY_DIRECTORY, "WindowHeight", "REG_DWORD", $DEFAULT_HEIGHT)
RegWrite($REGISTRY_KEY_DIRECTORY, "WindowWidth", "REG_DWORD", $DEFAULT_WIDTH)
SetLog("Please restart your computer for the applied changes to take effect.", $COLOR_ORANGE)
If _Sleep(3000) Then Return
$MsgRet = MsgBox(BitOR($MB_OKCANCEL, $MB_SYSTEMMODAL), "Restart Computer", "Restart your computer for the applied changes to take effect." & @CRLF & "If your BlueStacks is the correct size (860 x 720), click OK.", 10)
If $MsgRet <> $IDOK Then
btnStop()
Return
EndIf

RunWait("net start BstHdAndroidSvc")
If _Sleep(500) Then Return
OpenBS(True) ; Open BS and restart CoC

;SetLog("BlueStacks doesn't appear to be the correct resolution.", $COLOR_ORANGE)
;If _Sleep(3000) Then Return
;$MsgRet = MsgBox(BitOR($MB_OKCANCEL, $MB_SYSTEMMODAL), "Change BS Resolution", "Click OK to change your BlueStacks resolution, or cancel to leave it as is.")
;If $MsgRet <> $IDOK Then
; btnStop()
; Return
;EndIf
EndIf

WinActivate($Title)
Expand Down
2 changes: 1 addition & 1 deletion COCBot/MBR GUI Control.au3
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Local $aLblBtnControls[17] = [$lblBtnBarbarians, $lblBtnArchers, $lblBtnGiants,

_GDIPlus_Startup()
Global Const $64Bit = StringInStr(@OSArch, "64") > 0
Global Const $DEFAULT_HEIGHT = 720
Global Const $DEFAULT_HEIGHT = 720+60 ;jp
Global Const $DEFAULT_WIDTH = 860
Global $Initiate = 0
Global Const $REGISTRY_KEY_DIRECTORY = "HKEY_LOCAL_MACHINE\SOFTWARE\BlueStacks\Guests\Android\FrameBuffer\0"
Expand Down
69 changes: 37 additions & 32 deletions COCBot/MBR Global Variables.au3
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@
#include <Process.au3>

;debugging
Global $debugSearchArea = 0, $debugOcr = 0, $debugRedArea = 0, $debugSetlog = 0, $debugDeadBaseImage = 0
Global $debugSearchArea = 0, $debugOcr = 0, $debugRedArea = 0, $debugSetlog = 1, $debugDeadBaseImage = 1 ;jp
Global $debugGetPixel = 0 ;jp

;Debug Click
Global $debugClick = 0 ;jp

Global Const $COLOR_ORANGE = 0xFF7700
Global Const $COLOR_CYAN = 0x00FFFF
Global Const $bCapturePixel = True, $bNoCapturePixel = False

Global $Compiled
Expand Down Expand Up @@ -422,7 +427,10 @@ Global $ichkBackground ; Background mode enabled disabled
Global $collectorPos[17][2] ;Positions of each collectors
Global $D[4] = [99, 111, 109, 47]

Global $break = @ScriptDir & "\images\break.bmp"
Global $fnBreak = @ScriptDir & "\images\break.bmp" ;jp
;jp connection error or connection lost
Global $fnConnectionError = @ScriptDir & "\images\connection.bmp" ;jp
Global $fnReload = @ScriptDir & "\images\reload.bmp" ;jp
Global $device = @ScriptDir & "\images\device.bmp"
Global $CocStopped = @ScriptDir & "\images\CocStopped.bmp"
Global $imgDivider = @ScriptDir & "\images\divider.bmp"
Expand Down Expand Up @@ -498,10 +506,6 @@ Global $hBitmapFirst
Global Enum $eVectorLeftTop, $eVectorRightTop, $eVectorLeftBottom, $eVectorRightBottom


;Debug CLick
Global $debugClick = 0


Global $DESTOLoc = ""

Global $dropAllOnSide = 1
Expand Down Expand Up @@ -537,32 +541,33 @@ Global $aLabPos[2] = [-1, -1]
Global $iChkLab, $iCmbLaboratory, $iFirstTimeLab

; Array to hold Laboratory Troop information [LocX of upper left corner of image, LocY of upper left corner of image, PageLocation, Troop "name", Icon # in DLL file]
;jp
Global Const $aLabTroops[25][5] = [ _
[-1, -1, -1, "None", $eIcnBlank], _
[123, 311, 0, "Barbarian", $eIcnBarbarian], _
[123, 417, 0, "Archer", $eIcnArcher], _
[230, 311, 0, "Giant", $eIcnGiant], _
[230, 417, 0, "Goblin", $eIcnGoblin], _
[336, 311, 0, "Wall Breaker", $eIcnWallBreaker], _
[336, 417, 0, "Balloon", $eIcnBalloon], _
[443, 311, 0, "Wizard", $eIcnWizard], _
[443, 417, 0, "Healer", $eIcnHealer], _
[550, 311, 0, "Dragon", $eIcnDragon], _
[550, 417, 0, "Pekka", $eIcnPekka], _
[657, 311, 0, "Lightning Spell", $eIcnLightSpell], _
[657, 417, 0, "Healing Spell", $eIcnHealSpell], _
[108, 311, 1, "Rage Spell", $eIcnRageSpell], _
[108, 417, 1, "Jump Spell", $eIcnJumpSpell], _
[214, 311, 1, "Freeze Spell", $eIcnFreezeSpell], _
[214, 417, 1, "Poison Spell", $eIcnPoisonSpell], _
[320, 311, 1, "Earthquake Spell", $eIcnEarthQuakeSpell], _
[320, 417, 1, "Haste Spell", $eIcnHasteSpell], _
[427, 311, 1, "Minion", $eIcnMinion], _
[427, 417, 1, "Hog Rider", $eIcnHogRider], _
[534, 311, 1, "Valkyrie", $eIcnValkyrie], _
[534, 417, 1, "Golem", $eIcnGolem], _
[640, 311, 1, "Witch", $eIcnWitch], _
[640, 417, 1, "Lava Hound", $eIcnLavaHound]]
[123, 311+40, 0, "Barbarian", $eIcnBarbarian], _
[123, 417+40, 0, "Archer", $eIcnArcher], _
[230, 311+40, 0, "Giant", $eIcnGiant], _
[230, 417+40, 0, "Goblin", $eIcnGoblin], _
[336, 311+40, 0, "Wall Breaker", $eIcnWallBreaker], _
[336, 417+40, 0, "Balloon", $eIcnBalloon], _
[443, 311+40, 0, "Wizard", $eIcnWizard], _
[443, 417+40, 0, "Healer", $eIcnHealer], _
[550, 311+40, 0, "Dragon", $eIcnDragon], _
[550, 417+40, 0, "Pekka", $eIcnPekka], _
[657, 311+40, 0, "Lightning Spell", $eIcnLightSpell], _
[657, 417+40, 0, "Healing Spell", $eIcnHealSpell], _
[108, 311+40, 1, "Rage Spell", $eIcnRageSpell], _
[108, 417+40, 1, "Jump Spell", $eIcnJumpSpell], _
[214, 311+40, 1, "Freeze Spell", $eIcnFreezeSpell], _
[214, 417+40, 1, "Poison Spell", $eIcnPoisonSpell], _
[320, 311+40, 1, "Earthquake Spell", $eIcnEarthQuakeSpell], _
[320, 417+40, 1, "Haste Spell", $eIcnHasteSpell], _
[427, 311+40, 1, "Minion", $eIcnMinion], _
[427, 417+40, 1, "Hog Rider", $eIcnHogRider], _
[534, 311+40, 1, "Valkyrie", $eIcnValkyrie], _
[534, 417+40, 1, "Golem", $eIcnGolem], _
[640, 311+40, 1, "Witch", $eIcnWitch], _
[640, 417+40, 1, "Lava Hound", $eIcnLavaHound]]

Global Const $aSearchCost[10] = _
[10, _
Expand Down Expand Up @@ -637,8 +642,8 @@ Global $numFactorySpellAvaiables = 0
Global $numFactoryDarkSpell = 0
Global $numFactoryDarkSpellAvaiables = 0

;position of barakcs
Global $btnpos = [[114, 535], [228, 535], [288, 535], [348, 535], [409, 535], [494, 535], [555, 535], [637, 535], [698, 535]]
;position of barack buttons on army training dialog
Global $btnpos = [[114, 535+30], [228, 535+30], [288, 535+30], [348, 535+30], [409, 535+30], [494, 535+30], [555, 535+30], [637, 535+30], [698, 535+30]] ;jp
;barracks and spells avaiables
Global $Trainavailable = [1, 0, 0, 0, 0, 0, 0, 0, 0]

Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Attack/Attack Algorithms/algorithmTH.au3
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Func AttackTHGrid($troopKind, $iNbOfSpots = 1, $iAtEachSpot = 1, $Sleep = Random
EndIf
;End All Barracks Troops

SelectDropTroop($THtroop) ;Select Troop to be Droped
SelectDropTroop($THtroop) ;Select Troop to be Dropped

If _Sleep($iDelayAttackTHGrid1) Then Return

Expand Down
12 changes: 6 additions & 6 deletions COCBot/functions/Attack/AttackReport.au3
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Func AttackReport()
$lootTrophies = ""

$iCount = 0 ; Reset loop counter
While _CheckPixel($aEndFightSceneAvl, True) = False ; check for light gold pixle in the Gold ribbon in End of Attack Scene before reading values
While _CheckPixel($aEndFightSceneAvl, True) = False ; check for light gold pixel in the Gold ribbon in End of Attack Scene before reading values
$iCount += 1
If _Sleep($iDelayAttackReport1) Then Return
If $debugSetlog = 1 Then Setlog("Waiting Attack Report Ready, " & ($iCount / 2) & " Seconds.", $COLOR_PURPLE)
Expand All @@ -33,7 +33,7 @@ Func AttackReport()
If $iCount > 30 Then Setlog("End of Attack scene slow to appear, attack values my not be correct", $COLOR_BLUE)

$iCount = 0 ; reset loop counter
While getResourcesLoot(333, 289) = "" ; check for gold value to be non-zero before reading other values as a secondary timer to make sure all values are available
While getResourcesLoot(333, 289+30) = "" ;jp ; check for gold value to be non-zero before reading other values as a secondary timer to make sure all values are available
$iCount += 1
If _Sleep($iDelayAttackReport1) Then Return
If $debugSetlog = 1 Then Setlog("Waiting Attack Report Ready, " & ($iCount / 2) & " Seconds.", $COLOR_PURPLE)
Expand All @@ -42,13 +42,13 @@ Func AttackReport()
If $iCount > 20 Then Setlog("End of Attack scene read gold error, attack values my not be correct", $COLOR_BLUE)

If _ColorCheck(_GetPixelColor($aAtkRprtDECheck[0], $aAtkRprtDECheck[1], True), Hex($aAtkRprtDECheck[2], 6), $aAtkRprtDECheck[3]) Then ; if the color of the DE drop detected
$iGoldLast = getResourcesLoot(333, 289)
$iGoldLast = getResourcesLoot(333, 289+30) ;jp
If _Sleep($iDelayAttackReport2) Then Return
$iElixirLast = getResourcesLoot(333, 328)
$iElixirLast = getResourcesLoot(333, 328+30) ;jp
If _Sleep($iDelayAttackReport2) Then Return
$iDarkLast = getResourcesLootDE(365, 365)
$iDarkLast = getResourcesLootDE(365, 365+30) ;jp
If _Sleep($iDelayAttackReport2) Then Return
$iTrophyLast = getResourcesLootT(403, 402)
$iTrophyLast = getResourcesLootT(403, 402+30) ;jp
If _ColorCheck(_GetPixelColor($aAtkRprtTrophyCheck[0], $aAtkRprtTrophyCheck[1], True), Hex($aAtkRprtTrophyCheck[2], 6), $aAtkRprtTrophyCheck[3]) Then
$iTrophyLast = -$iTrophyLast
EndIf
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Attack/GoldElixirChangeEBO.au3
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Func GoldElixirChangeEBO()
$Trophies = getTrophyVillageSearch(48, 138)
EndIf

;CALCULATE WITCH TIMER TO USE
;CALCULATE WHICH TIMER TO USE
Local $iBegin = TimerInit(), $x = $sTimeStopAtk * 1000, $y = $sTimeStopAtk2 * 1000, $z
If Number($Gold1) < Number($stxtMinGoldStopAtk2) And Number($Elixir1) < Number($stxtMinElixirStopAtk2) And Number($DarkElixir1) < Number($stxtMinDarkElixirStopAtk2) And $iChkTimeStopAtk2 = 1 Then
$z = $y
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 @@ -21,7 +21,7 @@ Func PrepareAttack($pMatchMode, $Remaining = False) ;Assigns troops
EndIf

_WinAPI_DeleteObject($hBitmapFirst)
$hBitmapFirst = _CaptureRegion2(0, 571, 859, 671)
$hBitmapFirst = _CaptureRegion2(0, 571+60, 859, 671+60) ;jp
If _Sleep($iDelayPrepareAttack1) Then Return
Local $result = DllCall($pFuncLib, "str", "searchIdentifyTroop", "ptr", $hBitmapFirst)
If $debugSetlog = 1 Then Setlog("DLL Troopsbar list: " & $result[0], $COLOR_PURPLE)
Expand Down
8 changes: 4 additions & 4 deletions COCBot/functions/Attack/ReturnHome.au3
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ Func ReturnHome($TakeSS = 1, $GoldChangeCheck = True) ;Return main screen
$i = 0 ; Reset Loop counter
While 1 ; Look for Okay button on the confirm surrender window before clicking to avoid troop deployment, since button is green (same as grass) have to search for edges of the button
Local $offColors[3][3] = [[0x000000, 144, 0], [0xFFFFFF, 54, 17], [0xCBE870, 54, 10]] ; 2nd Black opposite button, 3rd pixel white "O" center top, 4th pixel White "0" bottom center
Global $ButtonPixel = _MultiPixelSearch(438, 372, 590, 404, 1, 1, Hex(0x000000, 6), $offColors, 20) ; first vertical black pixel of Okay
If $debugSetlog = 1 Then Setlog("Confirm Surrender color #1: " & _GetPixelColor(441, 374, True) & ", #2: " & _GetPixelColor(441 + 144, 374, True) & ", #3: " & _GetPixelColor(441 + 54, 374 + 17, True) & ", #4: " & _GetPixelColor(441 + 54, 374 + 10, True), $COLOR_PURPLE)
Global $ButtonPixel = _MultiPixelSearch(438, 372+30, 590, 404+30, 1, 1, Hex(0x000000, 6), $offColors, 20) ;jp ; first vertical black pixel of Okay
If $debugSetlog = 1 Then Setlog("Confirm Surrender color #1: " & _GetPixelColor(441, 374+30, True) & ", #2: " & _GetPixelColor(441 + 144, 374+30, True) & ", #3: " & _GetPixelColor(441 + 54, 374 + 17+30, True) & ", #4: " & _GetPixelColor(441 + 54, 374 + 10+30, True), $COLOR_PURPLE)
If IsArray($ButtonPixel) Then
If $debugSetlog = 1 Then
Setlog("ButtonPixel = " & $ButtonPixel[0] & ", " & $ButtonPixel[1], $COLOR_PURPLE) ;Debug
Expand Down Expand Up @@ -102,15 +102,15 @@ Func ReturnHome($TakeSS = 1, $GoldChangeCheck = True) ;Return main screen
If $counter > 40 Then ExitLoop
WEnd
If _Sleep($iDelayReturnHome3) Then Return ; wait for all report details
_CaptureRegion(0, 0, 860, 675)
_CaptureRegion(0, 0, 860, 675+60) ;jp
AttackReport()
EndIf

If $TakeSS = 1 And $GoldChangeCheck = True Then
SetLog("Taking snapshot of your loot", $COLOR_GREEN)
Local $Date = @YEAR & "-" & @MON & "-" & @MDAY
Local $Time = @HOUR & "." & @MIN
_CaptureRegion(0, 0, 860, 675)
_CaptureRegion(0, 0, 860, 675+60) ;jp
$hBitmap_Scaled = _GDIPlus_ImageResize($hBitmap, _GDIPlus_ImageGetWidth($hBitmap) / 2, _GDIPlus_ImageGetHeight($hBitmap) / 2) ;resize image
; screenshot filename according with new options around filenames
If $ScreenshotLootInfo = 1 Then
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Attack/Troops/IdentifyTroopKind.au3
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Barbarian|14-26|0#Archer|87-30|75#WallBreaker|303-34|1#Wizard|377-35|1#Minion|45

Func IdentifyTroopKind($SlotPos = 0)
; capture troopbar
Local $x1 = 0, $y1 = 550, $x2 = 860, $y2 = 660, $SlotComp
Local $x1 = 0, $y1 = 550+60, $x2 = 860, $y2 = 660+60, $SlotComp ;jp
_CaptureRegion($x1, $y1, $x2, $y2)

;~ If _ColorCheck(_GetPixelColor(828, 573 - $y1), Hex(0x70B3D8, 6), 40) Then; Check pixelcolor for Slot 11 # same color for all troops or spells
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Attack/Troops/SelectDropTroop.au3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

Func SelectDropTroop($Troop)
Click(GetXPosOfArmySlot($Troop, 68), 595,1,0,"#0111")
Click(GetXPosOfArmySlot($Troop, 68), 595+60,1,0,"#0111") ;jp
EndFunc ;==>SelectDropTroop
4 changes: 2 additions & 2 deletions COCBot/functions/Attack/dropHeroes.au3
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Func dropHeroes($x, $y, $KingSlot = -1, $QueenSlot = -1) ;Drops for king and que
EndIf
If $dropKing Then
SetLog("Dropping King", $COLOR_BLUE)
Click(GetXPosOfArmySlot($KingSlot, 68), 595,1,0,"#0092") ;Select King
Click(GetXPosOfArmySlot($KingSlot, 68), 595+60,1,0,"#0092") ;jp ;Select King
If _Sleep($iDelaydropHeroes2) Then Return
Click($x, $y,1,0,"#0093")
$checkKPower = True
Expand All @@ -23,7 +23,7 @@ Func dropHeroes($x, $y, $KingSlot = -1, $QueenSlot = -1) ;Drops for king and que

If $dropQueen Then
SetLog("Dropping Queen", $COLOR_BLUE)
Click(GetXPosOfArmySlot($QueenSlot, 68), 595,1,0,"#0094") ;Select Queen
Click(GetXPosOfArmySlot($QueenSlot, 68), 595+60,1,0,"#0094") ;jp ;Select Queen
If _Sleep($iDelaydropHeroes2) Then Return
Click($x, $y,1,0,"#0095")
$checkQPower = True
Expand Down
20 changes: 10 additions & 10 deletions COCBot/functions/Attack/unbreakable.au3
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ Func Unbreakable()

$i = 0
While 1
PureClick(50, 700, 1, 0, "#0116") ; Hit BS Back button for the confirm exit dialog to appear
PureClick(50, 700+60, 1, 0, "#0116") ;jp ; Hit BS Back button for the confirm exit dialog to appear
If _Sleep($iDelayUnbreakable1) Then Return
; New button search as old pixel check matched grass color sometimes
Local $offColors[3][3] = [[0x000000, 144, 0], [0xFFFFFF, 54, 17], [0xCBE870, 54, 10]] ; 2nd Black opposite button, 3rd pixel white "O" center top, 4th pixel White "0" bottom center
Global $ButtonPixel = _MultiPixelSearch(438, 372, 590, 404, 1, 1, Hex(0x000000, 6), $offColors, 20) ; first vertical black pixel of Okay
If $debugSetlog = 1 Then Setlog("Exit btn chk-#1: " & _GetPixelColor(441, 374, True) & ", #2: " & _GetPixelColor(441 + 144, 374, True) & ", #3: " & _GetPixelColor(441 + 54, 374 + 17, True) & ", #4: " & _GetPixelColor(441 + 54, 374 + 10, True), $COLOR_PURPLE)
Global $ButtonPixel = _MultiPixelSearch(438, 372+30, 590, 404+30, 1, 1, Hex(0x000000, 6), $offColors, 20) ;jp ; first vertical black pixel of Okay
If $debugSetlog = 1 Then Setlog("Exit btn chk-#1: " & _GetPixelColor(441, 374+30, True) & ", #2: " & _GetPixelColor(441 + 144, 374+30, True) & ", #3: " & _GetPixelColor(441 + 54, 374 + 17+30, True) & ", #4: " & _GetPixelColor(441 + 54, 374 + 10+30, True), $COLOR_PURPLE) ;jp
If IsArray($ButtonPixel) Then
If $debugSetlog = 1 Then
Setlog("ButtonPixel = " & $ButtonPixel[0] & ", " & $ButtonPixel[1], $COLOR_PURPLE) ;Debug
Expand All @@ -152,8 +152,8 @@ Func Unbreakable()

$iCount = 0
While 1 ; Under attack when return from sleep? wait some more ...
If $debugSetlog = 1 Then Setlog("Under Attack Pixels = "&_GetPixelColor(841,342, True)&"/"&_GetPixelColor(842,348, True), $COLOR_PURPLE)
If _ColorCheck(_GetPixelColor(841,342, True), Hex(0x711C0A, 6), 20) And _ColorCheck(_GetPixelColor(842,348, True), Hex(0x721C0E, 6), 20) Then
If $debugSetlog = 1 Then Setlog("Under Attack Pixels = "&_GetPixelColor(841,342+60, True)&"/"&_GetPixelColor(842,348+60, True), $COLOR_PURPLE) ;jp
If _ColorCheck(_GetPixelColor(841,342+60, True), Hex(0x711C0A, 6), 20) And _ColorCheck(_GetPixelColor(842,348+60, True), Hex(0x721C0E, 6), 20) Then ;jp
Setlog("Base is under attack, waiting 30 seocnds for end", $COLOR_BLUE)
Else
ExitLoop
Expand All @@ -164,16 +164,16 @@ Func Unbreakable()
WEnd
If _Sleep($iDelayUnbreakable4) Then Return

Local $Message = _PixelSearch(19, 565, 104, 580, Hex(0xD9DDCF, 6), 15) ;Check if Return Home button available and close the screen
Local $Message = _PixelSearch(19, 565+60, 104, 580+60, Hex(0xD9DDCF, 6), 15) ;jp ;Check if Return Home button available and close the screen
If IsArray($Message) Then
If $debugSetlog = 1 Then Setlog("Return Home Pixel = "&_GetPixelColor($Message[0],$Message[1], True)&", Pos: "& $Message[0]&"/"&$Message[1], $COLOR_PURPLE)
PureClick(67, 602, 1, 0, "#0138")
PureClick(67, 602+60, 1, 0, "#0138") ;jp
If _Sleep($iDelayUnbreakable3) Then Return
EndIf

If _ColorCheck(_GetPixelColor(235, 209, True), Hex(0x9E3826, 6), 20) And _ColorCheck(_GetPixelColor(242, 140, True), Hex(0xFFFFFF, 6), 20) Then ;See if village was attacked, then click Okay
If $debugSetlog = 1 Then Setlog("Village Attacked Pixels = "&_GetPixelColor(235, 209, True)&"/"&_GetPixelColor(242, 140, True), $COLOR_PURPLE)
PureClick(429, 493, 1, 0, "#0132")
If _ColorCheck(_GetPixelColor(235, 209+30, True), Hex(0x9E3826, 6), 20) And _ColorCheck(_GetPixelColor(242, 140+30, True), Hex(0xFFFFFF, 6), 20) Then ;jp ;See if village was attacked, then click Okay
If $debugSetlog = 1 Then Setlog("Village Attacked Pixels = "&_GetPixelColor(235, 209+30, True)&"/"&_GetPixelColor(242, 140+30, True), $COLOR_PURPLE) ;jp
PureClick(429, 493+30, 1, 0, "#0132") ;jp
If _Sleep($iDelayUnbreakable3) Then Return
EndIf

Expand Down
Loading