Skip to content

Commit

Permalink
v4.9.7 - Date: 9/4/2022
Browse files Browse the repository at this point in the history
 - Fixed : misc fixes on train / donate.
  • Loading branch information
boludoz committed Apr 9, 2022
1 parent f08514f commit e7a87d6
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 78 deletions.
51 changes: 51 additions & 0 deletions COCBot/functions/CreateArmy/TrainSystem.au3
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,57 @@ Func TrainSystem()
TrainSiege()

If $g_bDonationEnabled And $g_bChkDonate Then ResetVariables("donated")

#Region - Custom train - Team AIO Mod++
; Inspired in Samkie
; Stick to Army page when time left - Team AIO Mod++
If $g_iStickToTrainWindow = 0 Or (ProfileSwitchAccountEnabled() And (Abs($g_aiAttackedCountSwitch[$g_iCurAccount]) <= 2)) Then
SetDebugLog("Not enabled waiting.")
ElseIf OpenArmyTab(False, "TrainSystem()") Then

Local $iLoop = 0
Do
$iLoop += 1

Local $iCount = 0, $iStickDelay = 0
While 1

If Not $g_bRunState Then Return
getArmyTroopTime(False, False, True, ($iCount = 0))

If $g_aiTimeTrain[0] <= 0 Then
Local $sResultTroops = getRemainTrainTimer(495, 169)
If StringRight($sResultTroops, 1) = "s" And StringLen($sResultTroops) < 4 Then
$g_aiTimeTrain[0] = Number("0." & Number($sResultTroops))
$g_aiTimeTrain[0] = Int($g_aiTimeTrain[0] * Random(1.10, 1.25, 1))
EndIf
EndIf

If _Sleep($DELAYRESPOND) Then Return
If $g_aiTimeTrain[0] > $g_iStickToTrainWindow Or $g_aiTimeTrain[0] <= 0 Then
If $iLoop <> 1 Then
ExitLoop
Else
ContinueLoop 2
EndIf
Else
If $g_aiTimeTrain[0] < 1 Then
$iStickDelay = Round($g_aiTimeTrain[0] * 1000)
$g_aiTimeTrain[0] = 0
ElseIf $g_aiTimeTrain[0] >= 2 Then
$iStickDelay = 60000
Else
$iStickDelay = 30000
EndIf
SetLog("[" & $iCount & "] Waiting for troops to be ready.", $COLOR_INFO)
If _Sleep($iStickDelay) Then Return
EndIf
$iCount += 1
If $iCount > (10 + $g_iStickToTrainWindow) Then ExitLoop
WEnd
Until True
EndIf
#EndRegion - Custom train - Team AIO Mod++

ClickAway() ; ClickP($aAway, 2, 0, "#0346") ;Click Away
If _Sleep(500) Then Return ; Delay AFTER the click Away Prevents lots of coc restarts
Expand Down
105 changes: 30 additions & 75 deletions COCBot/functions/CreateArmy/checkArmyCamp.au3
Original file line number Diff line number Diff line change
Expand Up @@ -21,82 +21,37 @@ Func checkArmyCamp($bOpenArmyWindow = False, $bCloseArmyWindow = False, $bGetHer
EndFunc

Func _checkArmyCamp($bOpenArmyWindow, $bCloseArmyWindow, $bGetHeroesTime, $bSetLog)
#Region - Custom train - Team AIO Mod++
Local $iLoop = 0
Do
$iLoop += 1
If $g_bDebugFuncTime Then StopWatchStart("checkArmyCamp")

If $g_bDebugSetlogTrain Then SetLog("Begin checkArmyCamp:", $COLOR_DEBUG1)

If $g_bDebugFuncTime Then StopWatchStart("IsTrainPage/openArmyOverview")
If Not $bOpenArmyWindow And Not IsTrainPage() Then ; check for train page
SetError(1)
Return; not open, not requested to be open - error.
ElseIf $bOpenArmyWindow Then
If Not OpenArmyOverview(True, "_checkArmyCamp()") Then
SetError(2)
Return; not open, requested to be open - error.
EndIf
If _Sleep($DELAYCHECKARMYCAMP5) Then Return
If $g_bDebugFuncTime Then StopWatchStart("checkArmyCamp")

If $g_bDebugSetlogTrain Then SetLog("Begin checkArmyCamp:", $COLOR_DEBUG1)

If $g_bDebugFuncTime Then StopWatchStart("IsTrainPage/openArmyOverview")
If Not $bOpenArmyWindow And Not IsTrainPage() Then ; check for train page
SetError(1)
Return; not open, not requested to be open - error.
ElseIf $bOpenArmyWindow Then
If Not OpenArmyOverview(True, "_checkArmyCamp()") Then
SetError(2)
Return; not open, requested to be open - error.
EndIf
If $g_bDebugFuncTime Then StopWatchStopLog()

If $g_bDebugFuncTime Then StopWatchStart("getArmyTroopsCapacity")
getArmyTroopCapacity(False, False, False, $bSetLog) ; Last parameter is to check the Army Window
If $g_bDebugFuncTime Then StopWatchStopLog()
If _Sleep($DELAYCHECKARMYCAMP6) Then Return ; 10ms improve pause button response

If $g_bDebugFuncTime Then StopWatchStart("getArmyTroops")
getArmyTroops(False, False, False, $bSetLog)
If $g_bDebugFuncTime Then StopWatchStopLog()
If _Sleep($DELAYCHECKARMYCAMP6) Then Return ; 10ms improve pause button response

; Stick to Army page when time left - Team AIO Mod++
If $g_iStickToTrainWindow = 0 Or ProfileSwitchAccountEnabled() And ($g_aiAttackedCountSwitch[$g_iCurAccount] <= $g_aiAttackedCountAcc[$g_iCurAccount] - 2) Then
If $g_bDebugFuncTime Then StopWatchStart("getArmyTroopTime")
getArmyTroopTime(False, False, False, $bSetLog) ; Last parameter is to check the Army Window
If $g_bDebugFuncTime Then StopWatchStopLog()
If _Sleep($DELAYCHECKARMYCAMP6) Then Return ; 10ms improve pause button response
Else
Local $iCount = 0, $iStickDelay = 0
While 1
If Not $g_bRunState Then Return
getArmyTroopTime(False, False, True, ($iCount = 0))

If $g_aiTimeTrain[0] <= 0 Then
Local $sResultTroops = getRemainTrainTimer(495, 169)
If StringRight($sResultTroops, 1) = "s" And StringLen($sResultTroops) < 4 Then
$g_aiTimeTrain[0] = Number("0." & Number($sResultTroops))
$g_aiTimeTrain[0] = Int($g_aiTimeTrain[0] * Random(1.10, 1.25, 1))
EndIf
EndIf

If _Sleep($DELAYRESPOND) Then Return
If $g_aiTimeTrain[0] > $g_iStickToTrainWindow Or $g_aiTimeTrain[0] <= 0 Then
If $iLoop <> 1 Then
ExitLoop
Else
ContinueLoop 2
EndIf
Else
If $g_aiTimeTrain[0] < 1 Then
$iStickDelay = Round($g_aiTimeTrain[0] * 1000)
$g_aiTimeTrain[0] = 0
ElseIf $g_aiTimeTrain[0] >= 2 Then
$iStickDelay = 60000
Else
$iStickDelay = 30000
EndIf
SetLog("[" & $iCount & "] Waiting for troops to be ready.", $COLOR_INFO)
If _Sleep($iStickDelay) Then Return
EndIf
$iCount += 1
If $iCount > (10 + $g_iStickToTrainWindow) Then ExitLoop
WEnd
EndIf
Until True
#EndRegion - Custom train - Team AIO Mod++
If _Sleep($DELAYCHECKARMYCAMP5) Then Return
EndIf
If $g_bDebugFuncTime Then StopWatchStopLog()

If $g_bDebugFuncTime Then StopWatchStart("getArmyTroopsCapacity")
getArmyTroopCapacity(False, False, False, $bSetLog) ; Last parameter is to check the Army Window
If $g_bDebugFuncTime Then StopWatchStopLog()
If _Sleep($DELAYCHECKARMYCAMP6) Then Return ; 10ms improve pause button response

If $g_bDebugFuncTime Then StopWatchStart("getArmyTroops")
getArmyTroops(False, False, False, $bSetLog)
If $g_bDebugFuncTime Then StopWatchStopLog()
If _Sleep($DELAYCHECKARMYCAMP6) Then Return ; 10ms improve pause button response

If $g_bDebugFuncTime Then StopWatchStart("getArmyTroopTime")
getArmyTroopTime(False, False, False, $bSetLog) ; Last parameter is to check the Army Window
If $g_bDebugFuncTime Then StopWatchStopLog()
If _Sleep($DELAYCHECKARMYCAMP6) Then Return ; 10ms improve pause button response

Local $HeroesRegenTime
If $g_bDebugFuncTime Then StopWatchStart("getArmyHeroCount")
Expand Down
4 changes: 2 additions & 2 deletions COCBot/functions/CreateArmy/openArmyOverview.au3
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
Func OpenArmyOverview($bCheckMain = True, $sWhereFrom = "Undefined")

If $bCheckMain Then
If Not IsMainPage() Then ; check for main page, avoid random troop drop
If Not IsMainPage(10) Then ; check for main page, avoid random troop drop
SetLog("Cannot open Army Overview window", $COLOR_ERROR)
SetError(1)
Return False
EndIf
EndIf

If WaitforPixel(23, 505 + $g_iBottomOffsetY, 53, 507 + $g_iBottomOffsetY, Hex(0xEEB344, 6), 5, 10) Then
If WaitforPixel(20, 565, 55, 605, Hex(0xDE9A39, 6), 20, 5) Then
If $g_bDebugSetlogTrain Then SetLog("Click $aArmyTrainButton" & " (Called from " & $sWhereFrom & ")", $COLOR_SUCCESS)
ClickP($aArmyTrainButton, 1, 0, "#0293") ; Button Army Overview
EndIf
Expand Down
3 changes: 3 additions & 0 deletions ModChangelog
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
Do everything you project.

Based on MyBot.run v7.9.7
v4.9.7 - Date: 9/4/2022
- Fixed : misc fixes on train / donate.

v4.9.6 - Date: 8/4/2022
- New : shadow scenery support.
- Fixed : misc fixes.
Expand Down
2 changes: 1 addition & 1 deletion MyBot.run.version.au3
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
Global $g_sBotVersion = "v7.9.7" ;~ Don't add more here, but below. Version can't be longer than vX.y.z because it is also used in Checkversion()

; Check Version - Team AiO MOD++
Global $g_sModVersion = "v4.9.6" ;<== Just Change This to Version Number
Global $g_sModVersion = "v4.9.7" ;<== Just Change This to Version Number
Global $g_sModSupportUrl = "https://github.com/boludoz/AIO-Mod/releases" ;<== Our Website Link Download

0 comments on commit e7a87d6

Please sign in to comment.