Jump to content
  • Announcements

    • Fliegerfaust

      Malicious and Banned Links   10/09/2016

      Please be careful of downloading ANY LINKS that are not originating from a MyBot.Run URL or another trusted URL (such as apkmirror.com, bluestacks, memu, xda-developers, etc).   We have banned ALL telegram links and other verified malicious links we have come across already. Users attempting to do this or get around this ban will be banned permanently.   Please report ANY suspicious links to MyBot Staff or pm me directly
    • monkeyhunter

      MyBot.run V7.5.3 RELEASED!   06/14/2018

      MyBot.run continues the legacy again with release of V7.5.3!!   This release supports the June 2018 game update and has some new features hidden inside as well   Get your copy in thread below!!   Click here to get to the release thread MyBot.run v7.5 Release

ch4qr1

Official Tester
  • Content count

    31
  • Avg. Content Per Day

    0
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ch4qr1

  1. It is enable by default after demen's new changes. Bot using 11 + if needed
  2. Telegram notify bug

    Devs aware of bot slowdown when telegram enabled but you need to full debug it and post here. Btw wait patiently when devs fixing issues because they are updated bot for new coc version on their vacation and they are deserve relief vacation without codes. Regards
  3. RAW commit from farm schedule fix for switch account groups from @demen Please commit this fix too @NguyenAnhHD From 7cb687a41bc575b2472a27f577fed04b0481e0d9 Mon Sep 17 00:00:00 2001 From: "VOLTAQE\\Voltaqe" <[email protected]> Date: Mon, 30 Apr 2018 02:05:59 +0300 Subject: [PATCH] farmschedule fix --- COCBot/Persian_MOD/GUI/MOD GUI Control.au3 | 11 +- .../GUI/MOD GUI Design - FarmSchedule.au3 | 112 +++++++++--------- .../Persian_MOD/functions/Config/applyConfig.au3 | 20 ++-- COCBot/Persian_MOD/functions/Config/readConfig.au3 | 31 ++--- COCBot/Persian_MOD/functions/Config/saveConfig.au3 | 29 ++--- .../Persian_MOD/functions/Mod's/FarmSchedule.au3 | 125 ++++++++++++++++----- 6 files changed, 207 insertions(+), 121 deletions(-) diff --git a/COCBot/Persian_MOD/GUI/MOD GUI Control.au3 b/COCBot/Persian_MOD/GUI/MOD GUI Control.au3 index 2139996..a67af27 100644 --- a/COCBot/Persian_MOD/GUI/MOD GUI Control.au3 +++ b/COCBot/Persian_MOD/GUI/MOD GUI Control.au3 @@ -101,9 +101,11 @@ Func btnEnableAuto() EndFunc ;==>btnEnableAuto ; Switch Accounts - Persian MOD (#-12) -Func UpdateMultiStats() +Func UpdateMultiStats($bCheckSwitchAccEnable = True) Local $bEnableSwitchAcc = $g_iCmbSwitchAcc > 0 Local $iCmbTotalAcc = _GUICtrlComboBox_GetCurSel($g_hCmbTotalAccount) + 1 ; combobox data starts with 2 + If Not $bCheckSwitchAccEnable Then $bEnableSwitchAcc = True ; added for Farm Schedule (Demen) + For $i = 0 To 7 If $bEnableSwitchAcc And $i <= $iCmbTotalAcc Then For $j = $g_ahGrpVillageAcc[$i] To $g_ahLblHourlyStatsTrophyAcc[$i] @@ -135,9 +137,10 @@ Func chkSwitchAcc() _GUI_Value_STATE("ENABLE", $g_ahChk_BotTypeMax[0] & "#" & $g_ahChk_BotTypeMax[1] & "#" & $g_ahChk_BotTypeMax[2] & "#" & $g_ahChk_BotTypeMax[3] & "#" & $g_ahChk_BotTypeMin[0] & "#" & $g_ahChk_BotTypeMin[1] & "#" & $g_ahChk_BotTypeMin[2] & "#" & $g_ahChk_BotTypeMin[3]) For $i = 0 To 7 GUICtrlSetState($g_ahChkSetFarm[$i], $GUI_ENABLE) + _chkSetFarmSchedule($i) ; Demen Next chkSwitchBotType() - + Else releaseSwitchAccountMutex() For $i = $g_hCmbTotalAccount To $g_ahChkDonate[7] @@ -147,7 +150,7 @@ Func chkSwitchAcc() _GUI_Value_STATE("DISABLE", $g_ahChk_BotTypeMax[0] & "#" & $g_ahChk_BotTypeMax[1] & "#" & $g_ahChk_BotTypeMax[2] & "#" & $g_ahChk_BotTypeMax[3] & "#" & $g_ahChk_BotTypeMin[0] & "#" & $g_ahChk_BotTypeMin[1] & "#" & $g_ahChk_BotTypeMin[2] & "#" & $g_ahChk_BotTypeMin[3]) For $i = 0 To 7 For $j = $g_ahChkSetFarm[$i] To $g_ahCmbTime2[$i] - GUICtrlSetState($j, $GUI_UNCHECKED + $GUI_DISABLE) + GUICtrlSetState($j, $GUI_DISABLE) Next Next EndIf @@ -227,6 +230,7 @@ Func cmbTotalAcc() For $j = $g_ahChkSetFarm[$i] To $g_ahCmbTime2[$i] GUICtrlSetState($j, $GUI_SHOW) Next + _chkSetFarmSchedule($i) ElseIf $i > $iCmbTotalAcc Then GUICtrlSetState($g_ahChkAccount[$i], $GUI_UNCHECKED) _GUI_Value_STATE("HIDE", $g_ahChkAccount[$i] & "#" & $g_ahCmbProfile[$i] & "#" & $g_ahChkDonate[$i]) @@ -236,7 +240,6 @@ Func cmbTotalAcc() EndIf chkAccount($i) Next - cmbChkSetFarm() EndFunc ;==>cmbTotalAcc Func chkSmartSwitch() diff --git a/COCBot/Persian_MOD/GUI/MOD GUI Design - FarmSchedule.au3 b/COCBot/Persian_MOD/GUI/MOD GUI Design - FarmSchedule.au3 index 8ca273a..156fc8c 100644 --- a/COCBot/Persian_MOD/GUI/MOD GUI Design - FarmSchedule.au3 +++ b/COCBot/Persian_MOD/GUI/MOD GUI Design - FarmSchedule.au3 @@ -33,7 +33,7 @@ Func CreateModFarmSchedule() For $i = 0 To 7 $x = 10 $g_ahChkSetFarm[$i] = GUICtrlCreateCheckbox("Acc " & $i + 1 & ".", $x, $y + $i * 30, -1, -1) - GUICtrlSetOnEvent(-1, "cmbChkSetFarm") + GUICtrlSetOnEvent(-1, "chkSetFarmSchedule") $g_ahCmbAction1[$i] = GUICtrlCreateCombo("Turn...", $x + 60, $y + $i * 30, 58, -1, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Idle|Donate|Active") GUICtrlSetBkColor(-1, $COLOR_WHITE) @@ -64,63 +64,73 @@ Func CreateModFarmSchedule() EndFunc ;==>CreateBotFarmSchedule -Func cmbChkSetFarm() - Local $iCmbTotalAcc = _GUICtrlComboBox_GetCurSel($g_hCmbTotalAccount) + 1 ; combobox data starts with 2 - For $i = 0 To 7 - If $i > $iCmbTotalAcc Then ExitLoop - If GUICtrlRead($g_ahChkSetFarm[$i]) = $GUI_CHECKED Then - _GUI_Value_STATE("ENABLE", $g_ahCmbAction1[$i] & "#" & $g_ahCmbAction2[$i] & "#" & $g_ahCmbCriteria1[$i] & "#" & $g_ahCmbCriteria2[$i]) - cmbCriteria1() - cmbCriteria2() - Else - _GUI_Value_STATE("DISABLE", $g_ahCmbAction1[$i] & "#" & $g_ahCmbCriteria1[$i] & "#" & $g_ahTxtResource1[$i] & "#" & $g_ahCmbTime1[$i] & "#" & _ - $g_ahCmbAction2[$i] & "#" & $g_ahCmbCriteria2[$i] & "#" & $g_ahTxtResource2[$i] & "#" & $g_ahCmbTime2[$i]) +Func chkSetFarmSchedule() + For $i = 0 To UBound($g_ahChkSetFarm) - 1 + If @GUI_CtrlId = $g_ahChkSetFarm[$i] Then + Return _chkSetFarmSchedule($i) EndIf Next -EndFunc ;==>cmbChkSetFarm +EndFunc ;==>chkSetFarmSchedule + +Func _chkSetFarmSchedule($i) + If GUICtrlRead($g_ahChkSetFarm[$i]) = $GUI_CHECKED Then + _GUI_Value_STATE("ENABLE", $g_ahCmbAction1[$i] & "#" & $g_ahCmbAction2[$i] & "#" & $g_ahCmbCriteria1[$i] & "#" & $g_ahCmbCriteria2[$i]) + _cmbCriteria1($i) + _cmbCriteria2($i) + Else + _GUI_Value_STATE("DISABLE", $g_ahCmbAction1[$i] & "#" & $g_ahCmbCriteria1[$i] & "#" & $g_ahTxtResource1[$i] & "#" & $g_ahCmbTime1[$i] & "#" & _ + $g_ahCmbAction2[$i] & "#" & $g_ahCmbCriteria2[$i] & "#" & $g_ahTxtResource2[$i] & "#" & $g_ahCmbTime2[$i]) + EndIf +EndFunc ;==>_chkSetFarmSchedule Func cmbCriteria1() - Local $aiDefaultValue[4] = ["6000000", "6000000", "180000", "5000"] - Local $aiDefaultLimit[4] = [9999999, 9999999, 199999, 9999] - Local $iCmbTotalAcc = _GUICtrlComboBox_GetCurSel($g_hCmbTotalAccount) + 1 ; combobox data starts with 2 - For $i = 0 To 7 - If $i > $iCmbTotalAcc Then ExitLoop - If GUICtrlRead($g_ahChkSetFarm[$i]) = $GUI_UNCHECKED Then ContinueLoop - Local $iCmbCriteria = _GUICtrlComboBox_GetCurSel($g_ahCmbCriteria1[$i]) - Switch $iCmbCriteria - Case 0 - _GUI_Value_STATE("DISABLE", $g_ahCmbTime1[$i] & "#" & $g_ahTxtResource1[$i]) - Case 1 To 4 - GUICtrlSetState($g_ahCmbTime1[$i], $GUI_HIDE) - GUICtrlSetState($g_ahTxtResource1[$i], $GUI_SHOW + $GUI_ENABLE) - If GUICtrlRead($g_ahTxtResource1[$i]) = "" Or GUICtrlRead($g_ahTxtResource1[$i]) > $aiDefaultLimit[$iCmbCriteria - 1] Then GUICtrlSetData($g_ahTxtResource1[$i], $aiDefaultValue[$iCmbCriteria - 1]) - GUICtrlSetLimit($g_ahTxtResource1[$i], StringLen($aiDefaultValue[$iCmbCriteria - 1])) - Case 5 - GUICtrlSetState($g_ahTxtResource1[$i], $GUI_HIDE) - GUICtrlSetState($g_ahCmbTime1[$i], $GUI_SHOW + $GUI_ENABLE) - EndSwitch + For $i = 0 To UBound($g_ahCmbCriteria1) - 1 + If @GUI_CtrlId = $g_ahCmbCriteria1[$i] Then + Return _cmbCriteria1($i) + EndIf Next EndFunc ;==>cmbCriteria1 -Func cmbCriteria2() - Local $aiDefaultValue[4] = ["1000000", "1000000", "020000", "3000"] +Func _cmbCriteria1($i) + Local $aiDefaultValue[4] = ["9000000", "9000000", "180000", "5000"] Local $aiDefaultLimit[4] = [9999999, 9999999, 199999, 9999] - Local $iCmbTotalAcc = _GUICtrlComboBox_GetCurSel($g_hCmbTotalAccount) + 1 ; combobox data starts with 2 - For $i = 0 To 7 - If $i > $iCmbTotalAcc Then ExitLoop - If GUICtrlRead($g_ahChkSetFarm[$i]) = $GUI_UNCHECKED Then ContinueLoop - Local $iCmbCriteria = _GUICtrlComboBox_GetCurSel($g_ahCmbCriteria2[$i]) - Switch $iCmbCriteria - Case 0 - _GUI_Value_STATE("DISABLE", $g_ahTxtResource2[$i] & "#" & $g_ahCmbTime2[$i]) - Case 1 To 4 - GUICtrlSetState($g_ahCmbTime2[$i], $GUI_HIDE) - GUICtrlSetState($g_ahTxtResource2[$i], $GUI_SHOW + $GUI_ENABLE) - If GUICtrlRead($g_ahTxtResource2[$i]) = "" Or GUICtrlRead($g_ahTxtResource2[$i]) > $aiDefaultLimit[$iCmbCriteria - 1] Then GUICtrlSetData($g_ahTxtResource2[$i], Number($aiDefaultValue[$iCmbCriteria - 1])) - GUICtrlSetLimit($g_ahTxtResource2[$i], StringLen($aiDefaultValue[$iCmbCriteria - 1])) - Case 5 - GUICtrlSetState($g_ahTxtResource2[$i], $GUI_HIDE) - GUICtrlSetState($g_ahCmbTime2[$i], $GUI_SHOW + $GUI_ENABLE) - EndSwitch + Local $iCmbCriteria = _GUICtrlComboBox_GetCurSel($g_ahCmbCriteria1[$i]) + Switch $iCmbCriteria + Case 0 + _GUI_Value_STATE("DISABLE", $g_ahCmbTime1[$i] & "#" & $g_ahTxtResource1[$i]) + Case 1 To 4 + GUICtrlSetState($g_ahCmbTime1[$i], $GUI_HIDE) + GUICtrlSetState($g_ahTxtResource1[$i], $GUI_SHOW + $GUI_ENABLE) + If GUICtrlRead($g_ahTxtResource1[$i]) = "" Or GUICtrlRead($g_ahTxtResource1[$i]) > $aiDefaultLimit[$iCmbCriteria - 1] Then GUICtrlSetData($g_ahTxtResource1[$i], $aiDefaultValue[$iCmbCriteria - 1]) + GUICtrlSetLimit($g_ahTxtResource1[$i], StringLen($aiDefaultValue[$iCmbCriteria - 1])) + Case 5 + GUICtrlSetState($g_ahTxtResource1[$i], $GUI_HIDE) + GUICtrlSetState($g_ahCmbTime1[$i], $GUI_SHOW + $GUI_ENABLE) + EndSwitch +EndFunc ;==>_cmbCriteria1 + +Func cmbCriteria2() + For $i = 0 To UBound($g_ahCmbCriteria2) - 1 + If @GUI_CtrlId = $g_ahCmbCriteria2[$i] Then + Return _cmbCriteria2($i) + EndIf Next EndFunc ;==>cmbCriteria2 + +Func _cmbCriteria2($i) + Local $aiDefaultValue[4] = ["1000000", "1000000", "020000", "3000"] + Local $aiDefaultLimit[4] = [9999999, 9999999, 199999, 9999] + Local $iCmbCriteria = _GUICtrlComboBox_GetCurSel($g_ahCmbCriteria2[$i]) + Switch $iCmbCriteria + Case 0 + _GUI_Value_STATE("DISABLE", $g_ahTxtResource2[$i] & "#" & $g_ahCmbTime2[$i]) + Case 1 To 4 + GUICtrlSetState($g_ahCmbTime2[$i], $GUI_HIDE) + GUICtrlSetState($g_ahTxtResource2[$i], $GUI_SHOW + $GUI_ENABLE) + If GUICtrlRead($g_ahTxtResource2[$i]) = "" Or GUICtrlRead($g_ahTxtResource2[$i]) > $aiDefaultLimit[$iCmbCriteria - 1] Then GUICtrlSetData($g_ahTxtResource2[$i], Number($aiDefaultValue[$iCmbCriteria - 1])) + GUICtrlSetLimit($g_ahTxtResource2[$i], StringLen($aiDefaultValue[$iCmbCriteria - 1])) + Case 5 + GUICtrlSetState($g_ahTxtResource2[$i], $GUI_HIDE) + GUICtrlSetState($g_ahCmbTime2[$i], $GUI_SHOW + $GUI_ENABLE) + EndSwitch +EndFunc ;==>_cmbCriteria2 \ No newline at end of file diff --git a/COCBot/Persian_MOD/functions/Config/applyConfig.au3 b/COCBot/Persian_MOD/functions/Config/applyConfig.au3 index 2f19f34..e92c501 100644 --- a/COCBot/Persian_MOD/functions/Config/applyConfig.au3 +++ b/COCBot/Persian_MOD/functions/Config/applyConfig.au3 @@ -67,16 +67,16 @@ Func ApplyConfig_MOD($TypeReadSave) _GUICtrlComboBox_SetCurSel($cmbCSVSpeed[$DB], $icmbCSVSpeed[$DB]) ; Switch Accounts - Persian MOD (#-12) - GUICtrlSetState($g_hChkSwitchAcc, $g_bChkSwitchAcc ? $GUI_CHECKED : $GUI_UNCHECKED) - GUICtrlSetState($g_hChkSmartSwitch, $g_bChkSmartSwitch ? $GUI_CHECKED : $GUI_UNCHECKED) - _GUICtrlComboBox_SetCurSel($g_hCmbTotalAccount, $g_iTotalAcc - 1) - For $i = 0 To 7 - GUICtrlSetState($g_ahChkAccount[$i], $g_abAccountNo[$i] ? $GUI_CHECKED : $GUI_UNCHECKED) - _GUICtrlComboBox_SetCurSel($g_ahCmbProfile[$i], $g_asProfileName[$i]) - GUICtrlSetState($g_ahChkDonate[$i], $g_abDonateOnly[$i] ? $GUI_CHECKED : $GUI_UNCHECKED) - Next - _GUICtrlComboBox_SetCurSel($g_hCmbTrainTimeToSkip, $g_iTrainTimeToSkip) - chkSwitchAcc() +; GUICtrlSetState($g_hChkSwitchAcc, $g_bChkSwitchAcc ? $GUI_CHECKED : $GUI_UNCHECKED) +; GUICtrlSetState($g_hChkSmartSwitch, $g_bChkSmartSwitch ? $GUI_CHECKED : $GUI_UNCHECKED) +; _GUICtrlComboBox_SetCurSel($g_hCmbTotalAccount, $g_iTotalAcc - 1) +; For $i = 0 To 7 +; GUICtrlSetState($g_ahChkAccount[$i], $g_abAccountNo[$i] ? $GUI_CHECKED : $GUI_UNCHECKED) +; _GUICtrlComboBox_SetCurSel($g_ahCmbProfile[$i], $g_asProfileName[$i]) +; GUICtrlSetState($g_ahChkDonate[$i], $g_abDonateOnly[$i] ? $GUI_CHECKED : $GUI_UNCHECKED) +; Next +; _GUICtrlComboBox_SetCurSel($g_hCmbTrainTimeToSkip, $g_iTrainTimeToSkip) +; chkSwitchAcc() ; Smart Train - Persian MOD (#-13) GUICtrlSetState($g_hchkSmartTrain, $ichkSmartTrain = 1 ? $GUI_CHECKED : $GUI_UNCHECKED) diff --git a/COCBot/Persian_MOD/functions/Config/readConfig.au3 b/COCBot/Persian_MOD/functions/Config/readConfig.au3 index 9552429..04fa827 100644 --- a/COCBot/Persian_MOD/functions/Config/readConfig.au3 +++ b/COCBot/Persian_MOD/functions/Config/readConfig.au3 @@ -180,19 +180,22 @@ Func ReadConfig_MOD() ReadConfig_SwitchAcc() ; Farm Schedule - Persian MOD (#-27) - For $i = 0 To 7 - IniReadS($g_abChkSetFarm[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "ChkSetFarm" & $i, False, "Bool") - - IniReadS($g_aiCmbAction1[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbAction1" & $i, 0, "Int") - IniReadS($g_aiCmbCriteria1[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbCriteria1" & $i, 0, "Int") - IniReadS($g_aiTxtResource1[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "TxtResource1" & $i, "") - IniReadS($g_aiCmbTime1[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbTime1" & $i, -1, "Int") - - IniReadS($g_aiCmbAction2[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbAction2" & $i, 0, "Int") - IniReadS($g_aiCmbCriteria2[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbCriteria2" & $i, 0, "Int") - IniReadS($g_aiTxtResource2[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "TxtResource2" & $i, "") - IniReadS($g_aiCmbTime2[$i], $g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbTime2" & $i, -1, "Int") - Next + If $g_iCmbSwitchAcc Then + Local $sSwitchAccFile = $g_sProfilePath & "\SwitchAccount.0" & $g_iCmbSwitchAcc & ".ini" + For $i = 0 To 7 + IniReadS($g_abChkSetFarm[$i], $sSwitchAccFile, "FarmStrategy", "ChkSetFarm" & $i, False, "Bool") + + IniReadS($g_aiCmbAction1[$i], $sSwitchAccFile, "FarmStrategy", "CmbAction1" & $i, 0, "Int") + IniReadS($g_aiCmbCriteria1[$i], $sSwitchAccFile, "FarmStrategy", "CmbCriteria1" & $i, 0, "Int") + IniReadS($g_aiTxtResource1[$i], $sSwitchAccFile, "FarmStrategy", "TxtResource1" & $i, "") + IniReadS($g_aiCmbTime1[$i], $sSwitchAccFile, "FarmStrategy", "CmbTime1" & $i, -1, "Int") + + IniReadS($g_aiCmbAction2[$i], $sSwitchAccFile, "FarmStrategy", "CmbAction2" & $i, 0, "Int") + IniReadS($g_aiCmbCriteria2[$i], $sSwitchAccFile, "FarmStrategy", "CmbCriteria2" & $i, 0, "Int") + IniReadS($g_aiTxtResource2[$i], $sSwitchAccFile, "FarmStrategy", "TxtResource2" & $i, "") + IniReadS($g_aiCmbTime2[$i], $sSwitchAccFile, "FarmStrategy", "CmbTime2" & $i, -1, "Int") + Next + EndIf ; Restart Search Legend league - Persian MOD (#-29) $g_bIsSearchTimeout = (IniRead($g_sProfileConfigPath, "other", "ChkSearchTimeout", "0") = "1") @@ -258,7 +261,7 @@ Func ReadConfig_SwitchAccounts() For $i = 1 To 8 $g_abAccountNo[$i - 1] = IniRead($sSwitchAccFile, "SwitchAccount", "AccountNo." & $i, "") = "1" $g_asProfileName[$i - 1] = IniRead($sSwitchAccFile, "SwitchAccount", "ProfileName." & $i, "") - $g_abDonateOnly[$i - 1] = IniRead($sSwitchAccFile, "SwitchAccount", "DonateOnly." & $i, "0") = "1" + $g_abDonateOnly[$i - 1] = $g_abAccountNo[$i - 1] And (IniRead($sSwitchAccFile, "SwitchAccount", "DonateOnly." & $i, "0") = "1") Next EndIf EndFunc ;==>ReadConfig_SwitchAccounts \ No newline at end of file diff --git a/COCBot/Persian_MOD/functions/Config/saveConfig.au3 b/COCBot/Persian_MOD/functions/Config/saveConfig.au3 index 14b02e6..25916d5 100644 --- a/COCBot/Persian_MOD/functions/Config/saveConfig.au3 +++ b/COCBot/Persian_MOD/functions/Config/saveConfig.au3 @@ -152,19 +152,22 @@ Func SaveConfig_MOD() SaveConfig_SwitchAcc() ; Farm Schedule - Persian MOD (#-27) - For $i = 0 To 7 - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "ChkSetFarm" & $i, $g_abChkSetFarm[$i]) - - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbAction1" & $i, $g_aiCmbAction1[$i]) - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbCriteria1" & $i, $g_aiCmbCriteria1[$i]) - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "TxtResource1" & $i, $g_aiTxtResource1[$i]) - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbTime1" & $i, $g_aiCmbTime1[$i]) - - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbAction2" & $i, $g_aiCmbAction2[$i]) - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbCriteria2" & $i, $g_aiCmbCriteria2[$i]) - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "TxtResource2" & $i, $g_aiTxtResource2[$i]) - IniWriteS($g_sProfilePath & "\Profile.ini", "FarmStrategy", "CmbTime2" & $i, $g_aiCmbTime2[$i]) - Next + If $g_iCmbSwitchAcc Then + Local $sSwitchAccFile = $g_sProfilePath & "\SwitchAccount.0" & $g_iCmbSwitchAcc & ".ini" + For $i = 0 To 7 + IniWriteS($sSwitchAccFile, "FarmStrategy", "ChkSetFarm" & $i, $g_abChkSetFarm[$i]) + + IniWriteS($sSwitchAccFile, "FarmStrategy", "CmbAction1" & $i, $g_aiCmbAction1[$i]) + IniWriteS($sSwitchAccFile, "FarmStrategy", "CmbCriteria1" & $i, $g_aiCmbCriteria1[$i]) + IniWriteS($sSwitchAccFile, "FarmStrategy", "TxtResource1" & $i, $g_aiTxtResource1[$i]) + IniWriteS($sSwitchAccFile, "FarmStrategy", "CmbTime1" & $i, $g_aiCmbTime1[$i]) + + IniWriteS($sSwitchAccFile, "FarmStrategy", "CmbAction2" & $i, $g_aiCmbAction2[$i]) + IniWriteS($sSwitchAccFile, "FarmStrategy", "CmbCriteria2" & $i, $g_aiCmbCriteria2[$i]) + IniWriteS($sSwitchAccFile, "FarmStrategy", "TxtResource2" & $i, $g_aiTxtResource2[$i]) + IniWriteS($sSwitchAccFile, "FarmStrategy", "CmbTime2" & $i, $g_aiCmbTime2[$i]) + Next + EndIf ; Restart Search Legend league - Persian MOD (#-29) _Ini_Add("other", "ChkSearchTimeout", $g_bIsSearchTimeout ? 1 : 0) diff --git a/COCBot/Persian_MOD/functions/Mod's/FarmSchedule.au3 b/COCBot/Persian_MOD/functions/Mod's/FarmSchedule.au3 index 54143bc..ac35ce6 100644 --- a/COCBot/Persian_MOD/functions/Mod's/FarmSchedule.au3 +++ b/COCBot/Persian_MOD/functions/Mod's/FarmSchedule.au3 @@ -16,11 +16,13 @@ Func CheckFarmSchedule() If Not ProfileSwitchAccountEnabled() Then Return + Static $aiActionDone[8] = [0, 0, 0, 0, 0, 0, 0, 0] Static $iStartHour = @HOUR + Local $bNeedSwitchAcc = False, $bNeedRunBot = False + If $g_bFirstStart And $iStartHour = -1 Then $iStartHour = @HOUR Local $bActionDone = False - Local $sText = "" - SetLog("Checking Farm Schedule...") + If $g_bDebugSetlog Then SetDebugLog("Checking Farm Schedule...") For $i = 0 To 7 If $i > $g_iTotalAcc Then ExitLoop @@ -28,28 +30,42 @@ Func CheckFarmSchedule() Local $iAction = -1 ; Check timing schedule - Local $iTimer1 = -1, $iTimer2 = -1 - If $g_aiCmbAction1[$i] >= 1 And $g_aiCmbCriteria1[$i] = 5 And $g_aiCmbTime1[$i] >= 0 Then - $iTimer1 = $g_aiCmbTime1[$i] - If $iTimer1 <= @HOUR Then $iAction = $g_aiCmbAction1[$i] - 1 - EndIf - If $g_aiCmbAction2[$i] >= 1 And $g_aiCmbCriteria2[$i] = 5 And $g_aiCmbTime2[$i] >= 0 Then - $iTimer2 = $g_aiCmbTime2[$i] - If $iTimer2 <= @HOUR And ($iTimer2 > $iTimer1 Or $iAction = -1) Then $iAction = $g_aiCmbAction2[$i] - 1 - EndIf - - If $g_bDebugSetlog Then SetDebugLog($i + 1 & ". $iTimer1 = " & $iTimer1 & ", $iTimer2 = " & $iTimer2 & ", $iStartHour = " & $iStartHour & ", $iAction = " & $iAction, $COLOR_DEBUG) + Local $iTimer1 = 25, $iTimer2 = 25 + If $g_aiCmbAction1[$i] >= 1 And $g_aiCmbCriteria1[$i] = 5 And $g_aiCmbTime1[$i] >= 0 Then $iTimer1 = Number($g_aiCmbTime1[$i]) + If $g_aiCmbAction2[$i] >= 1 And $g_aiCmbCriteria2[$i] = 5 And $g_aiCmbTime2[$i] >= 0 Then $iTimer2 = Number($g_aiCmbTime2[$i]) - If $iStartHour >= 0 And $iStartHour >= _Min($iTimer1, $iTimer2) Then - If $iStartHour < _Max($iTimer1, $iTimer2) Then - If @HOUR >= _Max($iTimer1, $iTimer2) Then $iStartHour = -1 + If @HOUR < _Min($iTimer1, $iTimer2) Then ; both timers are ahead. + $aiActionDone[$i] = 0 + $iStartHour = 0 + ElseIf @HOUR < _Max($iTimer1, $iTimer2) Then ; 1 timer has passed, 1 timer ahead + If @HOUR = _Min($iTimer1, $iTimer2) Then $iStartHour = -1 ; in case @Hour = 0 or Missing 1st IF condition + If $iTimer1 < $iTimer2 Then ; reach timer1, let's do action1 + If $aiActionDone[$i] <> 1 And $iStartHour < $iTimer1 Then + $iAction = $g_aiCmbAction1[$i] - 1 + $aiActionDone[$i] = 1 + EndIf + Else ; reach timer2, let's do action2 + If $aiActionDone[$i] <> 2 And $iStartHour < $iTimer2 Then + $iAction = $g_aiCmbAction2[$i] - 1 + $aiActionDone[$i] = 2 + EndIf + EndIf + Else ; passed both timers + If $iTimer1 < $iTimer2 Then + If $aiActionDone[$i] <> 2 And $iStartHour < $iTimer2 Then + $iAction = $g_aiCmbAction2[$i] - 1 + $aiActionDone[$i] = 2 + EndIf Else - If @HOUR < $iStartHour And @HOUR >= 0 Then $iStartHour = -1 + If $aiActionDone[$i] <> 1 And $iStartHour < $iTimer1 Then + $iAction = $g_aiCmbAction1[$i] - 1 + $aiActionDone[$i] = 1 + EndIf EndIf - If $iStartHour > -1 And $iAction >= 0 Then $iAction = -1 - If $g_bDebugSetlog Then SetDebugLog(" $iStartHour = " & $iStartHour & ", $iAction = " & $iAction, $COLOR_DEBUG) EndIf + If $g_bDebugSetlog Then SetDebugLog($i + 1 & ". $iTimer1 = " & $iTimer1 & ", $iTimer2 = " & $iTimer2 & ", Max = " & _Max($iTimer1, $iTimer2) & ", $iStartHour = " & $iStartHour &", $iAction = " & $iAction) + ; Check resource criteria for current account If $i = $g_iCurAccount And $iAction = -1 Then Local $asText[4] = ["Gold", "Elixir", "DarkE", "Trophy"] @@ -57,7 +73,7 @@ Func CheckFarmSchedule() If $g_aiCmbAction1[$i] >= 1 And $g_aiCmbCriteria1[$i] >= 1 And $g_aiCmbCriteria1[$i] <= 4 Then For $r = 1 To 4 If $g_aiCmbCriteria1[$i] = $r And Number($g_aiCurrentLoot[$r - 1]) >= Number($g_aiTxtResource1[$i]) Then - SetLog(" Village " & $asText[$r - 1] & " detected above 1st criterium: " & $g_aiTxtResource1[$i]) + SetLog("Village " & $asText[$r - 1] & " detected above 1st criterium: " & $g_aiTxtResource1[$i]) $iAction = $g_aiCmbAction1[$i] - 1 ExitLoop 2 EndIf @@ -66,7 +82,7 @@ Func CheckFarmSchedule() If $g_aiCmbAction2[$i] >= 1 And $g_aiCmbCriteria2[$i] >= 1 And $g_aiCmbCriteria2[$i] <= 4 Then For $r = 1 To 4 If $g_aiCmbCriteria2[$i] = $r And Number($g_aiCurrentLoot[$r - 1]) < Number($g_aiTxtResource2[$i]) And Number($g_aiCurrentLoot[$r - 1]) > 1 Then - SetLog(" Village " & $asText[$r - 1] & " detected below 2nd criterium: " & $g_aiTxtResource2[$i]) + SetLog("Village " & $asText[$r - 1] & " detected below 2nd criterium: " & $g_aiTxtResource2[$i]) $iAction = $g_aiCmbAction2[$i] - 1 ExitLoop 2 EndIf @@ -80,19 +96,29 @@ Func CheckFarmSchedule() Switch $iAction Case 0 ; turn Off (idle) If GUICtrlRead($g_ahChkAccount[$i]) = $GUI_CHECKED Then + + ; Checking if this is the last active account + Local $iSleeptime = CheckLastActiveAccount($i) + If $iSleeptime > 1 Then + SetLog("This is the last active/donate account to turn off.") + SetLog("Let's go sleep until another account is scheduled to turn active/donate") + SetSwitchAccLog(" Acc. " & $i + 1 & " go sleep", $COLOR_BLUE) + UniversalCloseWaitOpenCoC($iSleeptime * 60 * 1000, "FarmSchedule", False, True) ; wake up & full restart + EndIf + GUICtrlSetState($g_ahChkAccount[$i], $GUI_UNCHECKED) chkAccount($i) $bActionDone = True - If $i = $g_iCurAccount Then $g_bInitiateSwitchAcc = True - SetLog(" Acc [" & $i + 1 & "] turned OFF") + If $i = $g_iCurAccount Then $bNeedSwitchAcc = True + SetLog("Acc [" & $i + 1 & "] turned OFF") SetSwitchAccLog(" Acc. " & $i + 1 & " now Idle", $COLOR_BLUE) EndIf Case 1 ; turn Donate If GUICtrlRead($g_ahChkDonate[$i]) = $GUI_UNCHECKED Then _GUI_Value_STATE("CHECKED", $g_ahChkAccount[$i] & "#" & $g_ahChkDonate[$i]) $bActionDone = True - If $i = $g_iCurAccount Then $g_bInitiateSwitchAcc = True - SetLog(" Acc [" & $i + 1 & "] turned ON for Donating") + If $i = $g_iCurAccount Then $bNeedRunBot = True + SetLog("Acc [" & $i + 1 & "] turned ON for Donating") SetSwitchAccLog(" Acc. " & $i + 1 & " now Donate", $COLOR_BLUE) EndIf Case 2 ; turn Active @@ -100,8 +126,8 @@ Func CheckFarmSchedule() GUICtrlSetState($g_ahChkAccount[$i], $GUI_CHECKED) GUICtrlSetState($g_ahChkDonate[$i], $GUI_UNCHECKED) $bActionDone = True - If $i = $g_iCurAccount Then $g_bInitiateSwitchAcc = True - SetLog(" Acc [" & $i + 1 & "] turned ON for Farming") + If $i = $g_iCurAccount Then $bNeedRunBot = True + SetLog("Acc [" & $i + 1 & "] turned ON for Farming") SetSwitchAccLog(" Acc. " & $i + 1 & " now Active", $COLOR_BLUE) EndIf EndSwitch @@ -111,11 +137,52 @@ Func CheckFarmSchedule() If $bActionDone Then SaveConfig_SwitchAcc() ReadConfig_SwitchAcc() - UpdateMultiStats() + UpdateMultiStats(False) EndIf If _Sleep(500) Then Return - If $g_bInitiateSwitchAcc Then runBot() + If $bNeedSwitchAcc Then + Local $aActiveAccount = _ArrayFindAll($g_abAccountNo, True) + If UBound($aActiveAccount) >= 1 Then + $g_iNextAccount = $aActiveAccount[0] + SwitchCOCAcc($g_iNextAccount) + EndIf + + ElseIf $bNeedRunBot Then + runBot() + EndIf EndFunc ;==>CheckFarmSchedule + +Func CheckLastActiveAccount($i) + + Local $iSleeptime = 0 ; result in minutes + Local $aActiveAccount = _ArrayFindAll($g_abAccountNo, True) + + If $i = $g_iCurAccount And UBound($aActiveAccount) <= 1 Then + Local $iCurrentTime = @HOUR + @MIN / 60 + @SEC / 3600 ; decimal hour + Local $iSoonestTimer = -1 + For $i = 0 To 7 + If $i > $g_iTotalAcc Then ExitLoop + If $g_abChkSetFarm[$i] Then + If $g_aiCmbAction1[$i] >= 1 And $g_aiCmbCriteria1[$i] = 5 And $g_aiCmbTime1[$i] >= 0 Then + Local $ConvertTime1 = $g_aiCmbTime1[$i] + $g_aiCmbTime1[$i] <= @HOUR ? 24 : 0 + If $iSoonestTimer = -1 Or $iSoonestTimer > $ConvertTime1 Then $iSoonestTimer = $ConvertTime1 + EndIf + If $g_aiCmbAction2[$i] >= 1 And $g_aiCmbCriteria2[$i] = 5 And $g_aiCmbTime2[$i] >= 0 Then + Local $ConvertTime2 = $g_aiCmbTime2[$i] + $g_aiCmbTime2[$i] <= @HOUR ? 24 : 0 + If $iSoonestTimer = -1 Or $iSoonestTimer > $ConvertTime2 Then $iSoonestTimer = $ConvertTime2 + EndIf + If $g_bDebugSetlog Then SetDebugLog("@Hour: " & @HOUR & "Timers " & $i + 1 & ": " & $g_aiCmbTime1[$i] & " / " & $g_aiCmbTime2[$i] & ". $iSoonestTimer = " & $iSoonestTimer) + EndIf + Next + If $g_bDebugSetlog Then SetDebugLog("$iSoonestTimer = " & $iSoonestTimer) + If $iSoonestTimer >= 0 Then $iSleeptime = ($iSoonestTimer - $iCurrentTime) * 60 + EndIf + + If $g_bDebugSetlog Then SetDebugLog("$iSleeptime: " & Round($iSleeptime, 2) & " m") + + Return $iSleeptime + +EndFunc ;==>CheckLastActiveAccount [/CODE]
  4. Double train army

    @demen here log about loop with and without switch account same loop. https://pastebin.aquilenet.fr/?a13949d51f5bcacd#JHYzDI4w0uadhtSzoYlE5EkIDVQ89GEORyFfbqFSaHQ=
  5. Stop bot for war

    Thanks sir. Im away from home so i can test after 7-8 hours but i will update post when i try. Edit: Works as expected. Good job master
  6. Stop bot for war

    check pm please. I send you mod version. @demen
  7. Stop bot for war

    Welcome back @demen we miss your mod a lot btw. After switch groups adapted to mybot, your farm schedule feature still working but it is saving condition to Profile.ini which all switch groups using same and it is crashing about profile to profile. So suggestion about that maybe we can change config path about profile to profile other than Profile.ini
  8. Merhaba abiler, kardeşler. Adım Çağrı, 26 yaşındayım. 7. seviye bir klanım var gerçek hayattan arkadaşlarla kurmuştuk fakat sayımız az olduğu için klan oyunlarını tamamlayamadığımız için klanı bot klanına çevirmeye karar verdim. Hangi th veya seviyede olduğunuzun benim için pek önemi yok daha çok klan oyunlarında aktiflik sağlamanız benim için yeterlidir. Düzenli savaş var fakat önceliğim her geleni savaşa almak değildir önceden belirtmek isterim (106 g, 27y). Terbiyeli, sağa sola bulaşmayan, aktif arkadaşlar arıyorum. İlgilenenler için balon, minion savaştığım için 7/24 açık botumdan 4 hesaptan balon bağışlıyorum ve düşük kupalarda takılıyorum yani bağışınız maksimum 5 dakika içinde dolar. Lüzum görülürse lav bağışını da ayarlayabilirim. Ek olarak bağışçı olmanıza gerek yok fakat level yükseltmek isterim derseniz siz de bağışçı olabilirsiniz. Doğal olarak bot kelimesinin klan veya global sohbette kullanılmaması hepimizin yararına olur. Hem sohbet hem oyun oynarız diyen arkadaşlar olursa whatsapp grubu veya telegram grubu kurmayı düşünüyorum. Müracaat için yanıt olarak yaşınız, belediye binası seviyenizi belirtilseniz özel mesajdan size ulaşabilirim. Saygı ve sevgilerimle. Allaha emanet olun.
×