diff --git a/CHANGELOG b/CHANGELOG index cdb1a0862..0e026a69b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,30 @@ -* **V7.7.2** +* **V7.7.3** +* Added Telegram notification when the lab is idle by @mitzu2250 +* Added Google Play Services button under Bot/Android Play Store to manually install/update Google Play Services +* Added conditions "TH", "SIEGE" and "TH+SIEGE" to csv WAIT command, to break the wait early thx @Fahid.Mahmood for the inspiration +* see CSV HowTo Guide or Max-Human-Like TH12 LavaLoonion.csv for usage +* Added Bot/Android "Update shared_prefs" option to always push and pull shared_prefs to reset zoom, set language to English, disable snow and rate popup +* Fixed forum authentication crashing the bot with FileNotFoundException (as reported in Windows Event Log) +* Fixed forum authentication http error 500 +* Fixed forum authentication interfering with watch dog +* Fixed forum authentication due to windows permissions, saving .mybot.run.authentication file now in @AppDataDir (existing will be moved) +* Fixed shared_prefs pull/push due to windows permissions, saving now in @AppDataDir\MyBot.run-Profiles (existing will be moved) +* Fixed CSV attack with 11+ slots in attackbar +* Fixed Telegram push for Smart Wait Time by @mitzu2250 +* Fixed Clangames "Caravan is not available" +* Fixed minitouch click and click&drag for BlueStacks 4 +* Fixed KOPLAYER "device offline" problem +* Fixed MEmu and BlueStacks CoC crashing when using home button or polite close +* Fixed Nox DirectX mode for versions 3.3.0 - 6.2.0 ("Unsupported Nox screen size of 864 x 36" or similar) +* Fixed Nox "Nox unsupported Graphics Engine Type" log message +* Fixed Nox shared folder detection and disabled VM is running check (as it might not work) +* Fixed missing shared folder by adding configuration to instance +* Fixed docked mode manual mouse double click (fixed also mouse device issues for MEmu and LeapDroid) +* Fixed LeapDroid and iTools version identification +* Fixed check obstables not restarting CoC due to recursion +* Improved running different Android Emulator by replacing emulator provided adb.exe with MyBot.run version + +* **V7.7.2** * Fixed forum authentication with non ansi characters like Hindi, Cyrillic or Asian * Fixed incorrect share folder detection when permission denied ocurres * Fixed removal of "Zone.Identifier" for files in lib\adb and lib\curl folders diff --git a/COCBot/GUI/MBR GUI Control Notify.au3 b/COCBot/GUI/MBR GUI Control Notify.au3 index c3af546ad..b6ebf3b3e 100644 --- a/COCBot/GUI/MBR GUI Control Notify.au3 +++ b/COCBot/GUI/MBR GUI Control Notify.au3 @@ -42,6 +42,7 @@ Func chkPBTGenabled() GUICtrlSetState($g_hChkNotifyAlertBAN, $GUI_ENABLE) GUICtrlSetState($g_hChkNotifyBOTUpdate, $GUI_ENABLE) GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $GUI_ENABLE) + GUICtrlSetState($g_hChkNotifyAlertLaboratoryIdle, $GUI_ENABLE) Else GUICtrlSetState($g_hChkNotifyRemote, $GUI_DISABLE) GUICtrlSetState($g_hTxtNotifyOrigin, $GUI_DISABLE) @@ -60,6 +61,7 @@ Func chkPBTGenabled() GUICtrlSetState($g_hChkNotifyAlertBAN, $GUI_DISABLE) GUICtrlSetState($g_hChkNotifyBOTUpdate, $GUI_DISABLE) GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $GUI_DISABLE) + GUICtrlSetState($g_hChkNotifyAlertLaboratoryIdle, $GUI_DISABLE) EndIf EndFunc ;==>chkPBTGenabled diff --git a/COCBot/GUI/MBR GUI Control Splash.au3 b/COCBot/GUI/MBR GUI Control Splash.au3 index 551b596d4..e223c9def 100644 --- a/COCBot/GUI/MBR GUI Control Splash.au3 +++ b/COCBot/GUI/MBR GUI Control Splash.au3 @@ -53,11 +53,16 @@ Func UpdateSplashTitle($title) GUICtrlSetData($g_lSplashTitle, $title) EndFunc ;==>UpdateSplashTitle -Func DestroySplashScreen() - If IsHWnd($g_hSplash) Then GUIDelete($g_hSplash) - ; allow now other bots to launch - ReleaseMutex($g_hSplashMutex) - $g_hSplashMutex = 0 +Func DestroySplashScreen($bReleaseMutex = True) + If $g_hSplash And IsHWnd($g_hSplash) Then + GUIDelete($g_hSplash) + $g_hSplash = 0 + EndIf + If $bReleaseMutex Then + ; allow now other bots to launch + ReleaseMutex($g_hSplashMutex) + $g_hSplashMutex = 0 + EndIf EndFunc ;==>DestroySplashScreen Func MoveSplashScreen() diff --git a/COCBot/GUI/MBR GUI Design Child Bot - Android.au3 b/COCBot/GUI/MBR GUI Design Child Bot - Android.au3 index aeffdbd85..92f27f8a0 100644 --- a/COCBot/GUI/MBR GUI Design Child Bot - Android.au3 +++ b/COCBot/GUI/MBR GUI Design Child Bot - Android.au3 @@ -16,7 +16,7 @@ Global $g_hCmbCOCDistributors = 0, $g_hCmbAndroidBackgroundMode = 0, $g_hCmbAndroidZoomoutMode = 0, $g_hCmbSuspendAndroid = 0, $g_hChkAndroidAdbClick = 0, _ $g_hChkAndroidAdbClickDragScript = 0, $g_hBtnAndroidAdbShell = 0, $g_hBtnAndroidHome = 0, $g_hBtnAndroidBack = 0, $g_hTxtAndroidRebootHours = 0, _ - $g_hChkAndroidCloseWithBot = 0, $g_hBtnAndroidEnableTouch = 0, $g_hBtnAndroidDisableTouch = 0, $g_lblHelpBot = 0 + $g_hChkAndroidCloseWithBot = 0, $g_hChkUpdateSharedPrefs = 0, $g_hBtnAndroidEnableTouch = 0, $g_hBtnAndroidDisableTouch = 0, $g_lblHelpBot = 0 Func CreateBotAndroid() @@ -61,13 +61,17 @@ Func CreateBotAndroid() GUICtrlSetState(-1, (($g_bAndroidCloseWithBot) ? ($GUI_CHECKED) : ($GUI_UNCHECKED))) $y += 25 - GUICtrlCreateLabel(GetTranslatedFileIni("Android", "LblAndroidRebootHours", "Reboot Android in") & ":", $x + 17, $y + 2, -1, -1) + $g_hChkUpdateSharedPrefs = GUICtrlCreateCheckbox(GetTranslatedFileIni("Android", "ChkUpdateSharedPrefs", "Update shared_prefs"), $x, $y, -1, -1) + _GUICtrlSetTip(-1, GetTranslatedFileIni("Android", "ChkUpdateSharedPrefs_Info", "Pull and push shared_prefs to reset zoom,\nset language to English, disable snow and rate popup.")) + GUICtrlSetState(-1, (($g_bUpdateSharedPrefs) ? ($GUI_CHECKED) : ($GUI_UNCHECKED))) + + GUICtrlCreateLabel(GetTranslatedFileIni("Android", "LblAndroidRebootHours", "Reboot Android in") & ":", $x + 217, $y + 2, -1, -1) $sTxtTip = GetTranslatedFileIni("Android", "LblAndroidRebootHours_Info", "Enter hours when Android will be automatically rebooted after specified run-time.") _GUICtrlSetTip(-1, $sTxtTip) - $g_hTxtAndroidRebootHours = GUICtrlCreateInput($g_iAndroidRebootHours, $x + 177, $y + 1, 30, 16, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) + $g_hTxtAndroidRebootHours = GUICtrlCreateInput($g_iAndroidRebootHours, $x + 327, $y + 1, 30, 16, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) _GUICtrlSetTip(-1, $sTxtTip) GUICtrlSetLimit(-1, 4) - GUICtrlCreateLabel(GetTranslatedFileIni("MBR Global GUI Design", "hrs", -1), $x + 212, $y + 2, -1, -1) + GUICtrlCreateLabel(GetTranslatedFileIni("MBR Global GUI Design", "hrs", -1), $x + 362, $y + 2, -1, -1) GUICtrlCreateGroup("", -99, -99, 1, 1) $y = $y2 + $h + 5 @@ -106,14 +110,17 @@ Func CreateBotAndroid() ;$x = 25 + $g_iSizeWGrpTab2 - 2 - 10 - $w $x = 25 + 240 + 10 + 30 $y = $y2 - $w = 125 - $h = 80 + $w = 145 + $h = 110 GUICtrlCreateGroup(GetTranslatedFileIni("Android Control", "Group_04", "Install Play Store Apps"), $x - 20, $y - 20, $w, $h) $y -= 2 - GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreGame", "Clash of Clans"), $x - 8, $y, 100, 25) + GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreGame", "Clash of Clans"), $x - 8, $y, $w - 24, 25) GUICtrlSetOnEvent(-1, "OpenPlayStoreGame") $y += 30 - GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreNovaLauncher", "Nova Launcher"), $x - 8, $y, 100, 25) + GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreGooglePlayServices", "Google Play Services"), $x - 8, $y, $w - 24, 25) + GUICtrlSetOnEvent(-1, "OpenPlayStoreGooglePlayServices") + $y += 30 + GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreNovaLauncher", "Nova Launcher"), $x - 8, $y, $w - 24, 25) GUICtrlSetOnEvent(-1, "OpenPlayStoreNovaLauncher") GUICtrlCreateGroup("", -99, -99, 1, 1) diff --git a/COCBot/GUI/MBR GUI Design Child Village - Notify.au3 b/COCBot/GUI/MBR GUI Design Child Village - Notify.au3 index 97191bb93..3d22a83b1 100644 --- a/COCBot/GUI/MBR GUI Design Child Village - Notify.au3 +++ b/COCBot/GUI/MBR GUI Design Child Village - Notify.au3 @@ -23,7 +23,7 @@ Global $g_hChkNotifyRemote = 0, $g_hTxtNotifyOrigin = 0 Global $g_hChkNotifyAlertMatchFound = 0, $g_hChkNotifyAlertLastRaidIMG = 0, $g_hChkNotifyAlertLastRaidTXT = 0, $g_hChkNotifyAlertCampFull = 0, _ $g_hChkNotifyAlertUpgradeWall = 0, $g_hChkNotifyAlertOutOfSync = 0, $g_hChkNotifyAlertTakeBreak = 0, $g_hChkNotifyAlertBuilderIdle = 0, _ $g_hChkNotifyAlertVillageStats = 0, $g_hChkNotifyAlertLastAttack = 0, $g_hChkNotifyAlertAnotherDevice = 0, $g_hChkNotifyAlertMaintenance = 0, _ - $g_hChkNotifyAlertBAN = 0, $g_hChkNotifyBOTUpdate = 0, $g_hChkNotifyAlertSmartWaitTime = 0 + $g_hChkNotifyAlertBAN = 0, $g_hChkNotifyBOTUpdate = 0, $g_hChkNotifyAlertSmartWaitTime = 0, $g_hChkNotifyAlertLaboratoryIdle = 0 Global $g_hChkNotifyOnlyHours = 0, $g_hChkNotifyOnlyWeekDays = 0, $g_hChkNotifyhours[24] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], _ $g_hChkNotifyWeekdays[7] = [0, 0, 0, 0, 0, 0, 0] @@ -127,6 +127,9 @@ Func CreatePushBulletTelegramSubTab() $g_hChkNotifyBOTUpdate = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyBOTUpdate", "BOT Update"), $x + 210, $y, -1, -1) _GUICtrlSetTip(-1, GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyBOTUpdate_Info_01", "Send an Alert when there is a new version of the bot.")) GUICtrlSetState(-1, $GUI_DISABLE) + $g_hChkNotifyAlertLaboratoryIdle = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertLaboratoryIdle", "Laboratory Idle"), $x + 315, $y, -1, -1) + _GUICtrlSetTip(-1, GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertLaboratoryIdle_Info_01", "Send an Alert when the laboratory is idle.")) + GUICtrlSetState(-1, $GUI_DISABLE) $y += 20 ; TODO diff --git a/COCBot/GUI/MBR GUI Design Splash.au3 b/COCBot/GUI/MBR GUI Design Splash.au3 index 706831787..892c7cefb 100644 --- a/COCBot/GUI/MBR GUI Design Splash.au3 +++ b/COCBot/GUI/MBR GUI Design Splash.au3 @@ -87,8 +87,12 @@ Func CreateSplashScreen($iSteps = Default) GUICtrlSetOnEvent(-1, "MoveSplashScreen") $g_hSplashProgress = GUICtrlCreateProgress(15, $iY + $iT + $iB + 20, $iX - 30, 10, $PBS_SMOOTH, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) ; Splash Progress $g_lSplashStatus = GUICtrlCreateLabel(GetTranslatedFileIni("MBR GUI Design - Loading", "SplashStep_Loading", "Loading..."), 15, $iY + $iT + $iB + 38, $iX - 30, 15, $SS_CENTER) ; Splash Title + GUICtrlSetOnEvent(-1, "MoveSplashScreen") + Else + $g_lSplashTitle = 0 + $g_hSplashProgress = 0 + $g_lSplashStatus = 0 EndIf - GUICtrlSetOnEvent(-1, "MoveSplashScreen") ; Cleanup GDI resources _GDIPlus_BitmapDispose($hSplashImg) diff --git a/COCBot/MBR GUI Action.au3 b/COCBot/MBR GUI Action.au3 index aca0339a3..dec80fbbc 100644 --- a/COCBot/MBR GUI Action.au3 +++ b/COCBot/MBR GUI Action.au3 @@ -15,6 +15,21 @@ Func BotStart($bAutostartDelay = 0) FuncEnter(BotStart) + + If Not $g_bSearchMode Then + If $g_hLogFile = 0 Then CreateLogFile() ; only create new log file when doesn't exist yet + CreateAttackLogFile() + If $g_iFirstRun = -1 Then $g_iFirstRun = 1 + EndIf + SetLogCentered(" BOT LOG ", Default, Default, True) + + If Not ForumAuthentication() Then + ; not authenticated exit now, but restore controls first + EnableControls($g_hFrmBotBottom, Default, $g_aFrmBotBottomCtrlState) + SetRedrawBotWindow(True, Default, Default, Default, "BotStart") + Return FuncReturn() + EndIf + ResumeAndroid() CleanSecureFiles() CalCostCamp() @@ -36,13 +51,6 @@ Func BotStart($bAutostartDelay = 0) $g_bIsClientSyncError = False $g_bDisableBreakCheck = False ; reset flag to check for early warning message when bot start/restart in case user stopped in middle - If Not $g_bSearchMode Then - If $g_hLogFile = 0 Then CreateLogFile() ; only create new log file when doesn't exist yet - CreateAttackLogFile() - If $g_iFirstRun = -1 Then $g_iFirstRun = 1 - EndIf - SetLogCentered(" BOT LOG ", Default, Default, True) - SaveConfig() readConfig() applyConfig(False) ; bot window redraw stays disabled! diff --git a/COCBot/MBR GUI Control.au3 b/COCBot/MBR GUI Control.au3 index 5754949f4..70ae18570 100644 --- a/COCBot/MBR GUI Control.au3 +++ b/COCBot/MBR GUI Control.au3 @@ -320,7 +320,7 @@ Func GUIControl_WM_MOUSE($hWin, $iMsg, $wParam, $lParam) EndIf Switch $iMsg - Case $WM_LBUTTONDOWN, $WM_LBUTTONUP, $WM_RBUTTONDOWN, $WM_RBUTTONUP + Case $WM_LBUTTONDOWN, $WM_LBUTTONUP, $WM_RBUTTONDOWN, $WM_RBUTTONUP, $WM_LBUTTONDBLCLK ; ensure text box still has focus Local $hInput = GUICtrlGetHandle($g_hFrmBotEmbeddedShieldInput) _WinAPI_SetFocus($hInput) @@ -339,6 +339,11 @@ Func GUIControl_WM_MOUSE($hWin, $iMsg, $wParam, $lParam) Local $c = GetPixelFromWindow($x, $y, $g_hAndroidControl) SetLog(StringFormat("Mouse LBUTTONDOWN %03i,%03i Color %s", $x, $y, $c), $COLOR_DEBUG) EndIf + Case $WM_LBUTTONDBLCLK + If $g_bDebugClick And AndroidShieldHasFocus() Then + Local $c = GetPixelFromWindow($x, $y, $g_hAndroidControl) + SetLog(StringFormat("Mouse LBUTTONDBLCLK %03i,%03i Color %s", $x, $y, $c), $COLOR_DEBUG) + EndIf Case $WM_LBUTTONUP, $WM_RBUTTONUP If $g_iDebugWindowMessages Then SetDebugLog("GUIControl_WM_MOUSE: " & ($iMsg = $WM_LBUTTONUP ? "$WM_LBUTTONUP" : "$WM_RBUTTONUP") & " $hWin=" & $hWin & ",$iMsg=" & $iMsg & ",$wParam=" & $wParam & ",$lParam=" & $lParam & ", X=" & $x & ", Y=" & $y, Default, True) @@ -376,7 +381,7 @@ Func GUIControl_WM_MOUSE($hWin, $iMsg, $wParam, $lParam) If $s_x <> $x Or $s_y <> $y Then $iBytesSent = Minitouch($x, $y, 0) EndIf - Case $WM_LBUTTONDOWN + Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK $iBytesSent = Minitouch($x, $y, 1) Case $WM_LBUTTONUP $iBytesSent = Minitouch($x, $y, 2) diff --git a/COCBot/MBR Global Variables.au3 b/COCBot/MBR Global Variables.au3 index 7b3d9a292..12a23c3a3 100644 --- a/COCBot/MBR Global Variables.au3 +++ b/COCBot/MBR Global Variables.au3 @@ -231,7 +231,8 @@ Global $g_bAndroidAdbInstanceEnabled = True ; Enable Android steady ADB shell in Global $g_bAndroidSuspendedEnabled = True ; Enable Android Suspend & Resume during Search and Attack Global $g_iAndroidSuspendModeFlags = 1 ; Android Suspend & Resume mode bit flags: 0=Disabled, 1=Only during Search/Attack, 2=For every ImgLoc call, 4=Suspend entire Android (not advised!) Global $g_bNoFocusTampering = False ; If enabled, no ControlFocus or WinActivate is called, except when really required (like Zoom-Out for Droid4X, might break restart stability when Android Window not responding) -Global $g_iAndroidRecoverStrategy = 1 ; 0 = Stop ADB Daemon first then restart Android; 1 = Restart Android first then restart ADB Daemon +Global $g_iAndroidRecoverStrategyDefault = 1 ; 0 = Stop ADB Daemon first then restart Android; 1 = Restart Android first then restart ADB Daemon +Global $g_iAndroidRecoverStrategy = $g_iAndroidRecoverStrategyDefault ; 0 = Stop ADB Daemon first then restart Android; 1 = Restart Android first then restart ADB Daemon Global $g_bTerminateAdbShellOnStop = False ; "BlueStacks2" $g_avAndroidAppConfig is also updated based on Registry settings in Func InitBlueStacks2() with these special variables @@ -254,11 +255,12 @@ Global $__Droid4X_Window[3][3] = _ ; Alternative window sizes (array must be ord ["0.10.0", $g_iDEFAULT_WIDTH + 6, $g_iDEFAULT_HEIGHT + 53], _ ["0.8.6", $g_iDEFAULT_WIDTH + 10, $g_iDEFAULT_HEIGHT + 50] _ ] -Global $__Nox_Config[2][3] = _ ; Alternative Nox Control ID (array must be ordered by version descending!) +Global $__Nox_Config[1][3] = _ ; Alternative Nox Control ID (array must be ordered by version descending!) [ _ ; Version|$g_sAppClassInstance - ["6.2.1", "[CLASS:subWin; INSTANCE:1]|[CLASS:AnglePlayer_0; INSTANCE:1]", True], _ ; subWin is used for OpenGL and AnglePlayer_0 for DirectX, $g_bAndroidControlUseParentPos is set to True to support DirectX when docked - ["3.3.0", "[CLASS:subWin; INSTANCE:1]|[TEXT:QWidgetClassWindow; CLASS:Qt5QWindowIcon]", False] _ ; use multiple index as during undock it can change + ["3.3.0", "[CLASS:subWin; INSTANCE:1]|[CLASS:AnglePlayer_0; INSTANCE:1]", True] _ ; subWin is used for OpenGL and AnglePlayer_0 for DirectX, $g_bAndroidControlUseParentPos is set to True to support DirectX when docked ] + ;["6.2.1", "[CLASS:subWin; INSTANCE:1]|[CLASS:AnglePlayer_0; INSTANCE:1]", True], _ ; subWin is used for OpenGL and AnglePlayer_0 for DirectX, $g_bAndroidControlUseParentPos is set to True to support DirectX when docked + ;["3.3.0", "[CLASS:subWin; INSTANCE:1]|[TEXT:QWidgetClassWindow; CLASS:Qt5QWindowIcon]", False] _ ; use multiple index as during undock it can change ; 0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11 |12 |13 |14 |15 ; $g_sAndroidEmulator |$g_sAndroidTitle |$g_sAppClassInstance |$g_sAppPaneName |$g_iAndroidClientWidth|$g_iAndroidClientHeight|$g_iAndroidWindowWidth|$g_iAndroidWindowHeight|$ClientOffsetY|$g_sAndroidAdbDevice|$g_iAndroidSupportFeature |$g_sAndroidShellPrompt|$g_sAndroidMouseDevice |$g_bAndroidEmbed/$g_iAndroidEmbedMode|$g_iAndroidBackgroundModeDefault @@ -270,26 +272,27 @@ Global $__Nox_Config[2][3] = _ ; Alternative Nox Control ID (array must be order ; | | | | | | | | | | |32 = ADB click drag | | | | ; | | | | | | | | | | |64 = Make DPI Aware (if avaliable) | | | ; | | | | | | | | | | |128 = ADB use input swipe and not script | | | -Global $g_avAndroidAppConfig[8][16] = [ _ ; | | | | | | | | |256 = Update $g_sAppClassInstance with Window Handle| | | - ["LeapDroid", "vm1", "Leapd", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "emulator-5554", 1 + 8 + 16 + 32, '# ', 'qwerty2', 1, 1], _ ; LeapDroid - ["Nox", "nox", "No", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 4, $g_iDEFAULT_HEIGHT - 10,0, "127.0.0.1:62001", 1 + 2 + 4 + 8 + 16 + 32 + 256,'# ', '(nox Virtual Input|Android Input|Android_Input)', 0, 2], _ ; Nox - ["MEmu", "MEmu", "MEmu ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 51,$g_iDEFAULT_HEIGHT - 12,0, "127.0.0.1:21503", 2 + 4 + 8 + 16 + 32, '# ', '(Microvirt Virtual Input|User Input)', 0, 2], _ ; MEmu - ["BlueStacks2","Android", "BlueStacks ", "[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 + 2 + 4 + 8 + 16 + 32 + 128,'$ ', 'BlueStacks Virtual Touch', 0, 1], _ ; BlueStacks2 - ["BlueStacks", "Android", "BlueStacks App Player","[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 + 8 + 16 + 32 + 128,'$ ', 'BlueStacks Virtual Touch', 0, 1], _ ; BlueStacks - ["iTools", "iToolsVM","iTools ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 2, $g_iDEFAULT_HEIGHT - 13,0, "127.0.0.1:54001", 1 + 2 + 4 + 8 + 16 + 32 + 64, '# ', 'iTools Virtual PassThrough Input', 0, 1], _ ; iTools - ["KOPLAYER", "KOPLAYER","KOPLAYER", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 64,$g_iDEFAULT_HEIGHT - 8, 0, "127.0.0.1:6555", 1 + 2 + 4 + 8 + 16 + 32, '# ', 'ttVM Virtual Input', 0, 2], _ ; KOPLAYER - ["Droid4X", "droid4x", "Droid4X ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 10,$g_iDEFAULT_HEIGHT + 50,0, "127.0.0.1:26944", 2 + 4 + 8 + 16 + 32, '# ', 'droid4x Virtual Input', 0, 2] _; Droid4X +; | | | | | | | | | | |256 = Update $g_sAppClassInstance with Window Handle| | | +Global $g_avAndroidAppConfig[8][16] = [ _ ; | | | | | | | | |512 = Supports adding shared folder with vboxmanage.exe | | + ["Nox", "nox", "No", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 4, $g_iDEFAULT_HEIGHT - 10,0, "127.0.0.1:62001", 1+2+4+8+16+32 +256+512, '# ', '(nox Virtual Input|Android Input|Android_Input)', 0, 2], _ ; Nox + ["MEmu", "MEmu", "MEmu ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 51,$g_iDEFAULT_HEIGHT - 12,0, "127.0.0.1:21503", 2+4+8+16+32 +512, '# ', '(Microvirt Virtual Input|User Input)', 0, 2], _ ; MEmu + ["BlueStacks2","Android", "BlueStacks ", "[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1+2+4+8+16+32 +128, '$ ', 'BlueStacks Virtual Touch', 0, 1], _ ; BlueStacks2 + ["BlueStacks", "Android", "BlueStacks App Player","[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 +8+16+32 +128, '$ ', 'BlueStacks Virtual Touch', 0, 1], _ ; BlueStacks + ["LeapDroid", "vm1", "Leapd", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "emulator-5554", 1 +8+16+32 +512, '# ', 'qwerty2', 1, 1], _ ; LeapDroid + ["iTools", "iToolsVM","iTools ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 2, $g_iDEFAULT_HEIGHT - 13,0, "127.0.0.1:54001", 1+2+4+8+16+32+64 +512, '# ', 'iTools Virtual PassThrough Input', 0, 1], _ ; iTools + ["KOPLAYER", "KOPLAYER","KOPLAYER", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 64,$g_iDEFAULT_HEIGHT - 8, 0, "127.0.0.1:6555", 1+2+4+8+16+32 +512, '# ', 'ttVM Virtual Input', 0, 2], _ ; KOPLAYER + ["Droid4X", "droid4x", "Droid4X ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 10,$g_iDEFAULT_HEIGHT + 50,0, "127.0.0.1:26944", 2+4+8+16+32 +512, '# ', 'droid4x Virtual Input', 0, 2] _; Droid4X ] -; Android Configutions -Global $__MEmu_Idx = _ArraySearch($g_avAndroidAppConfig, "MEmu", 0, 0, 0, 0, 1, 0) ; MEmu 3.6.2.0, 3.5.0.2, 3.1.2.x, 2.9.6.1, 2.9.3, 2.9.1, 2.8.6, 2.8.5, 2.8.3, 2.8.2, 2.8.0, 2.7.2, 2.7.0, 2.6.6, 2.6.5, 2.6.2, 2.6.1, 2.5.0, 2.3.1, 2.3.0, 2.2.1 -Global $__BS2_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks2", 0, 0, 0, 0, 1, 0) ; BlueStacks 3.50.63.2536, 3.7.x, 2.7.x, 2.6.x, 2.5.x, 2.4.x, 2.3.x, 2.2.x, 2.1.x, 2.0.x -Global $__BS_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks", 0, 0, 0, 0, 1, 0) ; BlueStacks 0.11.x, 0.10.x, 0.9.x, 0.8.x -Global $__KOPLAYER_Idx = _ArraySearch($g_avAndroidAppConfig, "KOPLAYER", 0, 0, 0, 0, 1, 0) ; KOPLAYER 1.4.1055, 1.4.1049 -Global $__LeapDroid_Idx = _ArraySearch($g_avAndroidAppConfig, "LeapDroid", 0, 0, 0, 0, 1, 0) ; LeapDroid 1.8.0, 1.7.0, 1.6.1, 1.5.0, 1.4.0, 1.3.1 -Global $__iTools_Idx = _ArraySearch($g_avAndroidAppConfig, "iTools", 0, 0, 0, 0, 1, 0) ; iTools AVM 2.0.8.9, 2.0.7.9, 2.0.6.8 -Global $__Droid4X_Idx = _ArraySearch($g_avAndroidAppConfig, "Droid4X", 0, 0, 0, 0, 1, 0) ; Droid4X 0.10.6 Beta, Droid4X 0.10.5 Beta, 0.10.4 Beta, 0.10.3 Beta, 0.10.2 Beta, 0.10.1 Beta, 0.10.0 Beta, 0.9.0 Beta, 0.8.7 Beta, 0.8.6 Beta -Global $__Nox_Idx = _ArraySearch($g_avAndroidAppConfig, "Nox", 0, 0, 0, 0, 1, 0) ; Nox 6.0.0, 5.2.1.0, 5.1.0.0, 5.0.0.1, 5.0.0.0, 3.8.1.3, 3.8.0.x, 3.7.6.x, 3.7.5.1, 3.7.5, 3.7.3, 3.7.1, 3.7.0, 3.6.0, 3.5.1, 3.3.0, 3.1.0, 3.0.0 +; Android Configutions, see COCBot\functions\Android\Android Status & Information.txt for more details +Global $__Nox_Idx = _ArraySearch($g_avAndroidAppConfig, "Nox", 0, 0, 0, 0, 1, 0) ; http://en.bignox.com/ +Global $__MEmu_Idx = _ArraySearch($g_avAndroidAppConfig, "MEmu", 0, 0, 0, 0, 1, 0) ; http://www.memuplay.com/ +Global $__BS2_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks2", 0, 0, 0, 0, 1, 0) ; http://www.bluestacks.com/ +Global $__BS_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks", 0, 0, 0, 0, 1, 0) ; https://filehippo.com/de/download_bluestacks_app_player/64518/ +Global $__LeapDroid_Idx = _ArraySearch($g_avAndroidAppConfig, "LeapDroid", 0, 0, 0, 0, 1, 0) ; https://mybot.run/forums/index.php?/topic/22912-new-leapdroid-support +Global $__iTools_Idx = _ArraySearch($g_avAndroidAppConfig, "iTools", 0, 0, 0, 0, 1, 0) ; https://pro.itools.cn/simulate/ +Global $__KOPLAYER_Idx = _ArraySearch($g_avAndroidAppConfig, "KOPLAYER", 0, 0, 0, 0, 1, 0) ; http://www.koplayer.com/ +Global $__Droid4X_Idx = _ArraySearch($g_avAndroidAppConfig, "Droid4X", 0, 0, 0, 0, 1, 0) ; http://droid4x.haimawan.com/ ; Startup detection Global $g_bOnlyInstance = True @@ -315,6 +318,7 @@ Global $g_iAndroidClientHeight ; Expected height of android rendering control Global $g_iAndroidWindowWidth ; Expected Width of android window Global $g_iAndroidWindowHeight ; Expected height of android window Global $g_bAndroidAdbUseMyBot = True ; Use MyBot provided adb.exe and not the one from emulator +Global $g_bAndroidAdbReplaceEmulatorVersion = True ; If True and MyBot.run adb.exe is available, Android provided adb.exe will be replaced to ensure MyBot.run adb.exe version is used Global $g_sAndroidAdbPath ; Path to executable HD-Adb.exe or adb.exe Global $g_sAndroidAdbGlobalOptions ; Additional adb global options like -P 5037 for port Global $g_sAndroidAdbDevice ; full device name ADB connects to @@ -332,14 +336,15 @@ Global $g_bAndroidEmbed ; Enable Android Docking Global $g_iAndroidEmbedMode ; Android Dock Mode: -1 = Not available, 0 = Normal docking, 1 = Simulated docking Global $g_bAndroidBackgroundLaunch ; Enabled Android Background launch using Windows Scheduled Task Global $g_bAndroidBackgroundLaunched ; True when Android was launched in headless mode without a window -Global $g_iAndroidControlClickDelay = 10 ; 10 is Default (Milliseconds) -Global $g_iAndroidControlClickDownDelay = 5 ; 2 is Default (Milliseconds) +Global $g_iAndroidControlClickDownDelay = 5 ; 5 is Default for down (Milliseconds) +Global $g_iAndroidControlClickDelay = 10 ; 10 is Default for up (Milliseconds) Global $g_iAndroidAdbClickGroup = 50 ; 1 Disables grouping clicks; > 1 number of clicks fired at once (e.g. when Click with $times > 1 used) (Experimental as some clicks might get lost!); can be overridden via the ini file Global $g_iAndroidAdbClickGroupDelay = 25 ; Additional delay in Milliseconds after group of ADB clicks sent (sleep in Android is executed!) Global $g_iAndroidControlClickWindow = 0 ; 0 = Click the Android Control, 1 = Click the Android Window Global $g_iAndroidControlClickMode = 0 ; 0 = Use AutoIt ControlClick, 1 = Use _SendMessage Global $g_bAndroidCloseWithBot = False ; Close Android when bot closes Global $g_bAndroidInitialized = False +Global $g_bUpdateSharedPrefs = False ; Update shared_prefs/storage_new.xml before pushing Global $g_iAndroidProcessAffinityMask = 0 @@ -366,9 +371,10 @@ Global $g_sAndroidPicturesPathAvailable = False Global $g_sAndroidPicturesPath = "" ; Android mounted path to pictures on host Global $g_sAndroidPicturesHostPath = "" ; Windows host path to mounted pictures in android Global $g_bAndroidSharedFolderAvailable = True +Global $g_sAndroidSharedFolderName = "" ; Set during Android initialization Global Const $g_iAndroidSecureFlags = 3 ; Bits 0 = disabled file renaming/folder less mode, 1 = Secure (SHA-1 filenames no folder), 2 = Delete files after use immediately Global $g_sAndroidPicturesHostFolder = "" ; Subfolder for host and android, can be "", must end with "\" when used -Global $g_bAndroidPicturesPathAutoConfig = True ; Try to configure missing shared folder if missing +Global $g_bAndroidPicturesPathAutoConfig = True ; Try to configure missing shared folder if missing (set by android support feature bit 512) ; Special ADB modes for screencap, mouse clicks and input text Global $g_iAndroidAdbAutoTerminateCount = 0 ; Counter for $g_iAndroidAdbAutoTerminate to terminate ADB shell automatically after x executed commands Global $g_aiAndroidAdbScreencapBuffer = DllStructCreate("byte[" & ($g_iDEFAULT_WIDTH * $g_iDEFAULT_HEIGHT * 4) & "]") ; Holds the android screencap BGRA buffer for caching @@ -437,8 +443,8 @@ Global $g_iThreads = 0 ; Used by ImgLoc for parallism (for this bot instance), 0 ; Profile file/folder paths Global $g_sProfilePath = @ScriptDir & "\Profiles" -Global Const $g_sPrivateProfilePath = @MyDocumentsDir & "\MyBot.run-Profiles" ; Used to save private & very sensitive profile information like shared_prefs (notification tokens will be saved in future here also) -Global Const $g_sPrivateAuthenticationFile = @MyDocumentsDir & "\MyBot.run-Profiles\.mybot.run.authentication" +Global Const $g_sPrivateProfilePath = @AppDataDir & "\MyBot.run-Profiles" ; Used to save private & very sensitive profile information like shared_prefs (notification tokens will be saved in future here also) +Global Const $g_sPrivateAuthenticationFile = @AppDataDir & "\.mybot.run.authentication" Global Const $g_sProfilePresetPath = @ScriptDir & "\Strategies" Global $g_sProfileCurrentName = "" ; Name of profile currently being used Global $g_sProfileConfigPath = "" ; Path to the current config.ini being used in this profile @@ -546,7 +552,7 @@ Global Enum $eIcnArcher = 1, $eIcnDonArcher, $eIcnBalloon, $eIcnDonBalloon, $eIc $eIcnCCSpells, $eIcnSpellsGroup, $eBahasaIND, $eChinese_S, $eChinese_T, $eEnglish, $eFrench, $eGerman, $eItalian, $ePersian, _ $eRussian, $eSpanish, $eTurkish, $eMissingLangIcon, $eWall12, $ePortuguese, $eIcnDonPoisonSpell, $eIcnDonEarthQuakeSpell, $eIcnDonHasteSpell, $eIcnDonSkeletonSpell, $eVietnamese, $eKorean, $eAzerbaijani, _ $eArabic, $eIcnBuilderHall, $eIcnClockTower, $eIcnElixirCollectorL5, $eIcnGemMine, $eIcnGoldMineL5, $eIcnElectroDragon, $eIcnTH12, $eHdV12, $eWall13, $eIcnGrayShield, $eIcnBlueShield, $eIcnGreenShield, $eIcnRedShield, _ - $eIcnBattleB , $eIcnWallW, $eIcnSiegeCost, $eIcnBoostPotion, $eIcnBatSpell, $eIcnStoneS, $eIcnIceGolem, $eIcnStarLaboratory, $eIcnRagedBarbarian, $eIcnSneakyArcher, $eIcnBoxerGiant, $eIcnBetaMinion, _ + $eIcnBattleB, $eIcnWallW, $eIcnSiegeCost, $eIcnBoostPotion, $eIcnBatSpell, $eIcnStoneS, $eIcnIceGolem, $eIcnStarLaboratory, $eIcnRagedBarbarian, $eIcnSneakyArcher, $eIcnBoxerGiant, $eIcnBetaMinion, _ $eIcnBomber, $eIcnBBBabyDragon, $eIcnCannonCart, $eIcnNightWitch, $eIcnDropShip, $eIcnSuperPekka, $eIcnBBWall01, $eIcnBBWall02, $eIcnBBWall03, $eIcnBBWall04, $eIcnBBWall05, $eIcnBBWall06, $eIcnBBWall07, $eIcnBBWall08 Global $eIcnDonBlank = $eIcnDonBlacklist @@ -953,7 +959,7 @@ Global $g_bNotifyRemoteEnable = False, $g_sNotifyOrigin = "", $g_bNotifyDeleteAl Global $g_bNotifyAlertMatchFound = False, $g_bNotifyAlerLastRaidIMG = False, $g_bNotifyAlerLastRaidTXT = False, $g_bNotifyAlertCampFull = False, _ $g_bNotifyAlertUpgradeWalls = False, $g_bNotifyAlertOutOfSync = False, $g_bNotifyAlertTakeBreak = False, $g_bNotifyAlertBulderIdle = False, _ $g_bNotifyAlertVillageReport = False, $g_bNotifyAlertLastAttack = False, $g_bNotifyAlertAnotherDevice = False, $g_bNotifyAlertMaintenance = False, _ - $g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False + $g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False, $g_bNotifyAlertLaboratoryIdle = False ;Schedule Global $g_bNotifyScheduleHoursEnable = False, $g_bNotifyScheduleWeekDaysEnable = False Global $g_abNotifyScheduleHours[24] = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] @@ -1265,7 +1271,7 @@ Global $g_iSkippedVillageCount = 0, $g_iDroppedTrophyCount = 0 ; skipped village Global $g_iCostGoldWall = 0, $g_iCostElixirWall = 0, $g_iCostGoldBuilding = 0, $g_iCostElixirBuilding = 0, $g_iCostDElixirHero = 0 ; wall, building and hero upgrade costs Global $g_iNbrOfWallsUpped = 0, $g_iNbrOfWallsUppedGold = 0, $g_iNbrOfWallsUppedElixir = 0 Global $g_iNbrOfBuildingsUppedGold = 0, $g_iNbrOfBuildingsUppedElixir = 0, $g_iNbrOfHeroesUpped = 0 ; number of wall, building, hero upgrades with gold, elixir, delixir -Global $g_iSearchCost = 0, $g_iTrainCostElixir = 0, $g_iTrainCostDElixir = 0 , $g_iTrainCostGold = 0; search and train troops cost +Global $g_iSearchCost = 0, $g_iTrainCostElixir = 0, $g_iTrainCostDElixir = 0, $g_iTrainCostGold = 0 ; search and train troops cost Global $g_iNbrOfOoS = 0 ; number of Out of Sync occurred Global $g_iNbrOfTHSnipeFails = 0, $g_iNbrOfTHSnipeSuccess = 0 ; number of fails and success while TH Sniping Global $g_iGoldFromMines = 0, $g_iElixirFromCollectors = 0, $g_iDElixirFromDrills = 0 ; number of resources gain by collecting mines, collectors, drills @@ -1741,7 +1747,7 @@ Global $g_iPurgeMax = 5 ; [0] is unlimited , 1-10 Global $g_bChkCollectFreeMagicItems = True ; SC_ID without shared_prefs -GloBal $g_bOnlySCIDAccounts = False +Global $g_bOnlySCIDAccounts = False Global $g_iWhatSCIDAccount2Use = 0 ; All Variables to DB sqlite @@ -1773,4 +1779,4 @@ Global $g_sStarsEarned = Null Func _ArrayIndexValid(Const ByRef $a, Const $idx) Return $idx >= 0 And $idx < UBound($a) -EndFunc \ No newline at end of file +EndFunc ;==>_ArrayIndexValid diff --git a/COCBot/MBR References.au3 b/COCBot/MBR References.au3 index 1ee320279..15e5008c9 100644 --- a/COCBot/MBR References.au3 +++ b/COCBot/MBR References.au3 @@ -218,6 +218,8 @@ Func ReferenceFunctions() GetKOPLAYERBackgroundMode() GetMEmuBackgroundMode() GetNoxBackgroundMode() + ConfigureSharedFolderBlueStacks() + ConfigureSharedFolderBlueStacks2() ; DonateCC.au3 getChatString(0, 0, 0) getChatStringChinese(0, 0) diff --git a/COCBot/functions/Android/Android Status & Information.txt b/COCBot/functions/Android/Android Status & Information.txt index 5337e5195..6f9589ad0 100644 --- a/COCBot/functions/Android/Android Status & Information.txt +++ b/COCBot/functions/Android/Android Status & Information.txt @@ -8,7 +8,7 @@ The once listed here have been tested and do work. Nox === http://en.bignox.com/ -Versions 6.2.6.x, 6.2.5.3, 6.2.0.0, 6.0.1.0, 6.0.0.0, 5.2.1.0, 5.1.0.0, 5.0.0.1, 5.0.0.0, 3.8.1.3, 3.8.0.x, 3.7.6.x, 3.7.5.1, 3.7.5, 3.7.3, 3.7.1, 3.7.0, 3.6.0, 3.5.1, 3.3.0, 3.1.0, 3.0.0 +Versions 6.2.7.x, 6.2.6.x, 6.2.5.3, 6.2.0.0, 6.0.1.0, 6.0.0.0, 5.2.1.0, 5.1.0.0, 5.0.0.1, 5.0.0.0, 3.8.1.3, 3.8.0.x, 3.7.6.x, 3.7.5.1, 3.7.5, 3.7.3, 3.7.1, 3.7.0, 3.6.0, 3.5.1, 3.3.0, 3.1.0, 3.0.0 MyBot Command Line Key: Nox Default Instance Key: nox Second Instance Key: Nox_1 @@ -17,11 +17,16 @@ Info/known issues/bugs: Only in low computer screen resolutions and when Android due to different window size, MyBot resizing fails for any version. Bot set Nox to fixed size to avoid any resize issues. Since 3.3.0 Nox support also DirectX that can be used for faster Screen-Capture. Newer versions since 3.7.3 support setting of framerates and 20 fps or lower significantly reduce CPU load. +Click delays should be 5ms down and 10ms up of clicks get lost. + +If you see errors like this "BigNoxVMMgr.exe: error: Code REGDB_E_CLASSNOTREG (0x80040154) - Class not registered (extended info not available)" +your Nox installation is corrupt. Then open cmd.exe and register all dlls: +FOR %1 IN ("C:\Program Files\Bignox\BigNoxVM\RT\*.DLL") DO REGSVR32 /S "%1" MEmu ==== http://www.memuplay.com/ -Versions 6.0.7.6, 6.0.6.0, 5.3.2.0, 5.2.3.0, 5.0.1.0, 3.6.2.0, 3.5.0.2, 3.1.2.x, 2.9.6.1, 2.9.3, 2.9.1, 2.8.6, 2.8.5, 2.8.3, 2.8.2, 2.8.0, 2.7.2, 2.7.0, 2.6.6, 2.6.5, 2.6.2, 2.6.1, 2.5.0, 2.3.1, 2.3.0, 2.2.1 +Versions 6.1.0, 6.0.7.6, 6.0.6.0, 5.3.2.0, 5.2.3.0, 5.0.1.0, 3.6.2.0, 3.5.0.2, 3.1.2.x, 2.9.6.1, 2.9.3, 2.9.1, 2.8.6, 2.8.5, 2.8.3, 2.8.2, 2.8.0, 2.7.2, 2.7.0, 2.6.6, 2.6.5, 2.6.2, 2.6.1, 2.5.0, 2.3.1, 2.3.0, 2.2.1 MyBot Command Line Key: MEmu Default Instance Key: MEmu Second Instance Key: MEmu_1 @@ -31,11 +36,12 @@ Known issues/bugs: **Newest versions , 5.3.2 or 5.5.5 doesn't work the _ControlC BlueStacks ========== http://www.bluestacks.com/ -Version 4.32.x, 4.3.x, 3.50.x, 3.7.x, 2.7.x, 2.6.x, 2.5.x, 2.4.x, 2.3.x, 2.2.x, 2.1.x, 2.0.x, 0.11.x, 0.10.x, 0.9.x, 0.8.x +Find version 0.10.7.5601 here: https://filehippo.com/de/download_bluestacks_app_player/64518/ +Version 4.60.x, 4.50.x, 4.32.x, 4.3.x, 3.50.x, 3.7.x, 2.7.x, 2.6.x, 2.5.x, 2.4.x, 2.3.x, 2.2.x, 2.1.x, 2.0.x, 0.11.x, 0.10.x, 0.9.x, 0.8.x MyBot Command Line Key (0.8.x - 0.11.x): BlueStacks -MyBot Command Line Key (2.x/3.x): BlueStacks2 +MyBot Command Line Key (2.x/3.x/4.x): BlueStacks2 Default Instance Key: Android -Second Instance Key (only for BlueStacks 3.x): Android_1 +Second Instance Key (only for BlueStacks 3.x/4.x): Android_1 Known issues/bugs: True Background mode using ADB not available for older versions. Older versions might not install the right Clash of Clans APK: "CPU ABI incompatible" error in Play Store. diff --git a/COCBot/functions/Android/Android.au3 b/COCBot/functions/Android/Android.au3 index 5baed36c1..0c2aa1bfe 100644 --- a/COCBot/functions/Android/Android.au3 +++ b/COCBot/functions/Android/Android.au3 @@ -18,14 +18,17 @@ Global Const $g_sAdbScriptsPath = $g_sLibPath & "\adb.scripts" ; ADD script and Global $g_sAndroidAdbPrompt = "mybot.run:" ; Unique ADB PS1 prompt Global $g_bAndroidAdbPortPerInstance = True ; New default behavior to use a dedicated ADB daemon per bot and android instance using port between 5038-5137, it initializes $g_sAndroidAdbGlobalOptions Global $g_bAndroidAdbPort = 0 ; When $g_bAndroidAdbPortPerInstance = True save here the port -Global $g_bAndroidAdbMinitouchPort = 0 ; When $g_bAndroidAdbPortPerInstance = True save here the minitouch port +Global $g_iAndroidAdbMinitouchModeDefault = 1 ; 0 = use tcp port, 1 = use stdin in separate shell +Global $g_iAndroidAdbMinitouchMode = $g_iAndroidAdbMinitouchModeDefault ; 0 = use tcp port, 1 = use stdin in separate shell +Global $g_bAndroidAdbMinitouchPort = 0 ; The minitouch port Global $g_bAndroidAdbMinitouchSocket = 0 ; Socket for minitouch communication Global $g_sAndroidAdbInstanceShellOptionsDefault = " -t -t" ; Additional shell options, only used by BlueStacks2 " -t -t" Global $g_sAndroidAdbInstanceShellOptions = $g_sAndroidAdbInstanceShellOptionsDefault ; Additional shell options, only used by BlueStacks2 " -t -t" Global $g_sAndroidAdbShellOptions = "" ; Additional shell options when launch shell with command, only used by BlueStacks2 " /data/anr/../../system/xbin/bstk/su root" Global $g_bAndroidAdbPromptUseGiven = False ; If True, don't set custom prompt with PS1, use default Global $g_iAndroidCoCPid = 0 ; Android CoC process PID for suspend and resume -Global $g_iAndroidAdbProcess = [0, 0, 0, 0, 0] ; Single instance of ADB used for screencap, 0: PID, 1: StdIn handles, 2: StdOut handles, 3: Process handle, 4: Thread handle +Global $g_iAndroidAdbProcess = [0, 0, 0, 0, 0] ; Single instance of ADB used for screencap, 0: PID, 1: StdIn handle, 2: StdOut handle, 3: Process handle, 4: Thread handle +Global $g_iAndroidAdbMinitouchProcess = [0, 0, 0, 0, 0] ; Single instance of ADB used for minitouch, 0: PID, 1: StdIn handle, 2: StdOut handle, 3: Process handle, 4: Thread handle Global $g_aiAndroidAdbClicks[1] = [-1] ; Stores clicks after KeepClicks() called, fired and emptied with ReleaseClicks() Global $g_aiAndroidAdbStatsTotal[2][2] = [ _ [0, 0], _ ; Total of screencap duration, 0 is count, 1 is sum of durations @@ -48,6 +51,13 @@ Global $g_aiMouseOffsetWindowOnly = [0, 0] Global $g_bPullPushSharedPrefsAbdCommand = False ; If true, push and pull with adb pull/push is tried first before falling back to use shared folder (some adb pull can create shared_prefs subfolder causing problems) Global $g_PushedSharedPrefsProfile = "" ; Last Profile name shared_prefs were pushed Global $g_PushedSharedPrefsProfile_Timer = 0 ; Last __TimerInit() shared_prefs were pushed +; Update shared_prefs when pushing +Global $g_bUpdateSharedPrefsLanguage = True ; Reset Language to English when pushing shared_prefs +Global $g_bUpdateSharedPrefsSnow = True ; Reset Snow when pushing shared_prefs +Global $g_bUpdateSharedPrefsZoomLevel = True ; Reset ZoomLevel when pushing shared_prefs +Global $g_bUpdateSharedPrefsGoogleDisconnected = True ; Reset GoogleDisconnected when pushing shared_prefs +Global $g_bUpdateSharedPrefsRated = True ; Reset Rated when pushing shared_prefs + Func InitAndroidConfig($bRestart = False) FuncEnter(InitAndroidConfig) @@ -76,6 +86,7 @@ Func InitAndroidConfig($bRestart = False) $g_bAndroidAdbInput = $g_bAndroidAdbInputEnabled = True And BitAND($g_iAndroidSupportFeature, 8) = 8 ; Enable Android ADB send text (CC requests) $g_bAndroidAdbInstance = $g_bAndroidAdbInstanceEnabled = True And BitAND($g_iAndroidSupportFeature, 16) = 16 ; Enable Android steady ADB shell instance when available $g_bAndroidAdbClickDrag = $g_bAndroidAdbClickDragEnabled = True And BitAND($g_iAndroidSupportFeature, 32) = 32 ; Enable Android ADB Click Drag script or input swipe + $g_bAndroidPicturesPathAutoConfig = BitAND($g_iAndroidSupportFeature, 512) > 0 $g_bAndroidEmbed = $g_bAndroidEmbedEnabled = True And $g_iAndroidEmbedMode > -1 ; Enable Android Docking $g_bAndroidBackgroundLaunch = $g_bAndroidBackgroundLaunchEnabled = True ; Enabled Android Background launch using Windows Scheduled Task $g_bAndroidBackgroundLaunched = False ; True when Android was launched in headless mode without a window @@ -84,6 +95,8 @@ Func InitAndroidConfig($bRestart = False) $g_sAndroidAdbInstanceShellOptions = $g_sAndroidAdbInstanceShellOptionsDefault ; Additional shell options, only used by BlueStacks2 " -t -t" $g_sAndroidAdbShellOptions = "" ; Additional shell options when launch shell with command, only used by BlueStacks2 " /data/anr/../../system/xbin/bstk/su root" $g_bAndroidAdbPortPerInstance = True ; New default behavior to use a dedicated ADB daemon per bot and android instance using port between 5038-5137, it initializes $g_sAndroidAdbGlobalOptions + $g_iAndroidRecoverStrategy = $g_iAndroidRecoverStrategyDefault + $g_iAndroidAdbMinitouchMode = $g_iAndroidAdbMinitouchModeDefault ; reset shared prefs variables $g_PushedSharedPrefsProfile = "" $g_PushedSharedPrefsProfile_Timer = 0 @@ -554,13 +567,18 @@ Func _WinGetAndroidHandle($bFindByTitle = False) If IsArray($aWinList) = 0 Then Local $aWinList2 = _WinAPI_EnumProcessWindows($pid, True) If IsArray($aWinList2) = 1 And $aWinList2[0][0] > 0 Then - Local $aWinList[$aWinList2[0][0] + 1][3] + Local $aWinList[$aWinList2[0][0] + 1][5] $aWinList[0][0] = $aWinList2[0][0] For $i = 1 To $aWinList2[0][0] + Local $aPos = WinGetPos($aWinList2[$i][0]) $aWinList[$i][0] = WinGetTitle($aWinList2[$i][0]) $aWinList[$i][1] = $aWinList2[$i][0] $aWinList[$i][2] = $aWinList2[$i][1] - SetDebugLog("Found Android window: " & $aWinList[$i][0] & ", " & $aWinList[$i][1] & ", " & $aWinList[$i][2]) + If UBound($aPos) > 3 Then + $aWinList[$i][3] = $aPos[2] + $aWinList[$i][4] = $aPos[3] + EndIf + SetDebugLog("Found Android window: " & $aWinList[$i][0] & ", " & $aWinList[$i][1] & ", " & $aWinList[$i][2] & ", " & $aWinList[$i][3] & ", " & $aWinList[$i][4]) Next EndIf EndIf @@ -569,7 +587,7 @@ Func _WinGetAndroidHandle($bFindByTitle = False) For $i = 1 To $aWinList[0][0] $t = $aWinList[$i][0] $hWin = $aWinList[$i][1] - If $pid = WinGetProcess($hWin) And ControlGetHandle2($hWin, $g_sAppPaneName, $g_sAppClassInstance) <> 0 Then + If $pid = WinGetProcess($hWin) And ControlGetHandle2($hWin, $g_sAppPaneName, $g_sAppClassInstance) <> 0 And $aWinList[$i][3] > 400 And $aWinList[$i][4] > 400 Then SetDebugLog("Found " & $g_sAndroidEmulator & " Window '" & $t & "' (" & $hWin & ") by PID " & $pid & " ('" & $commandLine & "')") UpdateHWnD($hWin) $g_sAndroidTitle = UpdateAndroidWindowTitle($g_hAndroidWindow, $t) @@ -757,19 +775,31 @@ EndFunc ;==>DetectInstalledAndroid ; Find preferred Adb Path. Current Android ADB is used and saved in profile.ini and shared across instances. Func FindPreferredAdbPath() - Local $adbPath, $i - If $g_bAndroidAdbUseMyBot Then - Local $sAdb = @ScriptDir & "\lib\adb\adb.exe" - If FileExists($sAdb) Then Return $sAdb + Local $sAdb = @ScriptDir & "\lib\adb\adb.exe" + Local $aDll = ["AdbWinApi.dll", "AdbWinUsbApi.dll"] + Local $adbPath = Execute("Get" & $g_sAndroidEmulator & "AdbPath()") + Local $sAdbFolder = StringLeft($adbPath, StringInStr($adbPath, "\", 0, -1)) + Local $sAdbFile = StringMid($adbPath, StringLen($sAdbFolder) + 1) + + If $g_bAndroidAdbReplaceEmulatorVersion And $adbPath And FileExists($sAdb) And FileExists(@ScriptDir & "\lib\adb\" & $aDll[0]) And FileExists(@ScriptDir & "\lib\adb\" & $aDll[1]) _ + And (FileGetSize($adbPath) <> FileGetSize($sAdb) Or FileGetSize($sAdbFolder & $aDll[0]) <> FileGetSize(@ScriptDir & "\lib\adb\" & $aDll[0]) Or FileGetSize($sAdbFolder & $aDll[1]) <> FileGetSize(@ScriptDir & "\lib\adb\" & $aDll[1])) Then + If FileCopy($sAdb, $adbPath, 1) And FileCopy(@ScriptDir & "\lib\adb\" & $aDll[0], $sAdbFolder & $aDll[0], 1) And FileCopy(@ScriptDir & "\lib\adb\" & $aDll[1], $sAdbFolder & $aDll[1], 1) Then + SetLog("Replaced " & $g_sAndroidEmulator & " ADB with MyBot.run version") + Else + SetLog("Cannot replace " & $g_sAndroidEmulator & " ADB with MyBot.run version", $COLOR_ERROR) + EndIf + EndIf + + If $g_bAndroidAdbUseMyBot And FileExists($sAdb) Then + Return $sAdb EndIf If FileExists($g_sAndroidAdbPath) Then Return $g_sAndroidAdbPath EndIf - $adbPath = Execute("Get" & $g_sAndroidEmulator & "AdbPath()") If $adbPath = "" Then - ; first first of support Android + ; find any For $i = 0 To UBound($g_avAndroidAppConfig) - 1 $adbPath = Execute("Get" & $g_avAndroidAppConfig[$i][0] & "AdbPath()") If $adbPath <> "" Then ExitLoop @@ -797,62 +827,68 @@ EndFunc ;==>IncrUpdate Func InitAndroidAdbPorts($bForce = False) - If $g_bAndroidAdbPortPerInstance Then - If $bForce Then $g_bAndroidAdbPort = 0 - If Not $g_bAndroidAdbPort Then - ; dynamically select port to use by mutex - Local $iPortStart = 5038, $iPortRange = 255 - Local $iPort = $iPortStart, $iTcpIdx = 1, $iTcpMtIdx = 0, $iMtPort - Local $hMutex = 0 - $g_sAndroidAdbGlobalOptions = "" - Local $aTcpTable = _TcpTable(5, "LISTENING") - If $g_hMutex_AdbDaemon Then - ; release prior mutex - ReleaseMutex($g_hMutex_AdbDaemon) - $g_hMutex_AdbDaemon = 0 - EndIf - While Not $hMutex And $iPort < $iPortStart + $iPortRange - ; find next free port - For $i = $iTcpIdx To UBound($aTcpTable) -1 - If $aTcpTable[$i][2] < $iPort Then - $iTcpIdx = $i + 1 - ContinueLoop - ElseIf $aTcpTable[$i][0] = "adb.exe" Or $aTcpTable[$i][2] > $iPort Then - ; re-use adb.exe or port is free - ExitLoop - Else - ; cannot use that port - $iPort += 1 - EndIf - Next - ; now check for free minitouch port - $iMtPort = 0 + Local $bUsePort = $g_bAndroidAdbPortPerInstance + + If $bForce Then $g_bAndroidAdbPort = 0 + If Not $g_bAndroidAdbPort Then + ; dynamically select port to use by mutex + Local $iPortStart = 5038, $iPortRange = 255 + Local $iPort = $iPortStart, $iTcpIdx = 1, $iTcpMtIdx = 0, $iMtPort + Local $hMutex = 0 + $g_sAndroidAdbGlobalOptions = "" + Local $aTcpTable = _TcpTable(5, "LISTENING") + If $g_hMutex_AdbDaemon Then + ; release prior mutex + ReleaseMutex($g_hMutex_AdbDaemon) + $g_hMutex_AdbDaemon = 0 + EndIf + While Not $hMutex And $iPort < $iPortStart + $iPortRange + ; find next free port + For $i = $iTcpIdx To UBound($aTcpTable) - 1 + If $aTcpTable[$i][2] < $iPort Then + $iTcpIdx = $i + 1 + ContinueLoop + ElseIf $aTcpTable[$i][0] = "adb.exe" Or $aTcpTable[$i][2] > $iPort Then + ; re-use adb.exe or port is free + ExitLoop + Else + ; cannot use that port + $iPort += 1 + EndIf + Next + ; now check for free minitouch port + $iMtPort = 0 + If $g_iAndroidAdbMinitouchMode = 0 Then $iTcpMtIdx = _ArrayBinarySearch($aTcpTable, $iPort + 1000, 0, 0, 2) If $iTcpMtIdx = -1 Or ($iTcpMtIdx > 0 And $aTcpTable[$iTcpMtIdx][0] = "adb.exe") Then ; use minitouch port $iMtPort = $iPort + 1000 EndIf - If $iMtPort Then - ; try to use it - $hMutex = CreateMutex("MyBot.run/Adb-Port-" & $iPort) - If $hMutex Then - ;_ArrayDisplay($aTcpTable) - $g_hMutex_AdbDaemon = $hMutex - $g_bAndroidAdbPort = $iPort - $g_bAndroidAdbMinitouchPort = $iMtPort - ExitLoop - EndIf + EndIf + If $iMtPort Or $g_iAndroidAdbMinitouchMode = 1 Then + ; try to use it + $hMutex = CreateMutex("MyBot.run/Adb-Port-" & $iPort) + If $hMutex Then + ;_ArrayDisplay($aTcpTable) + $g_hMutex_AdbDaemon = $hMutex + $g_bAndroidAdbPort = $iPort + $g_bAndroidAdbMinitouchPort = $iMtPort + ExitLoop EndIf - $iPort += 1 ; try next port - WEnd - EndIf + EndIf + $iPort += 1 ; try next port + WEnd EndIf - If $g_bAndroidAdbPort Then + If $bUsePort And $g_bAndroidAdbPort Then SetDebugLog("Using ADB Daemon port " & $g_bAndroidAdbPort) $g_sAndroidAdbGlobalOptions = "-P " & $g_bAndroidAdbPort Else - SetDebugLog("Cannot aquire ADB Daemon port, using default", $COLOR_ERROR) - $g_bAndroidAdbMinitouchPort = 1111 + If $g_bAndroidAdbPort Then + SetDebugLog("Using default ADB Daemon port, minitouch port is " & ($g_bAndroidAdbPort + 1000), $COLOR_ERROR) + Else + SetDebugLog("Cannot aquire ADB Daemon port, using default", $COLOR_ERROR) + $g_bAndroidAdbMinitouchPort = 1111 + EndIf EndIf EndFunc ;==>InitAndroidAdbPorts @@ -921,6 +957,16 @@ Func InitAndroid($bCheckOnly = False, $bLogChangesOnly = True) Else SetDebugLog("Cannot disable WerFault for " & $sFileOnly) EndIf + Local $sPath = Execute("Get" & $g_sAndroidEmulator & "AdbPath()") + If $sPath Then + Local $sFileOnly = StringMid($sPath, StringInStr($sPath, "\", 0, -1) + 1) + Local $aResult = DllCall("Wer.dll", "int", "WerAddExcludedApplication", "wstr", $sFileOnly, "bool", True) + If (UBound($aResult) > 0 And $aResult[0] = $S_OK) Or RegWrite($g_sHKLM & "\Software\Microsoft\Windows\Windows Error Reporting\ExcludedApplications", $sFileOnly, "REG_DWORD", "1") = 1 Then + SetDebugLog("Disabled WerFault for " & $sFileOnly) + Else + SetDebugLog("Cannot disable WerFault for " & $sFileOnly) + EndIf + EndIf EndIf ; update Virtualbox properties @@ -962,8 +1008,16 @@ Func InitAndroid($bCheckOnly = False, $bLogChangesOnly = True) DirCreate($g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder) EndIf ElseIf $g_sAndroidPicturesHostPath <> "" Then - SetLog("Shared Folder doesn't exist, please fix:", $COLOR_ERROR) - SetLog($g_sAndroidPicturesHostPath, $COLOR_ERROR) + #cs + If DirCreate($g_sAndroidPicturesHostPath) Then + SetLog("Shared Folder doesn't exist and was now created:", $COLOR_ERROR) + SetLog($g_sAndroidPicturesHostPath, $COLOR_ERROR) + SetLog("Please restart " & $g_sAndroidEmulator & " instance " & $g_sAndroidInstance, $COLOR_ERROR) + Else + SetLog("Shared Folder doesn't exist, please fix:", $COLOR_ERROR) + SetLog($g_sAndroidPicturesHostPath, $COLOR_ERROR) + EndIf + #ce EndIf If CompareAndUpdate($aPriorValues[IncrUpdate($i)], $g_sAndroidPicturesHostPath) Or $bLogChangesOnly = False Then SetDebugLog("Android ADB Shared Folder on Host: " & $g_sAndroidPicturesHostPath) If CompareAndUpdate($aPriorValues[IncrUpdate($i)], $g_sAndroidPicturesHostFolder) Or $bLogChangesOnly = False Then SetDebugLog("Android ADB Shared SubFolder: " & $g_sAndroidPicturesHostFolder) @@ -1145,8 +1199,8 @@ Func _RestartAndroidCoC($bInitAndroid = True, $bRestart = True, $bStopCoC = True ;AndroidAdbTerminateShellInstance() If Not $g_bRunState Then Return False ;$cmdOutput = LaunchConsole($g_sAndroidAdbPath, "-s " & $g_sAndroidAdbDevice & " shell am start " & $sRestart & "-n " & $g_sAndroidGamePackage & "/" & $g_sAndroidGameClass, $process_killed, 30 * 1000) ; removed "-W" option and added timeout (didn't exit sometimes) - If ProfileSwitchAccountEnabled() And $g_bChkSharedPrefs And HaveSharedPrefs() And _ - ($g_PushedSharedPrefsProfile <> $g_sProfileCurrentName Or ($g_PushedSharedPrefsProfile_Timer = 0 Or __TimerDiff($g_PushedSharedPrefsProfile_Timer) > 120000)) Then PushSharedPrefs() + If ((ProfileSwitchAccountEnabled() And $g_bChkSharedPrefs) Or $g_bUpdateSharedPrefs) And HaveSharedPrefs() And _ + ($g_bUpdateSharedPrefs Or $g_PushedSharedPrefsProfile <> $g_sProfileCurrentName Or ($g_PushedSharedPrefsProfile_Timer = 0 Or __TimerDiff($g_PushedSharedPrefsProfile_Timer) > 120000)) Then PushSharedPrefs() $cmdOutput = AndroidAdbSendShellCommand("set export=$(am start " & $sRestart & "-n " & $g_sAndroidGamePackage & "/" & $g_sAndroidGameClass & " >&2)", 60000) ; timeout of 1 Minute If StringInStr($cmdOutput, "Error:") > 0 And StringInStr($cmdOutput, $g_sAndroidGamePackage) > 0 Then @@ -1678,7 +1732,7 @@ EndFunc ;==>AndroidInitPrompt Func AndroidAdbLaunchShellInstance($wasRunState = Default, $rebootAndroidIfNeccessary = $g_bRunState) Static $bAndroidAdbLaunchShellInstanceActive = False Local $bWasActive = $bAndroidAdbLaunchShellInstanceActive - + ;If $bWasActive Then Return FuncEnter(AndroidAdbLaunchShellInstance) $bAndroidAdbLaunchShellInstanceActive = True Local $Result = _AndroidAdbLaunchShellInstance($wasRunState, (($bWasActive) ? (False) : ($rebootAndroidIfNeccessary))) @@ -1696,6 +1750,11 @@ Func _AndroidAdbLaunchShellInstance($wasRunState = Default, $rebootAndroidIfNecc InitAndroid() Local $s + ; if shared folder is not available, configure it + If (Not $g_sAndroidPicturesHostPath Or Not $g_bAndroidSharedFolderAvailable) And $g_bAndroidPicturesPathAutoConfig And $rebootAndroidIfNeccessary Then + RebootAndroidSetScreenDefault() + EndIf + ; sync android tools to shared folder Local $hostFolder = $g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder If FileExists($hostFolder) = 1 Then @@ -1813,7 +1872,12 @@ Func _AndroidAdbLaunchShellInstance($wasRunState = Default, $rebootAndroidIfNecc If UBound($aRegExResult) > 0 Then _ArrayConcatenate($aMounts, $aRegExResult) ; check which path contains dummy file Local $dummyFile = StringMid(_Crypt_HashData($g_sBotTitle & _Now(), $CALG_SHA1), 3) - FileWriteLine($g_sAndroidPicturesHostPath & $dummyFile, _Now()) + If FileWriteLine($g_sAndroidPicturesHostPath & $dummyFile, _Now()) Then + SetDebugLog("Created dummy file: " & $g_sAndroidPicturesHostPath & $dummyFile) + Else + SetLog("Cannot create dummy file: " & $g_sAndroidPicturesHostPath & $dummyFile, $COLOR_ERROR) + Return SetError(4, 0) + EndIf For $i = 0 To UBound($aMounts) - 1 $path = $aMounts[$i] If $path = "" Then ContinueLoop @@ -1885,36 +1949,38 @@ Func _AndroidAdbLaunchShellInstance($wasRunState = Default, $rebootAndroidIfNecc TCPCloseSocket($g_bAndroidAdbMinitouchSocket) $g_bAndroidAdbMinitouchSocket = 0 EndIf - If $g_bAndroidAdbMinitouchPort Then - SetDebugLog($g_sAndroidEmulator & " initialize minitouch on port " & $g_bAndroidAdbMinitouchPort) - ; launch minitouch - Local $androidPath = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") - Local $output = AndroidAdbSendShellCommand($androidPath & "minitouch -d " & $g_sAndroidMouseDevice & " >/dev/null 2>&1 &", -1000, $wasRunState, False) - ; clear output - AndroidAdbSendShellCommand("", Default, $wasRunState, False) - ; forward minitouch port - Local $process_killed - Local $output = LaunchConsole($g_sAndroidAdbPath, AddSpace($g_sAndroidAdbGlobalOptions) & "-s " & $g_sAndroidAdbDevice & " forward tcp:" & $g_bAndroidAdbMinitouchPort & " localabstract:minitouch", $process_killed) - If StringInStr($output, "cannot bind") > 0 Then - ; cannot bind TCP port, not available "anymore" - SetLog("Initialize Android ADB ports...") - ; try again - AndroidAdbTerminateShellInstance() - InitAndroidAdbPorts(True) - _AndroidAdbLaunchShellInstance($wasRunState, $rebootAndroidIfNeccessary) - Return + If $g_iAndroidAdbMinitouchMode = 0 Then + If $g_bAndroidAdbMinitouchPort Then + SetDebugLog($g_sAndroidEmulator & " initialize minitouch on port " & $g_bAndroidAdbMinitouchPort) + ; launch minitouch + Local $androidPath = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") + Local $output = AndroidAdbSendShellCommand($androidPath & "minitouch -d " & $g_sAndroidMouseDevice & " >/dev/null 2>&1 &", -1000, $wasRunState, False) + ; clear output + AndroidAdbSendShellCommand("", Default, $wasRunState, False) + ; forward minitouch port + Local $process_killed + Local $output = LaunchConsole($g_sAndroidAdbPath, AddSpace($g_sAndroidAdbGlobalOptions) & "-s " & $g_sAndroidAdbDevice & " forward tcp:" & $g_bAndroidAdbMinitouchPort & " localabstract:minitouch", $process_killed) + If StringInStr($output, "cannot bind") > 0 Then + ; cannot bind TCP port, not available "anymore" + SetLog("Initialize Android ADB ports...") + ; try again + AndroidAdbTerminateShellInstance() + InitAndroidAdbPorts(True) + _AndroidAdbLaunchShellInstance($wasRunState, $rebootAndroidIfNeccessary) + Return + EndIf + ; connect socket + $g_bAndroidAdbMinitouchSocket = TCPConnect("127.0.0.1", $g_bAndroidAdbMinitouchPort) + EndIf + If $g_bAndroidAdbMinitouchSocket < 1 Then + SetDebugLog($g_sAndroidEmulator & " minitouch not available, switch to STDIN", $COLOR_ERROR) + $g_bAndroidAdbMinitouchSocket = 0 + $g_iAndroidAdbMinitouchMode = 1 EndIf - ; connect socket - $g_bAndroidAdbMinitouchSocket = TCPConnect("127.0.0.1", $g_bAndroidAdbMinitouchPort) - EndIf - If $g_bAndroidAdbMinitouchSocket < 1 Then - SetDebugLog($g_sAndroidEmulator & " minitouch not available", $COLOR_ERROR) - $g_bAndroidAdbMinitouchSocket = 0 - Return SetError(2, 1) EndIf - If $g_bAndroidAdbMinitouchSocket Then - ;TCPCloseSocket($g_bAndroidAdbMinitouchSocket) - ;$g_bAndroidAdbMinitouchSocket = 0 + If $g_iAndroidAdbMinitouchMode = 1 Then + ; use STDIN + AndroidAdbLaunchMinitouchShellInstance($wasRunState, $rebootAndroidIfNeccessary) EndIf SuspendAndroid($SuspendMode) EndIf @@ -1938,6 +2004,7 @@ Func AndroidAdbTerminateShellInstance() TCPCloseSocket($g_bAndroidAdbMinitouchSocket) $g_bAndroidAdbMinitouchSocket = 0 EndIf + AndroidAdbTerminateMinitouchShellInstance() EndFunc ;==>AndroidAdbTerminateShellInstance Func AndroidAdbSendShellCommand($cmd = Default, $timeout = Default, $wasRunState = Default, $EnsureShellInstance = True, $bStripPrompt = True, $bNoShellTerminate = False) @@ -2056,6 +2123,115 @@ Func _AndroidAdbSendShellCommand($cmd = Default, $timeout = Default, $wasRunStat Return SetError($error, Int(__TimerDiff($hTimer)), $s) EndFunc ;==>_AndroidAdbSendShellCommand +Func AndroidAdbLaunchMinitouchShellInstance($wasRunState = Default, $rebootAndroidIfNeccessary = $g_bRunState) + If Not $g_bAndroidInitialized Then Return SetError(2, 0) + If $wasRunState = Default Then $wasRunState = $g_bRunState + Local $iConnected + If Not $g_bAndroidInitialized Or $g_iAndroidAdbMinitouchProcess[0] = 0 Or ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) <> $g_iAndroidAdbMinitouchProcess[0] Then + Local $SuspendMode = ResumeAndroid() + Local $s + + $iConnected = ConnectAndroidAdb($rebootAndroidIfNeccessary) + If $iConnected = 0 Or ($iConnected = 2 And $g_iAndroidAdbMinitouchProcess[0] = 0) Then + ; return with error + Return SetError(3, 0) + ElseIf $iConnected = 2 And $g_iAndroidAdbMinitouchProcess[0] Then + ; return OK + Return SetError(0, 0) + EndIf + AndroidAdbTerminateMinitouchShellInstance() + ; minitouch: Uses STDIN and doesn't start socket + Local $cmdMinitouch = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") & "minitouch -d " & $g_sAndroidMouseDevice & " -i" + Local $cmd = '"' & $g_sAndroidAdbPath & '"' & AddSpace($g_sAndroidAdbGlobalOptions, 1) & " -s " & $g_sAndroidAdbDevice & " shell" & $g_sAndroidAdbInstanceShellOptions & $g_sAndroidAdbShellOptions & " " & $cmdMinitouch + SetDebugLog("Run pipe ADB shell for minituch: " & $cmd) + $g_iAndroidAdbMinitouchProcess[0] = RunPipe($cmd, "", @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_MERGED), $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) + Sleep(500) + If $g_sAndroidAdbInstanceShellOptions And $g_iAndroidAdbMinitouchProcess[0] <> 0 And ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) <> $g_iAndroidAdbMinitouchProcess[0] Then + Local $aReadPipe = $g_iAndroidAdbMinitouchProcess[2] + Local $output = ReadPipe($aReadPipe[0]) + If InvalidAdbInstanceShellOptions($output, "AndroidAdbLaunchMinitouchShellInstance") Then + ; try again + ClosePipe($g_iAndroidAdbMinitouchProcess[0], $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) + $cmd = '"' & $g_sAndroidAdbPath & '"' & AddSpace($g_sAndroidAdbGlobalOptions, 1) & " -s " & $g_sAndroidAdbDevice & " shell" & $g_sAndroidAdbInstanceShellOptions & $g_sAndroidAdbShellOptions & " " & $cmdMinitouch + SetDebugLog("Run pipe ADB shell for minituch: " & $cmd) + $g_iAndroidAdbMinitouchProcess[0] = RunPipe($cmd, "", @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_MERGED), $g_iAndroidAdbProcess[1], $g_iAndroidAdbProcess[2], $g_iAndroidAdbProcess[3], $g_iAndroidAdbProcess[4]) + Sleep(500) + EndIf + EndIf + If $g_sAndroidAdbShellOptions And $g_iAndroidAdbMinitouchProcess[0] <> 0 And ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) <> $g_iAndroidAdbMinitouchProcess[0] Then + Local $aReadPipe = $g_iAndroidAdbMinitouchProcess[2] + Local $output = ReadPipe($aReadPipe[0]) + If InvalidAdbShellOptions($output, "AndroidAdbLaunchMinitouchShellInstance") Then + ; try again + ClosePipe($g_iAndroidAdbMinitouchProcess[0], $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) + $cmd = '"' & $g_sAndroidAdbPath & '"' & AddSpace($g_sAndroidAdbGlobalOptions, 1) & " -s " & $g_sAndroidAdbDevice & " shell" & $g_sAndroidAdbInstanceShellOptions & $g_sAndroidAdbShellOptions & " " & $cmdMinitouch + SetDebugLog("Run pipe ADB shell for minituch: " & $cmd) + $g_iAndroidAdbMinitouchProcess[0] = RunPipe($cmd, "", @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_MERGED), $g_iAndroidAdbProcess[1], $g_iAndroidAdbProcess[2], $g_iAndroidAdbProcess[3], $g_iAndroidAdbProcess[4]) + Sleep(500) + EndIf + EndIf + If $g_iAndroidAdbMinitouchProcess[0] And ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) = $g_iAndroidAdbMinitouchProcess[0] Then + ; all seems fine, run minitouch service now + Else + SetLog($g_sAndroidEmulator & " error launching ADB shell for minitouch", $COLOR_ERROR) + $g_iAndroidAdbMinitouchProcess[0] = 0 + Return SetError(1, 0) + EndIf + EndIf + SetError(0, 0) +EndFunc ;==>AndroidAdbLaunchMinitouchShellInstance + +Func AndroidAdbTerminateMinitouchShellInstance() + Local $SuspendMode = ResumeAndroid() + If $g_iAndroidAdbMinitouchProcess[0] <> 0 Then + ; send exit to shell + ;If AndroidAdbSendMinitouchShellCommand("exit", Default, False, False, True) Then _AndroidAdbSendShellCommand("exit", 0, Default, False, False, True) ; probably su (2nd shell) is running e.g. for BlueStacks + If ClosePipe($g_iAndroidAdbMinitouchProcess[0], $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) = 1 Then + SetDebugLog("ADB minitouch shell terminated, PID = " & $g_iAndroidAdbMinitouchProcess[0]) + Else + SetDebugLog("ADB minitouch shell already terminated, PID = " & $g_iAndroidAdbMinitouchProcess[0]) + EndIf + $g_iAndroidAdbMinitouchProcess[0] = 0 + EndIf +EndFunc ;==>AndroidAdbTerminateMinitouchShellInstance + +Func AndroidAdbSendMinitouchShellCommand($cmd = Default, $iDelay = 0, $wasRunState = Default, $EnsureShellInstance = True, $bStripPrompt = True, $bNoShellTerminate = False) + Static $iCommandErrors = 0 ; restart ADB on too many errors + Local $_SilentSetLog = $g_bSilentSetLog + If $wasRunState = Default Then $wasRunState = $g_bRunState + Local $sentBytes = 0 + Local $SuspendMode = ResumeAndroid() + SetError(0, 0, 0) + If $EnsureShellInstance = True Then + AndroidAdbLaunchMinitouchShellInstance($wasRunState) ; recursive call in AndroidAdbLaunchShellInstance! + EndIf + If @error <> 0 Then Return SetError(@error, 0, "") + Local $loopCount = 0 + ; use steady ADB shell + Local $aReadPipe = $g_iAndroidAdbMinitouchProcess[2] + Local $aWritePipe = $g_iAndroidAdbMinitouchProcess[1] + If UBound($aReadPipe) < 2 Or UBound($aWritePipe) < 2 Then + SetDebugLog("ADB Minitiuch Shell instance not initialized, cannot execute: " & $cmd, $COLOR_ERROR) + Return SetError(1, 0, "") + EndIf + ReadPipe($aReadPipe[0]) ; clear anything in read pipe first + If $cmd = Default Then + ; nothing to launch + Else + If $g_bDebugAndroid Then + ;$g_bSilentSetLog = True + SetDebugLog("Send ADB minitouch shell command: " & StringReplace($cmd, @LF, ";")) + ;$g_bSilentSetLog = $_SilentSetLog + EndIf + $sentBytes = WritePipe($aWritePipe[1], $cmd) + EndIf + If $iDelay Then Sleep($iDelay) + ; read pipe once + Local $s = ReadPipe($aReadPipe[0]) + SuspendAndroid($SuspendMode) + Return $s +EndFunc ;==>AndroidAdbSendMinitouchShellCommand + Func GetBinaryEvent($type, $code, $value) Local $h, $hType, $hCode, $hValue If IsInt($type) Then @@ -2682,23 +2858,25 @@ EndFunc ;==>AndroidClickDrag Func AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, $wasRunState = Default) AndroidAdbLaunchShellInstance($wasRunState) - If $g_bAndroidAdbMinitouchSocket < 1 Then - SetLog("Minitouch not available", $COLOR_ERROR) - Return SetError(1, 0, 0) - EndIf + If $g_iAndroidAdbMinitouchMode = 0 Then + If $g_bAndroidAdbMinitouchSocket < 1 Then + SetLog("Minitouch not available", $COLOR_ERROR) + Return SetError(1, 0, 0) + EndIf - TCPRecv($g_bAndroidAdbMinitouchSocket, 256, 1) - Local $recv_state = [@error, @extended] - Local $bytes = TCPSend($g_bAndroidAdbMinitouchSocket, @LF) - Local $send_state = [@error, $bytes] - If ($recv_state[0] Or $send_state[0] Or $send_state[1] <> 1) Then - If $wasRunState Then - SetLog("Cannot send minitouch data to " & $g_sAndroidEmulator & ", received " & $recv_state[1] & ", send " & $send_state[1], $COLOR_ERROR) - ; restart adb session that hopefully fixes the tcp issues - AndroidAdbTerminateShellInstance() - Return AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, False) + TCPRecv($g_bAndroidAdbMinitouchSocket, 256, 1) + Local $recv_state = [@error, @extended] + Local $bytes = TCPSend($g_bAndroidAdbMinitouchSocket, @LF) + Local $send_state = [@error, $bytes] + If ($recv_state[0] Or $send_state[0] Or $send_state[1] <> 1) Then + If $wasRunState Then + SetLog("Cannot send minitouch data to " & $g_sAndroidEmulator & ", received " & $recv_state[1] & ", send " & $send_state[1], $COLOR_ERROR) + ; restart adb session that hopefully fixes the tcp issues + AndroidAdbTerminateShellInstance() + Return AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, False) + EndIf + Return SetError(1, 0, 0) EndIf - Return SetError(1, 0, 0) EndIf Local $sleepStart = 250 @@ -2718,7 +2896,11 @@ Func AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, $wasRunState = Default) $send = "d 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF & "w " & $sleep & @LF $botSleep += $sleep If $g_bDebugAndroid Then SetDebugLog("minitouch: " & StringReplace($send, @LF, ";")) - TCPSend($g_bAndroidAdbMinitouchSocket, $send) + If $g_iAndroidAdbMinitouchMode = 0 Then + TCPSend($g_bAndroidAdbMinitouchSocket, $send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf $sleep = $sleepMove For $i = 1 To $loops $x += $x_steps @@ -2738,13 +2920,21 @@ Func AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, $wasRunState = Default) $send = "m 0 " & Int($x) & " " & Int($y) & " 50" & @LF & "c" & @LF & "w " & $sleep & @LF $botSleep += $sleep If $g_bDebugAndroid Then SetDebugLog("minitouch: " & StringReplace($send, @LF, ";")) - TCPSend($g_bAndroidAdbMinitouchSocket, $send) + If $g_iAndroidAdbMinitouchMode = 0 Then + TCPSend($g_bAndroidAdbMinitouchSocket, $send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf Next $sleep = $sleepMove $send = "u 0" & @LF & "c" & @LF & "w " & $sleep & @LF $botSleep += $sleep If $g_bDebugAndroid Then SetDebugLog("minitouch: " & StringReplace($send, @LF, ";")) - TCPSend($g_bAndroidAdbMinitouchSocket, $send) + If $g_iAndroidAdbMinitouchMode = 0 Then + TCPSend($g_bAndroidAdbMinitouchSocket, $send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf _Sleep($botSleep) Return SetError(0, 0, 1) @@ -3169,7 +3359,9 @@ EndFunc ;==>_AndroidFastClick ; User for docked mouse touches, $iaAction: 0 = move, 1 = down, 2 = up ; return bytes sent Func Minitouch($x, $y, $iAction = 0, $iDelay = 1) - If $g_bAndroidAdbMinitouchSocket < 1 Then Return -1 + If $g_iAndroidAdbMinitouchMode = 0 Then + If $g_bAndroidAdbMinitouchSocket < 1 Then Return -1 + EndIf Static $x_dn, $y_dn $x = Int($x) @@ -3179,27 +3371,55 @@ Func Minitouch($x, $y, $iAction = 0, $iDelay = 1) Local $iBytes = 0 Local $s Local $t = "" + Local $sWait = "" ; "w 1" & @LF Switch $iAction Case 0, 2 ; move or up If $iAction = 0 Or $x_dn <> $x Or $y_dn <> $y Then - $s = "m 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF + $s = "m 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF & $sWait $t &= $s - $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) + If $g_iAndroidAdbMinitouchMode = 0 Then + $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) + Else + AndroidAdbSendMinitouchShellCommand($s) + If @error Then + Return SetError(@error, 0, 0) + Else + $iBytes += StringLen($s) + EndIf + EndIf EndIf If $iAction = 2 Then ; up ;$s = "w " & $iDelay & @LF & "u 0 " & @LF & "c" & @LF - $s = "u 0 " & @LF & "c" & @LF + $s = "u 0 " & @LF & "c" & @LF & $sWait ; $g_iAndroidControlClickDelay ;For $i = 1 To 9 ; $s &= "u " & $i & @LF & "c" & @LF ;Next $t &= $s - $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) + If $g_iAndroidAdbMinitouchMode = 0 Then + $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) + Else + AndroidAdbSendMinitouchShellCommand($s) + If @error Then + Return SetError(@error, 0, 0) + Else + $iBytes += StringLen($s) + EndIf + EndIf EndIf Case 1 ; down ;$s = "d 0 " & $x & " " & $y & " 50" & @LF & "w " & $iDelay & @LF & "c" & @LF - $s = "d 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF + $s = "d 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF & $sWait ; $g_iAndroidControlClickDownDelay $t &= $s - $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) + If $g_iAndroidAdbMinitouchMode = 0 Then + $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) + Else + AndroidAdbSendMinitouchShellCommand($s) + If @error Then + Return SetError(@error, 0, 0) + Else + $iBytes += StringLen($s) + EndIf + EndIf $x_dn = $x $y_dn = $y EndSwitch @@ -3236,6 +3456,8 @@ Func AndroidMinitouchClick($x, $y, $times = 1, $speed = 0, $checkProblemAffect = Return EndIf + Local $bytes = 0 + Local $bytesSent = 0 Local $wasRunState = $g_bRunState Local $hostPath = $g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder Local $androidPath = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") @@ -3253,25 +3475,27 @@ Func AndroidMinitouchClick($x, $y, $times = 1, $speed = 0, $checkProblemAffect = EndIf AndroidAdbLaunchShellInstance($wasRunState) - ;$g_bAndroidAdbMinitouchSocket = TCPConnect("127.0.0.1", $g_bAndroidAdbMinitouchPort) - If $g_bAndroidAdbMinitouchSocket < 1 Then - $g_bAndroidAdbClick = False - SetLog("Disabled " & $g_sAndroidEmulator & " ADB fast mouse click", $COLOR_ERROR) - Return SetError(1, 0) - EndIf + If $g_iAndroidAdbMinitouchMode = 0 Then + ;$g_bAndroidAdbMinitouchSocket = TCPConnect("127.0.0.1", $g_bAndroidAdbMinitouchPort) + If $g_bAndroidAdbMinitouchSocket < 1 Then + $g_bAndroidAdbClick = False + SetLog("Disabled " & $g_sAndroidEmulator & " ADB fast mouse click", $COLOR_ERROR) + Return SetError(1, 0) + EndIf - TCPRecv($g_bAndroidAdbMinitouchSocket, 256, 1) - Local $recv_state = [@error, @extended] - Local $bytes = TCPSend($g_bAndroidAdbMinitouchSocket, @LF) - Local $send_state = [@error, $bytes] - If ($recv_state[0] Or $send_state[0] Or $send_state[1] <> 1) Then - SetLog("Cannot send minitouch data to " & $g_sAndroidEmulator & ", received " & $recv_state[1] & ", send " & $send_state[1], $COLOR_ERROR) - If $iRetryCount < 1 Then - ; restart adb session that hopefully fixes the tcp issues - AndroidAdbTerminateShellInstance() - Return AndroidMinitouchClick($x, $y, $times, $speed, $checkProblemAffect, $iRetryCount + 1) + TCPRecv($g_bAndroidAdbMinitouchSocket, 256, 1) + Local $recv_state = [@error, @extended] + $bytes = TCPSend($g_bAndroidAdbMinitouchSocket, @LF) + Local $send_state = [@error, $bytes] + If ($recv_state[0] Or $send_state[0] Or $send_state[1] <> 1) Then + SetLog("Cannot send minitouch data to " & $g_sAndroidEmulator & ", received " & $recv_state[1] & ", send " & $send_state[1], $COLOR_ERROR) + If $iRetryCount < 1 Then + ; restart adb session that hopefully fixes the tcp issues + AndroidAdbTerminateShellInstance() + Return AndroidMinitouchClick($x, $y, $times, $speed, $checkProblemAffect, $iRetryCount + 1) + EndIf + Return SetError(1, 0) EndIf - Return SetError(1, 0) EndIf ; consistency check @@ -3338,15 +3562,21 @@ Func AndroidMinitouchClick($x, $y, $times = 1, $speed = 0, $checkProblemAffect = EndIf Local $send = "" $bytes = 0 + $bytesSent = 0 If $BTN_TOUCH_DOWN Then ; down $send &= "d 0 " & $x & " " & $y & " 50" & @LF $send &= "c" & @LF - $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) - $send = "" + If $g_iAndroidAdbMinitouchMode = 0 Then + $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) + $bytesSent += StringLen($send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf EndIf If $BTN_TOUCH_UP Then + $send = "" ; wait Local $sleep = $minSleep If $speed > $minSleep And $times = 1 Then @@ -3356,46 +3586,63 @@ Func AndroidMinitouchClick($x, $y, $times = 1, $speed = 0, $checkProblemAffect = ;_SleepMicro($sleep * 1000) ; up $send &= "w " & $sleep & @LF - $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) + If $g_iAndroidAdbMinitouchMode = 0 Then + $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) + $bytesSent += StringLen($send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf $send = "" - _SleepMicro($sleep * 1000) $send &= "u 0" & @LF $send &= "c" & @LF + $send &= "w " & $iDelay & @LF ;$send &= "w " & $iDelay & @LF - $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) - $send = "" - _SleepMicro($iDelay * 1000) + If $g_iAndroidAdbMinitouchMode = 0 Then + $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) + $bytesSent += StringLen($send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf + _SleepMicro(($iDelay + $sleep) * 1000) If $g_bDebugClick Then SetDebugLog("minitouch: d 0 " & $x & " " & $y & " 50, speed=" & $sleep & ", delay=" & $iDelay) ;_SleepMicro(10000) EndIf - $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) - If $bytes < StringLen($send) Then SetDebugLog("minitouch: Faild to send " & (StringLen($send) - $bytes) & " bytes!", $COLOR_ERROR) - + If $g_iAndroidAdbMinitouchMode = 0 Then + If $bytes < $bytesSent Then SetDebugLog("minitouch: Faild to send " & ($bytesSent - $bytes) & " bytes!", $COLOR_ERROR) + EndIf ;TCPRecv($g_bAndroidAdbMinitouchSocket, 256, 1) Next EndIf $g_bSilentSetLog = True $g_bSilentSetLog = $_SilentSetLog - If $speed > 0 Then - ; speed was overwritten with $g_iAndroidAdbClickGroupDelay - ;AndroidAdbSendShellCommand($sleep) - If $g_bDebugClick Then SetDebugLog("minitouch: wait between group clicks: " & $speed & " ms.") - TCPSend($g_bAndroidAdbMinitouchSocket, "w " & $speed & @LF) - _SleepMicro($speed * 1000) - ;Local $sleepTime = $speed - __TimerDiff($sleepTimer) - ;If $sleepTime > 0 Then _Sleep($sleepTime, False) - EndIf - If $adjustSpeed > 0 Then - ; wait remaining time - Local $wait = Round($adjustSpeed - __TimerDiff($timer)) - If $wait > 0 Then - If $g_bDebugAndroid Or $g_bDebugClick Then - $g_bSilentSetLog = True - SetDebugLog("AndroidMinitouchClick: Sleep " & $wait & " ms.") - $g_bSilentSetLog = $_SilentSetLog + If False Then + ; disabled for now + If $speed > 0 Then + ; speed was overwritten with $g_iAndroidAdbClickGroupDelay + ;AndroidAdbSendShellCommand($sleep) + If $g_bDebugClick Then SetDebugLog("minitouch: wait between group clicks: " & $speed & " ms.") + $send = "w " & $speed & @LF + If $g_iAndroidAdbMinitouchMode = 0 Then + $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) + Else + AndroidAdbSendMinitouchShellCommand($send) + EndIf + _SleepMicro($speed * 1000) + ;Local $sleepTime = $speed - __TimerDiff($sleepTimer) + ;If $sleepTime > 0 Then _Sleep($sleepTime, False) + EndIf + If $adjustSpeed > 0 Then + ; wait remaining time + Local $wait = Round($adjustSpeed - __TimerDiff($timer)) + If $wait > 0 Then + If $g_bDebugAndroid Or $g_bDebugClick Then + $g_bSilentSetLog = True + SetDebugLog("AndroidMinitouchClick: Sleep " & $wait & " ms.") + $g_bSilentSetLog = $_SilentSetLog + EndIf + _Sleep($wait, False) EndIf - _Sleep($wait, False) EndIf EndIf $timeSlept += __TimerDiff($sleepTimer) @@ -3458,7 +3705,7 @@ Func AndroidSendText($sText, $SymbolFix = False, $wasRunState = $g_bRunState) $newText = StringRegExpReplace($newText, "([\\\?""\$\^&\*\(\)\+<>\|'~;])", "\\$1") ; replace " " with "%s" $newText = StringReplace($newText, " ", "%s") - AndroidAdbSendShellCommand("input text " & $newText, Default, $wasRunState) + AndroidAdbSendShellCommand("input text " & $newText, 6000, $wasRunState) ; use 6 secs for additional timeout Else ; send one word per command Local $words = StringSplit($newText, " ") @@ -3468,7 +3715,7 @@ Func AndroidSendText($sText, $SymbolFix = False, $wasRunState = $g_bRunState) While StringLen($word) > 0 ; escape special characters $newWord = StringRegExpReplace(StringLeft($word, $g_iAndroidAdbInputWordsCharLimit), "([\\\?""\$\^&\*\(\)\+<>\|'~;])", "\\$1") - AndroidAdbSendShellCommand("input text " & $newWord, Default, $wasRunState) + AndroidAdbSendShellCommand("input text " & $newWord, 6000, $wasRunState) ; use 6 secs for additional timeout $word = StringMid($word, $g_iAndroidAdbInputWordsCharLimit + 1) WEnd ; send space @@ -3523,7 +3770,7 @@ EndFunc ;==>AndroidSwipeNotWorking Func AndroidInputSwipe($x1, $y1, $x2, $y2, $wasRunState = $g_bRunState) ; Only used for BlueStacks/BlueStacks2 AndroidAdbLaunchShellInstance($wasRunState) If @error = 0 Then - AndroidAdbSendShellCommand("input swipe " & $x1 & " " & $y1 & " " & $x2 & " " & $y2 & ";input tap " & $x2 & " " & $y2, Default, $wasRunState) + AndroidAdbSendShellCommand("input swipe " & $x1 & " " & $y1 & " " & $x2 & " " & $y2 & ";input tap " & $x2 & " " & $y2, 6000, $wasRunState) ; use 6 secs for additional timeout SetError(0, 0) Else Local $error = @error @@ -3886,6 +4133,7 @@ Func AndroidPicturePathAutoConfig($myPictures = Default, $subDir = Default, $bSe ; path exists, nothing to do ElseIf DirCreate($path) = 1 Then SetGuiLog("Shared folder created: " & $path, $COLOR_SUCCESS, $bSetLog) + $Result = True Else SetGuiLog("Cannot configure " & $g_sAndroidEmulator & " shared folder", $COLOR_SUCCESS, $bSetLog) SetGuiLog("Cannot create folder: " & $path, $COLOR_ERROR, $bSetLog) @@ -3896,6 +4144,46 @@ Func AndroidPicturePathAutoConfig($myPictures = Default, $subDir = Default, $bSe Return $Result EndFunc ;==>AndroidPicturePathAutoConfig +Func ConfigureSharedFolder($iMode = 0, $bSetLog = Default) + If $bSetLog = Default Then $bSetLog = True + Local $Result = Execute("ConfigureSharedFolder" & $g_sAndroidEmulator & "(" & $iMode & "," & $bSetLog & ")") + If Not ($Result = "" And @error <> 0) Then + Return $Result + EndIf + + ; Not implemented, use default + Local $bResult = False + + Switch $iMode + Case 0 ; check that shared folder is configured in VM + Local $aRegexResult = StringRegExp($__VBoxVMinfo, "Name: '" & $g_sAndroidSharedFolderName & "', Host path: '(.*)'.*", $STR_REGEXPARRAYGLOBALMATCH) + If Not @error Then + $bResult = True + $g_bAndroidSharedFolderAvailable = True + $g_sAndroidPicturesHostPath = $aRegexResult[UBound($aRegexResult) - 1] & "\" + Else + SetLog($g_sAndroidEmulator & " shared folder is not available", $COLOR_ERROR) + $g_sAndroidPicturesHostPath = "" + $g_bAndroidAdbScreencap = False + $g_bAndroidSharedFolderAvailable = False + EndIf + Case 1 ; create missing shared folder + $bResult = AndroidPicturePathAutoConfig(Default, Default, $bSetLog) + Case 2 ; Configure VM and add missing shared folder + If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then + Local $cmdOutput, $process_killed + Local $path = $g_sAndroidPicturesHostPath + ; remove tailing backslash + If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) + $cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder remove " & $g_sAndroidInstance & " --name " & $g_sAndroidSharedFolderName, $process_killed) + $cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name " & $g_sAndroidSharedFolderName & " --hostpath """ & $path & """ --automount", $process_killed) + $bResult = True + EndIf + EndSwitch + + Return SetError(0,0, $bResult) +EndFunc + Func OpenAdbShell() Local $bWasRunState = $g_bRunState $g_bRunState = True @@ -3968,6 +4256,10 @@ Func OpenPlayStoreGame() Return OpenPlayStore($g_sUserGamePackage) EndFunc ;==>OpenPlayStoreGame +Func OpenPlayStoreGooglePlayServices() + Return OpenPlayStore("com.google.android.gms") +EndFunc ;==>OpenPlayStoreGooglePlayServices + Func OpenPlayStoreNovaLauncher() Return OpenPlayStore("com.teslacoilsw.launcher") EndFunc ;==>OpenPlayStoreNovaLauncher @@ -3977,6 +4269,10 @@ Func LaunchAndroid($sProgramPath, $sCmdParam, $sPath, $iWaitInSecAfterLaunch = D If $sCmdParam And StringLeft($sCmdParam, 1) <> " " Then $sCmdParam = " " & $sCmdParam EndIf + ; if shared folder is not available, configure it + If Not $g_sAndroidPicturesHostPath Then + SetScreenAndroid() + EndIf SetLog("Please wait while " & $g_sAndroidEmulator & " and CoC start...", $COLOR_SUCCESS) Local $pid = 0 ;$PID = ShellExecute($g_sAndroidProgramPath, $cmdPar, $__MEmu_Path) @@ -4288,6 +4584,37 @@ Func PushSharedPrefs($sProfile = $g_sProfileCurrentName, $bCloseGameIfRunning = If FileExists($hostFolder & "\shared_prefs") And $iFilesInShared < 1 Then ; copy files If FileCopy($g_sPrivateProfilePath & "\" & $sProfile & "\shared_prefs\*", $hostFolder & "\shared_prefs", $FC_OVERWRITE) And UBound(_FileListToArray($hostFolder & "\shared_prefs", "*", $FLTA_FILES)) - 1 >= $iFiles Then + + ; files copied, now check to update storage_new.xml + If $g_bUpdateSharedPrefs And ($g_bUpdateSharedPrefsLanguage OR $g_bUpdateSharedPrefsSnow Or $g_bUpdateSharedPrefsZoomLevel Or $g_bUpdateSharedPrefsGoogleDisconnected Or $g_bUpdateSharedPrefsRated) Then + ; read file + Local $hFile = FileOpen($hostFolder & "\shared_prefs\storage_new.xml", $FO_READ + $FO_UTF8_NOBOM) + Local $sStorage = FileRead($hFile) + FileClose($hFile) + If $sStorage Then + Local $sStorageUpdated = $sStorage + If $g_bUpdateSharedPrefsLanguage Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'FWCNTu39RUlYoSt0Y6mCwg==', 1) + If $g_bUpdateSharedPrefsSnow Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'jS26iozgAh+i/424eyY5cA==', 1) + If $g_bUpdateSharedPrefsZoomLevel Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'oiMa1oDch9dThLoIKokZqQ==', 1) + If $g_bUpdateSharedPrefsGoogleDisconnected Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'pmvEzdQuRQuKZob4KB0IeA==', 1) + If $g_bUpdateSharedPrefsRated Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'pmvEzdQuRQuKZob4KB0IeA==', 1) + If $sStorageUpdated <> $sStorage Then + ; write file + Local $hFile = FileOpen($hostFolder & "\shared_prefs\storage_new.xml", $FO_OVERWRITE + $FO_UTF8_NOBOM) + If FileWrite($hFile, $sStorageUpdated) Then + SetLog("Updated shared_prefs", $COLOR_SUCCESS) + Else + SetLog("Failed to update shared_prefs", $COLOR_ERROR) + EndIf + FileClose($hFile) + Else + SetDebugLog("No need to update shared_prefs", $COLOR_ERROR) + EndIf + Else + SetLog("Failed to read shared_prefs", $COLOR_ERROR) + EndIf + EndIf + AndroidAdbSendShellCommand("set result=$(rm /data/data/" & $g_sAndroidGamePackage & "/shared_prefs/* >&2)") AndroidAdbSendShellCommand("set result=$(cp " & $androidFolder & "/shared_prefs/* /data/data/" & $g_sAndroidGamePackage & "/shared_prefs >&2)") $cmdOutput = AndroidAdbSendShellCommand("set result=$(ls -l /data/data/" & $g_sAndroidGamePackage & "/shared_prefs/ >&2)") @@ -4381,9 +4708,9 @@ Func CheckEmuNewVersions() Switch $g_sAndroidEmulator Case "BlueStacks2" - $NewVersion = GetVersionNormalized("4.33.0.0") + $NewVersion = GetVersionNormalized("4.61.0.0") Case "MEmu" - $NewVersion = GetVersionNormalized("6.1.0.0") + $NewVersion = GetVersionNormalized("6.2.0.0") Case "Nox" $NewVersion = GetVersionNormalized("6.3.0.0") Case Else @@ -4394,7 +4721,7 @@ Func CheckEmuNewVersions() SetLog("You are using an unsupported " & $g_sAndroidEmulator & " version (" & $g_sAndroidVersion & ")!", $COLOR_ERROR) SetLog($HelpLink, $COLOR_INFO) EndIf -EndFunc ;==>CheckClickAdbNewVersions +EndFunc ;==>CheckEmuNewVersions Func InvalidAdbShellOptions($cmdOutput, $source) ; check for /data/anr/../../system/xbin/bstk/su: not found @@ -4428,4 +4755,4 @@ Func AddSpace($s, $Option = Default) Return " " & $s EndSwitch Return $s -EndFunc ;==>AddSpace \ No newline at end of file +EndFunc ;==>AddSpace diff --git a/COCBot/functions/Android/AndroidBlueStacks.au3 b/COCBot/functions/Android/AndroidBlueStacks.au3 index 6bd96585c..775c14474 100644 --- a/COCBot/functions/Android/AndroidBlueStacks.au3 +++ b/COCBot/functions/Android/AndroidBlueStacks.au3 @@ -91,8 +91,6 @@ Func _OpenBlueStacks2($bRestart = False) Local $hTimer, $iCount = 0, $cmdOutput, $process_killed, $i, $connected_to, $PID, $cmdPar - SetLog("Please wait while " & $g_sAndroidEmulator & " and CoC start...", $COLOR_SUCCESS) - CloseUnsupportedBlueStacks2() ; always start ADB first to avoid ADB connection problems @@ -269,13 +267,8 @@ Func InitBlueStacksX($bCheckOnly = False, $bAdjustResolution = False, $bLegacyMo $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $__BlueStacks_Path & "HD-Adb.exe" $g_sAndroidVersion = $__BlueStacks_Version - For $i = 0 To 5 - If RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Name") = "BstSharedFolder" Then - $g_sAndroidPicturesPath = "/storage/sdcard/windows/BstSharedFolder/" - $g_sAndroidPicturesHostPath = RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Path") - ExitLoop - EndIf - Next + + ConfigureSharedFolderBlueStacksX(0) ; something like D:\ProgramData\BlueStacks\Engine\UserData\SharedFolder\ SetDebugLog($g_sAndroidEmulator & " Engine 'Plus'-Mode: " & $plusMode) SetDebugLog($g_sAndroidEmulator & " OEM Features: " & $OEMFeatures) @@ -314,6 +307,37 @@ Func InitBlueStacksX($bCheckOnly = False, $bAdjustResolution = False, $bLegacyMo EndFunc ;==>InitBlueStacksX +Func ConfigureSharedFolderBlueStacks($iMode = 0, $bSetLog = Default) + ConfigureSharedFolderBlueStacksX($iMode, $bSetLog) +EndFunc ;==>ConfigureSharedFolderBlueStacks + +Func ConfigureSharedFolderBlueStacks2($iMode = 0, $bSetLog = Default) + ConfigureSharedFolderBlueStacksX($iMode, $bSetLog) +EndFunc ;==>ConfigureSharedFolderBlueStacks2 + +Func ConfigureSharedFolderBlueStacksX($iMode = 0, $bSetLog = Default) + If $bSetLog = Default Then $bSetLog = True + Local $bResult = False + + Switch $iMode + Case 0 ; check that shared folder is configured in VM + For $i = 0 To 5 + If RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Name") = "BstSharedFolder" Then + $bResult = True + $g_bAndroidSharedFolderAvailable = True + $g_sAndroidPicturesPath = "/storage/sdcard/windows/BstSharedFolder/" + $g_sAndroidPicturesHostPath = RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Path") + ExitLoop + EndIf + Next + Case 1 ; create missing shared folder + Case 2 ; Configure VM and add missing shared folder + EndSwitch + + Return SetError(0, 0, $bResult) + +EndFunc ;==>ConfigureSharedFolderBlueStacksX + Func InitBlueStacks($bCheckOnly = False) Local $bInstalled = InitBlueStacksX($bCheckOnly) If $bInstalled And (GetVersionNormalized($__BlueStacks_Version) < GetVersionNormalized("0.8") Or GetVersionNormalized($__BlueStacks_Version) > GetVersionNormalized("2.0")) Then @@ -349,6 +373,9 @@ Func InitBlueStacks2($bCheckOnly = False) ; only Version 4 requires new options ;$g_sAndroidAdbInstanceShellOptions = " -t -t" ; Additional shell options, only used by BlueStacks2 " -t -t" $g_sAndroidAdbShellOptions = " /data/anr/../../system/xbin/bstk/su root" ; Additional shell options when launch shell with command, only used by BlueStacks2 " /data/anr/../../system/xbin/bstk/su root" + + ; tcp forward not working in BS4 + $g_iAndroidAdbMinitouchMode = 1 EndIf CheckBlueStacksVersionMod() @@ -884,3 +911,4 @@ Func CloseUnsupportedBlueStacksX($bClose = True) Opt("WinTitleMatchMode", $WinTitleMatchMode) Return False EndFunc ;==>CloseUnsupportedBlueStacksX + diff --git a/COCBot/functions/Android/AndroidDroid4X.au3 b/COCBot/functions/Android/AndroidDroid4X.au3 index 431f44186..4e45616c6 100644 --- a/COCBot/functions/Android/AndroidDroid4X.au3 +++ b/COCBot/functions/Android/AndroidDroid4X.au3 @@ -187,16 +187,8 @@ Func InitDroid4X($bCheckOnly = False) ; get screencap paths: Name: 'picture', Host path: 'C:\Users\Administrator\Pictures\MEmu Photo' (machine mapping), writable ; see also: VBoxManage setextradata droid4x VBoxInternal2/SharedFoldersEnableSymlinksCreate/picture 1 $g_sAndroidPicturesPath = "/mnt/shared/picture/" - $aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'picture', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) - If Not @error Then - $g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" - $g_bAndroidSharedFolderAvailable = True - Else - SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) - $g_sAndroidPicturesHostPath = "" - $g_bAndroidAdbScreencap = False - $g_bAndroidSharedFolderAvailable = False - EndIf + $g_sAndroidSharedFolderName = "picture" + ConfigureSharedFolder(0) ; something like C:\Users\Administrator\Pictures\Droid4X Photo\ WinGetAndroidHandle() @@ -221,13 +213,8 @@ Func SetScreenDroid4X() $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) ;vboxmanage sharedfolder add droid4x --name picture --hostpath "C:\Users\Administrator\Pictures\Droid4X Photo" --automount - AndroidPicturePathAutoConfig() ; ensure $g_sAndroidPicturesHostPath is set and exists - If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then - ; remove tailing backslash - Local $path = $g_sAndroidPicturesHostPath - If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) - $cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name picture --hostpath """ & $path & """ --automount", $process_killed) - EndIf + ConfigureSharedFolder(1, True) + ConfigureSharedFolder(2, True) Return True EndFunc ;==>SetScreenDroid4X @@ -270,7 +257,7 @@ Func CheckScreenDroid4X($bSetLog = True) If $iErrCnt > 0 Then Return False ; check if shared folder exists - If AndroidPicturePathAutoConfig(Default, Default, $bSetLog) Then $iErrCnt += 1 + If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 Return True diff --git a/COCBot/functions/Android/AndroidKOPLAYER.au3 b/COCBot/functions/Android/AndroidKOPLAYER.au3 index 17f951c66..7e5c84ecf 100644 --- a/COCBot/functions/Android/AndroidKOPLAYER.au3 +++ b/COCBot/functions/Android/AndroidKOPLAYER.au3 @@ -140,6 +140,9 @@ Func InitKOPLAYER($bCheckOnly = False) If Not $bCheckOnly Then InitAndroidConfig(True) ; Restore default config + ; to avoid KOPLAYER "device offline" problems, force to use default port + $g_bAndroidAdbPortPerInstance = False + If Not GetAndroidVMinfo($__VBoxVMinfo, $KOPLAYER_Manage_Path) Then Return False ; update global variables $g_sAndroidProgramPath = $KOPLAYER_Path & "KOPLAYER.exe" @@ -176,14 +179,8 @@ Func InitKOPLAYER($bCheckOnly = False) ; get screencap paths: Name: 'picture', Host path: 'C:\Users\Administrator\Pictures\KOPLAYER Photo' (machine mapping), writable $g_sAndroidPicturesPath = "/mnt/shared/UserData/" - $aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'UserData', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) - If Not @error Then - $g_sAndroidPicturesHostPath = StringReplace($aRegExResult[0], "/", "\") & "\" - Else - $g_bAndroidAdbScreencap = False - $g_sAndroidPicturesHostPath = "" - SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_RED) - EndIf + $g_sAndroidSharedFolderName = "UserData" + ConfigureSharedFolder(0) ; something like C:\Users\Administrator\AppData\Local\KOPLAYERData\UserData\ EndIf @@ -221,6 +218,9 @@ Func SetScreenKOPLAYER() ; Since version 2.0 $cmdOutput = LaunchConsole($__VBoxManage_Path, "setextradata " & $g_sAndroidInstance & " RenderWindowProp " & $g_iAndroidClientWidth & "*" & $g_iAndroidClientHeight & "*160", $process_killed) + ConfigureSharedFolder(1, True) + ConfigureSharedFolder(2, True) + Return True EndFunc ;==>SetScreenKOPLAYER @@ -266,6 +266,10 @@ Func CheckScreenKOPLAYER($bSetLog = True) $iErrCnt += 1 EndIf Next + + ; check if shared folder exists + If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 + If $iErrCnt > 0 Then Return False Return True diff --git a/COCBot/functions/Android/AndroidLeapDroid.au3 b/COCBot/functions/Android/AndroidLeapDroid.au3 index bc64830a9..f70778a86 100644 --- a/COCBot/functions/Android/AndroidLeapDroid.au3 +++ b/COCBot/functions/Android/AndroidLeapDroid.au3 @@ -190,18 +190,22 @@ Func InitLeapDroid($bCheckOnly = False) InitAndroidConfig(True) ; Restore default config If Not GetAndroidVMinfo($__VBoxVMinfo, $LeapDroid_Manage_Path) Then Return False - Local $sAdbPAth = GetLeapDroidAdbPath() - If $sAdbPAth Then - ; to avoid LeapDroid "device offline" problems, force to use LeapDroid adb - $sPreferredADB = $sAdbPAth - $g_bAndroidAdbPortPerInstance = False - EndIf + ; to avoid LeapDroid "device offline" problems, force to use default port + $g_bAndroidAdbPortPerInstance = False $__VBoxGuestProperties = LaunchConsole($LeapDroid_Manage_Path, "guestproperty enumerate " & $g_sAndroidInstance, $process_killed) ; update global variables $g_sAndroidProgramPath = $LeapDroid_Path & "LeapdroidVM.exe" $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $LeapDroid_Path & "adb.exe" + If Not $LeapDroidVersion Then + ; read Android Program Details + Local $pAndroidFileVersionInfo + If _WinAPI_GetFileVersionInfo($g_sAndroidProgramPath, $pAndroidFileVersionInfo) Then + $g_avAndroidProgramFileVersionInfo = _WinAPI_VerQueryValue($pAndroidFileVersionInfo, "FileVersion") + If UBound($g_avAndroidProgramFileVersionInfo) > 1 Then $LeapDroidVersion = $g_avAndroidProgramFileVersionInfo[1][1] + EndIf + EndIf $g_sAndroidVersion = $LeapDroidVersion $__LeapDroid_Path = $LeapDroid_Path $g_sAndroidPath = $__LeapDroid_Path @@ -226,24 +230,15 @@ Func InitLeapDroid($bCheckOnly = False) EndIf ; get screencap paths: Name: 'picture', Host path: 'C:\Users\Administrator\Pictures\LeapDroid Photo' (machine mapping), writable - $g_sAndroidPicturesPath = "/mnt/shared/yw_shared/" - $aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'yw_shared', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) - If Not @error Then - $g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" - Else - ; new since 1.7.0 + If GetVersionNormalized($g_sAndroidVersion) >= GetVersionNormalized("1.7.0") Then ; Name: 'LeapDroidShared', Host path: 'C:\Users\Administrator\AppData\Roaming\Leapdroid\shared' (machine mapping), writable $g_sAndroidPicturesPath = "/mnt/shared/LeapDroidShared/" - $aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'LeapDroidShared', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) - If Not @error Then - $g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" - Else - $oops = 1 - $g_bAndroidAdbScreencap = False - $g_sAndroidPicturesHostPath = "" - SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) - EndIf + $g_sAndroidSharedFolderName = "LeapDroidShared" + Else + $g_sAndroidPicturesPath = "/mnt/shared/yw_shared/" + $g_sAndroidSharedFolderName = "yw_shared" EndIf + ConfigureSharedFolder(0) ; something like C:\Users\Administrator\AppData\Roaming\Leapdroid\shared\ ; Android Window Title is always "Leapdroid" so add instance name $g_bUpdateAndroidWindowTitle = True @@ -320,6 +315,10 @@ Func SetScreenLeapDroid() ; Set dpi $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) #ce + + ConfigureSharedFolder(1, True) + ConfigureSharedFolder(2, True) + Return True EndFunc ;==>SetScreenLeapDroid @@ -340,6 +339,8 @@ Func CheckScreenLeapDroid($bSetLog = True) If Not InitAndroid() Then Return False + Local $iErrCnt = 0 + #cs Local $aValues[4][2] = [ _ ["is_full_screen", "0"], _ @@ -370,6 +371,11 @@ Func CheckScreenLeapDroid($bSetLog = True) Next If $iErrCnt > 0 Then Return False #ce + + ; check if shared folder exists + If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 + + If $iErrCnt > 0 Then Return False Return True EndFunc ;==>CheckScreenLeapDroid diff --git a/COCBot/functions/Android/AndroidMEmu.au3 b/COCBot/functions/Android/AndroidMEmu.au3 index 3540d9c5b..5dd717d6b 100644 --- a/COCBot/functions/Android/AndroidMEmu.au3 +++ b/COCBot/functions/Android/AndroidMEmu.au3 @@ -172,6 +172,7 @@ Func InitMEmu($bCheckOnly = False) ; Read ADB host and Port If Not $bCheckOnly Then + ;$g_iAndroidRecoverStrategy = 0 ; newer MEmu doesn't support yet ADB mouse click/minitouch local $memuCurr = GetVersionNormalized($MEmuVersion) Local $memu6 = GetVersionNormalized("6.0") @@ -183,12 +184,8 @@ Func InitMEmu($bCheckOnly = False) InitAndroidConfig(True) ; Restore default config If Not GetAndroidVMinfo($__VBoxVMinfo, $MEmu_Manage_Path) Then Return False - Local $sAdbPAth = GetMEmuAdbPath() - If $sAdbPAth Then - ; to avoid MEmu "device offline" problems, force to use MEmu adb - $sPreferredADB = $sAdbPAth - $g_bAndroidAdbPortPerInstance = False - EndIf + ; to avoid MEmu "device offline" problems, force to use default port + $g_bAndroidAdbPortPerInstance = False ; update global variables $g_sAndroidProgramPath = $MEmu_Path & "MEmu.exe" @@ -224,15 +221,8 @@ Func InitMEmu($bCheckOnly = False) ; get screencap paths: Name: 'picture', Host path: 'C:\Users\Administrator\Pictures\MEmu Photo' (machine mapping), writable $g_sAndroidPicturesPath = "/mnt/shell/emulated/0/Pictures/" - $aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'picture', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) - If Not @error Then - $g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" - Else - $oops = 1 - $g_bAndroidAdbScreencap = False - $g_sAndroidPicturesHostPath = "" - SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) - EndIf + $g_sAndroidSharedFolderName = "picture" + ConfigureSharedFolder(0) ; something like C:\Users\Administrator\Pictures\MEmu Photo\ $__VBoxGuestProperties = LaunchConsole($__VBoxManage_Path, "guestproperty enumerate " & $g_sAndroidInstance, $process_killed) @@ -259,6 +249,9 @@ Func SetScreenMEmu() ; Set dpi $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) + ConfigureSharedFolder(1, True) + ConfigureSharedFolder(2, True) + Return True EndFunc ;==>SetScreenMEmu @@ -306,6 +299,10 @@ Func CheckScreenMEmu($bSetLog = True) $iErrCnt += 1 EndIf Next + + ; check if shared folder exists + If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 + If $iErrCnt > 0 Then Return False Return True diff --git a/COCBot/functions/Android/AndroidNox.au3 b/COCBot/functions/Android/AndroidNox.au3 index 1f64beb3f..dffadebb2 100644 --- a/COCBot/functions/Android/AndroidNox.au3 +++ b/COCBot/functions/Android/AndroidNox.au3 @@ -32,7 +32,8 @@ Func OpenNox($bRestart = False) $hTimer = __TimerInit() - If WaitForRunningVMS($g_iAndroidLaunchWaitSec - __TimerDiff($hTimer) / 1000, $hTimer) Then Return False + ; Nox can have issues detecting if VM is running, so now disabled + ;If WaitForRunningVMS($g_iAndroidLaunchWaitSec - __TimerDiff($hTimer) / 1000, $hTimer) Then Return False ; update ADB port, as that can changes when Nox just started... $g_bInitAndroid = True @@ -142,7 +143,7 @@ Func GetNoxBackgroundMode() If $sConfig Then Local $graphic_engine_type = IniRead($sConfig, "setting", "graphic_engine_type", "") ; 0 = OpenGL, 1 = DirectX Switch $graphic_engine_type - Case "0" + Case "0", "" Return $iOpenGL Case "1" Return $iDirectX @@ -217,37 +218,6 @@ Func InitNox($bCheckOnly = False) SetLog("Using ADB default device " & $g_sAndroidAdbDevice & " for " & $g_sAndroidEmulator, $COLOR_ERROR) EndIf - ;$g_sAndroidPicturesPath = "/mnt/shell/emulated/0/Download/other/" - ;$g_sAndroidPicturesPath = "/mnt/shared/Other/" - $g_sAndroidPicturesPath = "(/mnt/shared/Other|/mnt/shell/emulated/0/Download/other|/mnt/shell/emulated/0/Others)" - $aRegexResult = StringRegExp($__VBoxVMinfo, "Name: 'Other', Host path: '(.*)'.*", $STR_REGEXPARRAYGLOBALMATCH) - If Not @error Then - $g_bAndroidSharedFolderAvailable = True - $g_sAndroidPicturesHostPath = $aRegexResult[UBound($aRegexResult) - 1] & "\" - Else - ; Check the shared folder 'Nox_share' , this is the default path on last version - If FileExists(@MyDocumentsDir & "\Nox_share\") Then - $g_bAndroidSharedFolderAvailable = True - $g_sAndroidPicturesHostPath = @MyDocumentsDir & "\Nox_share\Other\" - If Not FileExists($g_sAndroidPicturesHostPath) Then - ; Just in case of 'Other' Folder doesn't exist - DirCreate($g_sAndroidPicturesHostPath) - EndIf - ; > Nox v5.2.0.0 - ElseIf FileExists(@HomeDrive & @HomePath & "\Nox_share\") Then - $g_bAndroidSharedFolderAvailable = True - $g_sAndroidPicturesHostPath = @HomeDrive & @HomePath & "\Nox_share\" - If Not FileExists($g_sAndroidPicturesHostPath) Then - ; Just in case of 'Other' Folder doesn't exist - DirCreate($g_sAndroidPicturesHostPath) - EndIf - Else - $g_bAndroidSharedFolderAvailable = False - $g_bAndroidAdbScreencap = False - $g_sAndroidPicturesHostPath = "" - SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) - EndIf - EndIf Local $v = GetVersionNormalized($g_sAndroidVersion) For $i = 0 To UBound($__Nox_Config) - 1 @@ -268,6 +238,10 @@ Func InitNox($bCheckOnly = False) EndIf #ce + ; Update shared folder state + $g_sAndroidSharedFolderName = "Other" + ConfigureSharedFolderNox(0) ; something like C:\Users\Administrator\Documents\Nox_share\Other\ + UpdateHWnD($g_hAndroidWindow, False) ; Ensure $g_sAppClassInstance is properly set ; Update Android Screen and Window @@ -287,6 +261,52 @@ Func GetNoxConfigFile() Return "" EndFunc ;==>GetNoxConfigFile +Func ConfigureSharedFolderNox($iMode = 0, $bSetLog = Default) + If $bSetLog = Default Then $bSetLog = True + Local $bResult = False + + Switch $iMode + Case 0 ; check that shared folder is configured in VM + ;$g_sAndroidPicturesPath = "/mnt/shell/emulated/0/Download/other/" + ;$g_sAndroidPicturesPath = "/mnt/shared/Other/" + $g_sAndroidPicturesPath = "(/mnt/shared/Other|/mnt/shell/emulated/0/Download/other|/mnt/shell/emulated/0/Others)" + Local $aRegexResult = StringRegExp($__VBoxVMinfo, "Name: '" & $g_sAndroidSharedFolderName & "', Host path: '(.*)'.*", $STR_REGEXPARRAYGLOBALMATCH) + If Not @error Then + $bResult = True + $g_bAndroidSharedFolderAvailable = True + $g_sAndroidPicturesHostPath = $aRegexResult[UBound($aRegexResult) - 1] & "\" + Else + ; Check the shared folder 'Nox_share' , this is the default path on last version + If FileExists(@HomeDrive & @HomePath & "\Nox_share\OtherShare\") Then + ; > Nox v6 + $g_bAndroidSharedFolderAvailable = True + $g_sAndroidPicturesHostPath = @HomeDrive & @HomePath & "\Nox_share\OtherShare\" + ElseIf FileExists(@HomeDrive & @HomePath & "\Nox_share\") Then + ; > Nox v5.2.0.0 + $g_bAndroidSharedFolderAvailable = True + $g_sAndroidPicturesHostPath = @HomeDrive & @HomePath & "\Nox_share\" + ElseIf FileExists(@MyDocumentsDir & "\Nox_share\Other\") Then + $g_bAndroidSharedFolderAvailable = True + $g_sAndroidPicturesHostPath = @MyDocumentsDir & "\Nox_share\Other\" + Else + $g_bAndroidSharedFolderAvailable = False + $g_bAndroidAdbScreencap = False + $g_sAndroidPicturesHostPath = "" + SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) + EndIf + EndIf + + Case 1 ; create missing shared folder + $bResult = AndroidPicturePathAutoConfig(@MyDocumentsDir, "\Nox_share\Other", $bSetLog) + + Case Else + ; use default impl. + Return SetError(1, 0, "") + EndSwitch + + Return SetError(0, 0, $bResult) +EndFunc + Func SetScreenNox() If Not InitAndroid() Then Return False @@ -299,14 +319,8 @@ Func SetScreenNox() ; Set dpi ;$cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) - AndroidPicturePathAutoConfig(@MyDocumentsDir, "\Nox_share\Other") ; ensure $g_sAndroidPicturesHostPath is set and exists - If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then - ; remove tailing backslash - Local $path = $g_sAndroidPicturesHostPath - If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) - $cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder remove " & $g_sAndroidInstance & " --name Other", $process_killed) - $cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name Other --hostpath """ & $path & """ --automount", $process_killed) - EndIf + ConfigureSharedFolder(1, True) + ConfigureSharedFolder(2, True) ; find Nox conf.ini in C:\Users\User\AppData\Local\Nox and set "Fix window size" to Enable, "Remember size and position" to Disable and screen res also Local $sConfig = GetNoxConfigFile() @@ -350,7 +364,25 @@ Func CheckScreenNox($bSetLog = True) For $i = 0 To UBound($aValues) - 1 $aRegexResult = StringRegExp($__VBoxGuestProperties, "Name: " & $aValues[$i][0] & ", value: (.+), timestamp:", $STR_REGEXPARRAYMATCH) - If @error = 0 Then $Value = $aRegexResult[0] + If @error = 0 Then + $Value = $aRegexResult[0] + Else + If StringInStr($__VBoxGuestProperties, "error:") = 0 Then + If $bSetLog Then + SetLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0], $COLOR_ERROR) + Else + SetDebugLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0], $COLOR_ERROR) + EndIF + Else + $Value = $aValues[$i][1] + If $bSetLog Then + SetLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0] & ", assuming " & $Value, $COLOR_ERROR) + Else + SetDebugLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0] & ", assuming " & $Value, $COLOR_ERROR) + EndIF + EndIf + EndIf + If $Value <> $aValues[$i][1] Then If $iErrCnt = 0 Then If $bSetLog Then @@ -369,7 +401,7 @@ Func CheckScreenNox($bSetLog = True) Next ; check if shared folder exists - If AndroidPicturePathAutoConfig(@MyDocumentsDir, "\Nox_share\Other", $bSetLog) Then $iErrCnt += 1 + If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 If $iErrCnt > 0 Then Return False Return True diff --git a/COCBot/functions/Android/AndroidiTools.au3 b/COCBot/functions/Android/AndroidiTools.au3 index 8adf8fdd7..021fde8ed 100644 --- a/COCBot/functions/Android/AndroidiTools.au3 +++ b/COCBot/functions/Android/AndroidiTools.au3 @@ -171,6 +171,12 @@ Func InitiTools($bCheckOnly = False) $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $iTools_Path & "tools\adb.exe" $g_sAndroidVersion = "" + ; read Android Program Details + Local $pAndroidFileVersionInfo + If _WinAPI_GetFileVersionInfo($g_sAndroidProgramPath, $pAndroidFileVersionInfo) Then + $g_avAndroidProgramFileVersionInfo = _WinAPI_VerQueryValue($pAndroidFileVersionInfo, "FileVersion") + If UBound($g_avAndroidProgramFileVersionInfo) > 1 Then $g_sAndroidVersion = $g_avAndroidProgramFileVersionInfo[1][1] + EndIf $__iTools_Path = $iTools_Path $g_sAndroidPath = $__iTools_Path $__VBoxManage_Path = $iTools_Manage_Path @@ -201,17 +207,8 @@ Func InitiTools($bCheckOnly = False) ; get screencap paths: Name: 'picture', Host path: 'C:\Users\Administrator\Pictures\iTools Photo' (machine mapping), writable $g_sAndroidPicturesPath = "/mnt/shared/picture/" - $aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'picture', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) - If Not @error Then - $g_bAndroidSharedFolderAvailable = True - $g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" - Else - $oops = 1 - $g_bAndroidAdbScreencap = False - $g_bAndroidSharedFolderAvailable = False - $g_sAndroidPicturesHostPath = "" - SetLog($g_sAndroidEmulator & " shared folder is not available", $COLOR_ERROR) - EndIf + $g_sAndroidSharedFolderName = "picture" + ConfigureSharedFolder(0) ; something like C:\Users\Administrator\Pictures\iTools Photo\ ; Android Window Title is always "iTools" so add instance name $g_bUpdateAndroidWindowTitle = True @@ -236,13 +233,8 @@ Func SetScreeniTools() $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) ;vboxmanage sharedfolder add droid4x --name picture --hostpath "C:\Users\Administrator\Pictures\Droid4X Photo" --automount - AndroidPicturePathAutoConfig() ; ensure $g_sAndroidPicturesHostPath is set and exists - If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then - ; remove tailing backslash - Local $path = $g_sAndroidPicturesHostPath - If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) - $cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name picture --hostpath """ & $path & """ --automount", $process_killed) - EndIf + ConfigureSharedFolder(1, True) + ConfigureSharedFolder(2, True) Return True @@ -285,7 +277,7 @@ Func CheckScreeniTools($bSetLog = True) If $iErrCnt > 0 Then Return False ; check if shared folder exists - If AndroidPicturePathAutoConfig(Default, Default, $bSetLog) Then $iErrCnt += 1 + If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 If $iErrCnt > 0 Then Return False Return True diff --git a/COCBot/functions/Android/UniversalCloseWaitOpenCoC.au3 b/COCBot/functions/Android/UniversalCloseWaitOpenCoC.au3 index 3266c0fa5..e217d257a 100644 --- a/COCBot/functions/Android/UniversalCloseWaitOpenCoC.au3 +++ b/COCBot/functions/Android/UniversalCloseWaitOpenCoC.au3 @@ -77,7 +77,8 @@ Func UniversalCloseWaitOpenCoC($iWaitTime = 0, $sSource = "Unknown", $StopEmulat If _Sleep($DELAYRESPOND) Then Return False OpenCoC() Case 1 ; close CoC app only (after 2017/Dec. only jump to home-screen to avoid CoC launch delay) - Local $bSendHome = ($g_sAndroidEmulator <> "MEmu") ; MEmu has issues with CoC running in background: it crashed... to avoid that use polite close + ; Local $bSendHome = ($g_sAndroidEmulator <> "MEmu") + Local $bSendHome = False ; MEmu and BlueStacks 4 have issues with CoC running in background: it crashes... to avoid that use polite close If $bSendHome Then AndroidHomeButton() Else diff --git a/COCBot/functions/Attack/Attack Algorithms/SmartFarm.au3 b/COCBot/functions/Attack/Attack Algorithms/SmartFarm.au3 index 1349c8414..2969ef8e1 100644 --- a/COCBot/functions/Attack/Attack Algorithms/SmartFarm.au3 +++ b/COCBot/functions/Attack/Attack Algorithms/SmartFarm.au3 @@ -240,9 +240,9 @@ Func SmartFarmDetection($txtBuildings = "Mines") $iMaxLevel = 7 Case "All" If $g_iDetectedImageType = 1 Then - $sdirectory = @ScriptDir & "\imgxml\Storages\All" - Else $sdirectory = @ScriptDir & "\imgxml\Storages\All_Snow" + Else + $sdirectory = @ScriptDir & "\imgxml\Storages\All" EndIf $iMaxReturnPoints = 21 $iMaxLevel = 13 diff --git a/COCBot/functions/Attack/AttackCSV/ParseAttackCSV.au3 b/COCBot/functions/Attack/AttackCSV/ParseAttackCSV.au3 index 1cb140eae..99721c8be 100644 --- a/COCBot/functions/Attack/AttackCSV/ParseAttackCSV.au3 +++ b/COCBot/functions/Attack/AttackCSV/ParseAttackCSV.au3 @@ -5,7 +5,7 @@ ; Parameters ....: $debug - [optional] ; Return values .: None ; Author ........: Sardo (2016) -; Modified ......: MMHK (07-2017)(01-2018) +; Modified ......: MMHK (07/2017)(01/2018), TripleM (03/2019) ; Remarks .......: This file is part of MyBot, previously known as ClashGameBot. Copyright 2015-2019 ; MyBot is distributed under the terms of the GNU GPL ; Related .......: @@ -319,9 +319,12 @@ Func ParseAttackCSV($debug = False) ReleaseClicks($g_iAndroidAdbClicksTroopDeploySize) If _Sleep($DELAYRESPOND) Then Return ; check for pause/stop ;set flag if warden was dropped and sleep after delay was to short for icon to update properly - $iTroopIndex = TroopIndexLookup($value4, "ParseAttackCSV") ; obtain enum - $bWardenDrop = ($iTroopIndex = $eWarden) And ($sleepdrop1 < 1000) + If $value4 <> "REMAIN" Then + $iTroopIndex = TroopIndexLookup($value4, "ParseAttackCSV") ; obtain enum + $bWardenDrop = ($iTroopIndex = $eWarden) And ($sleepdrop1 < 1000) + EndIf Case "WAIT" + Local $hSleepTimer = __TimerInit() ; Initialize the timer at first ReleaseClicks() ;sleep time Local $sleep1, $sleep2, $sleepvect @@ -335,7 +338,7 @@ Func ParseAttackCSV($debug = False) $sleep2 = 1 EndIf Else - If Int($value3) > 0 Then + If Int($value1) > 0 Then $sleep1 = Int($value1) $sleep2 = Int($value1) Else @@ -349,7 +352,6 @@ Func ParseAttackCSV($debug = False) Local $sleep = Int($sleep1) EndIf debugAttackCSV("wait " & $sleep) - ;If _Sleep($sleep) Then Return Local $Gold = 0 Local $Elixir = 0 Local $DarkElixir = 0 @@ -357,9 +359,63 @@ Func ParseAttackCSV($debug = False) Local $exitOneStar = 0 Local $exitTwoStars = 0 Local $exitNoResources = 0 - Local $hSleepTimer = __TimerInit() + Local $exitAttackEnded = 0 + Local $bBreakOnTH = False + Local $bBreakOnSiege = False + Local $bBreakOnTHAndSiege = False + Local $aSiegeSlotPos = [0,0] + Local $tempvalue2 = StringStripWS($value2, $STR_STRIPALL) ; remove all whitespaces from parameter + If StringLen($tempvalue2) > 0 Then ; If parameter is not empty + Local $aParam = StringSplit($tempvalue2, ",", $STR_NOCOUNT) ; split parameter into subparameters "TH","Siege","TH+Siege" + For $iParam = 0 To UBound($aParam) - 1 + Switch $aParam[$iParam] + Case "TH" + $bBreakOnTH = True + Case "SIEGE" + $bBreakOnSiege = True + Case "TH+SIEGE" + $bBreakOnTHAndSiege = True + EndSwitch + Next + SetDebugLog("$bBreakOnTH = " & $bBreakOnTH & ", $bBreakOnSiege = " & $bBreakOnSiege & ", $bBreakOnTHAndSiege = " & $bBreakOnTHAndSiege, $COLOR_INFO) + If $bBreakOnSiege Or $bBreakOnTHAndSiege Then + debugAttackCSV("WAIT Condition Break on Siege Troop Drop set") + ;Check if Siege is Available In Attackbar + For $i = 0 To UBound($g_avAttackTroops) - 1 + If $g_avAttackTroops[$i][0] = $eCastle Then + SetDebugLog("WAIT Break on Siege Machine is set but Clan Castle Troop selected.", $COLOR_INFO) + ExitLoop + ElseIf $g_avAttackTroops[$i][0] = $eWallW Or $g_avAttackTroops[$i][0] = $eBattleB Or $g_avAttackTroops[$i][0] = $eStoneS Then + Local $sSiegeName = GetTroopName($g_avAttackTroops[$i][0]) + SetDebugLog(" " & $sSiegeName & " found. Let's Check If is Dropped Or Not?", $COLOR_SUCCESS) + ;Check Siege Slot Quantity If It's 0 Means Siege Is Dropped + If ReadTroopQuantity($i) = 0 Then + SetDebugLog(" " & $sSiegeName & " is dropped.", $COLOR_SUCCESS) + ;Get Siege Machine Slot For Checking Slot Grayed Out or Not + $aSiegeSlotPos = GetSlotPosition($i, True) + Else + SetDebugLog(" " & $sSiegeName & " is not dropped yet.", $COLOR_SUCCESS) + EndIf + ExitLoop + EndIf + Next + If $aSiegeSlotPos[0] = 0 And $aSiegeSlotPos[1] = 0 Then ; no dropped Siege found + SetDebugLog("WAIT no dropped Siege found, so unset Break on Siege.", $COLOR_INFO) + If $bBreakOnTHAndSiege Then $bBreakOnTH = True ; When "TH+Siege" is set, set it to only "TH" + $bBreakOnSiege = False + $bBreakOnTHAndSiege = False + If Not $bBreakOnTH Then ContinueLoop ; Don't wait, when "Siege" was the only condition, but not found + EndIf + EndIf + EndIf While __TimerDiff($hSleepTimer) < $sleep CheckHeroesHealth() + ; When Break on Siege is active and troops dropped, return ASAP + If $bBreakOnSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) Then ContinueLoop 2 + ; When Break on TH Kill is active in case townhall destroyed, return ASAP + If $bBreakOnTH And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 + ; When Break on TH Kill And Siege is active, if both TH is destroyed and Siege troops are dropped, return ASAP + If $bBreakOnTHAndSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 ;READ RESOURCES $Gold = getGoldVillageSearch(48, 69) $Elixir = getElixirVillageSearch(48, 69 + 29) @@ -372,6 +428,13 @@ Func ParseAttackCSV($debug = False) $Trophies = getTrophyVillageSearch(48, 69 + 69) EndIf CheckHeroesHealth() + ; When Break on Siege is active and troops dropped, return ASAP + If $bBreakOnSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) Then ContinueLoop 2 + ; When Break on TH Kill is active in case townhall destroyed, return ASAP + If $bBreakOnTH And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 + ; When Break on TH Kill And Siege is active, if both TH is destroyed and Siege troops are dropped, return ASAP + If $bBreakOnTHAndSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 + If $g_bDebugSetlog Then SetDebugLog("detected [G]: " & $Gold & " [E]: " & $Elixir & " [DE]: " & $DarkElixir, $COLOR_INFO) ;EXIT IF RESOURCES = 0 If $g_abStopAtkNoResources[$g_iMatchMode] And Number($Gold) = 0 And Number($Elixir) = 0 And Number($DarkElixir) = 0 Then @@ -395,9 +458,14 @@ Func ParseAttackCSV($debug = False) If $g_abStopAtkPctHigherEnable[$g_iMatchMode] And Number(getOcrOverAllDamage(780, 527 + $g_iBottomOffsetY)) > Int($g_aiStopAtkPctHigherAmt[$g_iMatchMode]) Then ExitLoop EndIf + If _CheckPixel($aEndFightSceneBtn, True) And _CheckPixel($aEndFightSceneAvl, True) And _CheckPixel($aEndFightSceneReportGold, True) Then + SetDebugLog("From Attackcsv: Found End Fight Scene to close, exit", $COLOR_SUCCESS) + $exitAttackEnded = 1 + ExitLoop + EndIf If _Sleep($DELAYRESPOND) Then Return ; check for pause/stop WEnd - If $exitOneStar = 1 Or $exitTwoStars = 1 Or $exitNoResources = 1 Then ExitLoop ;stop parse CSV file, start exit battle procedure + If $exitOneStar = 1 Or $exitTwoStars = 1 Or $exitNoResources = 1 Or $exitAttackEnded = 1 Then ExitLoop ;stop parse CSV file, start exit battle procedure Case "RECALC" ReleaseClicks() @@ -434,6 +502,59 @@ Func ParseAttackCSV($debug = False) EndIf EndFunc ;==>ParseAttackCSV +;This Function is used to check if siege dropped the troops +Func CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) + ;Check Gray Pixel When Siege IS Dead. + If _ColorCheck(_GetPixelColor($aSiegeSlotPos[0] + 20, $aSiegeSlotPos[1] + 20, True, "WAIT--> IsSiegeDestroyed"), Hex(0x474747, 6), 10) Then + SetDebugLog("WAIT--> Siege Got Destroyed After " & Round(__TimerDiff($hSleepTimer)) & "ms.", $COLOR_SUCCESS) + Return True + EndIf + Return False +EndFunc ;==>CheckIfSiegeDroppedTheTroops + +;This Function is used to check if Townhall is destroyed +Func CheckIfTownHallGotDestroyed($hSleepTimer) + Static $hPopupTimer = 0 + Local $bIsTHDestroyed = False + ; Check if got any star + Local $bWonOneStar = _CheckPixel($aWonOneStar, True) + Local $bWonTwoStar = _CheckPixel($aWonTwoStar, True) + ; Check for the centrally popped up star + Local $bCentralStarPopup = _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) - 2, Int($g_iGAME_HEIGHT / 2) - 2, True), Hex(0xC0C4C0, 6), 20) And _ + _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) - 2, Int($g_iGAME_HEIGHT / 2) + 2, True), Hex(0xC0C4C0, 6), 20) And _ + _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) + 2, Int($g_iGAME_HEIGHT / 2) + 2, True), Hex(0xC0C4C0, 6), 20) And _ + _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) + 2, Int($g_iGAME_HEIGHT / 2) - 2, True), Hex(0xC0C4C0, 6), 20) + ;Get Current Damge % + Local $iDamage = Number(getOcrOverAllDamage(780, 527 + $g_iBottomOffsetY)) + + ; Optimistic Trigger on Star Popup + If $bCentralStarPopup Then + ; When damage < 50% TH is destroyed + If $iDamage < 50 Then + $bIsTHDestroyed = True + ; When already one star, popup star is the second one for TH + ElseIf $bWonOneStar Then + $bIsTHDestroyed = True + ; trying to catch the cornercase of two distinguishable popups within 1500 msec (time from popup to settle of a star) + ; Initialize the Timer, when not initialized, or last initialization is more than 1500 msec old + ElseIf $hPopupTimer = 0 Or __TimerDiff($hPopupTimer) > 1500 Then + $hPopupTimer = __TimerInit() + ; trigger, when 500ms after a star popup there is still a popped up star (the star usually stays less than half a sec) + ElseIf __TimerDiff($hPopupTimer) > 500 Then + $bIsTHDestroyed = True + EndIf + ; Failsafe Trigger: If Got 1 Star and Damage % < 50% then TH was taken before 50% + ElseIf $bWonOneStar And $iDamage < 50 Then + $bIsTHDestroyed = True + ; Failsafe Trigger: If Got 2 Star and Damage % >= 50% then TH was taken after 50% + ElseIf $bWonTwoStar Then + $bIsTHDestroyed = True + EndIf + SetDebugLog("WAIT--> $iDamage: " & $iDamage & ", $bCentralStarPopup: " & $bCentralStarPopup & ", $bWonOneStar: " & $bWonOneStar & ", $bWonTwoStar: " & $bWonTwoStar & ", $bIsTHDestroyed: " & $bIsTHDestroyed, $COLOR_INFO) + If $bIsTHDestroyed Then SetDebugLog("WAIT--> Town Hall Got Destroyed After " & Round(__TimerDiff($hSleepTimer)) & "ms.", $COLOR_SUCCESS) + Return $bIsTHDestroyed +EndFunc ;==>CheckIfTownHallGotDestroyed + ; #FUNCTION# ==================================================================================================================== ; Name ..........: ParseAttackCSV_MainSide diff --git a/COCBot/functions/Attack/GetAttackBar.au3 b/COCBot/functions/Attack/GetAttackBar.au3 index 02670e3af..a1d5a707a 100644 --- a/COCBot/functions/Attack/GetAttackBar.au3 +++ b/COCBot/functions/Attack/GetAttackBar.au3 @@ -163,8 +163,10 @@ Func GetAttackBar($bRemaining = False, $pMatchMode = $DB, $bDebug = False) DragAttackBar() Local $aExtendedArray = ExtendedAttackBarCheck($aAttackBar, $bRemaining, $sSearchDiamond) _ArrayAdd($aFinalAttackBar, $aExtendedArray) - $g_iTotalAttackSlot = UBound($aFinalAttackBar, 1) + 1 - If Not $bRemaining Then DragAttackBar($g_iTotalAttackSlot, True) ; return drag + If Not $bRemaining Then + $g_iTotalAttackSlot = UBound($aFinalAttackBar, 1) - 1 + DragAttackBar($g_iTotalAttackSlot, True) ; return drag + EndIf EndIf _ArraySort($aFinalAttackBar, 0, 0, 0, 1) ; Sort Final Array by Slot Number diff --git a/COCBot/functions/Attack/Troops/dropHeroes.au3 b/COCBot/functions/Attack/Troops/dropHeroes.au3 index 83c2c52e5..f91714c58 100644 --- a/COCBot/functions/Attack/Troops/dropHeroes.au3 +++ b/COCBot/functions/Attack/Troops/dropHeroes.au3 @@ -41,7 +41,7 @@ Func dropHeroes($iX, $iY, $iKingSlotNumber = -1, $iQueenSlotNumber = -1, $iWarde If $g_bDebugSetlog Then SetDebugLog("drop WARDEN = " & $bDropWarden, $COLOR_DEBUG) If $bDropKing Then - SetLog("Dropping King", $COLOR_INFO) + SetLog("Dropping King at " & $iX & ", " & $iY, $COLOR_INFO) SelectDropTroop($iKingSlotNumber, 1, Default, False) If _Sleep($DELAYDROPHEROES2) Then Return AttackClick($iX, $iY, 1, 0, 0, "#0093") @@ -58,7 +58,7 @@ Func dropHeroes($iX, $iY, $iKingSlotNumber = -1, $iQueenSlotNumber = -1, $iWarde If _Sleep($DELAYDROPHEROES1) Then Return If $bDropQueen Then - SetLog("Dropping Queen", $COLOR_INFO) + SetLog("Dropping Queen at " & $iX & ", " & $iY, $COLOR_INFO) SelectDropTroop($iQueenSlotNumber, 1, Default, False) If _Sleep($DELAYDROPHEROES2) Then Return AttackClick($iX, $iY, 1, 0, 0, "#0095") @@ -75,7 +75,7 @@ Func dropHeroes($iX, $iY, $iKingSlotNumber = -1, $iQueenSlotNumber = -1, $iWarde If _Sleep($DELAYDROPHEROES1) Then Return If $bDropWarden Then - SetLog("Dropping Grand Warden", $COLOR_INFO) + SetLog("Dropping Grand Warden at " & $iX & ", " & $iY, $COLOR_INFO) SelectDropTroop($iWardenSlotNumber, 1, Default, False) If _Sleep($DELAYDROPHEROES2) Then Return AttackClick($iX, $iY, 1, 0, 0, "#x999") diff --git a/COCBot/functions/Config/ScreenCoordinates.au3 b/COCBot/functions/Config/ScreenCoordinates.au3 index d486e0cf2..2081338fa 100644 --- a/COCBot/functions/Config/ScreenCoordinates.au3 +++ b/COCBot/functions/Config/ScreenCoordinates.au3 @@ -40,6 +40,7 @@ Global $aCancelFight[4] = [822, 48, 0xD80408, 20] ; Cancel Fight Scene Global $aCancelFight2[4] = [830, 59, 0xD80408, 20] ; Cancel Fight Scene 2nd pixel Global $aEndFightSceneBtn[4] = [429, 519 + $g_iMidOffsetY, 0xB8E35F, 20] ; Victory or defeat scene buton = green edge Global $aEndFightSceneAvl[4] = [241, 196 + $g_iMidOffsetY, 0xFFF090, 20] ; Victory or defeat scene left side ribbon = light gold +Global $aEndFightSceneReportGold = $aEndFightSceneAvl ; Missing... TripleM ??? Global $aReturnHomeButton[4] = [376, 567 + $g_iMidOffsetY, 0x60AC10, 20] ; Return Home Button, End Battle Screen Global $aChatTab[4] = [331, 325 + $g_iMidOffsetY, 0xF0951D, 20] ; Chat Window Open, Main Screen Global $aChatTab2[4] = [331, 330 + $g_iMidOffsetY, 0xF0951D, 20] ; Chat Window Open, Main Screen diff --git a/COCBot/functions/Config/applyConfig.au3 b/COCBot/functions/Config/applyConfig.au3 index 938056f25..09bada053 100644 --- a/COCBot/functions/Config/applyConfig.au3 +++ b/COCBot/functions/Config/applyConfig.au3 @@ -188,6 +188,7 @@ Func ApplyConfig_Android($TypeReadSave) _GUICtrlComboBox_SetCurSel($g_hCmbAndroidZoomoutMode, $g_iAndroidZoomoutMode) GUICtrlSetState($g_hChkAndroidAdbClickDragScript, $g_bAndroidAdbClickDragScript ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetState($g_hChkAndroidCloseWithBot, $g_bAndroidCloseWithBot ? $GUI_CHECKED : $GUI_UNCHECKED) + GUICtrlSetState($g_hChkUpdateSharedPrefs, $g_bUpdateSharedPrefs ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetData($g_hTxtAndroidRebootHours, $g_iAndroidRebootHours) _GUICtrlComboBox_SetCurSel($g_hCmbSuspendAndroid, AndroidSuspendFlagsToIndex($g_iAndroidSuspendModeFlags)) Case "Save" @@ -198,6 +199,7 @@ Func ApplyConfig_Android($TypeReadSave) $g_bAndroidAdbClick = $g_bAndroidAdbClickEnabled ; also update $g_bAndroidAdbClick as that one is actually used $g_bAndroidAdbClickDragScript = (GUICtrlRead($g_hChkAndroidAdbClickDragScript) = $GUI_CHECKED ? True : False) $g_bAndroidCloseWithBot = (GUICtrlRead($g_hChkAndroidCloseWithBot) = $GUI_CHECKED ? True : False) + $g_bUpdateSharedPrefs = (GUICtrlRead($g_hChkUpdateSharedPrefs) = $GUI_CHECKED ? True : False) $g_iAndroidRebootHours = Int(GUICtrlRead($g_hTxtAndroidRebootHours)) ; Hours are entered cmbSuspendAndroid() EndSwitch @@ -837,6 +839,7 @@ Func ApplyConfig_600_18($TypeReadSave) GUICtrlSetState($g_hChkNotifyAlertBAN, $g_bNotifyAlertBAN ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetState($g_hChkNotifyBOTUpdate, $g_bNotifyAlertBOTUpdate ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $g_bNotifyAlertSmartWaitTime ? $GUI_CHECKED : $GUI_UNCHECKED) + GUICtrlSetState($g_hChkNotifyAlertLaboratoryIdle, $g_bNotifyAlertLaboratoryIdle ? $GUI_CHECKED : $GUI_UNCHECKED) Case "Save" ; Telegram $g_bNotifyTGEnable = (GUICtrlRead($g_hChkNotifyTGEnable) = $GUI_CHECKED) @@ -860,6 +863,7 @@ Func ApplyConfig_600_18($TypeReadSave) $g_bNotifyAlertBAN = (GUICtrlRead($g_hChkNotifyAlertBAN) = $GUI_CHECKED) $g_bNotifyAlertBOTUpdate = (GUICtrlRead($g_hChkNotifyBOTUpdate) = $GUI_CHECKED) $g_bNotifyAlertSmartWaitTime = (GUICtrlRead($g_hChkNotifyAlertSmartWaitTime) = $GUI_CHECKED) + $g_bNotifyAlertLaboratoryIdle = (GUICtrlRead($g_hChkNotifyAlertLaboratoryIdle) = $GUI_CHECKED) EndSwitch EndFunc ;==>ApplyConfig_600_18 diff --git a/COCBot/functions/Config/readConfig.au3 b/COCBot/functions/Config/readConfig.au3 index 3197e21b9..88b9616d4 100644 --- a/COCBot/functions/Config/readConfig.au3 +++ b/COCBot/functions/Config/readConfig.au3 @@ -330,6 +330,7 @@ Func ReadConfig_Android() $g_iAndroidSuspendModeFlags = Int(IniRead($g_sProfileConfigPath, "android", "suspend.mode", $g_iAndroidSuspendModeFlags)) $g_iAndroidRebootHours = Int(IniRead($g_sProfileConfigPath, "android", "reboot.hours", $g_iAndroidRebootHours)) $g_bAndroidCloseWithBot = Int(IniRead($g_sProfileConfigPath, "android", "close", $g_bAndroidCloseWithBot ? 1 : 0)) = 1 + $g_bUpdateSharedPrefs = Int(IniRead($g_sProfileConfigPath, "android", "shared_prefs.update", $g_bUpdateSharedPrefs ? 1 : 0)) = 1 $g_iAndroidProcessAffinityMask = Int(IniRead($g_sProfileConfigPath, "android", "process.affinity.mask", $g_iAndroidProcessAffinityMask)) If $g_bBotLaunchOption_Restart = True Or $g_asCmdLine[0] < 2 Then @@ -764,6 +765,7 @@ Func ReadConfig_600_18() IniReadS($g_bNotifyAlertBAN, $g_sProfileConfigPath, "notify", "AlertPBBAN", False, "Bool") IniReadS($g_bNotifyAlertBOTUpdate, $g_sProfileConfigPath, "notify", "AlertPBUpdate", False, "Bool") IniReadS($g_bNotifyAlertSmartWaitTime, $g_sProfileConfigPath, "notify", "AlertSmartWaitTime", False, "Bool") + IniReadS($g_bNotifyAlertLaboratoryIdle, $g_sProfileConfigPath, "notify", "AlertLaboratoryIdle", False, "Bool") EndFunc ;==>ReadConfig_600_18 Func ReadConfig_600_19() diff --git a/COCBot/functions/Config/saveConfig.au3 b/COCBot/functions/Config/saveConfig.au3 index 5bb94ecba..17742d47d 100644 --- a/COCBot/functions/Config/saveConfig.au3 +++ b/COCBot/functions/Config/saveConfig.au3 @@ -288,6 +288,7 @@ Func SaveConfig_Android() _Ini_Add("android", "instance", $g_sAndroidInstance) _Ini_Add("android", "reboot.hours", $g_iAndroidRebootHours) _Ini_Add("android", "close", ($g_bAndroidCloseWithBot ? "1" : "0")) + _Ini_Add("android", "shared_prefs.update", ($g_bUpdateSharedPrefs ? "1" : "0")) _Ini_Add("android", "process.affinity.mask", $g_iAndroidProcessAffinityMask) EndFunc ;==>SaveConfig_Android @@ -574,6 +575,7 @@ Func SaveConfig_600_18() _Ini_Add("notify", "AlertPBBAN", $g_bNotifyAlertBAN ? 1 : 0) _Ini_Add("notify", "AlertPBUpdate", $g_bNotifyAlertBOTUpdate ? 1 : 0) _Ini_Add("notify", "AlertSmartWaitTime", $g_bNotifyAlertSmartWaitTime ? 1 : 0) + _Ini_Add("notify", "AlertLaboratoryIdle", $g_bNotifyAlertLaboratoryIdle ? 1 : 0) EndFunc ;==>SaveConfig_600_18 Func SaveConfig_600_19() diff --git a/COCBot/functions/CreateArmy/SmartWait4Train.au3 b/COCBot/functions/CreateArmy/SmartWait4Train.au3 index 0fef08612..47f68869c 100644 --- a/COCBot/functions/CreateArmy/SmartWait4Train.au3 +++ b/COCBot/functions/CreateArmy/SmartWait4Train.au3 @@ -266,14 +266,14 @@ Func SmartWait4Train($iTestSeconds = Default) If $iDiffTime <= 0 Then ; is shield time less than total train time? ; close game = $iShieldTime because less than train time remaining SetLog("Smart wait while shield time = " & StringFormat("%.2f", $iShieldTime / 60) & " Minutes", $COLOR_INFO) - If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_01", "Smart Wait While Shield Time = ") & StringFormat("%.2f", $iShieldTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) + If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_01", "Smart Wait While Shield Time = ") & StringFormat("%.2f", $iShieldTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) If $bTest Then $iShieldTime = $iTestSeconds UniversalCloseWaitOpenCoC($iShieldTime * 1000, "SmartWait4Train_", $StopEmulator, $bFullRestart, $bSuspendComputer) $g_bRestart = True ; Set flag to exit idle loop to deal with potential user changes to GUI ResetTrainTimeArray() Else ; close game = $iTrainWaitTime because shield is larger than train time SetLog("Smart wait train time = " & StringFormat("%.2f", $iTrainWaitTime / 60) & " Minutes", $COLOR_INFO) - If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_04", "Smart Wait Train Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) + If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_04", "Smart Wait Train Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) If $bTest Then $iTrainWaitTime = $iTestSeconds UniversalCloseWaitOpenCoC($iTrainWaitTime * 1000, "SmartWait4Train_", $StopEmulator, $bFullRestart, $bSuspendComputer) $g_bRestart = True ; Set flag to exit idle loop to deal with potential user changes to GUI @@ -283,7 +283,7 @@ Func SmartWait4Train($iTestSeconds = Default) ElseIf ($g_bCloseWithoutShield And $g_aiTimeTrain[0] > 0) Or ($ichkCloseWaitSpell = 1 And $g_aiTimeTrain[1] > 0) Or ($ichkCloseWaitHero = 1 And $g_aiTimeTrain[2] > 0) Then ;when no shield close game for $iTrainWaitTime time as determined above SetLog("Smart Wait time = " & StringFormat("%.2f", $iTrainWaitTime / 60) & " Minutes", $COLOR_INFO) - If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_05", "Smart Wait Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) + If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_05", "Smart Wait Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) If $bTest Then $iTrainWaitTime = $iTestSeconds UniversalCloseWaitOpenCoC($iTrainWaitTime * 1000, "SmartWait4TrainNoShield_", $StopEmulator, $bFullRestart, $bSuspendComputer) $g_bRestart = True ; Set flag to exit idle loop to deal with potential user changes to GUI diff --git a/COCBot/functions/CreateArmy/TrainIt.au3 b/COCBot/functions/CreateArmy/TrainIt.au3 index 2d844c7a0..730700aec 100644 --- a/COCBot/functions/CreateArmy/TrainIt.au3 +++ b/COCBot/functions/CreateArmy/TrainIt.au3 @@ -170,19 +170,27 @@ Func GetVariable(Const $ImageToUse, Const $iIndex) Else If $g_bDebugSetlogTrain Then SetLog("String: " & $asResult[0]) Local $aResult = StringSplit($asResult[0], "|", $STR_NOCOUNT) - Local $aCoordinates = StringSplit($aResult[1], ",", $STR_NOCOUNT) - Local $iButtonX = 25 + Int($aCoordinates[0]) - Local $iButtonY = 375 + Int($aCoordinates[1]) - Local $sColorToCheck = "0x" & _GetPixelColor($iButtonX, $iButtonY, $g_bCapturePixel) - Local $iTolerance = 40 - Local $aTrainPos[4] = [$iButtonX, $iButtonY, $sColorToCheck, $iTolerance] - If $g_bDebugSetlogTrain Then SetLog("Found: [" & $iButtonX & "," & $iButtonY & "]", $COLOR_SUCCESS) - If $g_bDebugSetlogTrain Then SetLog("$sColorToCheck: " & $sColorToCheck, $COLOR_SUCCESS) - If $g_bDebugSetlogTrain Then SetLog("$iTolerance: " & $iTolerance, $COLOR_SUCCESS) - Return $aTrainPos + If UBound($aResult) > 1 Then + Local $aCoordinates = StringSplit($aResult[1], ",", $STR_NOCOUNT) + If UBound($aCoordinates) > 1 Then + Local $iButtonX = 25 + Int($aCoordinates[0]) + Local $iButtonY = 375 + Int($aCoordinates[1]) + Local $sColorToCheck = "0x" & _GetPixelColor($iButtonX, $iButtonY, $g_bCapturePixel) + Local $iTolerance = 40 + Local $aTrainPos[4] = [$iButtonX, $iButtonY, $sColorToCheck, $iTolerance] + If $g_bDebugSetlogTrain Then SetLog("Found: [" & $iButtonX & "," & $iButtonY & "]", $COLOR_SUCCESS) + If $g_bDebugSetlogTrain Then SetLog("$sColorToCheck: " & $sColorToCheck, $COLOR_SUCCESS) + If $g_bDebugSetlogTrain Then SetLog("$iTolerance: " & $iTolerance, $COLOR_SUCCESS) + Return $aTrainPos + Else + SetLog("Don't know how to train the troop with index " & $iIndex & " yet.") + EndIf + Else + SetLog("Don't know how to train the troop with index " & $iIndex & " yet..") + EndIf EndIf Else - SetLog("Don't know how to train the troop with index " & $iIndex & " yet") + SetLog("Don't know how to train the troop with index " & $iIndex & " yet...") EndIf Return $aTrainPos EndFunc ;==>GetVariable diff --git a/COCBot/functions/CreateArmy/TrainSystem.au3 b/COCBot/functions/CreateArmy/TrainSystem.au3 index 06ae263d9..2cd9c32dd 100644 --- a/COCBot/functions/CreateArmy/TrainSystem.au3 +++ b/COCBot/functions/CreateArmy/TrainSystem.au3 @@ -284,27 +284,22 @@ Func CheckIfArmyIsReady() EndIf EndIf - If (IsSearchModeActive($DB) And checkCollectors(True, False)) Or IsSearchModeActive($LB) Or IsSearchModeActive($TS) Then - If $g_bFullArmy And $g_bCheckSpells And $bFullArmyHero And $bFullArmyCC And $bFullSiege Then - $g_bIsFullArmywithHeroesAndSpells = True - If $g_bFirstStart Then $g_bFirstStart = False - Else - If $g_bDebugSetlog Then - SetDebugLog(" $g_bFullArmy: " & String($g_bFullArmy), $COLOR_DEBUG) - SetDebugLog(" $g_bCheckSpells: " & String($g_bCheckSpells), $COLOR_DEBUG) - SetDebugLog(" $bFullArmyHero: " & String($bFullArmyHero), $COLOR_DEBUG) - SetDebugLog(" $bFullSiege: " & String($bFullSiege), $COLOR_DEBUG) - SetDebugLog(" $bFullArmyCC: " & String($bFullArmyCC), $COLOR_DEBUG) - EndIf - $g_bIsFullArmywithHeroesAndSpells = False - EndIf - If $g_bFullArmy And $g_bCheckSpells And $bFullArmyHero Then ; Force Switch while waiting for CC in SwitchAcc - If Not $bFullArmyCC Then $g_bWaitForCCTroopSpell = True - EndIf + If $g_bFullArmy And $g_bCheckSpells And $bFullArmyHero And $bFullArmyCC And $bFullSiege Then + $g_bIsFullArmywithHeroesAndSpells = True + If $g_bFirstStart Then $g_bFirstStart = False Else - If $g_bDebugSetlog Then SetDebugLog(" Army not ready: IsSearchModeActive($DB)=" & IsSearchModeActive($DB) & ", checkCollectors(True, False)=" & checkCollectors(True, False) & ", IsSearchModeActive($LB)=" & IsSearchModeActive($LB) & ", IsSearchModeActive($TS)=" & IsSearchModeActive($TS), $COLOR_DEBUG) + If $g_bDebugSetlog Then + SetDebugLog(" $g_bFullArmy: " & String($g_bFullArmy), $COLOR_DEBUG) + SetDebugLog(" $g_bCheckSpells: " & String($g_bCheckSpells), $COLOR_DEBUG) + SetDebugLog(" $bFullArmyHero: " & String($bFullArmyHero), $COLOR_DEBUG) + SetDebugLog(" $bFullSiege: " & String($bFullSiege), $COLOR_DEBUG) + SetDebugLog(" $bFullArmyCC: " & String($bFullArmyCC), $COLOR_DEBUG) + EndIf $g_bIsFullArmywithHeroesAndSpells = False EndIf + If $g_bFullArmy And $g_bCheckSpells And $bFullArmyHero Then ; Force Switch while waiting for CC in SwitchAcc + If Not $bFullArmyCC Then $g_bWaitForCCTroopSpell = True + EndIf Local $sLogText = "" If Not $g_bFullArmy Then $sLogText &= " Troops," diff --git a/COCBot/functions/CreateArmy/getArmyHeroes/getArmyHeroCount.au3 b/COCBot/functions/CreateArmy/getArmyHeroes/getArmyHeroCount.au3 index 3a117bfc6..fa38d06d5 100644 --- a/COCBot/functions/CreateArmy/getArmyHeroes/getArmyHeroCount.au3 +++ b/COCBot/functions/CreateArmy/getArmyHeroes/getArmyHeroCount.au3 @@ -317,7 +317,7 @@ Func LabGuiDisplay() ; called from main loop to get an early status for indictor ; check for upgrade in process - look for green in finish upgrade with gems button If _ColorCheck(_GetPixelColor(730, 200, True), Hex(0xA2CB6C, 6), 20) Then ; Look for light green in upper right corner of lab window. - SetLog("Laboratory is Running. ", $COLOR_INFO) + SetLog("Laboratory is Running", $COLOR_INFO) ;==========Hide Red Show Green Hide Gray=== GUICtrlSetState($g_hPicLabGray, $GUI_HIDE) GUICtrlSetState($g_hPicLabRed, $GUI_HIDE) @@ -336,6 +336,7 @@ Func LabGuiDisplay() ; called from main loop to get an early status for indictor Return True ElseIf _ColorCheck(_GetPixelColor(730, 200, True), Hex(0x8088B0, 6), 20) Then ; Look for light purple in upper right corner of lab window. SetLog("Laboratory has Stopped", $COLOR_INFO) + If $g_bNotifyTGEnable And $g_bNotifyAlertLaboratoryIdle Then NotifyPushToTelegram($g_sNotifyOrigin & " | " & GetTranslatedFileIni("MBR Func_Notify", "Laboratory-Idle_Info_01", "Laboratory Idle") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Laboratory-Idle_Info_02", "Laboratory has Stopped")) ClickP($aAway, 2, $DELAYLABORATORY4, "#0359") ;========Show Red Hide Green Hide Gray===== GUICtrlSetState($g_hPicLabGray, $GUI_HIDE) diff --git a/COCBot/functions/Image Search/imglocAuxiliary.au3 b/COCBot/functions/Image Search/imglocAuxiliary.au3 index f08c2fe28..a82d2a0a6 100644 --- a/COCBot/functions/Image Search/imglocAuxiliary.au3 +++ b/COCBot/functions/Image Search/imglocAuxiliary.au3 @@ -875,30 +875,32 @@ Func Slot($iX, $iY) ; Return Slots for Quantity Reading on Army Window If $iY < 315 Then Return 184 ; Troops If $iY > 315 Then Return 195 ; Spell - Case 244 To 307 ; Slot 4 + Case 244 To 314 ; Slot 4 If $iY < 315 Then Return 255 ; Troops If $iY > 315 Then Return 272 ; Spell - Case 308 To 392 ; Slot 5 + Case 315 To 387 ; Slot 5 If $iY < 315 Then Return 330 ; Troops If $iY > 315 Then Return 341 ; Spell - Case 393 To 464 ; Slot 6 + Case 388 To 460 ; Slot 6 If $iY < 315 Then Return 403 ; Troops If $iY > 315 Then Return 415 ; Spell - Case 465 To 540 ; Slot 7 + Case 461 To 533 ; Slot 7 If $iY < 315 Then Return 477 ; Troops If $iY > 315 Then Return 485 ; Spell - Case 538 To 610 ; Slot 8 - Return 551 ; Troops +;~ Case 534 To 600 ; Slot 7.5 (8) +;~ Return 551 ; Troops - Case 611 To 682 ; Slot 9 - Return 620 ; Siege Machines & Heroes + Case 605 To 677 ; Slot 8 + Return 620 ; Siege Machines slot 1 - Case 683 To 752 ; Slot 10 - If $iY > 315 Then Return 691 ; Heroes & Siege Machine slot 0 - Return 700 ; Siege Machines slot 1 + Case 678 To 752 ; Slot 9 + Return 693 ; Siege Machines slot 2 + + Case 754 To 826 ; Slot 10 + Return 769 ; Siege Machines slot 2 EndSwitch Else ;CC Troops & Spells Switch $iX diff --git a/COCBot/functions/Main Screen/checkObstacles.au3 b/COCBot/functions/Main Screen/checkObstacles.au3 index 86a54848b..4e2dee76d 100644 --- a/COCBot/functions/Main Screen/checkObstacles.au3 +++ b/COCBot/functions/Main Screen/checkObstacles.au3 @@ -17,7 +17,7 @@ Func checkObstacles($bBuilderBase = Default) ;Checks if something is in the way for mainscreen FuncEnter(checkObstacles) If $bBuilderBase = Default Then $bBuilderBase = False - Static $checkObstaclesActive = False + Static $iRecursive = 0 If TestCapture() = False And WinGetAndroidHandle() = 0 Then ; Android not available @@ -34,11 +34,10 @@ Func checkObstacles($bBuilderBase = Default) ;Checks if something is in the way ; Return FuncReturn(True) ;EndIf Local $wasForce = OcrForceCaptureRegion(False) - Local $checkObstaclesWasActive = $checkObstaclesActive - $checkObstaclesActive = True - Local $Result = _checkObstacles($bBuilderBase, $checkObstaclesWasActive) + $iRecursive += 1 + Local $Result = _checkObstacles($bBuilderBase, $iRecursive > 5) OcrForceCaptureRegion($wasForce) - $checkObstaclesActive = $checkObstaclesWasActive + $iRecursive -= 1 Return FuncReturn($Result) EndFunc ;==>checkObstacles @@ -134,7 +133,7 @@ Func _checkObstacles($bBuilderBase = False, $bRecursive = False) ;Checks if some Return checkObstacles_StopBot($msg) ; stop bot EndIf SetLog("Connection lost, Reloading CoC...", $COLOR_ERROR) - If $g_bChkSharedPrefs And HaveSharedPrefs() Then + If ($g_bChkSharedPrefs Or $g_bUpdateSharedPrefs) And HaveSharedPrefs() Then SetLog("Please wait for loading CoC...!") PushSharedPrefs() If Not $bRecursive Then OpenCoC() @@ -222,7 +221,7 @@ Func _checkObstacles($bBuilderBase = False, $bRecursive = False) ;Checks if some BanMsgBox() Return checkObstacles_StopBot($msg) ; stop bot EndIf - SetLog("Warning: Can not find type of Reload error message", $COLOR_ERROR) + SetLog("Warning: Cannot find type of Reload error message", $COLOR_ERROR) EndSelect If TestCapture() Then Return "Village is out of sync or inactivity or connection lost or maintenance" Return checkObstacles_ReloadCoC($aReloadButton, "#0131", $bRecursive) ; Click for out of sync or inactivity or connection lost or maintenance diff --git a/COCBot/functions/Other/CheckPrerequisites.au3 b/COCBot/functions/Other/CheckPrerequisites.au3 index 39f96ebdd..b20b1705f 100644 --- a/COCBot/functions/Other/CheckPrerequisites.au3 +++ b/COCBot/functions/Other/CheckPrerequisites.au3 @@ -102,6 +102,7 @@ Func isEveryFileInstalled($bSilent = False) $g_sLibPath & "\ImageSearchDLL.dll", _ $g_sLibPath & "\MBRBot.dll", _ $g_sLibPath & "\MyBot.run.dll", _ + $g_sLibPath & "\Newtonsoft.Json.dll", _ $g_sLibPath & "\sqlite3.dll", _ $g_sLibPath & "\opencv_core220.dll", _ $g_sLibPath & "\opencv_imgproc220.dll"] @@ -115,16 +116,17 @@ Func isEveryFileInstalled($bSilent = False) If Number($xmls[0]) < 570 Then SetLog("Verify '\imgxml\' folder, found " & $xmls[0] & " *.xml files.", $COLOR_ERROR) EndIf + Local $MsgBox = 0 + Local $sText1 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_01", "Hey Chief, we are missing some files!") + Local $sText2 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_02", "Please extract all files and folders and start this program again!") + Local $sText3 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_03", "Sorry, Start button disabled until fixed!") + Local $sText4 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_04", "Hey Chief, file name incorrect!") + Local $sText5 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_05", 'You have renamed the file "MyBot.run.exe"! Please change it back to MyBot.run.exe and restart the bot!') If $iCount = UBound($aCheckFiles) Then $bResult = True ElseIf Not $bSilent Then GUICtrlSetState($g_hBtnStart, $GUI_DISABLE) - Local $sText1 = "", $sText2 = "", $sText3 = "", $MsgBox = 0 - $sText1 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_01", "Hey Chief, we are missing some files!") - $sText2 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_02", "Please extract all files and folders and start this program again!") - $sText3 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_03", "Sorry, Start button disabled until fixed!") - SetLog($sText1, $COLOR_ERROR) SetLog($sText2, $COLOR_ERROR) SetLog($sText3, $COLOR_ERROR) @@ -136,17 +138,13 @@ Func isEveryFileInstalled($bSilent = False) If @Compiled Then ;if .exe If Not StringInStr(@ScriptFullPath, "MyBot.run.exe", 1) Then ; if filename isn't MyBot.run.exe If Not $bSilent Then - Local $sText1, $sText2, $MsgBox - $sText1 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_04", "Hey Chief, file name incorrect!") - $sText2 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_05", 'You have renamed the file "MyBot.run.exe"! Please change it back to MyBot.run.exe and restart the bot!') - $sText3 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_03", "Sorry, Start button disabled until fixed!") - + SetLog($sText1, $COLOR_ERROR) - SetLog($sText2, $COLOR_ERROR) + SetLog($sText5, $COLOR_ERROR) SetLog($sText3, $COLOR_ERROR) _ExtMsgBoxSet(1 + 64, $SS_CENTER, 0x004080, 0xFFFF00, 12, "Comic Sans MS", 500) - $MsgBox = _ExtMsgBox(48, GetTranslatedFileIni("MBR Popups", "Ok", "Ok"), $sText1, $sText2, 0) + $MsgBox = _ExtMsgBox(48, GetTranslatedFileIni("MBR Popups", "Ok", "Ok"), $sText1, $sText5, 0) GUICtrlSetState($g_hBtnStart, $GUI_DISABLE) EndIf $bResult = False diff --git a/COCBot/functions/Other/Click.au3 b/COCBot/functions/Other/Click.au3 index 7d7a5722f..885bbfa82 100644 --- a/COCBot/functions/Other/Click.au3 +++ b/COCBot/functions/Other/Click.au3 @@ -71,8 +71,6 @@ Func _ControlClick($x, $y) $y += $g_aiBSrpos[1] EndIf If $g_iAndroidControlClickMode = 0 Then - Opt("MouseClickDelay", $g_iAndroidControlClickDelay) ;Default: 10 milliseconds - Opt("MouseClickDownDelay", $g_iAndroidControlClickDownDelay) ;Default: 2 milliseconds Return ControlClick($hWin, "", "", "left", "1", $x, $y) EndIf Local $WM_LBUTTONDOWN = 0x0201, $WM_LBUTTONUP = 0x0202 diff --git a/COCBot/functions/Other/ForumAuthentication.au3 b/COCBot/functions/Other/ForumAuthentication.au3 index c155fa992..5ddb0f9b9 100644 --- a/COCBot/functions/Other/ForumAuthentication.au3 +++ b/COCBot/functions/Other/ForumAuthentication.au3 @@ -11,11 +11,15 @@ ; Example .......: ; =============================================================================================================================== +Global Enum $g_eForumAuthenticationWaiting, $g_eForumAuthenticationLogin, $g_eForumAuthenticationExit +Global $g_hGuiForumAuthentication = 0 +Global $g_hForumAuthenticationState = $g_eForumAuthenticationWaiting, $g_hForumAuthenticationLogin, $g_hForumAuthenticationExit, $g_hForumAuthenticationUser, $g_hForumAuthenticationPass + Func ForumAuthentication() ; load text so translation is upadted Local $sLogLogPleaseEnter = GetTranslatedFileIni("MBR Authentication", "LogPleaseEnter", "Please enter your Mybot.run Forum username and password") - Local $sLogPasswordIsSave = GetTranslatedFileIni("MBR Authentication", "LogPasswordIsSave", "Your password is not saved anywhere and secure!") + Local $sLogPasswordIsSave = GetTranslatedFileIni("MBR Authentication", "LogPasswordIsSave", "Password is only used once to authenticate and nowhere saved!") Local $sTitleUsername = GetTranslatedFileIni("MBR Authentication", "Username", "Username") Local $sTitlePassword = GetTranslatedFileIni("MBR Authentication", "Password", "Password") Local $sYouNeedToLogin = GetTranslatedFileIni("MBR Authentication", "YouNeedToLogin", "You need to login to MyBot.run Forum...") @@ -30,76 +34,101 @@ Func ForumAuthentication() GetTranslatedFileIni("MBR Authentication", "BotIsAuthenticated", "MyBot.run is authenticated") GetTranslatedFileIni("MBR Authentication", "BotIsNotAuthenticated", "Error authenticating Mybot.run") + Local $bNotAuthenticated = ($g_hGuiForumAuthentication <> 0) + + ; check if migration is required + Local $sOldFile = @MyDocumentsDir & "\MyBot.run-Profiles\.mybot.run.authentication" + If FileExists($g_sPrivateAuthenticationFile) = 0 And FileExists($sOldFile) = 1 Then FileMove($sOldFile, $g_sPrivateAuthenticationFile) + If FileExists($g_sPrivateAuthenticationFile) = 0 Or Not CheckForumAuthentication() Then - SetLog($sLogLogPleaseEnter, $COLOR_BLUE) - SetLog($sLogPasswordIsSave, $COLOR_BLUE) - - Local $xyt = CreateSplashScreen("Form Login") - Local $guiLogin = $g_hSplash - Local $iW = $xyt[0] - Local $iH = $xyt[1] - Local $iT = $xyt[2] - Local $iSpace = 20 - Local $iButtonTop = $iH - 20 - $iSpace - GUICtrlCreateLabel($sTitleUsername, $iSpace, $iButtonTop - 22, 100, 20) - Local $hUser = GUICtrlCreateInput("", $iSpace, $iButtonTop, 100, 20) - GUICtrlSetLimit($hUser, 128, 1) - GUICtrlCreateLabel($sTitlePassword, $iSpace + 100 + 5, $iButtonTop - 22, 100, 20) - Local $hPass = GUICtrlCreateInput("", $iSpace + 100 + 5, $iButtonTop, 100, 20, BitOR($ES_PASSWORD, $GUI_SS_DEFAULT_INPUT)) - GUICtrlSetLimit($hPass, 128, 1) - Local $iTextAddWidth = 30 - Local $hText = GUICtrlCreateLabel($sYouNeedToLogin, $iSpace + 100 + 5 + 100 + 5 - $iTextAddWidth, $iButtonTop - 22, $iW - $iSpace - ($iSpace + 100 + 5 + 100 + 5) + $iTextAddWidth, 20, $SS_RIGHT) - Local $hLogin = GUICtrlCreateButton($sLogin, $iW - 50 - $iSpace, $iButtonTop, 50, 25, $BS_DEFPUSHBUTTON) - Local $hExit = GUICtrlCreateButton($sExit, $iW - (50 + $iSpace + 50 + 5), $iButtonTop, 50, 25) - - ControlFocus($guiLogin, "", $hUser) - - Local $iOpt = Opt("GUIOnEventMode", 0) - - GUISetState(@SW_SHOW, $guiLogin) - Local $bOk = False - - Local $hTimer = __TimerInit() - While True - Switch GUIGetMsg() - Case $GUI_EVENT_CLOSE, $hExit - ExitLoop - Case $hLogin - Local $sUser = GUICtrlRead($hUser) - Local $sPass = GUICtrlRead($hPass) - If $sUser = "" Or $sPass = "" Then - GUICtrlSetData($hText, $sPleaseEnter) - Else - ;SetDebugLog("ForumAuthentication: username=" & $sUser & ", password=" & $sPass) ; ONLY ENABLE WHEN YOU REALLY NEED TO VALIDATE YOUR INPUT - Local $json = ForumLogin($sUser, $sPass) - If StringInStr($json, '"access_token"') And CheckForumAuthentication() Then - GUICtrlSetData($hText, $sWelcome) - Sleep(1000) - $bOk = True - ExitLoop + + If $bNotAuthenticated Then + + ; Bot will not run 100% stable!!! + SetLog($sAuthenticationFailed1, $COLOR_ERROR) + SetLog($sAuthenticationFailed2, $COLOR_ERROR) + _Sleep(5000) + Return False + + Else + + SetLog($sLogLogPleaseEnter, $COLOR_BLUE) + SetLog($sLogPasswordIsSave, $COLOR_BLUE) + + Local $xyt = CreateSplashScreen("Form Login") + Local $guiLogin = $g_hSplash + $g_hGuiForumAuthentication = $guiLogin + Local $iW = $xyt[0] + Local $iH = $xyt[1] + Local $iT = $xyt[2] + Local $iSpace = 20 + Local $iButtonTop = $iH - 20 - $iSpace + GUICtrlCreateLabel($sTitleUsername, $iSpace, $iButtonTop - 22, 100, 20) + Local $hUser = GUICtrlCreateInput("", $iSpace, $iButtonTop, 100, 20) + GUICtrlSetLimit($hUser, 128, 1) + GUICtrlCreateLabel($sTitlePassword, $iSpace + 100 + 5, $iButtonTop - 22, 100, 20) + Local $hPass = GUICtrlCreateInput("", $iSpace + 100 + 5, $iButtonTop, 100, 20, BitOR($ES_PASSWORD, $GUI_SS_DEFAULT_INPUT)) + GUICtrlSetLimit($hPass, 128, 1) + Local $iTextAddWidth = 30 + Local $hText = GUICtrlCreateLabel($sYouNeedToLogin, $iSpace + 100 + 5 + 100 + 5 - $iTextAddWidth, $iButtonTop - 22, $iW - $iSpace - ($iSpace + 100 + 5 + 100 + 5) + $iTextAddWidth, 20, $SS_RIGHT) + $g_hForumAuthenticationLogin = GUICtrlCreateButton($sLogin, $iW - 50 - $iSpace, $iButtonTop, 50, 25, $BS_DEFPUSHBUTTON) + GUICtrlSetOnEvent(-1, "ForumAuthenticationLogin") + $g_hForumAuthenticationExit = GUICtrlCreateButton($sExit, $iW - (50 + $iSpace + 50 + 5), $iButtonTop, 50, 25) + GUICtrlSetOnEvent(-1, "ForumAuthenticationExit") + ControlFocus($guiLogin, "", $hUser) + + GUISetState(@SW_SHOW, $guiLogin) + Local $bOk = False + + Local $hTimer = __TimerInit() + While True + Switch $g_hForumAuthenticationState + Case $g_eForumAuthenticationLogin + Local $sUser = GUICtrlRead($hUser) + Local $sPass = GUICtrlRead($hPass) + If $sUser = "" Or $sPass = "" Then + GUICtrlSetData($hText, $sPleaseEnter) Else - GUICtrlSetData($hText, $sLoginFailed) + ;SetDebugLog("ForumAuthentication: username=" & $sUser & ", password=" & $sPass) ; ONLY ENABLE WHEN YOU REALLY NEED TO VALIDATE YOUR INPUT + Local $json = ForumLogin($sUser, $sPass) + If StringInStr($json, '"access_token"') And CheckForumAuthentication() Then + GUICtrlSetData($hText, $sWelcome) + Sleep(1000) + $bOk = True + ExitLoop + Else + GUICtrlSetData($hText, $sLoginFailed) + EndIf EndIf - EndIf - Case Else - ; move window - _WinAPI_PostMessage($guiLogin, $WM_SYSCOMMAND, 0xF012, 0) ; SC_DRAGMOVE = 0xF012 - EndSwitch - ; exit after 15 Minutes, but: Bot will not run 100% stable!!! - If __TimerDiff($hTimer) / 1000 > 15 * 60 Then - SetLog($sAuthenticationFailed1, $COLOR_ERROR) - SetLog($sAuthenticationFailed2, $COLOR_ERROR) - $bOk = True - ExitLoop - EndIf - WEnd - - GUIDelete($guiLogin) - Opt("GUIOnEventMode", $iOpt) - - If Not $bOk Then BotClose() + Case $g_eForumAuthenticationExit + ExitLoop + EndSwitch + ; exit after 15 Minutes, but: Bot will not run 100% stable!!! + If __TimerDiff($hTimer) / 1000 > 15 * 60 Then + SetLog($sAuthenticationFailed1, $COLOR_ERROR) + SetLog($sAuthenticationFailed2, $COLOR_ERROR) + $bOk = True + ExitLoop + EndIf + $g_hForumAuthenticationState = $g_eForumAuthenticationWaiting ; reset state + Sleep(100) + WEnd + + GUIDelete($guiLogin) + $g_hGuiForumAuthentication = 0 + + If Not $bOk Then BotClose() + + EndIf EndIf Return True EndFunc ;==>ForumAuthentication +Func ForumAuthenticationLogin() + $g_hForumAuthenticationState = $g_eForumAuthenticationLogin +EndFunc ;==>ForumAuthenticationLogin + +Func ForumAuthenticationExit() + $g_hForumAuthenticationState = $g_eForumAuthenticationExit +EndFunc ;==>ForumAuthenticationexit diff --git a/COCBot/functions/Other/MBRFunc.au3 b/COCBot/functions/Other/MBRFunc.au3 index 937bfe57b..f937ee407 100644 --- a/COCBot/functions/Other/MBRFunc.au3 +++ b/COCBot/functions/Other/MBRFunc.au3 @@ -115,7 +115,7 @@ EndFunc ;==>debugMBRFunctions Func setAndroidPID($pid = GetAndroidPid()) If $g_hLibMyBot = -1 Then Return ; Bot didn't finish launch yet SetDebugLog("setAndroidPID: $pid=" & $pid) - Local $result = DllCall($g_hLibMyBot, "str", "setAndroidPID", "int", $pid) + Local $result = DllCall($g_hLibMyBot, "str", "setAndroidPID", "int", $pid, "str", $g_sBotVersion, "str", $g_sAndroidEmulator, "str", $g_sAndroidVersion, "str", $g_sAndroidInstance) If @error Then _logErrorDLLCall($g_sLibMyBotPath & ", setAndroidPID:", @error) Return SetError(@error) @@ -178,7 +178,7 @@ EndFunc ;==>CheckForumAuthentication Func ForumLogin($sUsername, $sPassword) If $g_hLibMyBot = -1 Then Return False ; Bot didn't finish launch yet - Local $result = DllCall($g_hLibMyBot, "str", "ForumLogin", "str", _Base64Encode(StringToBinary($sUsername, 4), 1024), "str", _Base64Encode(StringToBinary($sPassword, 4), 1024), "str", _Base64Encode(StringToBinary($g_sBotTitle, 4), 1024)) + Local $result = DllCall($g_hLibMyBot, "str", "ForumLogin", "str", _Base64Encode(StringToBinary($sUsername, 4), 1024), "str", _Base64Encode(StringToBinary($sPassword, 4), 1024)) If @error Then _logErrorDLLCall($g_sLibMyBotPath & ", ForumLogin:", @error) Return SetError(@error) diff --git a/COCBot/functions/Village/SwitchAccount.au3 b/COCBot/functions/Village/SwitchAccount.au3 index 95a3b70a7..6f78fd16a 100644 --- a/COCBot/functions/Village/SwitchAccount.au3 +++ b/COCBot/functions/Village/SwitchAccount.au3 @@ -342,7 +342,7 @@ Func SwitchCOCAcc($NextAccount) SetSwitchAccLog("Switched to Acc [" & $NextAccount + 1 & "]", $COLOR_SUCCESS) - If $g_bChkSharedPrefs Then + If $g_bChkSharedPrefs And Not ($g_bUpdateSharedPrefs And $g_bUpdateSharedPrefsGoogleDisconnected) Then ; disconnect account again for saving shared_prefs waitMainScreen() If IsMainPage() Then diff --git a/CSV/Attack/Max-Human-Like TH12 LavaLoonion.csv b/CSV/Attack/Max-Human-Like TH12 LavaLoonion.csv new file mode 100644 index 000000000..aa8be42cf --- /dev/null +++ b/CSV/Attack/Max-Human-Like TH12 LavaLoonion.csv @@ -0,0 +1,73 @@ +NOTE |Author: DUC4TI +NOTE |TH-level: 12 +NOTE |set deploy line on "EXTERNAL EDGES" +NOTE |TRAIN 2 Lava Hounds, 36 Balloons, 20 Minions, 3 Rage, 3 Haste, 2 freeze +NOTE |CC requirements: 1 Rage, 8 Balloons, 1 Siege Machine +NOTE |Siege setting: Any Siege Machine + | | | | | | | | | + |EXTR. GOLD |EXTR.ELIXIR|EXTR. DARK |DEPO. GOLD |DEPO.ELIXIR|DEPO. DARK |TOWNHALL |FORCED SIDE| +SIDE |0 |0 |0 |0 |0 |0 | 0 | | + | | | | | | | | | + |EAGLE |INFERNO |XBOW |WIZTOWER |MORTAR |AIRDEFENSE |AIRSWEEPER | | +SIDEB |20 |0 |0 |0 |0 |0 |0 | | + | | | | | | | | | + |VECTOR |SIDE |DROP_POINTS|ADDTILES |VERSUS |RANDOMX_PX |RANDOMY_PX |BUILDING | + | | | | | | | | | +MAKE |A |FRONT-LEFT |10 |2 |EXT-INT |0 |0 | | +MAKE |B |FRONT-RIGHT|10 |2 |INT-EXT |0 |0 | | +MAKE |C |FRONT-LEFT |10 |-4 |EXT-INT |0 |0 | | +MAKE |D |FRONT-RIGHT|10 |-5 |INT-EXT |0 |0 | | +MAKE |E |FRONT-LEFT |10 |-12 |EXT-INT |0 |0 | | +MAKE |F |FRONT-RIGHT|10 |-12 |INT-EXT |0 |0 | | +MAKE |X |FRONT-LEFT |1 |0 |IGNORE | | |TOWNHALL | +MAKE |Y |FRONT-LEFT |1 |0 |IGNORE | | |EAGLE | + | | | | | | | | | + |VECTOR |INDEX |QTY_X_VECT |TROOPNAME |DELAY_DROP |DELAYCHANGE|SLEEPAFTER | | +DROP |A |8 |1 |Lava |70-90 |27-50 |200-250 | | +DROP |B |3 |1 |Lava |70-90 |27-50 |100-150 | | + | | | | | | | | | +DROP |B |1 |1 |Castle |0 |0 |150-170 | | +DROP |B |1 |1 |WallW |0 |0 |150-170 | | +DROP |B |1 |1 |BattleB |0 |0 |150-170 | | +DROP |B |1 |1 |StoneS |0 |0 |150-170 | | + | | | | | | | | | +WAIT |2000-2050 | | | | | | | | + | | | | | | | | | +DROP |A |6,7,8,9,10 |5 |Ball |70-90 |27-50 |15-20 | | +DROP |B |1,2,3,4,5 |5 |Ball |70-90 |27-50 |15-20 | | +DROP |B |4,3,2,1 |4 |Ball |75-90 |27-50 |15-20 | | +DROP |A |10,9,8,7 |4 |Ball |70-90 |27-50 |15-20 | | +DROP |A |6,7,8,9,10 |5 |Ball |70-90 |27-50 |15-20 | | +DROP |B |1,2,3,4,5 |5 |Ball |70-90 |27-50 |15-20 | | +DROP |B |4,3,2,1 |4 |Ball |70-90 |27-50 |15-20 | | +DROP |A |10,9,8,7 |4 |Ball |70-90 |27-50 |15-20 | | +DROP |Y |1 |1 |FSpell |50-100 |0 |0 | | + | | | | | | | | | +DROP |C |8 |1 |HaSpell |50-100 |0 |50-70 | | +DROP |D |1 |1 |HaSpell |50-100 |0 |50-70 | | +DROP |D |4 |1 |HaSpell |50-100 |0 |50-70 | | +DROP |B |1 |1 |Warden |70-100 |0 |100-150 | | + | | | | | | | | | +WAIT |2000-2050 | | | | | | | | + | | | | | | | | | +DROP |E |8 |1 |RSpell |50-100 |0 |50-70 | | +DROP |F |1 |1 |RSpell |50-100 |0 |50-70 | | +DROP |F |4 |1 |RSpell |50-100 |0 |50-70 | | + | | | | | | | | | +DROP |A |1,2,3,4,5 |5 |Mini |75-90 |27-50 |40-70 | | +DROP |A |6,7,8,9,10 |5 |Mini |75-90 |27-50 |40-70 | | +DROP |B |1,2,3,4,5 |5 |Mini |75-90 |27-50 |40-70 | | +DROP |B |6,7,8,9,10 |5 |Mini |75-90 |27-50 |100-150 | | + | | | | | | | | | +WAIT |2000-2050 | | | | | | | | + | | | | | | | | | +DROP |B |1 |1 |King |70-100 |0 |150-180 | | +DROP |B |1 |1 |Queen |70-100 |0 |0 | | + | | | | | | | | | +WAIT |60000 |TH,SIEGE | | | | | | | + | | | | | | | | | +DROP |B |1 |1 |Warden |0 |0 |0 | |Activate Grand Warden +DROP |X |1 |1 |FSpell |50-100 |0 |0 | | +DROP |X |1 |1 |RSpell |0 |0 |0 | | + | | | | | | | | | +DROP |B |1 |1 |Remain |75-90 |27-50 |90-100 | | diff --git a/Languages/English.ini b/Languages/English.ini index 6bb48df42..90448452e 100644 --- a/Languages/English.ini +++ b/Languages/English.ini @@ -1180,6 +1180,8 @@ ChkNotifyAlertBuilderIdle=Builder Idle ChkNotifyAlertBuilderIdle_Info_01=Send an Alert when at least one builder is idle. ChkNotifyAlertCampFull=Army Camp Full ChkNotifyAlertCampFull_Info_01=Sent an Alert when your Army Camp is full. +ChkNotifyAlertLaboratoryIdle=Laboratory Idle +ChkNotifyAlertLaboratoryIdle_Info_01=Send an Alert when the laboratory is idle. ChkNotifyAlertLastAttack=Alert Last Attack ChkNotifyAlertLastAttack_Info_01=Send info about the Last Attack. ChkNotifyAlertLastRaidIMG=Last raid as image @@ -2009,6 +2011,8 @@ ChkAdbClickDragScript=Use minitouch for accurate Click && Drag ChkAdbClickDragScript_Info=Use minitouch for accurate Click & Drag.\r\nIf unchecked use more compatible 'input swipe' or WinAPI. ChkAndroidCloseWithBot=Close Android with bot ChkAndroidCloseWithBot_Info=Close also Android Emulator when bot exists. +ChkUpdateSharedPrefs=Update shared_prefs +ChkUpdateSharedPrefs_Info=Pull and push shared_prefs to reset zoom,\nset language to English, disable snow and rate popup. CmbBackgroundMode=Default|Use WinAPI (need Android DirectX)|Use ADB screencap CmbBackgroundMode_Info=Control how the Android screenshot is taken in background mode.\nDefault chooses WinAPI or screencap based on Android Emulator.\nInfo: WinAPI is faster than screencap, but screencap always works,\neven if screen is off (we call that the "True Background Mode")! CmbZoomoutMode=Default|Use Minitouch script|Use dd script|WinAPI @@ -2022,6 +2026,7 @@ BtnAndroidAdbShell=Start ADB Shell in new Console Window BtnAndroidBack=Send Back BtnAndroidHome=Send Home BtnPlayStoreGame=Clash of Clans +BtnPlayStoreGooglePlayServices=Google Play Services BtnPlayStoreNovaLauncher=Nova Launcher DisableShowTouchs=Disable Touchs EnableShowTouchs=Enable Touchs @@ -2086,7 +2091,7 @@ BotIsNotAuthenticated=Error authenticating Mybot.run Exit=Exit Login=Login LoginFailed=Login failed, username or password was incorrect. -LogPasswordIsSave=Your password is not saved anywhere and secure! +LogPasswordIsSave=Password is only used once to authenticate and nowhere saved! LogPleaseEnter=Please enter your Mybot.run Forum username and password Password=Password PleaseEnter=Please enter a username and password. diff --git a/MyBot.run.MiniGui.au3 b/MyBot.run.MiniGui.au3 index 7c326fb4c..7f3d56096 100644 --- a/MyBot.run.MiniGui.au3 +++ b/MyBot.run.MiniGui.au3 @@ -50,8 +50,6 @@ Opt("GUIEventOptions", 1) ; Handle minimize and restore for dock android support Opt("GUICloseOnESC", 0) ; Don't send the $GUI_EVENT_CLOSE message when ESC is pressed. Opt("WinTitleMatchMode", 3) ; Window Title exact match mode Opt("GUIOnEventMode", 1) -Opt("MouseClickDelay", 10) -Opt("MouseClickDownDelay", 10) Global $hNtDll = DllOpen("ntdll.dll") #cs diff --git a/MyBot.run.MiniGui.exe b/MyBot.run.MiniGui.exe index f5dc5829e..8e4f2c28d 100644 Binary files a/MyBot.run.MiniGui.exe and b/MyBot.run.MiniGui.exe differ diff --git a/MyBot.run.MiniGui_stripped.au3 b/MyBot.run.MiniGui_stripped.au3 index ed5698f03..f78942285 100644 --- a/MyBot.run.MiniGui_stripped.au3 +++ b/MyBot.run.MiniGui_stripped.au3 @@ -5,11 +5,11 @@ #pragma compile(Icon, "Images\MyBot.ico") #pragma compile(FileDescription, Clash of Clans Bot - A Free Clash of Clans bot - https://mybot.run) #pragma compile(ProductVersion, 7.7) -#pragma compile(FileVersion, 7.7.2) +#pragma compile(FileVersion, 7.7.3) #pragma compile(LegalCopyright, © https://mybot.run) #Au3Stripper_Off #Au3Stripper_On -Global $g_sBotVersion = "v7.7.2" +Global $g_sBotVersion = "v7.7.3" Opt("MustDeclareVars", 1) Global $g_sBotTitle = "" Global $g_hFrmBot = 0 @@ -2078,8 +2078,6 @@ Opt("GUIEventOptions", 1) Opt("GUICloseOnESC", 0) Opt("WinTitleMatchMode", 3) Opt("GUIOnEventMode", 1) -Opt("MouseClickDelay", 10) -Opt("MouseClickDownDelay", 10) Global $hNtDll = DllOpen("ntdll.dll") Global $g_iGlobalActiveBotsAllowed = 0 Global $g_hMutextOrSemaphoreGlobalActiveBots = 0 @@ -2611,15 +2609,15 @@ Global $g_iAndroidAdbClicksTroopDeploySize = 0 Global $g_bAndroidAdbInstanceEnabled = True Global $g_iAndroidSuspendModeFlags = 1 Global $g_bNoFocusTampering = False -Global $g_avAndroidAppConfig[8][16] = [ ["LeapDroid", "vm1", "Leapd", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "emulator-5554", 1 + 8 + 16 + 32, '# ', 'qwerty2', 1, 1], ["Nox", "nox", "No", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 4, $g_iDEFAULT_HEIGHT - 10,0, "127.0.0.1:62001", 1 + 2 + 4 + 8 + 16 + 32 + 256,'# ', '(nox Virtual Input|Android Input|Android_Input)', 0, 2], ["MEmu", "MEmu", "MEmu ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 51,$g_iDEFAULT_HEIGHT - 12,0, "127.0.0.1:21503", 2 + 4 + 8 + 16 + 32, '# ', '(Microvirt Virtual Input|User Input)', 0, 2], ["BlueStacks2","Android", "BlueStacks ", "[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 + 2 + 4 + 8 + 16 + 32 + 128,'$ ', 'BlueStacks Virtual Touch', 0, 1], ["BlueStacks", "Android", "BlueStacks App Player","[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 + 8 + 16 + 32 + 128,'$ ', 'BlueStacks Virtual Touch', 0, 1], ["iTools", "iToolsVM","iTools ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 2, $g_iDEFAULT_HEIGHT - 13,0, "127.0.0.1:54001", 1 + 2 + 4 + 8 + 16 + 32 + 64, '# ', 'iTools Virtual PassThrough Input', 0, 1], ["KOPLAYER", "KOPLAYER","KOPLAYER", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 64,$g_iDEFAULT_HEIGHT - 8, 0, "127.0.0.1:6555", 1 + 2 + 4 + 8 + 16 + 32, '# ', 'ttVM Virtual Input', 0, 2], ["Droid4X", "droid4x", "Droid4X ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 10,$g_iDEFAULT_HEIGHT + 50,0, "127.0.0.1:26944", 2 + 4 + 8 + 16 + 32, '# ', 'droid4x Virtual Input', 0, 2] ] +Global $g_avAndroidAppConfig[8][16] = [ ["Nox", "nox", "No", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 4, $g_iDEFAULT_HEIGHT - 10,0, "127.0.0.1:62001", 1+2+4+8+16+32 +256+512, '# ', '(nox Virtual Input|Android Input|Android_Input)', 0, 2], ["MEmu", "MEmu", "MEmu ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 51,$g_iDEFAULT_HEIGHT - 12,0, "127.0.0.1:21503", 2+4+8+16+32 +512, '# ', '(Microvirt Virtual Input|User Input)', 0, 2], ["BlueStacks2","Android", "BlueStacks ", "[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1+2+4+8+16+32 +128, '$ ', 'BlueStacks Virtual Touch', 0, 1], ["BlueStacks", "Android", "BlueStacks App Player","[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 +8+16+32 +128, '$ ', 'BlueStacks Virtual Touch', 0, 1], ["LeapDroid", "vm1", "Leapd", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "emulator-5554", 1 +8+16+32 +512, '# ', 'qwerty2', 1, 1], ["iTools", "iToolsVM","iTools ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 2, $g_iDEFAULT_HEIGHT - 13,0, "127.0.0.1:54001", 1+2+4+8+16+32+64 +512, '# ', 'iTools Virtual PassThrough Input', 0, 1], ["KOPLAYER", "KOPLAYER","KOPLAYER", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 64,$g_iDEFAULT_HEIGHT - 8, 0, "127.0.0.1:6555", 1+2+4+8+16+32 +512, '# ', 'ttVM Virtual Input', 0, 2], ["Droid4X", "droid4x", "Droid4X ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 10,$g_iDEFAULT_HEIGHT + 50,0, "127.0.0.1:26944", 2+4+8+16+32 +512, '# ', 'droid4x Virtual Input', 0, 2] ] +Global $__Nox_Idx = _ArraySearch($g_avAndroidAppConfig, "Nox", 0, 0, 0, 0, 1, 0) Global $__MEmu_Idx = _ArraySearch($g_avAndroidAppConfig, "MEmu", 0, 0, 0, 0, 1, 0) Global $__BS2_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks2", 0, 0, 0, 0, 1, 0) Global $__BS_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks", 0, 0, 0, 0, 1, 0) -Global $__KOPLAYER_Idx = _ArraySearch($g_avAndroidAppConfig, "KOPLAYER", 0, 0, 0, 0, 1, 0) Global $__LeapDroid_Idx = _ArraySearch($g_avAndroidAppConfig, "LeapDroid", 0, 0, 0, 0, 1, 0) Global $__iTools_Idx = _ArraySearch($g_avAndroidAppConfig, "iTools", 0, 0, 0, 0, 1, 0) +Global $__KOPLAYER_Idx = _ArraySearch($g_avAndroidAppConfig, "KOPLAYER", 0, 0, 0, 0, 1, 0) Global $__Droid4X_Idx = _ArraySearch($g_avAndroidAppConfig, "Droid4X", 0, 0, 0, 0, 1, 0) -Global $__Nox_Idx = _ArraySearch($g_avAndroidAppConfig, "Nox", 0, 0, 0, 0, 1, 0) Global $g_iAndroidBackgroundMode = 0 Global $g_iAndroidBackgroundModeDefault = 1 Global $g_iAndroidConfig = 0 @@ -2653,6 +2651,7 @@ Global $g_bAndroidBackgroundLaunch Global $g_bAndroidBackgroundLaunched Global $g_iAndroidAdbClickGroup = 50 Global $g_bAndroidCloseWithBot = False +Global $g_bUpdateSharedPrefs = False Global $g_iAndroidProcessAffinityMask = 0 Global $g_bInitAndroidActive = False Global $g_sAndroidProgramPath = "" @@ -2704,7 +2703,7 @@ Global $g_hLibNTDLL = DllOpen("ntdll.dll") Global $g_hLibUser32DLL = DllOpen("user32.dll") Global Const $g_sLibIconPath = $g_sLibPath & "\MBRBOT.dll" Global $g_iRedrawBotWindowMode = 2 -Global Enum $eIcnArcher = 1, $eIcnDonArcher, $eIcnBalloon, $eIcnDonBalloon, $eIcnBarbarian, $eIcnDonBarbarian, $eBtnTest, $eIcnBuilder, $eIcnCC, $eIcnGUI, $eIcnDark, $eIcnDragon, $eIcnDonDragon, $eIcnDrill, $eIcnElixir, $eIcnCollector, $eIcnFreezeSpell, $eIcnGem, $eIcnGiant, $eIcnDonGiant, $eIcnTrap, $eIcnGoblin, $eIcnDonGoblin, $eIcnGold, $eIcnGolem, $eIcnDonGolem, $eIcnHealer, $eIcnDonHealer, $eIcnHogRider, $eIcnDonHogRider, $eIcnHealSpell, $eIcnInferno, $eIcnJumpSpell, $eIcnLavaHound, $eIcnDonLavaHound, $eIcnLightSpell, $eIcnMinion, $eIcnDonMinion, $eIcnPekka, $eIcnDonPekka, $eIcnTreasury, $eIcnRageSpell, $eIcnTroops, $eIcnHourGlass, $eIcnTH1, $eIcnTH10, $eIcnTrophy, $eIcnValkyrie, $eIcnDonValkyrie, $eIcnWall, $eIcnWallBreaker, $eIcnDonWallBreaker, $eIcnWitch, $eIcnDonWitch, $eIcnWizard, $eIcnDonWizard, $eIcnXbow, $eIcnBarrackBoost, $eIcnMine, $eIcnCamp, $eIcnBarrack, $eIcnSpellFactory, $eIcnDonBlacklist, $eIcnSpellFactoryBoost, $eIcnMortar, $eIcnWizTower, $eIcnPayPal, $eIcnNotify, $eIcnGreenLight, $eIcnLaboratory, $eIcnRedLight, $eIcnBlank, $eIcnYellowLight, $eIcnDonCustom, $eIcnTombstone, $eIcnSilverStar, $eIcnGoldStar, $eIcnDarkBarrack, $eIcnCollectorLocate, $eIcnDrillLocate, $eIcnMineLocate, $eIcnBarrackLocate, $eIcnDarkBarrackLocate, $eIcnDarkSpellFactoryLocate, $eIcnDarkSpellFactory, $eIcnEarthQuakeSpell, $eIcnHasteSpell, $eIcnPoisonSpell, $eIcnBldgTarget, $eIcnBldgX, $eIcnRecycle, $eIcnHeroes, $eIcnBldgElixir, $eIcnBldgGold, $eIcnMagnifier, $eIcnWallElixir, $eIcnWallGold, $eIcnKing, $eIcnQueen, $eIcnDarkSpellBoost, $eIcnQueenBoostLocate, $eIcnKingBoostLocate, $eIcnKingUpgr, $eIcnQueenUpgr, $eIcnWardenUpgr, $eIcnWarden, $eIcnWardenBoostLocate, $eIcnKingBoost, $eIcnQueenBoost, $eIcnWardenBoost, $eEmpty3, $eIcnReload, $eIcnCopy, $eIcnAddcvs, $eIcnEdit, $eIcnTreeSnow, $eIcnSleepingQueen, $eIcnSleepingKing, $eIcnGoldElixir, $eIcnBowler, $eIcnDonBowler, $eIcnCCDonate, $eIcnEagleArt, $eIcnGembox, $eIcnInferno4, $eIcnInfo, $eIcnMain, $eIcnTree, $eIcnProfile, $eIcnCCRequest, $eIcnTelegram, $eIcnTiles, $eIcnXbow3, $eIcnBark, $eIcnDailyProgram, $eIcnLootCart, $eIcnSleepMode, $eIcnTH11, $eIcnTrainMode, $eIcnSleepingWarden, $eIcnCloneSpell, $eIcnSkeletonSpell, $eIcnBabyDragon, $eIcnDonBabyDragon, $eIcnMiner, $eIcnDonMiner, $eIcnNoShield, $eIcnDonCustomB, $eIcnAirdefense, $eIcnDarkBarrackBoost, $eIcnDarkElixirStorage, $eIcnSpellsCost, $eIcnTroopsCost, $eIcnResetButton, $eIcnNewSmartZap, $eIcnTrain, $eIcnAttack, $eIcnDelay, $eIcnReOrder, $eIcn2Arrow, $eIcnArrowLeft, $eIcnArrowRight, $eIcnAndroid, $eHdV04, $eHdV05, $eHdV06, $eHdV07, $eHdV08, $eHdV09, $eHdV10, $eHdV11, $eUnranked, $eBronze, $eSilver, $eGold, $eCrystal, $eMaster, $eChampion, $eTitan, $eLegend, $eWall04, $eWall05, $eWall06, $eWall07, $eWall08, $eWall09, $eWall10, $eWall11, $eIcnPBNotify, $eIcnCCTroops, $eIcnCCSpells, $eIcnSpellsGroup, $eBahasaIND, $eChinese_S, $eChinese_T, $eEnglish, $eFrench, $eGerman, $eItalian, $ePersian, $eRussian, $eSpanish, $eTurkish, $eMissingLangIcon, $eWall12, $ePortuguese, $eIcnDonPoisonSpell, $eIcnDonEarthQuakeSpell, $eIcnDonHasteSpell, $eIcnDonSkeletonSpell, $eVietnamese, $eKorean, $eAzerbaijani, $eArabic, $eIcnBuilderHall, $eIcnClockTower, $eIcnElixirCollectorL5, $eIcnGemMine, $eIcnGoldMineL5, $eIcnElectroDragon, $eIcnTH12, $eHdV12, $eWall13, $eIcnGrayShield, $eIcnBlueShield, $eIcnGreenShield, $eIcnRedShield, $eIcnBattleB , $eIcnWallW, $eIcnSiegeCost, $eIcnBoostPotion, $eIcnBatSpell, $eIcnStoneS, $eIcnIceGolem, $eIcnStarLaboratory, $eIcnRagedBarbarian, $eIcnSneakyArcher, $eIcnBoxerGiant, $eIcnBetaMinion, $eIcnBomber, $eIcnBBBabyDragon, $eIcnCannonCart, $eIcnNightWitch, $eIcnDropShip, $eIcnSuperPekka, $eIcnBBWall01, $eIcnBBWall02, $eIcnBBWall03, $eIcnBBWall04, $eIcnBBWall05, $eIcnBBWall06, $eIcnBBWall07, $eIcnBBWall08 +Global Enum $eIcnArcher = 1, $eIcnDonArcher, $eIcnBalloon, $eIcnDonBalloon, $eIcnBarbarian, $eIcnDonBarbarian, $eBtnTest, $eIcnBuilder, $eIcnCC, $eIcnGUI, $eIcnDark, $eIcnDragon, $eIcnDonDragon, $eIcnDrill, $eIcnElixir, $eIcnCollector, $eIcnFreezeSpell, $eIcnGem, $eIcnGiant, $eIcnDonGiant, $eIcnTrap, $eIcnGoblin, $eIcnDonGoblin, $eIcnGold, $eIcnGolem, $eIcnDonGolem, $eIcnHealer, $eIcnDonHealer, $eIcnHogRider, $eIcnDonHogRider, $eIcnHealSpell, $eIcnInferno, $eIcnJumpSpell, $eIcnLavaHound, $eIcnDonLavaHound, $eIcnLightSpell, $eIcnMinion, $eIcnDonMinion, $eIcnPekka, $eIcnDonPekka, $eIcnTreasury, $eIcnRageSpell, $eIcnTroops, $eIcnHourGlass, $eIcnTH1, $eIcnTH10, $eIcnTrophy, $eIcnValkyrie, $eIcnDonValkyrie, $eIcnWall, $eIcnWallBreaker, $eIcnDonWallBreaker, $eIcnWitch, $eIcnDonWitch, $eIcnWizard, $eIcnDonWizard, $eIcnXbow, $eIcnBarrackBoost, $eIcnMine, $eIcnCamp, $eIcnBarrack, $eIcnSpellFactory, $eIcnDonBlacklist, $eIcnSpellFactoryBoost, $eIcnMortar, $eIcnWizTower, $eIcnPayPal, $eIcnNotify, $eIcnGreenLight, $eIcnLaboratory, $eIcnRedLight, $eIcnBlank, $eIcnYellowLight, $eIcnDonCustom, $eIcnTombstone, $eIcnSilverStar, $eIcnGoldStar, $eIcnDarkBarrack, $eIcnCollectorLocate, $eIcnDrillLocate, $eIcnMineLocate, $eIcnBarrackLocate, $eIcnDarkBarrackLocate, $eIcnDarkSpellFactoryLocate, $eIcnDarkSpellFactory, $eIcnEarthQuakeSpell, $eIcnHasteSpell, $eIcnPoisonSpell, $eIcnBldgTarget, $eIcnBldgX, $eIcnRecycle, $eIcnHeroes, $eIcnBldgElixir, $eIcnBldgGold, $eIcnMagnifier, $eIcnWallElixir, $eIcnWallGold, $eIcnKing, $eIcnQueen, $eIcnDarkSpellBoost, $eIcnQueenBoostLocate, $eIcnKingBoostLocate, $eIcnKingUpgr, $eIcnQueenUpgr, $eIcnWardenUpgr, $eIcnWarden, $eIcnWardenBoostLocate, $eIcnKingBoost, $eIcnQueenBoost, $eIcnWardenBoost, $eEmpty3, $eIcnReload, $eIcnCopy, $eIcnAddcvs, $eIcnEdit, $eIcnTreeSnow, $eIcnSleepingQueen, $eIcnSleepingKing, $eIcnGoldElixir, $eIcnBowler, $eIcnDonBowler, $eIcnCCDonate, $eIcnEagleArt, $eIcnGembox, $eIcnInferno4, $eIcnInfo, $eIcnMain, $eIcnTree, $eIcnProfile, $eIcnCCRequest, $eIcnTelegram, $eIcnTiles, $eIcnXbow3, $eIcnBark, $eIcnDailyProgram, $eIcnLootCart, $eIcnSleepMode, $eIcnTH11, $eIcnTrainMode, $eIcnSleepingWarden, $eIcnCloneSpell, $eIcnSkeletonSpell, $eIcnBabyDragon, $eIcnDonBabyDragon, $eIcnMiner, $eIcnDonMiner, $eIcnNoShield, $eIcnDonCustomB, $eIcnAirdefense, $eIcnDarkBarrackBoost, $eIcnDarkElixirStorage, $eIcnSpellsCost, $eIcnTroopsCost, $eIcnResetButton, $eIcnNewSmartZap, $eIcnTrain, $eIcnAttack, $eIcnDelay, $eIcnReOrder, $eIcn2Arrow, $eIcnArrowLeft, $eIcnArrowRight, $eIcnAndroid, $eHdV04, $eHdV05, $eHdV06, $eHdV07, $eHdV08, $eHdV09, $eHdV10, $eHdV11, $eUnranked, $eBronze, $eSilver, $eGold, $eCrystal, $eMaster, $eChampion, $eTitan, $eLegend, $eWall04, $eWall05, $eWall06, $eWall07, $eWall08, $eWall09, $eWall10, $eWall11, $eIcnPBNotify, $eIcnCCTroops, $eIcnCCSpells, $eIcnSpellsGroup, $eBahasaIND, $eChinese_S, $eChinese_T, $eEnglish, $eFrench, $eGerman, $eItalian, $ePersian, $eRussian, $eSpanish, $eTurkish, $eMissingLangIcon, $eWall12, $ePortuguese, $eIcnDonPoisonSpell, $eIcnDonEarthQuakeSpell, $eIcnDonHasteSpell, $eIcnDonSkeletonSpell, $eVietnamese, $eKorean, $eAzerbaijani, $eArabic, $eIcnBuilderHall, $eIcnClockTower, $eIcnElixirCollectorL5, $eIcnGemMine, $eIcnGoldMineL5, $eIcnElectroDragon, $eIcnTH12, $eHdV12, $eWall13, $eIcnGrayShield, $eIcnBlueShield, $eIcnGreenShield, $eIcnRedShield, $eIcnBattleB, $eIcnWallW, $eIcnSiegeCost, $eIcnBoostPotion, $eIcnBatSpell, $eIcnStoneS, $eIcnIceGolem, $eIcnStarLaboratory, $eIcnRagedBarbarian, $eIcnSneakyArcher, $eIcnBoxerGiant, $eIcnBetaMinion, $eIcnBomber, $eIcnBBBabyDragon, $eIcnCannonCart, $eIcnNightWitch, $eIcnDropShip, $eIcnSuperPekka, $eIcnBBWall01, $eIcnBBWall02, $eIcnBBWall03, $eIcnBBWall04, $eIcnBBWall05, $eIcnBBWall06, $eIcnBBWall07, $eIcnBBWall08 Global Enum $eBotNoAction, $eBotStart, $eBotStop, $eBotSearchMode, $eBotClose Global $g_iBotAction = $eBotNoAction Global $g_bBotMoveRequested = False @@ -2834,7 +2833,7 @@ Global $g_iUnbrkMinGold = 50000, $g_iUnbrkMinElixir = 50000, $g_iUnbrkMaxGold = Global $g_sTGChatID = "" Global $g_bNotifyTGEnable = False, $g_sNotifyTGToken = "" Global $g_bNotifyRemoteEnable = False, $g_sNotifyOrigin = "", $g_bNotifyDeleteAllPushesOnStart = False, $g_bNotifyDeletePushesOlderThan = False, $g_iNotifyDeletePushesOlderThanHours = 4 -Global $g_bNotifyAlertMatchFound = False, $g_bNotifyAlerLastRaidIMG = False, $g_bNotifyAlerLastRaidTXT = False, $g_bNotifyAlertCampFull = False, $g_bNotifyAlertUpgradeWalls = False, $g_bNotifyAlertOutOfSync = False, $g_bNotifyAlertTakeBreak = False, $g_bNotifyAlertBulderIdle = False, $g_bNotifyAlertVillageReport = False, $g_bNotifyAlertLastAttack = False, $g_bNotifyAlertAnotherDevice = False, $g_bNotifyAlertMaintenance = False, $g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False +Global $g_bNotifyAlertMatchFound = False, $g_bNotifyAlerLastRaidIMG = False, $g_bNotifyAlerLastRaidTXT = False, $g_bNotifyAlertCampFull = False, $g_bNotifyAlertUpgradeWalls = False, $g_bNotifyAlertOutOfSync = False, $g_bNotifyAlertTakeBreak = False, $g_bNotifyAlertBulderIdle = False, $g_bNotifyAlertVillageReport = False, $g_bNotifyAlertLastAttack = False, $g_bNotifyAlertAnotherDevice = False, $g_bNotifyAlertMaintenance = False, $g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False, $g_bNotifyAlertLaboratoryIdle = False Global $g_bNotifyScheduleHoursEnable = False, $g_bNotifyScheduleWeekDaysEnable = False Global $g_abNotifyScheduleHours[24] = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] Global $g_abNotifyScheduleWeekDays[7] = [False, False, False, False, False, False, False] @@ -3058,7 +3057,7 @@ Global $g_bChkClanGamesStopBeforeReachAndPurge = 0 Global $g_bChkClanGamesDebug = 0 Global $g_iPurgeMax = 5 Global $g_bChkCollectFreeMagicItems = True -GloBal $g_bOnlySCIDAccounts = False +Global $g_bOnlySCIDAccounts = False Global $g_iWhatSCIDAccount2Use = 0 Global $g_bUseStatistics = False Func GetTranslatedParsedText($sText, $var1 = Default, $var2 = Default, $var3 = Default) @@ -4683,6 +4682,7 @@ $g_iAndroidInactiveTransparency = Int(IniRead($g_sProfileConfigPath, "android", $g_iAndroidSuspendModeFlags = Int(IniRead($g_sProfileConfigPath, "android", "suspend.mode", $g_iAndroidSuspendModeFlags)) $g_iAndroidRebootHours = Int(IniRead($g_sProfileConfigPath, "android", "reboot.hours", $g_iAndroidRebootHours)) $g_bAndroidCloseWithBot = Int(IniRead($g_sProfileConfigPath, "android", "close", $g_bAndroidCloseWithBot ? 1 : 0)) = 1 +$g_bUpdateSharedPrefs = Int(IniRead($g_sProfileConfigPath, "android", "shared_prefs.update", $g_bUpdateSharedPrefs ? 1 : 0)) = 1 $g_iAndroidProcessAffinityMask = Int(IniRead($g_sProfileConfigPath, "android", "process.affinity.mask", $g_iAndroidProcessAffinityMask)) If $g_bBotLaunchOption_Restart = True Or $g_asCmdLine[0] < 2 Then Local $sAndroidEmulator = IniRead($g_sProfileConfigPath, "android", "emulator", "") @@ -5005,6 +5005,7 @@ IniReadS($g_bNotifyAlertMaintenance, $g_sProfileConfigPath, "notify", "AlertPBMa IniReadS($g_bNotifyAlertBAN, $g_sProfileConfigPath, "notify", "AlertPBBAN", False, "Bool") IniReadS($g_bNotifyAlertBOTUpdate, $g_sProfileConfigPath, "notify", "AlertPBUpdate", False, "Bool") IniReadS($g_bNotifyAlertSmartWaitTime, $g_sProfileConfigPath, "notify", "AlertSmartWaitTime", False, "Bool") +IniReadS($g_bNotifyAlertLaboratoryIdle, $g_sProfileConfigPath, "notify", "AlertLaboratoryIdle", False, "Bool") EndFunc Func ReadConfig_600_19() $g_bNotifyScheduleHoursEnable =(IniRead($g_sProfileConfigPath, "notify", "NotifyHoursEnable", "0") = "1") diff --git a/MyBot.run.Watchdog.exe b/MyBot.run.Watchdog.exe index 71883e0e6..5c3b39ba6 100644 Binary files a/MyBot.run.Watchdog.exe and b/MyBot.run.Watchdog.exe differ diff --git a/MyBot.run.Watchdog_stripped.au3 b/MyBot.run.Watchdog_stripped.au3 index e2ea5c513..4a81a21b9 100644 --- a/MyBot.run.Watchdog_stripped.au3 +++ b/MyBot.run.Watchdog_stripped.au3 @@ -5,11 +5,11 @@ #pragma compile(Icon, "Images\MyBot.ico") #pragma compile(FileDescription, Clash of Clans Bot - A Free Clash of Clans bot - https://mybot.run) #pragma compile(ProductVersion, 7.7) -#pragma compile(FileVersion, 7.7.2) +#pragma compile(FileVersion, 7.7.3) #pragma compile(LegalCopyright, © https://mybot.run) #Au3Stripper_Off #Au3Stripper_On -Global $g_sBotVersion = "v7.7.2" +Global $g_sBotVersion = "v7.7.3" Opt("MustDeclareVars", 1) Global Const $WAIT_TIMEOUT = 258 Global Const $STDERR_MERGED = 8 diff --git a/MyBot.run.Wmi.exe b/MyBot.run.Wmi.exe index 8b058943c..f130a408f 100644 Binary files a/MyBot.run.Wmi.exe and b/MyBot.run.Wmi.exe differ diff --git a/MyBot.run.Wmi_stripped.au3 b/MyBot.run.Wmi_stripped.au3 index c1dd3b35d..7b89b4a26 100644 --- a/MyBot.run.Wmi_stripped.au3 +++ b/MyBot.run.Wmi_stripped.au3 @@ -6,7 +6,7 @@ #pragma compile(Icon, "Images\MyBot.ico") #pragma compile(FileDescription, Clash of Clans Bot - A Free Clash of Clans bot - https://mybot.run) #pragma compile(ProductVersion, 7.7) -#pragma compile(FileVersion, 7.7.2) +#pragma compile(FileVersion, 7.7.3) #pragma compile(LegalCopyright, © https://mybot.run) #Au3Stripper_Off #Au3Stripper_On diff --git a/MyBot.run.au3 b/MyBot.run.au3 index c091dfdb2..2d0a2f1cf 100644 --- a/MyBot.run.au3 +++ b/MyBot.run.au3 @@ -55,8 +55,8 @@ Opt("GUIEventOptions", 1) ; Handle minimize and restore for dock android support Opt("GUICloseOnESC", 0) ; Don't send the $GUI_EVENT_CLOSE message when ESC is pressed. Opt("WinTitleMatchMode", 3) ; Window Title exact match mode Opt("GUIOnEventMode", 1) -Opt("MouseClickDelay", 10) -Opt("MouseClickDownDelay", 10) +Opt("MouseClickDelay", $g_iAndroidControlClickDelay) ;Default: 10 milliseconds +Opt("MouseClickDownDelay", $g_iAndroidControlClickDownDelay) ;Default: 2 milliseconds Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) @@ -478,6 +478,19 @@ EndFunc ;==>InitializeMBR ; =============================================================================================================================== Func SetupFilesAndFolders() + ;Migrate old shared_prefs locations + Local $sOldProfiles = @MyDocumentsDir & "\MyBot.run-Profiles" + If FileExists($sOldProfiles) = 1 And FileExists($g_sPrivateProfilePath) = 0 Then + SetLog("Moving shared_prefs profiles folder...") + If DirMove($sOldProfiles, $g_sPrivateProfilePath) = 0 Then + SetLog("Error moving folder " & $sOldProfiles, $COLOR_ERROR) + SetLog("to new location " & $g_sPrivateProfilePath, $COLOR_ERROR) + SetLog("Please resolve manually!", $COLOR_ERROR) + Else + SetLog("Moved shared_prefs profiles to " & $g_sPrivateProfilePath, $COLOR_SUCCESS) + EndIf + EndIf + ;DirCreate($sTemplates) DirCreate($g_sProfilePresetPath) DirCreate($g_sPrivateProfilePath & "\" & $g_sProfileCurrentName) @@ -519,6 +532,7 @@ Func SetupFilesAndFolders() SetDebugLog("$g_sProfilePath = " & $g_sProfilePath) SetDebugLog("$g_sProfileCurrentName = " & $g_sProfileCurrentName) SetDebugLog("$g_sProfileLogsPath = " & $g_sProfileLogsPath) + EndFunc ;==>SetupFilesAndFolders ; #FUNCTION# ==================================================================================================================== @@ -537,7 +551,8 @@ EndFunc ;==>SetupFilesAndFolders ; =============================================================================================================================== Func FinalInitialization(Const $sAI) ; check for VC2010, .NET software and MyBot Files and Folders - If CheckPrerequisites(True) Then + Local $bCheckPrerequisitesOK = CheckPrerequisites(True) + If $bCheckPrerequisitesOK Then MBRFunc(True) ; start MyBot.run.dll, after this point .net is initialized and threads popup all the time setAndroidPID() ; set Android PID SetBotGuiPID() ; set GUI PID @@ -575,12 +590,20 @@ Func FinalInitialization(Const $sAI) If $g_iGuiPID = @AutoItPID Then SetDebugLog("GUI Process not received, close bot") BotClose() + $bCheckPrerequisitesOK = False Else SetDebugLog("Linked to GUI Process " & $g_iGuiPID) EndIf EndIf ; destroy splash screen here (so we witness the 100% ;) + DestroySplashScreen(False) + If $bCheckPrerequisitesOK Then + ; only when bot can run, register with forum + ForumAuthentication() + EndIf + + ; allow now other bots to launch DestroySplashScreen() ; InitializeVariables();initialize variables used in extrawindows @@ -626,11 +649,6 @@ Func MainLoop($bCheckPrerequisitesOK = True) If $g_bBotLaunchOption_MinimizeBot Then BotMinimizeRequest() EndIf - If $bCheckPrerequisitesOK Then - ; only when bot can run, register with forum - ForumAuthentication() - EndIf - Local $hStarttime = _Timer_Init() ; Check the Supported Emulator versions @@ -714,6 +732,8 @@ Func runBot() ;Bot that runs everything in order checkObstacles() ; trap common error messages also check for reconnecting animation If $g_bRestart = True Then ContinueLoop + If $g_bUpdateSharedPrefs Then PullSharedPrefs() + If $g_bQuicklyFirstStart = True Then $g_bQuicklyFirstStart = False Else @@ -1053,8 +1073,8 @@ Func AttackMain() ;Main control for attack functions If _Sleep($DELAYATTACKMAIN2) Then Return Return True Else - SetLog("No one of search condition match:", $COLOR_WARNING) - SetLog("Waiting on troops, heroes and/or spells according to search settings", $COLOR_WARNING) + SetLog("None of search condition match:", $COLOR_WARNING) + SetLog("Search, Trophy or Army Camp % are out of range in search setting", $COLOR_WARNING) $g_bIsSearchLimit = False $g_bIsClientSyncError = False $g_bQuickAttack = False diff --git a/MyBot.run.exe b/MyBot.run.exe index f01c86002..e8fd16dbb 100644 Binary files a/MyBot.run.exe and b/MyBot.run.exe differ diff --git a/MyBot.run.version.au3 b/MyBot.run.version.au3 index ee6bffb89..582a64467 100644 --- a/MyBot.run.version.au3 +++ b/MyBot.run.version.au3 @@ -15,8 +15,8 @@ #pragma compile(Icon, "Images\MyBot.ico") #pragma compile(FileDescription, Clash of Clans Bot - A Free Clash of Clans bot - https://mybot.run) #pragma compile(ProductVersion, 7.7) -#pragma compile(FileVersion, 7.7.2) +#pragma compile(FileVersion, 7.7.3) #pragma compile(LegalCopyright, © https://mybot.run) #Au3Stripper_On -Global $g_sBotVersion = "v7.7.2" ;~ Don't add more here, but below. Version can't be longer than vX.y.z because it is also used in Checkversion() \ No newline at end of file +Global $g_sBotVersion = "v7.7.3" ;~ Don't add more here, but below. Version can't be longer than vX.y.z because it is also used in Checkversion() \ No newline at end of file diff --git a/MyBot.run_stripped.au3 b/MyBot.run_stripped.au3 index d26eeae02..4a1bf8559 100644 --- a/MyBot.run_stripped.au3 +++ b/MyBot.run_stripped.au3 @@ -5,11 +5,11 @@ #pragma compile(Icon, "Images\MyBot.ico") #pragma compile(FileDescription, Clash of Clans Bot - A Free Clash of Clans bot - https://mybot.run) #pragma compile(ProductVersion, 7.7) -#pragma compile(FileVersion, 7.7.2) +#pragma compile(FileVersion, 7.7.3) #pragma compile(LegalCopyright, © https://mybot.run) #Au3Stripper_Off #Au3Stripper_On -Global $g_sBotVersion = "v7.7.2" +Global $g_sBotVersion = "v7.7.3" Opt("MustDeclareVars", 1) Global $g_sBotTitle = "" Global $g_hFrmBot = 0 @@ -67,6 +67,7 @@ Global Const $WM_SYSCOMMAND = 0x0112 Global Const $WM_MOUSEMOVE = 0x0200 Global Const $WM_LBUTTONDOWN = 0x0201 Global Const $WM_LBUTTONUP = 0x0202 +Global Const $WM_LBUTTONDBLCLK = 0x0203 Global Const $WM_RBUTTONDOWN = 0x0204 Global Const $WM_RBUTTONUP = 0x0205 Global Const $WM_MBUTTONDOWN = 0x0207 @@ -119,6 +120,7 @@ Global Const $FO_OVERWRITE = 2 Global Const $FO_CREATEPATH = 8 Global Const $FO_BINARY = 16 Global Const $FO_UTF16_LE = 32 +Global Const $FO_UTF8_NOBOM = 256 Global Const $FD_FILEMUSTEXIST = 1 Global Const $CREATE_NEW = 1 Global Const $CREATE_ALWAYS = 2 @@ -5848,7 +5850,8 @@ Global $g_bAndroidAdbInstanceEnabled = True Global $g_bAndroidSuspendedEnabled = True Global $g_iAndroidSuspendModeFlags = 1 Global $g_bNoFocusTampering = False -Global $g_iAndroidRecoverStrategy = 1 +Global $g_iAndroidRecoverStrategyDefault = 1 +Global $g_iAndroidRecoverStrategy = $g_iAndroidRecoverStrategyDefault Global $g_bTerminateAdbShellOnStop = False Global $__BlueStacks2Version_2_5_or_later = False Global $__MEmu_ToolBar_Width = 45 @@ -5856,16 +5859,16 @@ Global $__MEmu_SystemBar = 36 Global $__MEmu_PhoneLayout = "2" Global $__MEmu_Window[4][5] = [ ["3.0.8", $g_iDEFAULT_WIDTH + 40, $g_iDEFAULT_HEIGHT - 14, 36, "-1"], ["2.6.2", $g_iDEFAULT_WIDTH + 48, $g_iDEFAULT_HEIGHT - 10, 40, "2"], ["2.5.0", $g_iDEFAULT_WIDTH + 51, $g_iDEFAULT_HEIGHT - 12, 45, "0"], ["2.2.1", $g_iDEFAULT_WIDTH + 51, $g_iDEFAULT_HEIGHT - 12, 45, "0"] ] Global $__Droid4X_Window[3][3] = [ ["0.10.0", $g_iDEFAULT_WIDTH + 6, $g_iDEFAULT_HEIGHT + 53], ["0.8.6", $g_iDEFAULT_WIDTH + 10, $g_iDEFAULT_HEIGHT + 50] ] -Global $__Nox_Config[2][3] = [ ["6.2.1", "[CLASS:subWin; INSTANCE:1]|[CLASS:AnglePlayer_0; INSTANCE:1]", True], ["3.3.0", "[CLASS:subWin; INSTANCE:1]|[TEXT:QWidgetClassWindow; CLASS:Qt5QWindowIcon]", False] ] -Global $g_avAndroidAppConfig[8][16] = [ ["LeapDroid", "vm1", "Leapd", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "emulator-5554", 1 + 8 + 16 + 32, '# ', 'qwerty2', 1, 1], ["Nox", "nox", "No", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 4, $g_iDEFAULT_HEIGHT - 10,0, "127.0.0.1:62001", 1 + 2 + 4 + 8 + 16 + 32 + 256,'# ', '(nox Virtual Input|Android Input|Android_Input)', 0, 2], ["MEmu", "MEmu", "MEmu ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 51,$g_iDEFAULT_HEIGHT - 12,0, "127.0.0.1:21503", 2 + 4 + 8 + 16 + 32, '# ', '(Microvirt Virtual Input|User Input)', 0, 2], ["BlueStacks2","Android", "BlueStacks ", "[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 + 2 + 4 + 8 + 16 + 32 + 128,'$ ', 'BlueStacks Virtual Touch', 0, 1], ["BlueStacks", "Android", "BlueStacks App Player","[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 + 8 + 16 + 32 + 128,'$ ', 'BlueStacks Virtual Touch', 0, 1], ["iTools", "iToolsVM","iTools ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 2, $g_iDEFAULT_HEIGHT - 13,0, "127.0.0.1:54001", 1 + 2 + 4 + 8 + 16 + 32 + 64, '# ', 'iTools Virtual PassThrough Input', 0, 1], ["KOPLAYER", "KOPLAYER","KOPLAYER", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 64,$g_iDEFAULT_HEIGHT - 8, 0, "127.0.0.1:6555", 1 + 2 + 4 + 8 + 16 + 32, '# ', 'ttVM Virtual Input', 0, 2], ["Droid4X", "droid4x", "Droid4X ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 10,$g_iDEFAULT_HEIGHT + 50,0, "127.0.0.1:26944", 2 + 4 + 8 + 16 + 32, '# ', 'droid4x Virtual Input', 0, 2] ] +Global $__Nox_Config[1][3] = [ ["3.3.0", "[CLASS:subWin; INSTANCE:1]|[CLASS:AnglePlayer_0; INSTANCE:1]", True] ] +Global $g_avAndroidAppConfig[8][16] = [ ["Nox", "nox", "No", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 4, $g_iDEFAULT_HEIGHT - 10,0, "127.0.0.1:62001", 1+2+4+8+16+32 +256+512, '# ', '(nox Virtual Input|Android Input|Android_Input)', 0, 2], ["MEmu", "MEmu", "MEmu ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 51,$g_iDEFAULT_HEIGHT - 12,0, "127.0.0.1:21503", 2+4+8+16+32 +512, '# ', '(Microvirt Virtual Input|User Input)', 0, 2], ["BlueStacks2","Android", "BlueStacks ", "[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1+2+4+8+16+32 +128, '$ ', 'BlueStacks Virtual Touch', 0, 1], ["BlueStacks", "Android", "BlueStacks App Player","[CLASS:BlueStacksApp; INSTANCE:1]","_ctl.Window", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "127.0.0.1:5555", 1 +8+16+32 +128, '$ ', 'BlueStacks Virtual Touch', 0, 1], ["LeapDroid", "vm1", "Leapd", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,0, "emulator-5554", 1 +8+16+32 +512, '# ', 'qwerty2', 1, 1], ["iTools", "iToolsVM","iTools ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 2, $g_iDEFAULT_HEIGHT - 13,0, "127.0.0.1:54001", 1+2+4+8+16+32+64 +512, '# ', 'iTools Virtual PassThrough Input', 0, 1], ["KOPLAYER", "KOPLAYER","KOPLAYER", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 64,$g_iDEFAULT_HEIGHT - 8, 0, "127.0.0.1:6555", 1+2+4+8+16+32 +512, '# ', 'ttVM Virtual Input', 0, 2], ["Droid4X", "droid4x", "Droid4X ", "[CLASS:subWin; INSTANCE:1]", "", $g_iDEFAULT_WIDTH, $g_iDEFAULT_HEIGHT - 48,$g_iDEFAULT_WIDTH + 10,$g_iDEFAULT_HEIGHT + 50,0, "127.0.0.1:26944", 2+4+8+16+32 +512, '# ', 'droid4x Virtual Input', 0, 2] ] +Global $__Nox_Idx = _ArraySearch($g_avAndroidAppConfig, "Nox", 0, 0, 0, 0, 1, 0) Global $__MEmu_Idx = _ArraySearch($g_avAndroidAppConfig, "MEmu", 0, 0, 0, 0, 1, 0) Global $__BS2_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks2", 0, 0, 0, 0, 1, 0) Global $__BS_Idx = _ArraySearch($g_avAndroidAppConfig, "BlueStacks", 0, 0, 0, 0, 1, 0) -Global $__KOPLAYER_Idx = _ArraySearch($g_avAndroidAppConfig, "KOPLAYER", 0, 0, 0, 0, 1, 0) Global $__LeapDroid_Idx = _ArraySearch($g_avAndroidAppConfig, "LeapDroid", 0, 0, 0, 0, 1, 0) Global $__iTools_Idx = _ArraySearch($g_avAndroidAppConfig, "iTools", 0, 0, 0, 0, 1, 0) +Global $__KOPLAYER_Idx = _ArraySearch($g_avAndroidAppConfig, "KOPLAYER", 0, 0, 0, 0, 1, 0) Global $__Droid4X_Idx = _ArraySearch($g_avAndroidAppConfig, "Droid4X", 0, 0, 0, 0, 1, 0) -Global $__Nox_Idx = _ArraySearch($g_avAndroidAppConfig, "Nox", 0, 0, 0, 0, 1, 0) Global $g_bOnlyInstance = True Global $g_bFoundRunningAndroid = False Global $g_bFoundInstalledAndroid = False @@ -5887,6 +5890,7 @@ Global $g_iAndroidClientHeight Global $g_iAndroidWindowWidth Global $g_iAndroidWindowHeight Global $g_bAndroidAdbUseMyBot = True +Global $g_bAndroidAdbReplaceEmulatorVersion = True Global $g_sAndroidAdbPath Global $g_sAndroidAdbGlobalOptions Global $g_sAndroidAdbDevice @@ -5904,14 +5908,15 @@ Global $g_bAndroidEmbed Global $g_iAndroidEmbedMode Global $g_bAndroidBackgroundLaunch Global $g_bAndroidBackgroundLaunched -Global $g_iAndroidControlClickDelay = 10 Global $g_iAndroidControlClickDownDelay = 5 +Global $g_iAndroidControlClickDelay = 10 Global $g_iAndroidAdbClickGroup = 50 Global $g_iAndroidAdbClickGroupDelay = 25 Global $g_iAndroidControlClickWindow = 0 Global $g_iAndroidControlClickMode = 0 Global $g_bAndroidCloseWithBot = False Global $g_bAndroidInitialized = False +Global $g_bUpdateSharedPrefs = False Global $g_iAndroidProcessAffinityMask = 0 Global Const $g_iAndroidJellyBean = 17 Global Const $g_iAndroidLollipop = 21 @@ -5928,6 +5933,7 @@ Global $g_sAndroidPicturesPathAvailable = False Global $g_sAndroidPicturesPath = "" Global $g_sAndroidPicturesHostPath = "" Global $g_bAndroidSharedFolderAvailable = True +Global $g_sAndroidSharedFolderName = "" Global Const $g_iAndroidSecureFlags = 3 Global $g_sAndroidPicturesHostFolder = "" Global $g_bAndroidPicturesPathAutoConfig = True @@ -5979,8 +5985,8 @@ Global $g_hMutextOrSemaphoreGlobalActiveBots = 0 Global $g_iGlobalThreads = 0 Global $g_iThreads = 0 Global $g_sProfilePath = @ScriptDir & "\Profiles" -Global Const $g_sPrivateProfilePath = @MyDocumentsDir & "\MyBot.run-Profiles" -Global Const $g_sPrivateAuthenticationFile = @MyDocumentsDir & "\MyBot.run-Profiles\.mybot.run.authentication" +Global Const $g_sPrivateProfilePath = @AppDataDir & "\MyBot.run-Profiles" +Global Const $g_sPrivateAuthenticationFile = @AppDataDir & "\.mybot.run.authentication" Global Const $g_sProfilePresetPath = @ScriptDir & "\Strategies" Global $g_sProfileCurrentName = "" Global $g_sProfileConfigPath = "" @@ -6045,7 +6051,7 @@ Global Const $g_sIcnBldGold = @ScriptDir & "\Images\gold.png" Global Const $g_sIcnBldElixir = @ScriptDir & "\Images\elixir.png" Global Const $g_sIcnBldTrophy = @ScriptDir & "\Images\trophy.png" Global $g_iRedrawBotWindowMode = 2 -Global Enum $eIcnArcher = 1, $eIcnDonArcher, $eIcnBalloon, $eIcnDonBalloon, $eIcnBarbarian, $eIcnDonBarbarian, $eBtnTest, $eIcnBuilder, $eIcnCC, $eIcnGUI, $eIcnDark, $eIcnDragon, $eIcnDonDragon, $eIcnDrill, $eIcnElixir, $eIcnCollector, $eIcnFreezeSpell, $eIcnGem, $eIcnGiant, $eIcnDonGiant, $eIcnTrap, $eIcnGoblin, $eIcnDonGoblin, $eIcnGold, $eIcnGolem, $eIcnDonGolem, $eIcnHealer, $eIcnDonHealer, $eIcnHogRider, $eIcnDonHogRider, $eIcnHealSpell, $eIcnInferno, $eIcnJumpSpell, $eIcnLavaHound, $eIcnDonLavaHound, $eIcnLightSpell, $eIcnMinion, $eIcnDonMinion, $eIcnPekka, $eIcnDonPekka, $eIcnTreasury, $eIcnRageSpell, $eIcnTroops, $eIcnHourGlass, $eIcnTH1, $eIcnTH10, $eIcnTrophy, $eIcnValkyrie, $eIcnDonValkyrie, $eIcnWall, $eIcnWallBreaker, $eIcnDonWallBreaker, $eIcnWitch, $eIcnDonWitch, $eIcnWizard, $eIcnDonWizard, $eIcnXbow, $eIcnBarrackBoost, $eIcnMine, $eIcnCamp, $eIcnBarrack, $eIcnSpellFactory, $eIcnDonBlacklist, $eIcnSpellFactoryBoost, $eIcnMortar, $eIcnWizTower, $eIcnPayPal, $eIcnNotify, $eIcnGreenLight, $eIcnLaboratory, $eIcnRedLight, $eIcnBlank, $eIcnYellowLight, $eIcnDonCustom, $eIcnTombstone, $eIcnSilverStar, $eIcnGoldStar, $eIcnDarkBarrack, $eIcnCollectorLocate, $eIcnDrillLocate, $eIcnMineLocate, $eIcnBarrackLocate, $eIcnDarkBarrackLocate, $eIcnDarkSpellFactoryLocate, $eIcnDarkSpellFactory, $eIcnEarthQuakeSpell, $eIcnHasteSpell, $eIcnPoisonSpell, $eIcnBldgTarget, $eIcnBldgX, $eIcnRecycle, $eIcnHeroes, $eIcnBldgElixir, $eIcnBldgGold, $eIcnMagnifier, $eIcnWallElixir, $eIcnWallGold, $eIcnKing, $eIcnQueen, $eIcnDarkSpellBoost, $eIcnQueenBoostLocate, $eIcnKingBoostLocate, $eIcnKingUpgr, $eIcnQueenUpgr, $eIcnWardenUpgr, $eIcnWarden, $eIcnWardenBoostLocate, $eIcnKingBoost, $eIcnQueenBoost, $eIcnWardenBoost, $eEmpty3, $eIcnReload, $eIcnCopy, $eIcnAddcvs, $eIcnEdit, $eIcnTreeSnow, $eIcnSleepingQueen, $eIcnSleepingKing, $eIcnGoldElixir, $eIcnBowler, $eIcnDonBowler, $eIcnCCDonate, $eIcnEagleArt, $eIcnGembox, $eIcnInferno4, $eIcnInfo, $eIcnMain, $eIcnTree, $eIcnProfile, $eIcnCCRequest, $eIcnTelegram, $eIcnTiles, $eIcnXbow3, $eIcnBark, $eIcnDailyProgram, $eIcnLootCart, $eIcnSleepMode, $eIcnTH11, $eIcnTrainMode, $eIcnSleepingWarden, $eIcnCloneSpell, $eIcnSkeletonSpell, $eIcnBabyDragon, $eIcnDonBabyDragon, $eIcnMiner, $eIcnDonMiner, $eIcnNoShield, $eIcnDonCustomB, $eIcnAirdefense, $eIcnDarkBarrackBoost, $eIcnDarkElixirStorage, $eIcnSpellsCost, $eIcnTroopsCost, $eIcnResetButton, $eIcnNewSmartZap, $eIcnTrain, $eIcnAttack, $eIcnDelay, $eIcnReOrder, $eIcn2Arrow, $eIcnArrowLeft, $eIcnArrowRight, $eIcnAndroid, $eHdV04, $eHdV05, $eHdV06, $eHdV07, $eHdV08, $eHdV09, $eHdV10, $eHdV11, $eUnranked, $eBronze, $eSilver, $eGold, $eCrystal, $eMaster, $eChampion, $eTitan, $eLegend, $eWall04, $eWall05, $eWall06, $eWall07, $eWall08, $eWall09, $eWall10, $eWall11, $eIcnPBNotify, $eIcnCCTroops, $eIcnCCSpells, $eIcnSpellsGroup, $eBahasaIND, $eChinese_S, $eChinese_T, $eEnglish, $eFrench, $eGerman, $eItalian, $ePersian, $eRussian, $eSpanish, $eTurkish, $eMissingLangIcon, $eWall12, $ePortuguese, $eIcnDonPoisonSpell, $eIcnDonEarthQuakeSpell, $eIcnDonHasteSpell, $eIcnDonSkeletonSpell, $eVietnamese, $eKorean, $eAzerbaijani, $eArabic, $eIcnBuilderHall, $eIcnClockTower, $eIcnElixirCollectorL5, $eIcnGemMine, $eIcnGoldMineL5, $eIcnElectroDragon, $eIcnTH12, $eHdV12, $eWall13, $eIcnGrayShield, $eIcnBlueShield, $eIcnGreenShield, $eIcnRedShield, $eIcnBattleB , $eIcnWallW, $eIcnSiegeCost, $eIcnBoostPotion, $eIcnBatSpell, $eIcnStoneS, $eIcnIceGolem, $eIcnStarLaboratory, $eIcnRagedBarbarian, $eIcnSneakyArcher, $eIcnBoxerGiant, $eIcnBetaMinion, $eIcnBomber, $eIcnBBBabyDragon, $eIcnCannonCart, $eIcnNightWitch, $eIcnDropShip, $eIcnSuperPekka, $eIcnBBWall01, $eIcnBBWall02, $eIcnBBWall03, $eIcnBBWall04, $eIcnBBWall05, $eIcnBBWall06, $eIcnBBWall07, $eIcnBBWall08 +Global Enum $eIcnArcher = 1, $eIcnDonArcher, $eIcnBalloon, $eIcnDonBalloon, $eIcnBarbarian, $eIcnDonBarbarian, $eBtnTest, $eIcnBuilder, $eIcnCC, $eIcnGUI, $eIcnDark, $eIcnDragon, $eIcnDonDragon, $eIcnDrill, $eIcnElixir, $eIcnCollector, $eIcnFreezeSpell, $eIcnGem, $eIcnGiant, $eIcnDonGiant, $eIcnTrap, $eIcnGoblin, $eIcnDonGoblin, $eIcnGold, $eIcnGolem, $eIcnDonGolem, $eIcnHealer, $eIcnDonHealer, $eIcnHogRider, $eIcnDonHogRider, $eIcnHealSpell, $eIcnInferno, $eIcnJumpSpell, $eIcnLavaHound, $eIcnDonLavaHound, $eIcnLightSpell, $eIcnMinion, $eIcnDonMinion, $eIcnPekka, $eIcnDonPekka, $eIcnTreasury, $eIcnRageSpell, $eIcnTroops, $eIcnHourGlass, $eIcnTH1, $eIcnTH10, $eIcnTrophy, $eIcnValkyrie, $eIcnDonValkyrie, $eIcnWall, $eIcnWallBreaker, $eIcnDonWallBreaker, $eIcnWitch, $eIcnDonWitch, $eIcnWizard, $eIcnDonWizard, $eIcnXbow, $eIcnBarrackBoost, $eIcnMine, $eIcnCamp, $eIcnBarrack, $eIcnSpellFactory, $eIcnDonBlacklist, $eIcnSpellFactoryBoost, $eIcnMortar, $eIcnWizTower, $eIcnPayPal, $eIcnNotify, $eIcnGreenLight, $eIcnLaboratory, $eIcnRedLight, $eIcnBlank, $eIcnYellowLight, $eIcnDonCustom, $eIcnTombstone, $eIcnSilverStar, $eIcnGoldStar, $eIcnDarkBarrack, $eIcnCollectorLocate, $eIcnDrillLocate, $eIcnMineLocate, $eIcnBarrackLocate, $eIcnDarkBarrackLocate, $eIcnDarkSpellFactoryLocate, $eIcnDarkSpellFactory, $eIcnEarthQuakeSpell, $eIcnHasteSpell, $eIcnPoisonSpell, $eIcnBldgTarget, $eIcnBldgX, $eIcnRecycle, $eIcnHeroes, $eIcnBldgElixir, $eIcnBldgGold, $eIcnMagnifier, $eIcnWallElixir, $eIcnWallGold, $eIcnKing, $eIcnQueen, $eIcnDarkSpellBoost, $eIcnQueenBoostLocate, $eIcnKingBoostLocate, $eIcnKingUpgr, $eIcnQueenUpgr, $eIcnWardenUpgr, $eIcnWarden, $eIcnWardenBoostLocate, $eIcnKingBoost, $eIcnQueenBoost, $eIcnWardenBoost, $eEmpty3, $eIcnReload, $eIcnCopy, $eIcnAddcvs, $eIcnEdit, $eIcnTreeSnow, $eIcnSleepingQueen, $eIcnSleepingKing, $eIcnGoldElixir, $eIcnBowler, $eIcnDonBowler, $eIcnCCDonate, $eIcnEagleArt, $eIcnGembox, $eIcnInferno4, $eIcnInfo, $eIcnMain, $eIcnTree, $eIcnProfile, $eIcnCCRequest, $eIcnTelegram, $eIcnTiles, $eIcnXbow3, $eIcnBark, $eIcnDailyProgram, $eIcnLootCart, $eIcnSleepMode, $eIcnTH11, $eIcnTrainMode, $eIcnSleepingWarden, $eIcnCloneSpell, $eIcnSkeletonSpell, $eIcnBabyDragon, $eIcnDonBabyDragon, $eIcnMiner, $eIcnDonMiner, $eIcnNoShield, $eIcnDonCustomB, $eIcnAirdefense, $eIcnDarkBarrackBoost, $eIcnDarkElixirStorage, $eIcnSpellsCost, $eIcnTroopsCost, $eIcnResetButton, $eIcnNewSmartZap, $eIcnTrain, $eIcnAttack, $eIcnDelay, $eIcnReOrder, $eIcn2Arrow, $eIcnArrowLeft, $eIcnArrowRight, $eIcnAndroid, $eHdV04, $eHdV05, $eHdV06, $eHdV07, $eHdV08, $eHdV09, $eHdV10, $eHdV11, $eUnranked, $eBronze, $eSilver, $eGold, $eCrystal, $eMaster, $eChampion, $eTitan, $eLegend, $eWall04, $eWall05, $eWall06, $eWall07, $eWall08, $eWall09, $eWall10, $eWall11, $eIcnPBNotify, $eIcnCCTroops, $eIcnCCSpells, $eIcnSpellsGroup, $eBahasaIND, $eChinese_S, $eChinese_T, $eEnglish, $eFrench, $eGerman, $eItalian, $ePersian, $eRussian, $eSpanish, $eTurkish, $eMissingLangIcon, $eWall12, $ePortuguese, $eIcnDonPoisonSpell, $eIcnDonEarthQuakeSpell, $eIcnDonHasteSpell, $eIcnDonSkeletonSpell, $eVietnamese, $eKorean, $eAzerbaijani, $eArabic, $eIcnBuilderHall, $eIcnClockTower, $eIcnElixirCollectorL5, $eIcnGemMine, $eIcnGoldMineL5, $eIcnElectroDragon, $eIcnTH12, $eHdV12, $eWall13, $eIcnGrayShield, $eIcnBlueShield, $eIcnGreenShield, $eIcnRedShield, $eIcnBattleB, $eIcnWallW, $eIcnSiegeCost, $eIcnBoostPotion, $eIcnBatSpell, $eIcnStoneS, $eIcnIceGolem, $eIcnStarLaboratory, $eIcnRagedBarbarian, $eIcnSneakyArcher, $eIcnBoxerGiant, $eIcnBetaMinion, $eIcnBomber, $eIcnBBBabyDragon, $eIcnCannonCart, $eIcnNightWitch, $eIcnDropShip, $eIcnSuperPekka, $eIcnBBWall01, $eIcnBBWall02, $eIcnBBWall03, $eIcnBBWall04, $eIcnBBWall05, $eIcnBBWall06, $eIcnBBWall07, $eIcnBBWall08 Global $eIcnDonBlank = $eIcnDonBlacklist Global $eIcnOptions = $eIcnDonBlacklist Global $eIcnAchievements = $eIcnMain @@ -6262,7 +6268,7 @@ Global $g_sTGLastMessage = "" Global $g_sAttackFile = "" Global $g_bNotifyTGEnable = False, $g_sNotifyTGToken = "" Global $g_bNotifyRemoteEnable = False, $g_sNotifyOrigin = "", $g_bNotifyDeleteAllPushesOnStart = False, $g_bNotifyDeletePushesOlderThan = False, $g_iNotifyDeletePushesOlderThanHours = 4 -Global $g_bNotifyAlertMatchFound = False, $g_bNotifyAlerLastRaidIMG = False, $g_bNotifyAlerLastRaidTXT = False, $g_bNotifyAlertCampFull = False, $g_bNotifyAlertUpgradeWalls = False, $g_bNotifyAlertOutOfSync = False, $g_bNotifyAlertTakeBreak = False, $g_bNotifyAlertBulderIdle = False, $g_bNotifyAlertVillageReport = False, $g_bNotifyAlertLastAttack = False, $g_bNotifyAlertAnotherDevice = False, $g_bNotifyAlertMaintenance = False, $g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False +Global $g_bNotifyAlertMatchFound = False, $g_bNotifyAlerLastRaidIMG = False, $g_bNotifyAlerLastRaidTXT = False, $g_bNotifyAlertCampFull = False, $g_bNotifyAlertUpgradeWalls = False, $g_bNotifyAlertOutOfSync = False, $g_bNotifyAlertTakeBreak = False, $g_bNotifyAlertBulderIdle = False, $g_bNotifyAlertVillageReport = False, $g_bNotifyAlertLastAttack = False, $g_bNotifyAlertAnotherDevice = False, $g_bNotifyAlertMaintenance = False, $g_bNotifyAlertBAN = False, $g_bNotifyAlertBOTUpdate = False, $g_bNotifyAlertSmartWaitTime = False, $g_bNotifyAlertLaboratoryIdle = False Global $g_bNotifyScheduleHoursEnable = False, $g_bNotifyScheduleWeekDaysEnable = False Global $g_abNotifyScheduleHours[24] = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] Global $g_abNotifyScheduleWeekDays[7] = [False, False, False, False, False, False, False] @@ -6420,7 +6426,7 @@ Global $g_iSkippedVillageCount = 0, $g_iDroppedTrophyCount = 0 Global $g_iCostGoldWall = 0, $g_iCostElixirWall = 0, $g_iCostGoldBuilding = 0, $g_iCostElixirBuilding = 0, $g_iCostDElixirHero = 0 Global $g_iNbrOfWallsUpped = 0, $g_iNbrOfWallsUppedGold = 0, $g_iNbrOfWallsUppedElixir = 0 Global $g_iNbrOfBuildingsUppedGold = 0, $g_iNbrOfBuildingsUppedElixir = 0, $g_iNbrOfHeroesUpped = 0 -Global $g_iSearchCost = 0, $g_iTrainCostElixir = 0, $g_iTrainCostDElixir = 0 , $g_iTrainCostGold = 0 +Global $g_iSearchCost = 0, $g_iTrainCostElixir = 0, $g_iTrainCostDElixir = 0, $g_iTrainCostGold = 0 Global $g_iNbrOfOoS = 0 Global $g_iNbrOfTHSnipeFails = 0, $g_iNbrOfTHSnipeSuccess = 0 Global $g_iGoldFromMines = 0, $g_iElixirFromCollectors = 0, $g_iDElixirFromDrills = 0 @@ -6724,7 +6730,7 @@ Global $g_bChkClanGamesDebug = 0 Global $g_iPurgeJobCount[8] = [0, 0, 0, 0, 0, 0, 0, 0] Global $g_iPurgeMax = 5 Global $g_bChkCollectFreeMagicItems = True -GloBal $g_bOnlySCIDAccounts = False +Global $g_bOnlySCIDAccounts = False Global $g_iWhatSCIDAccount2Use = 0 Global $g_bUseStatistics = False Global $g_hSQLiteDB = Null @@ -6975,10 +6981,15 @@ SetDebugLog("UpdateSplashTitle: " & $title) If $g_bDisableSplash Then Return GUICtrlSetData($g_lSplashTitle, $title) EndFunc -Func DestroySplashScreen() -If IsHWnd($g_hSplash) Then GUIDelete($g_hSplash) +Func DestroySplashScreen($bReleaseMutex = True) +If $g_hSplash And IsHWnd($g_hSplash) Then +GUIDelete($g_hSplash) +$g_hSplash = 0 +EndIf +If $bReleaseMutex Then ReleaseMutex($g_hSplashMutex) $g_hSplashMutex = 0 +EndIf EndFunc Func MoveSplashScreen() _WinAPI_PostMessage($g_hSplash, $WM_SYSCOMMAND, 0xF012, 0) @@ -7033,8 +7044,12 @@ $g_lSplashTitle = GUICtrlCreateLabel($g_sBotTitle, 15, $iY + $iT + $iB + 3, $iX GUICtrlSetOnEvent(-1, "MoveSplashScreen") $g_hSplashProgress = GUICtrlCreateProgress(15, $iY + $iT + $iB + 20, $iX - 30, 10, $PBS_SMOOTH, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) $g_lSplashStatus = GUICtrlCreateLabel(GetTranslatedFileIni("MBR GUI Design - Loading", "SplashStep_Loading", "Loading..."), 15, $iY + $iT + $iB + 38, $iX - 30, 15, $SS_CENTER) -EndIf GUICtrlSetOnEvent(-1, "MoveSplashScreen") +Else +$g_lSplashTitle = 0 +$g_hSplashProgress = 0 +$g_lSplashStatus = 0 +EndIf _GDIPlus_BitmapDispose($hSplashImg) If $g_bDebugSetlog Then SetDebugLog("Splash created: $g_hSplash=" & $g_hSplash & ", $g_lSplashPic=" & $g_lSplashPic & ", $g_lSplashTitle=" & $g_lSplashTitle & ", $g_hSplashProgress=" & $g_hSplashProgress & ", $g_lSplashStatus=" & $g_lSplashStatus) If Not $bCustomWindow Then @@ -7071,6 +7086,7 @@ Global $aCancelFight[4] = [822, 48, 0xD80408, 20] Global $aCancelFight2[4] = [830, 59, 0xD80408, 20] Global $aEndFightSceneBtn[4] = [429, 519 + $g_iMidOffsetY, 0xB8E35F, 20] Global $aEndFightSceneAvl[4] = [241, 196 + $g_iMidOffsetY, 0xFFF090, 20] +Global $aEndFightSceneReportGold = $aEndFightSceneAvl Global $aReturnHomeButton[4] = [376, 567 + $g_iMidOffsetY, 0x60AC10, 20] Global $aChatTab[4] = [331, 325 + $g_iMidOffsetY, 0xF0951D, 20] Global $aChatTab2[4] = [331, 330 + $g_iMidOffsetY, 0xF0951D, 20] @@ -7953,7 +7969,7 @@ EndFunc Func setAndroidPID($pid = GetAndroidPid()) If $g_hLibMyBot = -1 Then Return SetDebugLog("setAndroidPID: $pid=" & $pid) -Local $result = DllCall($g_hLibMyBot, "str", "setAndroidPID", "int", $pid) +Local $result = DllCall($g_hLibMyBot, "str", "setAndroidPID", "int", $pid, "str", $g_sBotVersion, "str", $g_sAndroidEmulator, "str", $g_sAndroidVersion, "str", $g_sAndroidInstance) If @error Then _logErrorDLLCall($g_sLibMyBotPath & ", setAndroidPID:", @error) Return SetError(@error) @@ -8009,7 +8025,7 @@ Return $bAuthenticated EndFunc Func ForumLogin($sUsername, $sPassword) If $g_hLibMyBot = -1 Then Return False -Local $result = DllCall($g_hLibMyBot, "str", "ForumLogin", "str", _Base64Encode(StringToBinary($sUsername, 4), 1024), "str", _Base64Encode(StringToBinary($sPassword, 4), 1024), "str", _Base64Encode(StringToBinary($g_sBotTitle, 4), 1024)) +Local $result = DllCall($g_hLibMyBot, "str", "ForumLogin", "str", _Base64Encode(StringToBinary($sUsername, 4), 1024), "str", _Base64Encode(StringToBinary($sPassword, 4), 1024)) If @error Then _logErrorDLLCall($g_sLibMyBotPath & ", ForumLogin:", @error) Return SetError(@error) @@ -8111,6 +8127,8 @@ Global Const $g_sAdbScriptsPath = $g_sLibPath & "\adb.scripts" Global $g_sAndroidAdbPrompt = "mybot.run:" Global $g_bAndroidAdbPortPerInstance = True Global $g_bAndroidAdbPort = 0 +Global $g_iAndroidAdbMinitouchModeDefault = 1 +Global $g_iAndroidAdbMinitouchMode = $g_iAndroidAdbMinitouchModeDefault Global $g_bAndroidAdbMinitouchPort = 0 Global $g_bAndroidAdbMinitouchSocket = 0 Global $g_sAndroidAdbInstanceShellOptionsDefault = " -t -t" @@ -8119,6 +8137,7 @@ Global $g_sAndroidAdbShellOptions = "" Global $g_bAndroidAdbPromptUseGiven = False Global $g_iAndroidCoCPid = 0 Global $g_iAndroidAdbProcess = [0, 0, 0, 0, 0] +Global $g_iAndroidAdbMinitouchProcess = [0, 0, 0, 0, 0] Global $g_aiAndroidAdbClicks[1] = [-1] Global $g_aiAndroidAdbStatsTotal[2][2] = [ [0, 0], [0, 0] ] Global $g_aiAndroidAdbStatsLast[2][12] @@ -8138,6 +8157,11 @@ Global $g_aiMouseOffsetWindowOnly = [0, 0] Global $g_bPullPushSharedPrefsAbdCommand = False Global $g_PushedSharedPrefsProfile = "" Global $g_PushedSharedPrefsProfile_Timer = 0 +Global $g_bUpdateSharedPrefsLanguage = True +Global $g_bUpdateSharedPrefsSnow = True +Global $g_bUpdateSharedPrefsZoomLevel = True +Global $g_bUpdateSharedPrefsGoogleDisconnected = True +Global $g_bUpdateSharedPrefsRated = True Func InitAndroidConfig($bRestart = False) FuncEnter(InitAndroidConfig) If $bRestart = False Then @@ -8163,6 +8187,7 @@ $g_bAndroidAdbClick = $g_bAndroidAdbClickEnabled = True And AndroidAdbClickSuppo $g_bAndroidAdbInput = $g_bAndroidAdbInputEnabled = True And BitAND($g_iAndroidSupportFeature, 8) = 8 $g_bAndroidAdbInstance = $g_bAndroidAdbInstanceEnabled = True And BitAND($g_iAndroidSupportFeature, 16) = 16 $g_bAndroidAdbClickDrag = $g_bAndroidAdbClickDragEnabled = True And BitAND($g_iAndroidSupportFeature, 32) = 32 +$g_bAndroidPicturesPathAutoConfig = BitAND($g_iAndroidSupportFeature, 512) > 0 $g_bAndroidEmbed = $g_bAndroidEmbedEnabled = True And $g_iAndroidEmbedMode > -1 $g_bAndroidBackgroundLaunch = $g_bAndroidBackgroundLaunchEnabled = True $g_bAndroidBackgroundLaunched = False @@ -8171,6 +8196,8 @@ $g_bAndroidControlUseParentPos = False $g_sAndroidAdbInstanceShellOptions = $g_sAndroidAdbInstanceShellOptionsDefault $g_sAndroidAdbShellOptions = "" $g_bAndroidAdbPortPerInstance = True +$g_iAndroidRecoverStrategy = $g_iAndroidRecoverStrategyDefault +$g_iAndroidAdbMinitouchMode = $g_iAndroidAdbMinitouchModeDefault $g_PushedSharedPrefsProfile = "" $g_PushedSharedPrefsProfile_Timer = 0 If $g_bAndroidAdbScreencap Then @@ -8540,13 +8567,18 @@ If $pid <> 0 Then If IsArray($aWinList) = 0 Then Local $aWinList2 = _WinAPI_EnumProcessWindows($pid, True) If IsArray($aWinList2) = 1 And $aWinList2[0][0] > 0 Then -Local $aWinList[$aWinList2[0][0] + 1][3] +Local $aWinList[$aWinList2[0][0] + 1][5] $aWinList[0][0] = $aWinList2[0][0] For $i = 1 To $aWinList2[0][0] +Local $aPos = WinGetPos($aWinList2[$i][0]) $aWinList[$i][0] = WinGetTitle($aWinList2[$i][0]) $aWinList[$i][1] = $aWinList2[$i][0] $aWinList[$i][2] = $aWinList2[$i][1] -SetDebugLog("Found Android window: " & $aWinList[$i][0] & ", " & $aWinList[$i][1] & ", " & $aWinList[$i][2]) +If UBound($aPos) > 3 Then +$aWinList[$i][3] = $aPos[2] +$aWinList[$i][4] = $aPos[3] +EndIf +SetDebugLog("Found Android window: " & $aWinList[$i][0] & ", " & $aWinList[$i][1] & ", " & $aWinList[$i][2] & ", " & $aWinList[$i][3] & ", " & $aWinList[$i][4]) Next EndIf EndIf @@ -8555,7 +8587,7 @@ SetDebugLog("Found " & $aWinList[0][0] & " windows, searching for '" & $g_sAppPa For $i = 1 To $aWinList[0][0] $t = $aWinList[$i][0] $hWin = $aWinList[$i][1] -If $pid = WinGetProcess($hWin) And ControlGetHandle2($hWin, $g_sAppPaneName, $g_sAppClassInstance) <> 0 Then +If $pid = WinGetProcess($hWin) And ControlGetHandle2($hWin, $g_sAppPaneName, $g_sAppClassInstance) <> 0 And $aWinList[$i][3] > 400 And $aWinList[$i][4] > 400 Then SetDebugLog("Found " & $g_sAndroidEmulator & " Window '" & $t & "' (" & $hWin & ") by PID " & $pid & " ('" & $commandLine & "')") UpdateHWnD($hWin) $g_sAndroidTitle = UpdateAndroidWindowTitle($g_hAndroidWindow, $t) @@ -8705,15 +8737,24 @@ SetDebugLog("Found no installed Android Emulator") FuncReturn() EndFunc Func FindPreferredAdbPath() -Local $adbPath, $i -If $g_bAndroidAdbUseMyBot Then Local $sAdb = @ScriptDir & "\lib\adb\adb.exe" -If FileExists($sAdb) Then Return $sAdb +Local $aDll = ["AdbWinApi.dll", "AdbWinUsbApi.dll"] +Local $adbPath = Execute("Get" & $g_sAndroidEmulator & "AdbPath()") +Local $sAdbFolder = StringLeft($adbPath, StringInStr($adbPath, "\", 0, -1)) +Local $sAdbFile = StringMid($adbPath, StringLen($sAdbFolder) + 1) +If $g_bAndroidAdbReplaceEmulatorVersion And $adbPath And FileExists($sAdb) And FileExists(@ScriptDir & "\lib\adb\" & $aDll[0]) And FileExists(@ScriptDir & "\lib\adb\" & $aDll[1]) And(FileGetSize($adbPath) <> FileGetSize($sAdb) Or FileGetSize($sAdbFolder & $aDll[0]) <> FileGetSize(@ScriptDir & "\lib\adb\" & $aDll[0]) Or FileGetSize($sAdbFolder & $aDll[1]) <> FileGetSize(@ScriptDir & "\lib\adb\" & $aDll[1])) Then +If FileCopy($sAdb, $adbPath, 1) And FileCopy(@ScriptDir & "\lib\adb\" & $aDll[0], $sAdbFolder & $aDll[0], 1) And FileCopy(@ScriptDir & "\lib\adb\" & $aDll[1], $sAdbFolder & $aDll[1], 1) Then +SetLog("Replaced " & $g_sAndroidEmulator & " ADB with MyBot.run version") +Else +SetLog("Cannot replace " & $g_sAndroidEmulator & " ADB with MyBot.run version", $COLOR_ERROR) +EndIf +EndIf +If $g_bAndroidAdbUseMyBot And FileExists($sAdb) Then +Return $sAdb EndIf If FileExists($g_sAndroidAdbPath) Then Return $g_sAndroidAdbPath EndIf -$adbPath = Execute("Get" & $g_sAndroidEmulator & "AdbPath()") If $adbPath = "" Then For $i = 0 To UBound($g_avAndroidAppConfig) - 1 $adbPath = Execute("Get" & $g_avAndroidAppConfig[$i][0] & "AdbPath()") @@ -8736,7 +8777,7 @@ If $ReturnInitial Then Return $i2 Return $i EndFunc Func InitAndroidAdbPorts($bForce = False) -If $g_bAndroidAdbPortPerInstance Then +Local $bUsePort = $g_bAndroidAdbPortPerInstance If $bForce Then $g_bAndroidAdbPort = 0 If Not $g_bAndroidAdbPort Then Local $iPortStart = 5038, $iPortRange = 255 @@ -8749,7 +8790,7 @@ ReleaseMutex($g_hMutex_AdbDaemon) $g_hMutex_AdbDaemon = 0 EndIf While Not $hMutex And $iPort < $iPortStart + $iPortRange -For $i = $iTcpIdx To UBound($aTcpTable) -1 +For $i = $iTcpIdx To UBound($aTcpTable) - 1 If $aTcpTable[$i][2] < $iPort Then $iTcpIdx = $i + 1 ContinueLoop @@ -8760,11 +8801,13 @@ $iPort += 1 EndIf Next $iMtPort = 0 +If $g_iAndroidAdbMinitouchMode = 0 Then $iTcpMtIdx = _ArrayBinarySearch($aTcpTable, $iPort + 1000, 0, 0, 2) If $iTcpMtIdx = -1 Or($iTcpMtIdx > 0 And $aTcpTable[$iTcpMtIdx][0] = "adb.exe") Then $iMtPort = $iPort + 1000 EndIf -If $iMtPort Then +EndIf +If $iMtPort Or $g_iAndroidAdbMinitouchMode = 1 Then $hMutex = CreateMutex("MyBot.run/Adb-Port-" & $iPort) If $hMutex Then $g_hMutex_AdbDaemon = $hMutex @@ -8776,14 +8819,17 @@ EndIf $iPort += 1 WEnd EndIf -EndIf -If $g_bAndroidAdbPort Then +If $bUsePort And $g_bAndroidAdbPort Then SetDebugLog("Using ADB Daemon port " & $g_bAndroidAdbPort) $g_sAndroidAdbGlobalOptions = "-P " & $g_bAndroidAdbPort Else +If $g_bAndroidAdbPort Then +SetDebugLog("Using default ADB Daemon port, minitouch port is " &($g_bAndroidAdbPort + 1000), $COLOR_ERROR) +Else SetDebugLog("Cannot aquire ADB Daemon port, using default", $COLOR_ERROR) $g_bAndroidAdbMinitouchPort = 1111 EndIf +EndIf EndFunc Func InitAndroid($bCheckOnly = False, $bLogChangesOnly = True) FuncEnter(InitAndroid) @@ -8814,6 +8860,16 @@ SetDebugLog("Disabled WerFault for " & $sFileOnly) Else SetDebugLog("Cannot disable WerFault for " & $sFileOnly) EndIf +Local $sPath = Execute("Get" & $g_sAndroidEmulator & "AdbPath()") +If $sPath Then +Local $sFileOnly = StringMid($sPath, StringInStr($sPath, "\", 0, -1) + 1) +Local $aResult = DllCall("Wer.dll", "int", "WerAddExcludedApplication", "wstr", $sFileOnly, "bool", True) +If(UBound($aResult) > 0 And $aResult[0] = $S_OK) Or RegWrite($g_sHKLM & "\Software\Microsoft\Windows\Windows Error Reporting\ExcludedApplications", $sFileOnly, "REG_DWORD", "1") = 1 Then +SetDebugLog("Disabled WerFault for " & $sFileOnly) +Else +SetDebugLog("Cannot disable WerFault for " & $sFileOnly) +EndIf +EndIf EndIf If FileExists($__VBoxManage_Path) Then If $__VBoxGuestProperties = "" Then $__VBoxGuestProperties = LaunchConsole($__VBoxManage_Path, "guestproperty enumerate " & $g_sAndroidInstance, $process_killed) @@ -8848,8 +8904,6 @@ If($g_sAndroidPicturesHostFolder <> "" Or BitAND($g_iAndroidSecureFlags, 1) = 1) DirCreate($g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder) EndIf ElseIf $g_sAndroidPicturesHostPath <> "" Then -SetLog("Shared Folder doesn't exist, please fix:", $COLOR_ERROR) -SetLog($g_sAndroidPicturesHostPath, $COLOR_ERROR) EndIf If CompareAndUpdate($aPriorValues[IncrUpdate($i)], $g_sAndroidPicturesHostPath) Or $bLogChangesOnly = False Then SetDebugLog("Android ADB Shared Folder on Host: " & $g_sAndroidPicturesHostPath) If CompareAndUpdate($aPriorValues[IncrUpdate($i)], $g_sAndroidPicturesHostFolder) Or $bLogChangesOnly = False Then SetDebugLog("Android ADB Shared SubFolder: " & $g_sAndroidPicturesHostFolder) @@ -8990,7 +9044,7 @@ EndIf ConnectAndroidAdb() If Not $g_bRunState Then Return False If Not $g_bRunState Then Return False -If ProfileSwitchAccountEnabled() And $g_bChkSharedPrefs And HaveSharedPrefs() And($g_PushedSharedPrefsProfile <> $g_sProfileCurrentName Or($g_PushedSharedPrefsProfile_Timer = 0 Or __TimerDiff($g_PushedSharedPrefsProfile_Timer) > 120000)) Then PushSharedPrefs() +If((ProfileSwitchAccountEnabled() And $g_bChkSharedPrefs) Or $g_bUpdateSharedPrefs) And HaveSharedPrefs() And($g_bUpdateSharedPrefs Or $g_PushedSharedPrefsProfile <> $g_sProfileCurrentName Or($g_PushedSharedPrefsProfile_Timer = 0 Or __TimerDiff($g_PushedSharedPrefsProfile_Timer) > 120000)) Then PushSharedPrefs() $cmdOutput = AndroidAdbSendShellCommand("set export=$(am start " & $sRestart & "-n " & $g_sAndroidGamePackage & "/" & $g_sAndroidGameClass & " >&2)", 60000) If StringInStr($cmdOutput, "Error:") > 0 And StringInStr($cmdOutput, $g_sAndroidGamePackage) > 0 Then SetLog("Unable to load Clash of Clans, install/reinstall the game.", $COLOR_ERROR) @@ -9434,6 +9488,9 @@ If Not $g_bAndroidInitialized Or $g_iAndroidAdbProcess[0] = 0 Or ProcessExists2( Local $SuspendMode = ResumeAndroid() InitAndroid() Local $s +If(Not $g_sAndroidPicturesHostPath Or Not $g_bAndroidSharedFolderAvailable) And $g_bAndroidPicturesPathAutoConfig And $rebootAndroidIfNeccessary Then +RebootAndroidSetScreenDefault() +EndIf Local $hostFolder = $g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder If FileExists($hostFolder) = 1 Then SetDebugLog($hostFolder & " exists") @@ -9525,7 +9582,12 @@ Local $aMounts[0] If $path Then _ArrayConcatenate($aMounts, StringSplit(((StringLeft($path, 1) = "(" And StringRight($path, 1) = ")") ? StringMid($path, 2, StringLen($path) - 2) : $path), "|", $STR_NOCOUNT)) If UBound($aRegExResult) > 0 Then _ArrayConcatenate($aMounts, $aRegExResult) Local $dummyFile = StringMid(_Crypt_HashData($g_sBotTitle & _Now(), $CALG_SHA1), 3) -FileWriteLine($g_sAndroidPicturesHostPath & $dummyFile, _Now()) +If FileWriteLine($g_sAndroidPicturesHostPath & $dummyFile, _Now()) Then +SetDebugLog("Created dummy file: " & $g_sAndroidPicturesHostPath & $dummyFile) +Else +SetLog("Cannot create dummy file: " & $g_sAndroidPicturesHostPath & $dummyFile, $COLOR_ERROR) +Return SetError(4, 0) +EndIf For $i = 0 To UBound($aMounts) - 1 $path = $aMounts[$i] If $path = "" Then ContinueLoop @@ -9588,6 +9650,7 @@ If $g_bAndroidAdbMinitouchSocket Then TCPCloseSocket($g_bAndroidAdbMinitouchSocket) $g_bAndroidAdbMinitouchSocket = 0 EndIf +If $g_iAndroidAdbMinitouchMode = 0 Then If $g_bAndroidAdbMinitouchPort Then SetDebugLog($g_sAndroidEmulator & " initialize minitouch on port " & $g_bAndroidAdbMinitouchPort) Local $androidPath = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") @@ -9605,11 +9668,13 @@ EndIf $g_bAndroidAdbMinitouchSocket = TCPConnect("127.0.0.1", $g_bAndroidAdbMinitouchPort) EndIf If $g_bAndroidAdbMinitouchSocket < 1 Then -SetDebugLog($g_sAndroidEmulator & " minitouch not available", $COLOR_ERROR) +SetDebugLog($g_sAndroidEmulator & " minitouch not available, switch to STDIN", $COLOR_ERROR) $g_bAndroidAdbMinitouchSocket = 0 -Return SetError(2, 1) +$g_iAndroidAdbMinitouchMode = 1 EndIf -If $g_bAndroidAdbMinitouchSocket Then +EndIf +If $g_iAndroidAdbMinitouchMode = 1 Then +AndroidAdbLaunchMinitouchShellInstance($wasRunState, $rebootAndroidIfNeccessary) EndIf SuspendAndroid($SuspendMode) EndIf @@ -9631,6 +9696,7 @@ If $g_bAndroidAdbMinitouchSocket Then TCPCloseSocket($g_bAndroidAdbMinitouchSocket) $g_bAndroidAdbMinitouchSocket = 0 EndIf +AndroidAdbTerminateMinitouchShellInstance() EndFunc Func AndroidAdbSendShellCommand($cmd = Default, $timeout = Default, $wasRunState = Default, $EnsureShellInstance = True, $bStripPrompt = True, $bNoShellTerminate = False) FuncEnter(AndroidAdbSendShellCommand) @@ -9728,6 +9794,95 @@ EndIf EndIf Return SetError($error, Int(__TimerDiff($hTimer)), $s) EndFunc +Func AndroidAdbLaunchMinitouchShellInstance($wasRunState = Default, $rebootAndroidIfNeccessary = $g_bRunState) +If Not $g_bAndroidInitialized Then Return SetError(2, 0) +If $wasRunState = Default Then $wasRunState = $g_bRunState +Local $iConnected +If Not $g_bAndroidInitialized Or $g_iAndroidAdbMinitouchProcess[0] = 0 Or ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) <> $g_iAndroidAdbMinitouchProcess[0] Then +Local $SuspendMode = ResumeAndroid() +$iConnected = ConnectAndroidAdb($rebootAndroidIfNeccessary) +If $iConnected = 0 Or($iConnected = 2 And $g_iAndroidAdbMinitouchProcess[0] = 0) Then +Return SetError(3, 0) +ElseIf $iConnected = 2 And $g_iAndroidAdbMinitouchProcess[0] Then +Return SetError(0, 0) +EndIf +AndroidAdbTerminateMinitouchShellInstance() +Local $cmdMinitouch = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") & "minitouch -d " & $g_sAndroidMouseDevice & " -i" +Local $cmd = '"' & $g_sAndroidAdbPath & '"' & AddSpace($g_sAndroidAdbGlobalOptions, 1) & " -s " & $g_sAndroidAdbDevice & " shell" & $g_sAndroidAdbInstanceShellOptions & $g_sAndroidAdbShellOptions & " " & $cmdMinitouch +SetDebugLog("Run pipe ADB shell for minituch: " & $cmd) +$g_iAndroidAdbMinitouchProcess[0] = RunPipe($cmd, "", @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_MERGED), $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) +Sleep(500) +If $g_sAndroidAdbInstanceShellOptions And $g_iAndroidAdbMinitouchProcess[0] <> 0 And ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) <> $g_iAndroidAdbMinitouchProcess[0] Then +Local $aReadPipe = $g_iAndroidAdbMinitouchProcess[2] +Local $output = ReadPipe($aReadPipe[0]) +If InvalidAdbInstanceShellOptions($output, "AndroidAdbLaunchMinitouchShellInstance") Then +ClosePipe($g_iAndroidAdbMinitouchProcess[0], $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) +$cmd = '"' & $g_sAndroidAdbPath & '"' & AddSpace($g_sAndroidAdbGlobalOptions, 1) & " -s " & $g_sAndroidAdbDevice & " shell" & $g_sAndroidAdbInstanceShellOptions & $g_sAndroidAdbShellOptions & " " & $cmdMinitouch +SetDebugLog("Run pipe ADB shell for minituch: " & $cmd) +$g_iAndroidAdbMinitouchProcess[0] = RunPipe($cmd, "", @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_MERGED), $g_iAndroidAdbProcess[1], $g_iAndroidAdbProcess[2], $g_iAndroidAdbProcess[3], $g_iAndroidAdbProcess[4]) +Sleep(500) +EndIf +EndIf +If $g_sAndroidAdbShellOptions And $g_iAndroidAdbMinitouchProcess[0] <> 0 And ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) <> $g_iAndroidAdbMinitouchProcess[0] Then +Local $aReadPipe = $g_iAndroidAdbMinitouchProcess[2] +Local $output = ReadPipe($aReadPipe[0]) +If InvalidAdbShellOptions($output, "AndroidAdbLaunchMinitouchShellInstance") Then +ClosePipe($g_iAndroidAdbMinitouchProcess[0], $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) +$cmd = '"' & $g_sAndroidAdbPath & '"' & AddSpace($g_sAndroidAdbGlobalOptions, 1) & " -s " & $g_sAndroidAdbDevice & " shell" & $g_sAndroidAdbInstanceShellOptions & $g_sAndroidAdbShellOptions & " " & $cmdMinitouch +SetDebugLog("Run pipe ADB shell for minituch: " & $cmd) +$g_iAndroidAdbMinitouchProcess[0] = RunPipe($cmd, "", @SW_HIDE, BitOR($STDIN_CHILD, $STDERR_MERGED), $g_iAndroidAdbProcess[1], $g_iAndroidAdbProcess[2], $g_iAndroidAdbProcess[3], $g_iAndroidAdbProcess[4]) +Sleep(500) +EndIf +EndIf +If $g_iAndroidAdbMinitouchProcess[0] And ProcessExists2($g_iAndroidAdbMinitouchProcess[0]) = $g_iAndroidAdbMinitouchProcess[0] Then +Else +SetLog($g_sAndroidEmulator & " error launching ADB shell for minitouch", $COLOR_ERROR) +$g_iAndroidAdbMinitouchProcess[0] = 0 +Return SetError(1, 0) +EndIf +EndIf +SetError(0, 0) +EndFunc +Func AndroidAdbTerminateMinitouchShellInstance() +Local $SuspendMode = ResumeAndroid() +If $g_iAndroidAdbMinitouchProcess[0] <> 0 Then +If ClosePipe($g_iAndroidAdbMinitouchProcess[0], $g_iAndroidAdbMinitouchProcess[1], $g_iAndroidAdbMinitouchProcess[2], $g_iAndroidAdbMinitouchProcess[3], $g_iAndroidAdbMinitouchProcess[4]) = 1 Then +SetDebugLog("ADB minitouch shell terminated, PID = " & $g_iAndroidAdbMinitouchProcess[0]) +Else +SetDebugLog("ADB minitouch shell already terminated, PID = " & $g_iAndroidAdbMinitouchProcess[0]) +EndIf +$g_iAndroidAdbMinitouchProcess[0] = 0 +EndIf +EndFunc +Func AndroidAdbSendMinitouchShellCommand($cmd = Default, $iDelay = 0, $wasRunState = Default, $EnsureShellInstance = True, $bStripPrompt = True, $bNoShellTerminate = False) +Static $iCommandErrors = 0 +If $wasRunState = Default Then $wasRunState = $g_bRunState +Local $sentBytes = 0 +Local $SuspendMode = ResumeAndroid() +SetError(0, 0, 0) +If $EnsureShellInstance = True Then +AndroidAdbLaunchMinitouchShellInstance($wasRunState) +EndIf +If @error <> 0 Then Return SetError(@error, 0, "") +Local $aReadPipe = $g_iAndroidAdbMinitouchProcess[2] +Local $aWritePipe = $g_iAndroidAdbMinitouchProcess[1] +If UBound($aReadPipe) < 2 Or UBound($aWritePipe) < 2 Then +SetDebugLog("ADB Minitiuch Shell instance not initialized, cannot execute: " & $cmd, $COLOR_ERROR) +Return SetError(1, 0, "") +EndIf +ReadPipe($aReadPipe[0]) +If $cmd = Default Then +Else +If $g_bDebugAndroid Then +SetDebugLog("Send ADB minitouch shell command: " & StringReplace($cmd, @LF, ";")) +EndIf +$sentBytes = WritePipe($aWritePipe[1], $cmd) +EndIf +If $iDelay Then Sleep($iDelay) +Local $s = ReadPipe($aReadPipe[0]) +SuspendAndroid($SuspendMode) +Return $s +EndFunc Func GetBinaryEvent($type, $code, $value) Local $h, $hType, $hCode, $hValue If IsInt($type) Then @@ -10211,6 +10366,7 @@ Return AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, $wasRunState) EndFunc Func AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, $wasRunState = Default) AndroidAdbLaunchShellInstance($wasRunState) +If $g_iAndroidAdbMinitouchMode = 0 Then If $g_bAndroidAdbMinitouchSocket < 1 Then SetLog("Minitouch not available", $COLOR_ERROR) Return SetError(1, 0, 0) @@ -10227,6 +10383,7 @@ Return AndroidMinitouchClickDrag($x1, $y1, $x2, $y2, False) EndIf Return SetError(1, 0, 0) EndIf +EndIf Local $sleepStart = 250 Local $sleepMove = 10 Local $sleepEnd = 1000 @@ -10244,7 +10401,11 @@ Local $x = $x1, $y = $y1 $send = "d 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF & "w " & $sleep & @LF $botSleep += $sleep If $g_bDebugAndroid Then SetDebugLog("minitouch: " & StringReplace($send, @LF, ";")) +If $g_iAndroidAdbMinitouchMode = 0 Then TCPSend($g_bAndroidAdbMinitouchSocket, $send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf $sleep = $sleepMove For $i = 1 To $loops $x += $x_steps @@ -10262,13 +10423,21 @@ EndIf $send = "m 0 " & Int($x) & " " & Int($y) & " 50" & @LF & "c" & @LF & "w " & $sleep & @LF $botSleep += $sleep If $g_bDebugAndroid Then SetDebugLog("minitouch: " & StringReplace($send, @LF, ";")) +If $g_iAndroidAdbMinitouchMode = 0 Then TCPSend($g_bAndroidAdbMinitouchSocket, $send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf Next $sleep = $sleepMove $send = "u 0" & @LF & "c" & @LF & "w " & $sleep & @LF $botSleep += $sleep If $g_bDebugAndroid Then SetDebugLog("minitouch: " & StringReplace($send, @LF, ";")) +If $g_iAndroidAdbMinitouchMode = 0 Then TCPSend($g_bAndroidAdbMinitouchSocket, $send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf _Sleep($botSleep) Return SetError(0, 0, 1) EndFunc @@ -10312,7 +10481,9 @@ ForceCaptureRegion() AndroidMinitouchClick($x, $y, $times, $speed, $checkProblemAffect) EndFunc Func Minitouch($x, $y, $iAction = 0, $iDelay = 1) +If $g_iAndroidAdbMinitouchMode = 0 Then If $g_bAndroidAdbMinitouchSocket < 1 Then Return -1 +EndIf Static $x_dn, $y_dn $x = Int($x) $y = Int($y) @@ -10320,22 +10491,50 @@ Execute($g_sAndroidEmulator & "AdjustClickCoordinates($x,$y)") Local $iBytes = 0 Local $s Local $t = "" +Local $sWait = "" Switch $iAction Case 0, 2 If $iAction = 0 Or $x_dn <> $x Or $y_dn <> $y Then -$s = "m 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF +$s = "m 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF & $sWait $t &= $s +If $g_iAndroidAdbMinitouchMode = 0 Then $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) +Else +AndroidAdbSendMinitouchShellCommand($s) +If @error Then +Return SetError(@error, 0, 0) +Else +$iBytes += StringLen($s) +EndIf +EndIf EndIf If $iAction = 2 Then -$s = "u 0 " & @LF & "c" & @LF +$s = "u 0 " & @LF & "c" & @LF & $sWait $t &= $s +If $g_iAndroidAdbMinitouchMode = 0 Then $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) +Else +AndroidAdbSendMinitouchShellCommand($s) +If @error Then +Return SetError(@error, 0, 0) +Else +$iBytes += StringLen($s) +EndIf +EndIf EndIf Case 1 -$s = "d 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF +$s = "d 0 " & $x & " " & $y & " 50" & @LF & "c" & @LF & $sWait $t &= $s +If $g_iAndroidAdbMinitouchMode = 0 Then $iBytes += TCPSend($g_bAndroidAdbMinitouchSocket, $s) +Else +AndroidAdbSendMinitouchShellCommand($s) +If @error Then +Return SetError(@error, 0, 0) +Else +$iBytes += StringLen($s) +EndIf +EndIf $x_dn = $x $y_dn = $y EndSwitch @@ -10368,6 +10567,8 @@ $g_bSilentSetLog = $_SilentSetLog EndIf Return EndIf +Local $bytes = 0 +Local $bytesSent = 0 Local $wasRunState = $g_bRunState Local $hostPath = $g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder Local $androidPath = $g_sAndroidPicturesPath & StringReplace($g_sAndroidPicturesHostFolder, "\", "/") @@ -10383,6 +10584,7 @@ SetLog("Disabled " & $g_sAndroidEmulator & " ADB fast mouse click", $COLOR_ERROR Return SetError(1, 0) EndIf AndroidAdbLaunchShellInstance($wasRunState) +If $g_iAndroidAdbMinitouchMode = 0 Then If $g_bAndroidAdbMinitouchSocket < 1 Then $g_bAndroidAdbClick = False SetLog("Disabled " & $g_sAndroidEmulator & " ADB fast mouse click", $COLOR_ERROR) @@ -10390,7 +10592,7 @@ Return SetError(1, 0) EndIf TCPRecv($g_bAndroidAdbMinitouchSocket, 256, 1) Local $recv_state = [@error, @extended] -Local $bytes = TCPSend($g_bAndroidAdbMinitouchSocket, @LF) +$bytes = TCPSend($g_bAndroidAdbMinitouchSocket, @LF) Local $send_state = [@error, $bytes] If($recv_state[0] Or $send_state[0] Or $send_state[1] <> 1) Then SetLog("Cannot send minitouch data to " & $g_sAndroidEmulator & ", received " & $recv_state[1] & ", send " & $send_state[1], $COLOR_ERROR) @@ -10400,6 +10602,7 @@ Return AndroidMinitouchClick($x, $y, $times, $speed, $checkProblemAffect, $iRetr EndIf Return SetError(1, 0) EndIf +EndIf Local $ReleaseClicksCheck =($x = Default And $y = Default And $g_aiAndroidAdbClicks[0] > 0) If $ReleaseClicks <> $ReleaseClicksCheck Then SetDebugLog("AndroidMinitouchClick: Release clicks condition changed from " & $ReleaseClicks & " to " & $ReleaseClicksCheck) @@ -10459,37 +10662,59 @@ $BTN_TOUCH_UP = StringInStr($up_down, "up") > 0 EndIf Local $send = "" $bytes = 0 +$bytesSent = 0 If $BTN_TOUCH_DOWN Then $send &= "d 0 " & $x & " " & $y & " 50" & @LF $send &= "c" & @LF +If $g_iAndroidAdbMinitouchMode = 0 Then $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) -$send = "" +$bytesSent += StringLen($send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf EndIf If $BTN_TOUCH_UP Then +$send = "" Local $sleep = $minSleep If $speed > $minSleep And $times = 1 Then $sleep = $speed EndIf $send &= "w " & $sleep & @LF +If $g_iAndroidAdbMinitouchMode = 0 Then $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) +$bytesSent += StringLen($send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf $send = "" -_SleepMicro($sleep * 1000) $send &= "u 0" & @LF $send &= "c" & @LF +$send &= "w " & $iDelay & @LF +If $g_iAndroidAdbMinitouchMode = 0 Then $bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) -$send = "" -_SleepMicro($iDelay * 1000) +$bytesSent += StringLen($send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf +_SleepMicro(($iDelay + $sleep) * 1000) If $g_bDebugClick Then SetDebugLog("minitouch: d 0 " & $x & " " & $y & " 50, speed=" & $sleep & ", delay=" & $iDelay) EndIf -$bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) -If $bytes < StringLen($send) Then SetDebugLog("minitouch: Faild to send " &(StringLen($send) - $bytes) & " bytes!", $COLOR_ERROR) +If $g_iAndroidAdbMinitouchMode = 0 Then +If $bytes < $bytesSent Then SetDebugLog("minitouch: Faild to send " &($bytesSent - $bytes) & " bytes!", $COLOR_ERROR) +EndIf Next EndIf $g_bSilentSetLog = True $g_bSilentSetLog = $_SilentSetLog +If False Then If $speed > 0 Then If $g_bDebugClick Then SetDebugLog("minitouch: wait between group clicks: " & $speed & " ms.") -TCPSend($g_bAndroidAdbMinitouchSocket, "w " & $speed & @LF) +$send = "w " & $speed & @LF +If $g_iAndroidAdbMinitouchMode = 0 Then +$bytes += TCPSend($g_bAndroidAdbMinitouchSocket, $send) +Else +AndroidAdbSendMinitouchShellCommand($send) +EndIf _SleepMicro($speed * 1000) EndIf If $adjustSpeed > 0 Then @@ -10503,6 +10728,7 @@ EndIf _Sleep($wait, False) EndIf EndIf +EndIf $timeSlept += __TimerDiff($sleepTimer) If $g_bRunState = False Then ExitLoop If $__TEST_ERROR_SLOW_ADB_CLICK_DELAY > 0 Then Sleep($__TEST_ERROR_SLOW_ADB_CLICK_DELAY) @@ -10547,7 +10773,7 @@ If $SymbolFix = False Then If $g_iAndroidAdbInputWordsCharLimit = 0 Then $newText = StringRegExpReplace($newText, "([\\\?""\$\^&\*\(\)\+<>\|'~;])", "\\$1") $newText = StringReplace($newText, " ", "%s") -AndroidAdbSendShellCommand("input text " & $newText, Default, $wasRunState) +AndroidAdbSendShellCommand("input text " & $newText, 6000, $wasRunState) Else Local $words = StringSplit($newText, " ") Local $i, $word, $newWord @@ -10555,7 +10781,7 @@ For $i = 1 To $words[0] $word = $words[$i] While StringLen($word) > 0 $newWord = StringRegExpReplace(StringLeft($word, $g_iAndroidAdbInputWordsCharLimit), "([\\\?""\$\^&\*\(\)\+<>\|'~;])", "\\$1") -AndroidAdbSendShellCommand("input text " & $newWord, Default, $wasRunState) +AndroidAdbSendShellCommand("input text " & $newWord, 6000, $wasRunState) $word = StringMid($word, $g_iAndroidAdbInputWordsCharLimit + 1) WEnd If $i < $words[0] Then AndroidAdbSendShellCommand("input text %s", Default, $wasRunState) @@ -10576,7 +10802,7 @@ EndFunc Func AndroidInputSwipe($x1, $y1, $x2, $y2, $wasRunState = $g_bRunState) AndroidAdbLaunchShellInstance($wasRunState) If @error = 0 Then -AndroidAdbSendShellCommand("input swipe " & $x1 & " " & $y1 & " " & $x2 & " " & $y2 & ";input tap " & $x2 & " " & $y2, Default, $wasRunState) +AndroidAdbSendShellCommand("input swipe " & $x1 & " " & $y1 & " " & $x2 & " " & $y2 & ";input tap " & $x2 & " " & $y2, 6000, $wasRunState) SetError(0, 0) Else Local $error = @error @@ -10882,6 +11108,7 @@ $path = $g_sAndroidPicturesHostPath If FileExists($path) = 1 Then ElseIf DirCreate($path) = 1 Then SetGuiLog("Shared folder created: " & $path, $COLOR_SUCCESS, $bSetLog) +$Result = True Else SetGuiLog("Cannot configure " & $g_sAndroidEmulator & " shared folder", $COLOR_SUCCESS, $bSetLog) SetGuiLog("Cannot create folder: " & $path, $COLOR_ERROR, $bSetLog) @@ -10891,6 +11118,40 @@ EndIf EndIf Return $Result EndFunc +Func ConfigureSharedFolder($iMode = 0, $bSetLog = Default) +If $bSetLog = Default Then $bSetLog = True +Local $Result = Execute("ConfigureSharedFolder" & $g_sAndroidEmulator & "(" & $iMode & "," & $bSetLog & ")") +If Not($Result = "" And @error <> 0) Then +Return $Result +EndIf +Local $bResult = False +Switch $iMode +Case 0 +Local $aRegexResult = StringRegExp($__VBoxVMinfo, "Name: '" & $g_sAndroidSharedFolderName & "', Host path: '(.*)'.*", $STR_REGEXPARRAYGLOBALMATCH) +If Not @error Then +$bResult = True +$g_bAndroidSharedFolderAvailable = True +$g_sAndroidPicturesHostPath = $aRegexResult[UBound($aRegexResult) - 1] & "\" +Else +SetLog($g_sAndroidEmulator & " shared folder is not available", $COLOR_ERROR) +$g_sAndroidPicturesHostPath = "" +$g_bAndroidAdbScreencap = False +$g_bAndroidSharedFolderAvailable = False +EndIf +Case 1 +$bResult = AndroidPicturePathAutoConfig(Default, Default, $bSetLog) +Case 2 +If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then +Local $cmdOutput, $process_killed +Local $path = $g_sAndroidPicturesHostPath +If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) +$cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder remove " & $g_sAndroidInstance & " --name " & $g_sAndroidSharedFolderName, $process_killed) +$cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name " & $g_sAndroidSharedFolderName & " --hostpath """ & $path & """ --automount", $process_killed) +$bResult = True +EndIf +EndSwitch +Return SetError(0,0, $bResult) +EndFunc Func OpenAdbShell() Local $bWasRunState = $g_bRunState $g_bRunState = True @@ -10953,6 +11214,9 @@ EndFunc Func OpenPlayStoreGame() Return OpenPlayStore($g_sUserGamePackage) EndFunc +Func OpenPlayStoreGooglePlayServices() +Return OpenPlayStore("com.google.android.gms") +EndFunc Func OpenPlayStoreNovaLauncher() Return OpenPlayStore("com.teslacoilsw.launcher") EndFunc @@ -10961,6 +11225,9 @@ If $iWaitInSecAfterLaunch = Default Then $iWaitInSecAfterLaunch = 10 If $sCmdParam And StringLeft($sCmdParam, 1) <> " " Then $sCmdParam = " " & $sCmdParam EndIf +If Not $g_sAndroidPicturesHostPath Then +SetScreenAndroid() +EndIf SetLog("Please wait while " & $g_sAndroidEmulator & " and CoC start...", $COLOR_SUCCESS) Local $pid = 0 For $i = 1 To 3 @@ -11221,6 +11488,32 @@ Local $hostFolder = $g_sAndroidPicturesHostPath & $g_sAndroidPicturesHostFolder Local $iFilesInShared = UBound(_FileListToArray($hostFolder & "\shared_prefs", "*", $FLTA_FILES)) - 1 If FileExists($hostFolder & "\shared_prefs") And $iFilesInShared < 1 Then If FileCopy($g_sPrivateProfilePath & "\" & $sProfile & "\shared_prefs\*", $hostFolder & "\shared_prefs", $FC_OVERWRITE) And UBound(_FileListToArray($hostFolder & "\shared_prefs", "*", $FLTA_FILES)) - 1 >= $iFiles Then +If $g_bUpdateSharedPrefs And($g_bUpdateSharedPrefsLanguage OR $g_bUpdateSharedPrefsSnow Or $g_bUpdateSharedPrefsZoomLevel Or $g_bUpdateSharedPrefsGoogleDisconnected Or $g_bUpdateSharedPrefsRated) Then +Local $hFile = FileOpen($hostFolder & "\shared_prefs\storage_new.xml", $FO_READ + $FO_UTF8_NOBOM) +Local $sStorage = FileRead($hFile) +FileClose($hFile) +If $sStorage Then +Local $sStorageUpdated = $sStorage +If $g_bUpdateSharedPrefsLanguage Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'FWCNTu39RUlYoSt0Y6mCwg==', 1) +If $g_bUpdateSharedPrefsSnow Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'jS26iozgAh+i/424eyY5cA==', 1) +If $g_bUpdateSharedPrefsZoomLevel Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'oiMa1oDch9dThLoIKokZqQ==', 1) +If $g_bUpdateSharedPrefsGoogleDisconnected Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'pmvEzdQuRQuKZob4KB0IeA==', 1) +If $g_bUpdateSharedPrefsRated Then $sStorageUpdated = StringRegExpReplace($sStorageUpdated, '.+<\/string>', 'pmvEzdQuRQuKZob4KB0IeA==', 1) +If $sStorageUpdated <> $sStorage Then +Local $hFile = FileOpen($hostFolder & "\shared_prefs\storage_new.xml", $FO_OVERWRITE + $FO_UTF8_NOBOM) +If FileWrite($hFile, $sStorageUpdated) Then +SetLog("Updated shared_prefs", $COLOR_SUCCESS) +Else +SetLog("Failed to update shared_prefs", $COLOR_ERROR) +EndIf +FileClose($hFile) +Else +SetDebugLog("No need to update shared_prefs", $COLOR_ERROR) +EndIf +Else +SetLog("Failed to read shared_prefs", $COLOR_ERROR) +EndIf +EndIf AndroidAdbSendShellCommand("set result=$(rm /data/data/" & $g_sAndroidGamePackage & "/shared_prefs/* >&2)") AndroidAdbSendShellCommand("set result=$(cp " & $androidFolder & "/shared_prefs/* /data/data/" & $g_sAndroidGamePackage & "/shared_prefs >&2)") $cmdOutput = AndroidAdbSendShellCommand("set result=$(ls -l /data/data/" & $g_sAndroidGamePackage & "/shared_prefs/ >&2)") @@ -11302,9 +11595,9 @@ Local $NewVersion = "" Local $HelpLink = "Please visit MyBot Forum!" Switch $g_sAndroidEmulator Case "BlueStacks2" -$NewVersion = GetVersionNormalized("4.33.0.0") +$NewVersion = GetVersionNormalized("4.61.0.0") Case "MEmu" -$NewVersion = GetVersionNormalized("6.1.0.0") +$NewVersion = GetVersionNormalized("6.2.0.0") Case "Nox" $NewVersion = GetVersionNormalized("6.3.0.0") Case Else @@ -14710,7 +15003,7 @@ Global $g_hGUI_NOTIFY = 0, $g_hGUI_NOTIFY_TAB = 0, $g_hGUI_NOTIFY_TAB_ITEM2 = 0 Global $g_hGrpNotify = 0 Global $g_hChkNotifyTGEnable = 0, $g_hTxtNotifyTGToken = 0 Global $g_hChkNotifyRemote = 0, $g_hTxtNotifyOrigin = 0 -Global $g_hChkNotifyAlertMatchFound = 0, $g_hChkNotifyAlertLastRaidIMG = 0, $g_hChkNotifyAlertLastRaidTXT = 0, $g_hChkNotifyAlertCampFull = 0, $g_hChkNotifyAlertUpgradeWall = 0, $g_hChkNotifyAlertOutOfSync = 0, $g_hChkNotifyAlertTakeBreak = 0, $g_hChkNotifyAlertBuilderIdle = 0, $g_hChkNotifyAlertVillageStats = 0, $g_hChkNotifyAlertLastAttack = 0, $g_hChkNotifyAlertAnotherDevice = 0, $g_hChkNotifyAlertMaintenance = 0, $g_hChkNotifyAlertBAN = 0, $g_hChkNotifyBOTUpdate = 0, $g_hChkNotifyAlertSmartWaitTime = 0 +Global $g_hChkNotifyAlertMatchFound = 0, $g_hChkNotifyAlertLastRaidIMG = 0, $g_hChkNotifyAlertLastRaidTXT = 0, $g_hChkNotifyAlertCampFull = 0, $g_hChkNotifyAlertUpgradeWall = 0, $g_hChkNotifyAlertOutOfSync = 0, $g_hChkNotifyAlertTakeBreak = 0, $g_hChkNotifyAlertBuilderIdle = 0, $g_hChkNotifyAlertVillageStats = 0, $g_hChkNotifyAlertLastAttack = 0, $g_hChkNotifyAlertAnotherDevice = 0, $g_hChkNotifyAlertMaintenance = 0, $g_hChkNotifyAlertBAN = 0, $g_hChkNotifyBOTUpdate = 0, $g_hChkNotifyAlertSmartWaitTime = 0, $g_hChkNotifyAlertLaboratoryIdle = 0 Global $g_hChkNotifyOnlyHours = 0, $g_hChkNotifyOnlyWeekDays = 0, $g_hChkNotifyhours[24] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], $g_hChkNotifyWeekdays[7] = [0, 0, 0, 0, 0, 0, 0] GLobal $g_hLblNotifyhour = 0, $g_ahLblNotifyhoursE = 0, $g_hChkNotifyhoursE1 = 0, $g_hChkNotifyhoursE2 = 0, $g_hLblNotifyhoursAM = 0, $g_hLblNotifyhoursPM = 0 GLobal $g_hLblNotifyhours[12] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] @@ -14798,6 +15091,9 @@ GUICtrlSetState(-1, $GUI_DISABLE) $g_hChkNotifyBOTUpdate = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyBOTUpdate", "BOT Update"), $x + 210, $y, -1, -1) _GUICtrlSetTip(-1, GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyBOTUpdate_Info_01", "Send an Alert when there is a new version of the bot.")) GUICtrlSetState(-1, $GUI_DISABLE) +$g_hChkNotifyAlertLaboratoryIdle = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertLaboratoryIdle", "Laboratory Idle"), $x + 315, $y, -1, -1) +_GUICtrlSetTip(-1, GetTranslatedFileIni("MBR GUI Design Child Village - Notify", "ChkNotifyAlertLaboratoryIdle_Info_01", "Send an Alert when the laboratory is idle.")) +GUICtrlSetState(-1, $GUI_DISABLE) $y += 20 $y += 30 $g_hChkNotifyOnlyHours = GUICtrlCreateCheckbox(GetTranslatedFileIni("MBR Global GUI Design", "Only_during_hours", "Only during these hours of each day"), $x + 70, $y ) @@ -19214,7 +19510,7 @@ $g_hBtnExportData = GUICtrlCreateButton( GetTranslatedFileIni("MBR GUI Design Ch GUICtrlSetOnEvent(-1, "SQLiteExport") GUICtrlCreateGroup("", -99, -99, 1, 1) EndFunc -Global $g_hCmbCOCDistributors = 0, $g_hCmbAndroidBackgroundMode = 0, $g_hCmbAndroidZoomoutMode = 0, $g_hCmbSuspendAndroid = 0, $g_hChkAndroidAdbClick = 0, $g_hChkAndroidAdbClickDragScript = 0, $g_hBtnAndroidAdbShell = 0, $g_hBtnAndroidHome = 0, $g_hBtnAndroidBack = 0, $g_hTxtAndroidRebootHours = 0, $g_hChkAndroidCloseWithBot = 0, $g_hBtnAndroidEnableTouch = 0, $g_hBtnAndroidDisableTouch = 0, $g_lblHelpBot = 0 +Global $g_hCmbCOCDistributors = 0, $g_hCmbAndroidBackgroundMode = 0, $g_hCmbAndroidZoomoutMode = 0, $g_hCmbSuspendAndroid = 0, $g_hChkAndroidAdbClick = 0, $g_hChkAndroidAdbClickDragScript = 0, $g_hBtnAndroidAdbShell = 0, $g_hBtnAndroidHome = 0, $g_hBtnAndroidBack = 0, $g_hTxtAndroidRebootHours = 0, $g_hChkAndroidCloseWithBot = 0, $g_hChkUpdateSharedPrefs = 0, $g_hBtnAndroidEnableTouch = 0, $g_hBtnAndroidDisableTouch = 0, $g_lblHelpBot = 0 Func CreateBotAndroid() Local $x = 25, $y = 45, $y2, $w = 240, $h = 50, $sTxtTip GUICtrlCreateGroup(GetTranslatedFileIni("MBR Distributors", "Group_01", "Distributors"), $x - 20, $y - 20, $w, $h) @@ -19254,13 +19550,16 @@ $g_hChkAndroidCloseWithBot = GUICtrlCreateCheckbox(GetTranslatedFileIni("Android _GUICtrlSetTip(-1, GetTranslatedFileIni("Android", "ChkAndroidCloseWithBot_Info", "Close also Android Emulator when bot exists.")) GUICtrlSetState(-1,(($g_bAndroidCloseWithBot) ?($GUI_CHECKED) :($GUI_UNCHECKED))) $y += 25 -GUICtrlCreateLabel(GetTranslatedFileIni("Android", "LblAndroidRebootHours", "Reboot Android in") & ":", $x + 17, $y + 2, -1, -1) +$g_hChkUpdateSharedPrefs = GUICtrlCreateCheckbox(GetTranslatedFileIni("Android", "ChkUpdateSharedPrefs", "Update shared_prefs"), $x, $y, -1, -1) +_GUICtrlSetTip(-1, GetTranslatedFileIni("Android", "ChkUpdateSharedPrefs_Info", "Pull and push shared_prefs to reset zoom,\nset language to English, disable snow and rate popup.")) +GUICtrlSetState(-1,(($g_bUpdateSharedPrefs) ?($GUI_CHECKED) :($GUI_UNCHECKED))) +GUICtrlCreateLabel(GetTranslatedFileIni("Android", "LblAndroidRebootHours", "Reboot Android in") & ":", $x + 217, $y + 2, -1, -1) $sTxtTip = GetTranslatedFileIni("Android", "LblAndroidRebootHours_Info", "Enter hours when Android will be automatically rebooted after specified run-time.") _GUICtrlSetTip(-1, $sTxtTip) -$g_hTxtAndroidRebootHours = GUICtrlCreateInput($g_iAndroidRebootHours, $x + 177, $y + 1, 30, 16, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) +$g_hTxtAndroidRebootHours = GUICtrlCreateInput($g_iAndroidRebootHours, $x + 327, $y + 1, 30, 16, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER)) _GUICtrlSetTip(-1, $sTxtTip) GUICtrlSetLimit(-1, 4) -GUICtrlCreateLabel(GetTranslatedFileIni("MBR Global GUI Design", "hrs", -1), $x + 212, $y + 2, -1, -1) +GUICtrlCreateLabel(GetTranslatedFileIni("MBR Global GUI Design", "hrs", -1), $x + 362, $y + 2, -1, -1) GUICtrlCreateGroup("", -99, -99, 1, 1) $y = $y2 + $h + 5 $w = $g_iSizeWGrpTab2 - 2 @@ -19295,14 +19594,17 @@ GUICtrlSetOnEvent(-1, "DisableShowTouchs") GUICtrlCreateGroup("", -99, -99, 1, 1) $x = 25 + 240 + 10 + 30 $y = $y2 -$w = 125 -$h = 80 +$w = 145 +$h = 110 GUICtrlCreateGroup(GetTranslatedFileIni("Android Control", "Group_04", "Install Play Store Apps"), $x - 20, $y - 20, $w, $h) $y -= 2 -GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreGame", "Clash of Clans"), $x - 8, $y, 100, 25) +GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreGame", "Clash of Clans"), $x - 8, $y, $w - 24, 25) GUICtrlSetOnEvent(-1, "OpenPlayStoreGame") $y += 30 -GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreNovaLauncher", "Nova Launcher"), $x - 8, $y, 100, 25) +GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreGooglePlayServices", "Google Play Services"), $x - 8, $y, $w - 24, 25) +GUICtrlSetOnEvent(-1, "OpenPlayStoreGooglePlayServices") +$y += 30 +GUICtrlCreateButton(GetTranslatedFileIni("Android Control", "BtnPlayStoreNovaLauncher", "Nova Launcher"), $x - 8, $y, $w - 24, 25) GUICtrlSetOnEvent(-1, "OpenPlayStoreNovaLauncher") GUICtrlCreateGroup("", -99, -99, 1, 1) $y += 105 @@ -25323,6 +25625,7 @@ GUICtrlSetState($g_hChkNotifyAlertMaintenance, $GUI_ENABLE) GUICtrlSetState($g_hChkNotifyAlertBAN, $GUI_ENABLE) GUICtrlSetState($g_hChkNotifyBOTUpdate, $GUI_ENABLE) GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $GUI_ENABLE) +GUICtrlSetState($g_hChkNotifyAlertLaboratoryIdle, $GUI_ENABLE) Else GUICtrlSetState($g_hChkNotifyRemote, $GUI_DISABLE) GUICtrlSetState($g_hTxtNotifyOrigin, $GUI_DISABLE) @@ -25341,6 +25644,7 @@ GUICtrlSetState($g_hChkNotifyAlertMaintenance, $GUI_DISABLE) GUICtrlSetState($g_hChkNotifyAlertBAN, $GUI_DISABLE) GUICtrlSetState($g_hChkNotifyBOTUpdate, $GUI_DISABLE) GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $GUI_DISABLE) +GUICtrlSetState($g_hChkNotifyAlertLaboratoryIdle, $GUI_DISABLE) EndIf EndFunc Func chkNotifyHours() @@ -27677,6 +27981,17 @@ SetDebugLog("EnableShowTouchs OFF") EndFunc Func BotStart($bAutostartDelay = 0) FuncEnter(BotStart) +If Not $g_bSearchMode Then +If $g_hLogFile = 0 Then CreateLogFile() +CreateAttackLogFile() +If $g_iFirstRun = -1 Then $g_iFirstRun = 1 +EndIf +SetLogCentered(" BOT LOG ", Default, Default, True) +If Not ForumAuthentication() Then +EnableControls($g_hFrmBotBottom, Default, $g_aFrmBotBottomCtrlState) +SetRedrawBotWindow(True, Default, Default, Default, "BotStart") +Return FuncReturn() +EndIf ResumeAndroid() CleanSecureFiles() CalCostCamp() @@ -27693,12 +28008,6 @@ $g_bDonationEnabled = True $g_bMeetCondStop = False $g_bIsClientSyncError = False $g_bDisableBreakCheck = False -If Not $g_bSearchMode Then -If $g_hLogFile = 0 Then CreateLogFile() -CreateAttackLogFile() -If $g_iFirstRun = -1 Then $g_iFirstRun = 1 -EndIf -SetLogCentered(" BOT LOG ", Default, Default, True) SaveConfig() readConfig() applyConfig(False) @@ -28030,7 +28339,7 @@ SetCriticalMessageProcessing($wasCritical) Return $GUI_RUNDEFMSG EndIf Switch $iMsg -Case $WM_LBUTTONDOWN, $WM_LBUTTONUP, $WM_RBUTTONDOWN, $WM_RBUTTONUP +Case $WM_LBUTTONDOWN, $WM_LBUTTONUP, $WM_RBUTTONDOWN, $WM_RBUTTONUP, $WM_LBUTTONDBLCLK Local $hInput = GUICtrlGetHandle($g_hFrmBotEmbeddedShieldInput) _WinAPI_SetFocus($hInput) EndSwitch @@ -28047,6 +28356,11 @@ If $g_bDebugClick And AndroidShieldHasFocus() Then Local $c = GetPixelFromWindow($x, $y, $g_hAndroidControl) SetLog(StringFormat("Mouse LBUTTONDOWN %03i,%03i Color %s", $x, $y, $c), $COLOR_DEBUG) EndIf +Case $WM_LBUTTONDBLCLK +If $g_bDebugClick And AndroidShieldHasFocus() Then +Local $c = GetPixelFromWindow($x, $y, $g_hAndroidControl) +SetLog(StringFormat("Mouse LBUTTONDBLCLK %03i,%03i Color %s", $x, $y, $c), $COLOR_DEBUG) +EndIf Case $WM_LBUTTONUP, $WM_RBUTTONUP If $g_iDebugWindowMessages Then SetDebugLog("GUIControl_WM_MOUSE: " &($iMsg = $WM_LBUTTONUP ? "$WM_LBUTTONUP" : "$WM_RBUTTONUP") & " $hWin=" & $hWin & ",$iMsg=" & $iMsg & ",$wParam=" & $wParam & ",$lParam=" & $lParam & ", X=" & $x & ", Y=" & $y, Default, True) @@ -28074,7 +28388,7 @@ Case $WM_MOUSEMOVE If $s_x <> $x Or $s_y <> $y Then $iBytesSent = Minitouch($x, $y, 0) EndIf -Case $WM_LBUTTONDOWN +Case $WM_LBUTTONDOWN, $WM_LBUTTONDBLCLK $iBytesSent = Minitouch($x, $y, 1) Case $WM_LBUTTONUP $iBytesSent = Minitouch($x, $y, 2) @@ -31843,8 +32157,10 @@ If($pMatchMode <= $LB And $bCheckSlot12 And Not $bDoubleRow And UBound($aAttackB DragAttackBar() Local $aExtendedArray = ExtendedAttackBarCheck($aAttackBar, $bRemaining, $sSearchDiamond) _ArrayAdd($aFinalAttackBar, $aExtendedArray) -$g_iTotalAttackSlot = UBound($aFinalAttackBar, 1) + 1 -If Not $bRemaining Then DragAttackBar($g_iTotalAttackSlot, True) +If Not $bRemaining Then +$g_iTotalAttackSlot = UBound($aFinalAttackBar, 1) - 1 +DragAttackBar($g_iTotalAttackSlot, True) +EndIf EndIf _ArraySort($aFinalAttackBar, 0, 0, 0, 1) Return $aFinalAttackBar @@ -33369,9 +33685,9 @@ $iMaxReturnPoints = 3 $iMaxLevel = 7 Case "All" If $g_iDetectedImageType = 1 Then -$sdirectory = @ScriptDir & "\imgxml\Storages\All" -Else $sdirectory = @ScriptDir & "\imgxml\Storages\All_Snow" +Else +$sdirectory = @ScriptDir & "\imgxml\Storages\All" EndIf $iMaxReturnPoints = 21 $iMaxLevel = 13 @@ -35046,9 +35362,12 @@ EndIf EndIf ReleaseClicks($g_iAndroidAdbClicksTroopDeploySize) If _Sleep($DELAYRESPOND) Then Return +If $value4 <> "REMAIN" Then $iTroopIndex = TroopIndexLookup($value4, "ParseAttackCSV") $bWardenDrop =($iTroopIndex = $eWarden) And($sleepdrop1 < 1000) +EndIf Case "WAIT" +Local $hSleepTimer = __TimerInit() ReleaseClicks() Local $sleep1, $sleep2, $sleepvect $sleepvect = StringSplit($value1, "-", 2) @@ -35061,7 +35380,7 @@ $sleep1 = 1 $sleep2 = 1 EndIf Else -If Int($value3) > 0 Then +If Int($value1) > 0 Then $sleep1 = Int($value1) $sleep2 = Int($value1) Else @@ -35082,9 +35401,57 @@ Local $Trophies = 0 Local $exitOneStar = 0 Local $exitTwoStars = 0 Local $exitNoResources = 0 -Local $hSleepTimer = __TimerInit() +Local $exitAttackEnded = 0 +Local $bBreakOnTH = False +Local $bBreakOnSiege = False +Local $bBreakOnTHAndSiege = False +Local $aSiegeSlotPos = [0,0] +Local $tempvalue2 = StringStripWS($value2, $STR_STRIPALL) +If StringLen($tempvalue2) > 0 Then +Local $aParam = StringSplit($tempvalue2, ",", $STR_NOCOUNT) +For $iParam = 0 To UBound($aParam) - 1 +Switch $aParam[$iParam] +Case "TH" +$bBreakOnTH = True +Case "SIEGE" +$bBreakOnSiege = True +Case "TH+SIEGE" +$bBreakOnTHAndSiege = True +EndSwitch +Next +SetDebugLog("$bBreakOnTH = " & $bBreakOnTH & ", $bBreakOnSiege = " & $bBreakOnSiege & ", $bBreakOnTHAndSiege = " & $bBreakOnTHAndSiege, $COLOR_INFO) +If $bBreakOnSiege Or $bBreakOnTHAndSiege Then +debugAttackCSV("WAIT Condition Break on Siege Troop Drop set") +For $i = 0 To UBound($g_avAttackTroops) - 1 +If $g_avAttackTroops[$i][0] = $eCastle Then +SetDebugLog("WAIT Break on Siege Machine is set but Clan Castle Troop selected.", $COLOR_INFO) +ExitLoop +ElseIf $g_avAttackTroops[$i][0] = $eWallW Or $g_avAttackTroops[$i][0] = $eBattleB Or $g_avAttackTroops[$i][0] = $eStoneS Then +Local $sSiegeName = GetTroopName($g_avAttackTroops[$i][0]) +SetDebugLog(" " & $sSiegeName & " found. Let's Check If is Dropped Or Not?", $COLOR_SUCCESS) +If ReadTroopQuantity($i) = 0 Then +SetDebugLog(" " & $sSiegeName & " is dropped.", $COLOR_SUCCESS) +$aSiegeSlotPos = GetSlotPosition($i, True) +Else +SetDebugLog(" " & $sSiegeName & " is not dropped yet.", $COLOR_SUCCESS) +EndIf +ExitLoop +EndIf +Next +If $aSiegeSlotPos[0] = 0 And $aSiegeSlotPos[1] = 0 Then +SetDebugLog("WAIT no dropped Siege found, so unset Break on Siege.", $COLOR_INFO) +If $bBreakOnTHAndSiege Then $bBreakOnTH = True +$bBreakOnSiege = False +$bBreakOnTHAndSiege = False +If Not $bBreakOnTH Then ContinueLoop +EndIf +EndIf +EndIf While __TimerDiff($hSleepTimer) < $sleep CheckHeroesHealth() +If $bBreakOnSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) Then ContinueLoop 2 +If $bBreakOnTH And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 +If $bBreakOnTHAndSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 $Gold = getGoldVillageSearch(48, 69) $Elixir = getElixirVillageSearch(48, 69 + 29) If _Sleep($DELAYRESPOND) Then Return @@ -35096,6 +35463,9 @@ $DarkElixir = "" $Trophies = getTrophyVillageSearch(48, 69 + 69) EndIf CheckHeroesHealth() +If $bBreakOnSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) Then ContinueLoop 2 +If $bBreakOnTH And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 +If $bBreakOnTHAndSiege And CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) And CheckIfTownHallGotDestroyed($hSleepTimer) Then ContinueLoop 2 If $g_bDebugSetlog Then SetDebugLog("detected [G]: " & $Gold & " [E]: " & $Elixir & " [DE]: " & $DarkElixir, $COLOR_INFO) If $g_abStopAtkNoResources[$g_iMatchMode] And Number($Gold) = 0 And Number($Elixir) = 0 And Number($DarkElixir) = 0 Then If Not $g_bDebugSetlog Then SetDebugLog("detected [G]: " & $Gold & " [E]: " & $Elixir & " [DE]: " & $DarkElixir, $COLOR_INFO) @@ -35116,9 +35486,14 @@ EndIf If $g_abStopAtkPctHigherEnable[$g_iMatchMode] And Number(getOcrOverAllDamage(780, 527 + $g_iBottomOffsetY)) > Int($g_aiStopAtkPctHigherAmt[$g_iMatchMode]) Then ExitLoop EndIf +If _CheckPixel($aEndFightSceneBtn, True) And _CheckPixel($aEndFightSceneAvl, True) And _CheckPixel($aEndFightSceneReportGold, True) Then +SetDebugLog("From Attackcsv: Found End Fight Scene to close, exit", $COLOR_SUCCESS) +$exitAttackEnded = 1 +ExitLoop +EndIf If _Sleep($DELAYRESPOND) Then Return WEnd -If $exitOneStar = 1 Or $exitTwoStars = 1 Or $exitNoResources = 1 Then ExitLoop +If $exitOneStar = 1 Or $exitTwoStars = 1 Or $exitNoResources = 1 Or $exitAttackEnded = 1 Then ExitLoop Case "RECALC" ReleaseClicks() PrepareAttack($g_iMatchMode, True) @@ -35151,6 +35526,39 @@ Else SetLog("Cannot find attack file " & $g_sCSVAttacksPath & "\" & $filename & ".csv", $COLOR_ERROR) EndIf EndFunc +Func CheckIfSiegeDroppedTheTroops($hSleepTimer, $aSiegeSlotPos) +If _ColorCheck(_GetPixelColor($aSiegeSlotPos[0] + 20, $aSiegeSlotPos[1] + 20, True, "WAIT--> IsSiegeDestroyed"), Hex(0x474747, 6), 10) Then +SetDebugLog("WAIT--> Siege Got Destroyed After " & Round(__TimerDiff($hSleepTimer)) & "ms.", $COLOR_SUCCESS) +Return True +EndIf +Return False +EndFunc +Func CheckIfTownHallGotDestroyed($hSleepTimer) +Static $hPopupTimer = 0 +Local $bIsTHDestroyed = False +Local $bWonOneStar = _CheckPixel($aWonOneStar, True) +Local $bWonTwoStar = _CheckPixel($aWonTwoStar, True) +Local $bCentralStarPopup = _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) - 2, Int($g_iGAME_HEIGHT / 2) - 2, True), Hex(0xC0C4C0, 6), 20) And _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) - 2, Int($g_iGAME_HEIGHT / 2) + 2, True), Hex(0xC0C4C0, 6), 20) And _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) + 2, Int($g_iGAME_HEIGHT / 2) + 2, True), Hex(0xC0C4C0, 6), 20) And _ColorCheck(_GetPixelColor(Int($g_iGAME_WIDTH / 2) + 2, Int($g_iGAME_HEIGHT / 2) - 2, True), Hex(0xC0C4C0, 6), 20) +Local $iDamage = Number(getOcrOverAllDamage(780, 527 + $g_iBottomOffsetY)) +If $bCentralStarPopup Then +If $iDamage < 50 Then +$bIsTHDestroyed = True +ElseIf $bWonOneStar Then +$bIsTHDestroyed = True +ElseIf $hPopupTimer = 0 Or __TimerDiff($hPopupTimer) > 1500 Then +$hPopupTimer = __TimerInit() +ElseIf __TimerDiff($hPopupTimer) > 500 Then +$bIsTHDestroyed = True +EndIf +ElseIf $bWonOneStar And $iDamage < 50 Then +$bIsTHDestroyed = True +ElseIf $bWonTwoStar Then +$bIsTHDestroyed = True +EndIf +SetDebugLog("WAIT--> $iDamage: " & $iDamage & ", $bCentralStarPopup: " & $bCentralStarPopup & ", $bWonOneStar: " & $bWonOneStar & ", $bWonTwoStar: " & $bWonTwoStar & ", $bIsTHDestroyed: " & $bIsTHDestroyed, $COLOR_INFO) +If $bIsTHDestroyed Then SetDebugLog("WAIT--> Town Hall Got Destroyed After " & Round(__TimerDiff($hSleepTimer)) & "ms.", $COLOR_SUCCESS) +Return $bIsTHDestroyed +EndFunc Func ParseAttackCSV_MainSide($debug = False) Local $bForceSideExist = False If $g_iMatchMode = $DB Then @@ -38499,7 +38907,7 @@ If $g_bDebugSetlog Then SetDebugLog("drop KING = " & $bDropKing, $COLOR_DEBUG) If $g_bDebugSetlog Then SetDebugLog("drop QUEEN = " & $bDropQueen, $COLOR_DEBUG) If $g_bDebugSetlog Then SetDebugLog("drop WARDEN = " & $bDropWarden, $COLOR_DEBUG) If $bDropKing Then -SetLog("Dropping King", $COLOR_INFO) +SetLog("Dropping King at " & $iX & ", " & $iY, $COLOR_INFO) SelectDropTroop($iKingSlotNumber, 1, Default, False) If _Sleep($DELAYDROPHEROES2) Then Return AttackClick($iX, $iY, 1, 0, 0, "#0093") @@ -38514,7 +38922,7 @@ If _Sleep($DELAYDROPHEROES1) Then Return EndIf If _Sleep($DELAYDROPHEROES1) Then Return If $bDropQueen Then -SetLog("Dropping Queen", $COLOR_INFO) +SetLog("Dropping Queen at " & $iX & ", " & $iY, $COLOR_INFO) SelectDropTroop($iQueenSlotNumber, 1, Default, False) If _Sleep($DELAYDROPHEROES2) Then Return AttackClick($iX, $iY, 1, 0, 0, "#0095") @@ -38529,7 +38937,7 @@ If _Sleep($DELAYDROPHEROES1) Then Return EndIf If _Sleep($DELAYDROPHEROES1) Then Return If $bDropWarden Then -SetLog("Dropping Grand Warden", $COLOR_INFO) +SetLog("Dropping Grand Warden at " & $iX & ", " & $iY, $COLOR_INFO) SelectDropTroop($iWardenSlotNumber, 1, Default, False) If _Sleep($DELAYDROPHEROES2) Then Return AttackClick($iX, $iY, 1, 0, 0, "#x999") @@ -40302,14 +40710,14 @@ If($iTrainWaitTime >= $MinimumTimeClose) Or $bTest Then If $iShieldTime > 0 Then If $iDiffTime <= 0 Then SetLog("Smart wait while shield time = " & StringFormat("%.2f", $iShieldTime / 60) & " Minutes", $COLOR_INFO) -If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_01", "Smart Wait While Shield Time = ") & StringFormat("%.2f", $iShieldTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) +If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_01", "Smart Wait While Shield Time = ") & StringFormat("%.2f", $iShieldTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) If $bTest Then $iShieldTime = $iTestSeconds UniversalCloseWaitOpenCoC($iShieldTime * 1000, "SmartWait4Train_", $StopEmulator, $bFullRestart, $bSuspendComputer) $g_bRestart = True ResetTrainTimeArray() Else SetLog("Smart wait train time = " & StringFormat("%.2f", $iTrainWaitTime / 60) & " Minutes", $COLOR_INFO) -If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_04", "Smart Wait Train Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) +If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_04", "Smart Wait Train Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) If $bTest Then $iTrainWaitTime = $iTestSeconds UniversalCloseWaitOpenCoC($iTrainWaitTime * 1000, "SmartWait4Train_", $StopEmulator, $bFullRestart, $bSuspendComputer) $g_bRestart = True @@ -40317,7 +40725,7 @@ ResetTrainTimeArray() EndIf ElseIf($g_bCloseWithoutShield And $g_aiTimeTrain[0] > 0) Or($ichkCloseWaitSpell = 1 And $g_aiTimeTrain[1] > 0) Or($ichkCloseWaitHero = 1 And $g_aiTimeTrain[2] > 0) Then SetLog("Smart Wait time = " & StringFormat("%.2f", $iTrainWaitTime / 60) & " Minutes", $COLOR_INFO) -If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_05", "Smart Wait Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "\n" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) +If $g_bNotifyTGEnable And $g_bNotifyAlertSmartWaitTime Then NotifyPushToTelegram($g_sNotifyOrigin & " : " & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_05", "Smart Wait Time = ") & StringFormat("%.2f", $iTrainWaitTime / 60) & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_02", " Minutes") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Smart-Wait-Time_Info_03", "Wait For Troops Ready")) If $bTest Then $iTrainWaitTime = $iTestSeconds UniversalCloseWaitOpenCoC($iTrainWaitTime * 1000, "SmartWait4TrainNoShield_", $StopEmulator, $bFullRestart, $bSuspendComputer) $g_bRestart = True @@ -40620,7 +41028,6 @@ Else SetLog("Waiting for Heroes to drop trophies!", $COLOR_ACTION) EndIf EndIf -If(IsSearchModeActive($DB) And checkCollectors(True, False)) Or IsSearchModeActive($LB) Or IsSearchModeActive($TS) Then If $g_bFullArmy And $g_bCheckSpells And $bFullArmyHero And $bFullArmyCC And $bFullSiege Then $g_bIsFullArmywithHeroesAndSpells = True If $g_bFirstStart Then $g_bFirstStart = False @@ -40637,10 +41044,6 @@ EndIf If $g_bFullArmy And $g_bCheckSpells And $bFullArmyHero Then If Not $bFullArmyCC Then $g_bWaitForCCTroopSpell = True EndIf -Else -If $g_bDebugSetlog Then SetDebugLog(" Army not ready: IsSearchModeActive($DB)=" & IsSearchModeActive($DB) & ", checkCollectors(True, False)=" & checkCollectors(True, False) & ", IsSearchModeActive($LB)=" & IsSearchModeActive($LB) & ", IsSearchModeActive($TS)=" & IsSearchModeActive($TS), $COLOR_DEBUG) -$g_bIsFullArmywithHeroesAndSpells = False -EndIf Local $sLogText = "" If Not $g_bFullArmy Then $sLogText &= " Troops," If Not $g_bCheckSpells Then $sLogText &= " Spells," @@ -42228,7 +42631,9 @@ SetLog("TrainIt.au3 GetVariable(): Wrong Resolution used for ImgLoc Search!", $C Else If $g_bDebugSetlogTrain Then SetLog("String: " & $asResult[0]) Local $aResult = StringSplit($asResult[0], "|", $STR_NOCOUNT) +If UBound($aResult) > 1 Then Local $aCoordinates = StringSplit($aResult[1], ",", $STR_NOCOUNT) +If UBound($aCoordinates) > 1 Then Local $iButtonX = 25 + Int($aCoordinates[0]) Local $iButtonY = 375 + Int($aCoordinates[1]) Local $sColorToCheck = "0x" & _GetPixelColor($iButtonX, $iButtonY, $g_bCapturePixel) @@ -42238,9 +42643,15 @@ If $g_bDebugSetlogTrain Then SetLog("Found: [" & $iButtonX & "," & $iButtonY & " If $g_bDebugSetlogTrain Then SetLog("$sColorToCheck: " & $sColorToCheck, $COLOR_SUCCESS) If $g_bDebugSetlogTrain Then SetLog("$iTolerance: " & $iTolerance, $COLOR_SUCCESS) Return $aTrainPos +Else +SetLog("Don't know how to train the troop with index " & $iIndex & " yet.") EndIf Else -SetLog("Don't know how to train the troop with index " & $iIndex & " yet") +SetLog("Don't know how to train the troop with index " & $iIndex & " yet..") +EndIf +EndIf +Else +SetLog("Don't know how to train the troop with index " & $iIndex & " yet...") EndIf Return $aTrainPos EndFunc @@ -43126,7 +43537,7 @@ GUICtrlSetState($g_hPicLabGray, $GUI_SHOW) Return EndIf If _ColorCheck(_GetPixelColor(730, 200, True), Hex(0xA2CB6C, 6), 20) Then -SetLog("Laboratory is Running. ", $COLOR_INFO) +SetLog("Laboratory is Running", $COLOR_INFO) GUICtrlSetState($g_hPicLabGray, $GUI_HIDE) GUICtrlSetState($g_hPicLabRed, $GUI_HIDE) GUICtrlSetState($g_hPicLabGreen, $GUI_SHOW) @@ -43143,6 +43554,7 @@ If ProfileSwitchAccountEnabled() Then SwitchAccountVariablesReload("Save") Return True ElseIf _ColorCheck(_GetPixelColor(730, 200, True), Hex(0x8088B0, 6), 20) Then SetLog("Laboratory has Stopped", $COLOR_INFO) +If $g_bNotifyTGEnable And $g_bNotifyAlertLaboratoryIdle Then NotifyPushToTelegram($g_sNotifyOrigin & " | " & GetTranslatedFileIni("MBR Func_Notify", "Laboratory-Idle_Info_01", "Laboratory Idle") & "%0A" & GetTranslatedFileIni("MBR Func_Notify", "Laboratory-Idle_Info_02", "Laboratory has Stopped")) ClickP($aAway, 2, $DELAYLABORATORY4, "#0359") GUICtrlSetState($g_hPicLabGray, $GUI_HIDE) GUICtrlSetState($g_hPicLabGreen, $GUI_HIDE) @@ -44962,25 +45374,24 @@ If $iY > 315 Then Return 120 Case 171 To 243 If $iY < 315 Then Return 184 If $iY > 315 Then Return 195 -Case 244 To 307 +Case 244 To 314 If $iY < 315 Then Return 255 If $iY > 315 Then Return 272 -Case 308 To 392 +Case 315 To 387 If $iY < 315 Then Return 330 If $iY > 315 Then Return 341 -Case 393 To 464 +Case 388 To 460 If $iY < 315 Then Return 403 If $iY > 315 Then Return 415 -Case 465 To 540 +Case 461 To 533 If $iY < 315 Then Return 477 If $iY > 315 Then Return 485 -Case 538 To 610 -Return 551 -Case 611 To 682 +Case 605 To 677 Return 620 -Case 683 To 752 -If $iY > 315 Then Return 691 -Return 700 +Case 678 To 752 +Return 693 +Case 754 To 826 +Return 769 EndSwitch Else Switch $iX @@ -45515,7 +45926,7 @@ EndFunc Func checkObstacles($bBuilderBase = Default) FuncEnter(checkObstacles) If $bBuilderBase = Default Then $bBuilderBase = False -Static $checkObstaclesActive = False +Static $iRecursive = 0 If TestCapture() = False And WinGetAndroidHandle() = 0 Then Return FuncReturn(True) EndIf @@ -45524,11 +45935,10 @@ SetLog("Found Switch Account dialog...!", $COLOR_INFO) PureClick(383, 375 + $g_iMidOffsetY, 1, 0, "Click Cancel") EndIf Local $wasForce = OcrForceCaptureRegion(False) -Local $checkObstaclesWasActive = $checkObstaclesActive -$checkObstaclesActive = True -Local $Result = _checkObstacles($bBuilderBase, $checkObstaclesWasActive) +$iRecursive += 1 +Local $Result = _checkObstacles($bBuilderBase, $iRecursive > 5) OcrForceCaptureRegion($wasForce) -$checkObstaclesActive = $checkObstaclesWasActive +$iRecursive -= 1 Return FuncReturn($Result) EndFunc Func _checkObstacles($bBuilderBase = False, $bRecursive = False) @@ -45611,7 +46021,7 @@ BanMsgBox() Return checkObstacles_StopBot($msg) EndIf SetLog("Connection lost, Reloading CoC...", $COLOR_ERROR) -If $g_bChkSharedPrefs And HaveSharedPrefs() Then +If($g_bChkSharedPrefs Or $g_bUpdateSharedPrefs) And HaveSharedPrefs() Then SetLog("Please wait for loading CoC...!") PushSharedPrefs() If Not $bRecursive Then OpenCoC() @@ -45693,7 +46103,7 @@ $msg = "Sorry but account has been banned, Bot must stop!!" BanMsgBox() Return checkObstacles_StopBot($msg) EndIf -SetLog("Warning: Can not find type of Reload error message", $COLOR_ERROR) +SetLog("Warning: Cannot find type of Reload error message", $COLOR_ERROR) EndSelect If TestCapture() Then Return "Village is out of sync or inactivity or connection lost or maintenance" Return checkObstacles_ReloadCoC($aReloadButton, "#0131", $bRecursive) @@ -47232,7 +47642,6 @@ Return False EndFunc Func _OpenBlueStacks2($bRestart = False) Local $hTimer, $iCount = 0, $cmdOutput, $process_killed, $i, $connected_to, $PID, $cmdPar -SetLog("Please wait while " & $g_sAndroidEmulator & " and CoC start...", $COLOR_SUCCESS) CloseUnsupportedBlueStacks2() LaunchConsole($g_sAndroidAdbPath, AddSpace($g_sAndroidAdbGlobalOptions) & "start-server", $process_killed) $hTimer = __TimerInit() @@ -47363,13 +47772,7 @@ $g_sAndroidProgramPath = $__BlueStacks_Path & $frontend_exe $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $__BlueStacks_Path & "HD-Adb.exe" $g_sAndroidVersion = $__BlueStacks_Version -For $i = 0 To 5 -If RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Name") = "BstSharedFolder" Then -$g_sAndroidPicturesPath = "/storage/sdcard/windows/BstSharedFolder/" -$g_sAndroidPicturesHostPath = RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Path") -ExitLoop -EndIf -Next +ConfigureSharedFolderBlueStacksX(0) SetDebugLog($g_sAndroidEmulator & " Engine 'Plus'-Mode: " & $plusMode) SetDebugLog($g_sAndroidEmulator & " OEM Features: " & $OEMFeatures) SetDebugLog($g_sAndroidEmulator & " System Bar is " &($g_bAndroidHasSystemBar ? "" : "not ") & "available") @@ -47383,6 +47786,31 @@ WinGetAndroidHandle() EndIf Return True EndFunc +Func ConfigureSharedFolderBlueStacks($iMode = 0, $bSetLog = Default) +ConfigureSharedFolderBlueStacksX($iMode, $bSetLog) +EndFunc +Func ConfigureSharedFolderBlueStacks2($iMode = 0, $bSetLog = Default) +ConfigureSharedFolderBlueStacksX($iMode, $bSetLog) +EndFunc +Func ConfigureSharedFolderBlueStacksX($iMode = 0, $bSetLog = Default) +If $bSetLog = Default Then $bSetLog = True +Local $bResult = False +Switch $iMode +Case 0 +For $i = 0 To 5 +If RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Name") = "BstSharedFolder" Then +$bResult = True +$g_bAndroidSharedFolderAvailable = True +$g_sAndroidPicturesPath = "/storage/sdcard/windows/BstSharedFolder/" +$g_sAndroidPicturesHostPath = RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\SharedFolder\" & $i & "\", "Path") +ExitLoop +EndIf +Next +Case 1 +Case 2 +EndSwitch +Return SetError(0, 0, $bResult) +EndFunc Func InitBlueStacks($bCheckOnly = False) Local $bInstalled = InitBlueStacksX($bCheckOnly) If $bInstalled And(GetVersionNormalized($__BlueStacks_Version) < GetVersionNormalized("0.8") Or GetVersionNormalized($__BlueStacks_Version) > GetVersionNormalized("2.0")) Then @@ -47411,6 +47839,7 @@ $__VBoxManage_Path = $__BlueStacks_Path & "BstkVMMgr.exe" Local $bsNow = GetVersionNormalized($__BlueStacks_Version) If $bsNow > GetVersionNormalized("4.0") Then $g_sAndroidAdbShellOptions = " /data/anr/../../system/xbin/bstk/su root" +$g_iAndroidAdbMinitouchMode = 1 EndIf CheckBlueStacksVersionMod() Local $BstAdbPort = RegRead($g_sHKLM & "\SOFTWARE\BlueStacks\Guests\" & $g_sAndroidInstance & "\Config\", "BstAdbPort") @@ -47911,16 +48340,8 @@ $g_sAndroidTitle = StringReplace($g_avAndroidAppConfig[$g_iAndroidConfig][2], "D EndIf EndIf $g_sAndroidPicturesPath = "/mnt/shared/picture/" -$aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'picture', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) -If Not @error Then -$g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" -$g_bAndroidSharedFolderAvailable = True -Else -SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) -$g_sAndroidPicturesHostPath = "" -$g_bAndroidAdbScreencap = False -$g_bAndroidSharedFolderAvailable = False -EndIf +$g_sAndroidSharedFolderName = "picture" +ConfigureSharedFolder(0) WinGetAndroidHandle() UpdateDroid4XConfig() EndIf @@ -47932,12 +48353,8 @@ If Not InitAndroid() Then Return False Local $cmdOutput, $process_killed $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_graph_mode " & $g_iAndroidClientWidth & "x" & $g_iAndroidClientHeight & "-16", $process_killed) $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) -AndroidPicturePathAutoConfig() -If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then -Local $path = $g_sAndroidPicturesHostPath -If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) -$cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name picture --hostpath """ & $path & """ --automount", $process_killed) -EndIf +ConfigureSharedFolder(1, True) +ConfigureSharedFolder(2, True) Return True EndFunc Func RebootDroid4XSetScreen() @@ -47967,7 +48384,7 @@ $iErrCnt += 1 EndIf Next If $iErrCnt > 0 Then Return False -If AndroidPicturePathAutoConfig(Default, Default, $bSetLog) Then $iErrCnt += 1 +If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 Return True EndFunc Func UpdateDroid4XConfig() @@ -48138,11 +48555,7 @@ If $memuCurr > $memu6 Then EndIf InitAndroidConfig(True) If Not GetAndroidVMinfo($__VBoxVMinfo, $MEmu_Manage_Path) Then Return False -Local $sAdbPAth = GetMEmuAdbPath() -If $sAdbPAth Then -$sPreferredADB = $sAdbPAth $g_bAndroidAdbPortPerInstance = False -EndIf $g_sAndroidProgramPath = $MEmu_Path & "MEmu.exe" $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $MEmu_Path & "adb.exe" @@ -48172,15 +48585,8 @@ Else SetLog("Using ADB default device " & $g_sAndroidAdbDevice & " for " & $g_sAndroidEmulator, $COLOR_ERROR) EndIf $g_sAndroidPicturesPath = "/mnt/shell/emulated/0/Pictures/" -$aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'picture', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) -If Not @error Then -$g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" -Else -$oops = 1 -$g_bAndroidAdbScreencap = False -$g_sAndroidPicturesHostPath = "" -SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) -EndIf +$g_sAndroidSharedFolderName = "picture" +ConfigureSharedFolder(0) $__VBoxGuestProperties = LaunchConsole($__VBoxManage_Path, "guestproperty enumerate " & $g_sAndroidInstance, $process_killed) UpdateMEmuConfig() EndIf @@ -48194,6 +48600,8 @@ $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroi $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " is_full_screen 0", $process_killed) $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " is_customed_resolution 1", $process_killed) $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) +ConfigureSharedFolder(1, True) +ConfigureSharedFolder(2, True) Return True EndFunc Func RebootMEmuSetScreen() @@ -48225,6 +48633,7 @@ EndIf $iErrCnt += 1 EndIf Next +If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 If $iErrCnt > 0 Then Return False Return True EndFunc @@ -48445,15 +48854,18 @@ EndIf If Not $bCheckOnly Then InitAndroidConfig(True) If Not GetAndroidVMinfo($__VBoxVMinfo, $LeapDroid_Manage_Path) Then Return False -Local $sAdbPAth = GetLeapDroidAdbPath() -If $sAdbPAth Then -$sPreferredADB = $sAdbPAth $g_bAndroidAdbPortPerInstance = False -EndIf $__VBoxGuestProperties = LaunchConsole($LeapDroid_Manage_Path, "guestproperty enumerate " & $g_sAndroidInstance, $process_killed) $g_sAndroidProgramPath = $LeapDroid_Path & "LeapdroidVM.exe" $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $LeapDroid_Path & "adb.exe" +If Not $LeapDroidVersion Then +Local $pAndroidFileVersionInfo +If _WinAPI_GetFileVersionInfo($g_sAndroidProgramPath, $pAndroidFileVersionInfo) Then +$g_avAndroidProgramFileVersionInfo = _WinAPI_VerQueryValue($pAndroidFileVersionInfo, "FileVersion") +If UBound($g_avAndroidProgramFileVersionInfo) > 1 Then $LeapDroidVersion = $g_avAndroidProgramFileVersionInfo[1][1] +EndIf +EndIf $g_sAndroidVersion = $LeapDroidVersion $__LeapDroid_Path = $LeapDroid_Path $g_sAndroidPath = $__LeapDroid_Path @@ -48472,22 +48884,14 @@ $g_sAndroidAdbDevice = "emulator-" &($g_sAndroidAdbDevicePort - 1) Else SetLog("Using ADB default device " & $g_sAndroidAdbDevice & " for " & $g_sAndroidEmulator, $COLOR_ERROR) EndIf -$g_sAndroidPicturesPath = "/mnt/shared/yw_shared/" -$aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'yw_shared', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) -If Not @error Then -$g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" -Else +If GetVersionNormalized($g_sAndroidVersion) >= GetVersionNormalized("1.7.0") Then $g_sAndroidPicturesPath = "/mnt/shared/LeapDroidShared/" -$aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'LeapDroidShared', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) -If Not @error Then -$g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" +$g_sAndroidSharedFolderName = "LeapDroidShared" Else -$oops = 1 -$g_bAndroidAdbScreencap = False -$g_sAndroidPicturesHostPath = "" -SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) -EndIf +$g_sAndroidPicturesPath = "/mnt/shared/yw_shared/" +$g_sAndroidSharedFolderName = "yw_shared" EndIf +ConfigureSharedFolder(0) $g_bUpdateAndroidWindowTitle = True EndIf Return SetError($oops, 0, True) @@ -48534,6 +48938,8 @@ FileClose($h) EndIf EndIf Next +ConfigureSharedFolder(1, True) +ConfigureSharedFolder(2, True) Return True EndFunc Func RebootLeapDroidSetScreen() @@ -48544,6 +48950,9 @@ Return CloseVboxAndroidSvc() EndFunc Func CheckScreenLeapDroid($bSetLog = True) If Not InitAndroid() Then Return False +Local $iErrCnt = 0 +If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 +If $iErrCnt > 0 Then Return False Return True EndFunc Func EmbedLeapDroid($bEmbed = Default, $hHWndAfter = Default) @@ -48595,7 +49004,6 @@ Return False EndIf EndIf $hTimer = __TimerInit() -If WaitForRunningVMS($g_iAndroidLaunchWaitSec - __TimerDiff($hTimer) / 1000, $hTimer) Then Return False $g_bInitAndroid = True InitAndroid() $connected_to = ConnectAndroidAdb(False, 60 * 1000) @@ -48681,7 +49089,7 @@ Local $sConfig = GetNoxConfigFile() If $sConfig Then Local $graphic_engine_type = IniRead($sConfig, "setting", "graphic_engine_type", "") Switch $graphic_engine_type -Case "0" +Case "0", "" Return $iOpenGL Case "1" Return $iDirectX @@ -48744,31 +49152,6 @@ $g_sAndroidAdbDevice = $g_sAndroidAdbDeviceHost & ":" & $g_sAndroidAdbDevicePort Else SetLog("Using ADB default device " & $g_sAndroidAdbDevice & " for " & $g_sAndroidEmulator, $COLOR_ERROR) EndIf -$g_sAndroidPicturesPath = "(/mnt/shared/Other|/mnt/shell/emulated/0/Download/other|/mnt/shell/emulated/0/Others)" -$aRegexResult = StringRegExp($__VBoxVMinfo, "Name: 'Other', Host path: '(.*)'.*", $STR_REGEXPARRAYGLOBALMATCH) -If Not @error Then -$g_bAndroidSharedFolderAvailable = True -$g_sAndroidPicturesHostPath = $aRegexResult[UBound($aRegexResult) - 1] & "\" -Else -If FileExists(@MyDocumentsDir & "\Nox_share\") Then -$g_bAndroidSharedFolderAvailable = True -$g_sAndroidPicturesHostPath = @MyDocumentsDir & "\Nox_share\Other\" -If Not FileExists($g_sAndroidPicturesHostPath) Then -DirCreate($g_sAndroidPicturesHostPath) -EndIf -ElseIf FileExists(@HomeDrive & @HomePath & "\Nox_share\") Then -$g_bAndroidSharedFolderAvailable = True -$g_sAndroidPicturesHostPath = @HomeDrive & @HomePath & "\Nox_share\" -If Not FileExists($g_sAndroidPicturesHostPath) Then -DirCreate($g_sAndroidPicturesHostPath) -EndIf -Else -$g_bAndroidSharedFolderAvailable = False -$g_bAndroidAdbScreencap = False -$g_sAndroidPicturesHostPath = "" -SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) -EndIf -EndIf Local $v = GetVersionNormalized($g_sAndroidVersion) For $i = 0 To UBound($__Nox_Config) - 1 Local $v2 = GetVersionNormalized($__Nox_Config[$i][0]) @@ -48780,6 +49163,8 @@ $g_avAndroidAppConfig[$g_iAndroidConfig][3] = $g_sAppClassInstance ExitLoop EndIf Next +$g_sAndroidSharedFolderName = "Other" +ConfigureSharedFolderNox(0) UpdateHWnD($g_hAndroidWindow, False) EndIf Return True @@ -48792,16 +49177,45 @@ Local $sConfig = $sLocalAppData & "\Nox\" & $sPre & "conf.ini" If FileExists($sConfig) Then Return $sConfig Return "" EndFunc +Func ConfigureSharedFolderNox($iMode = 0, $bSetLog = Default) +If $bSetLog = Default Then $bSetLog = True +Local $bResult = False +Switch $iMode +Case 0 +$g_sAndroidPicturesPath = "(/mnt/shared/Other|/mnt/shell/emulated/0/Download/other|/mnt/shell/emulated/0/Others)" +Local $aRegexResult = StringRegExp($__VBoxVMinfo, "Name: '" & $g_sAndroidSharedFolderName & "', Host path: '(.*)'.*", $STR_REGEXPARRAYGLOBALMATCH) +If Not @error Then +$bResult = True +$g_bAndroidSharedFolderAvailable = True +$g_sAndroidPicturesHostPath = $aRegexResult[UBound($aRegexResult) - 1] & "\" +Else +If FileExists(@HomeDrive & @HomePath & "\Nox_share\OtherShare\") Then +$g_bAndroidSharedFolderAvailable = True +$g_sAndroidPicturesHostPath = @HomeDrive & @HomePath & "\Nox_share\OtherShare\" +ElseIf FileExists(@HomeDrive & @HomePath & "\Nox_share\") Then +$g_bAndroidSharedFolderAvailable = True +$g_sAndroidPicturesHostPath = @HomeDrive & @HomePath & "\Nox_share\" +ElseIf FileExists(@MyDocumentsDir & "\Nox_share\Other\") Then +$g_bAndroidSharedFolderAvailable = True +$g_sAndroidPicturesHostPath = @MyDocumentsDir & "\Nox_share\Other\" +Else +$g_bAndroidSharedFolderAvailable = False +$g_bAndroidAdbScreencap = False +$g_sAndroidPicturesHostPath = "" +SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_ERROR) +EndIf +EndIf +Case 1 +$bResult = AndroidPicturePathAutoConfig(@MyDocumentsDir, "\Nox_share\Other", $bSetLog) +Case Else +Return SetError(1, 0, "") +EndSwitch +Return SetError(0, 0, $bResult) +EndFunc Func SetScreenNox() If Not InitAndroid() Then Return False -Local $cmdOutput, $process_killed -AndroidPicturePathAutoConfig(@MyDocumentsDir, "\Nox_share\Other") -If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then -Local $path = $g_sAndroidPicturesHostPath -If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) -$cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder remove " & $g_sAndroidInstance & " --name Other", $process_killed) -$cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name Other --hostpath """ & $path & """ --automount", $process_killed) -EndIf +ConfigureSharedFolder(1, True) +ConfigureSharedFolder(2, True) Local $sConfig = GetNoxConfigFile() If $sConfig Then SetDebugLog("Configure Nox screen config: " & $sConfig) @@ -48828,7 +49242,24 @@ Local $aValues[2][2] = [ ["vbox_dpi", "160"], ["vbox_graph_mode", $g_iAndroidCli Local $i, $Value, $iErrCnt = 0, $process_killed, $aRegexResult For $i = 0 To UBound($aValues) - 1 $aRegexResult = StringRegExp($__VBoxGuestProperties, "Name: " & $aValues[$i][0] & ", value: (.+), timestamp:", $STR_REGEXPARRAYMATCH) -If @error = 0 Then $Value = $aRegexResult[0] +If @error = 0 Then +$Value = $aRegexResult[0] +Else +If StringInStr($__VBoxGuestProperties, "error:") = 0 Then +If $bSetLog Then +SetLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0], $COLOR_ERROR) +Else +SetDebugLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0], $COLOR_ERROR) +EndIF +Else +$Value = $aValues[$i][1] +If $bSetLog Then +SetLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0] & ", assuming " & $Value, $COLOR_ERROR) +Else +SetDebugLog("Cannot validate " & $g_sAndroidEmulator & " property " & $aValues[$i][0] & ", assuming " & $Value, $COLOR_ERROR) +EndIF +EndIf +EndIf If $Value <> $aValues[$i][1] Then If $iErrCnt = 0 Then If $bSetLog Then @@ -48845,7 +49276,7 @@ EndIf $iErrCnt += 1 EndIf Next -If AndroidPicturePathAutoConfig(@MyDocumentsDir, "\Nox_share\Other", $bSetLog) Then $iErrCnt += 1 +If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 If $iErrCnt > 0 Then Return False Return True EndFunc @@ -49029,6 +49460,7 @@ Return False EndIf If Not $bCheckOnly Then InitAndroidConfig(True) +$g_bAndroidAdbPortPerInstance = False If Not GetAndroidVMinfo($__VBoxVMinfo, $KOPLAYER_Manage_Path) Then Return False $g_sAndroidProgramPath = $KOPLAYER_Path & "KOPLAYER.exe" $g_sAndroidAdbPath = $sPreferredADB @@ -49060,14 +49492,8 @@ Else SetLog("Using ADB default device " & $g_sAndroidAdbDevice & " for " & $g_sAndroidEmulator, $COLOR_RED) EndIf $g_sAndroidPicturesPath = "/mnt/shared/UserData/" -$aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'UserData', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) -If Not @error Then -$g_sAndroidPicturesHostPath = StringReplace($aRegExResult[0], "/", "\") & "\" -Else -$g_bAndroidAdbScreencap = False -$g_sAndroidPicturesHostPath = "" -SetLog($g_sAndroidEmulator & " Background Mode is not available", $COLOR_RED) -EndIf +$g_sAndroidSharedFolderName = "UserData" +ConfigureSharedFolder(0) EndIf Return True EndFunc @@ -49093,6 +49519,8 @@ Local $cmdOutput, $process_killed $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_graph_mode " & $g_iAndroidClientWidth & "x" & $g_iAndroidClientHeight & "-16", $process_killed) $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) $cmdOutput = LaunchConsole($__VBoxManage_Path, "setextradata " & $g_sAndroidInstance & " RenderWindowProp " & $g_iAndroidClientWidth & "*" & $g_iAndroidClientHeight & "*160", $process_killed) +ConfigureSharedFolder(1, True) +ConfigureSharedFolder(2, True) Return True EndFunc Func RebootKOPLAYERSetScreen() @@ -49124,6 +49552,7 @@ EndIf $iErrCnt += 1 EndIf Next +If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 If $iErrCnt > 0 Then Return False Return True EndFunc @@ -49284,6 +49713,11 @@ $g_sAndroidProgramPath = $iTools_Path & "iToolsAVM.exe" $g_sAndroidAdbPath = $sPreferredADB If $g_sAndroidAdbPath = "" Then $g_sAndroidAdbPath = $iTools_Path & "tools\adb.exe" $g_sAndroidVersion = "" +Local $pAndroidFileVersionInfo +If _WinAPI_GetFileVersionInfo($g_sAndroidProgramPath, $pAndroidFileVersionInfo) Then +$g_avAndroidProgramFileVersionInfo = _WinAPI_VerQueryValue($pAndroidFileVersionInfo, "FileVersion") +If UBound($g_avAndroidProgramFileVersionInfo) > 1 Then $g_sAndroidVersion = $g_avAndroidProgramFileVersionInfo[1][1] +EndIf $__iTools_Path = $iTools_Path $g_sAndroidPath = $__iTools_Path $__VBoxManage_Path = $iTools_Manage_Path @@ -49309,17 +49743,8 @@ Else SetLog("Using ADB default device " & $g_sAndroidAdbDevice & " for " & $g_sAndroidEmulator, $COLOR_ERROR) EndIf $g_sAndroidPicturesPath = "/mnt/shared/picture/" -$aRegExResult = StringRegExp($__VBoxVMinfo, "Name: 'picture', Host path: '(.*)'.*", $STR_REGEXPARRAYMATCH) -If Not @error Then -$g_bAndroidSharedFolderAvailable = True -$g_sAndroidPicturesHostPath = $aRegExResult[0] & "\" -Else -$oops = 1 -$g_bAndroidAdbScreencap = False -$g_bAndroidSharedFolderAvailable = False -$g_sAndroidPicturesHostPath = "" -SetLog($g_sAndroidEmulator & " shared folder is not available", $COLOR_ERROR) -EndIf +$g_sAndroidSharedFolderName = "picture" +ConfigureSharedFolder(0) $g_bUpdateAndroidWindowTitle = True EndIf Return SetError($oops, 0, True) @@ -49330,12 +49755,8 @@ If Not InitAndroid() Then Return False Local $cmdOutput, $process_killed $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_graph_mode " & $g_iAndroidClientWidth & "x" & $g_iAndroidClientHeight & "-16", $process_killed) $cmdOutput = LaunchConsole($__VBoxManage_Path, "guestproperty set " & $g_sAndroidInstance & " vbox_dpi 160", $process_killed) -AndroidPicturePathAutoConfig() -If $g_bAndroidSharedFolderAvailable = False And $g_bAndroidPicturesPathAutoConfig = True And FileExists($g_sAndroidPicturesHostPath) = 1 Then -Local $path = $g_sAndroidPicturesHostPath -If StringRight($path, 1) = "\" Then $path = StringLeft($path, StringLen($path) - 1) -$cmdOutput = LaunchConsole($__VBoxManage_Path, "sharedfolder add " & $g_sAndroidInstance & " --name picture --hostpath """ & $path & """ --automount", $process_killed) -EndIf +ConfigureSharedFolder(1, True) +ConfigureSharedFolder(2, True) Return True EndFunc Func RebootiToolsSetScreen() @@ -49360,7 +49781,7 @@ $iErrCnt += 1 EndIf Next If $iErrCnt > 0 Then Return False -If AndroidPicturePathAutoConfig(Default, Default, $bSetLog) Then $iErrCnt += 1 +If ConfigureSharedFolder(1, $bSetLog) Then $iErrCnt += 1 If $iErrCnt > 0 Then Return False Return True EndFunc @@ -49747,7 +50168,7 @@ EndIf If _Sleep($DELAYRESPOND) Then Return False OpenCoC() Case 1 -Local $bSendHome =($g_sAndroidEmulator <> "MEmu") +Local $bSendHome = False If $bSendHome Then AndroidHomeButton() Else @@ -51104,8 +51525,6 @@ $x += $g_aiBSrpos[0] $y += $g_aiBSrpos[1] EndIf If $g_iAndroidControlClickMode = 0 Then -Opt("MouseClickDelay", $g_iAndroidControlClickDelay) -Opt("MouseClickDownDelay", $g_iAndroidControlClickDownDelay) Return ControlClick($hWin, "", "", "left", "1", $x, $y) EndIf Local $WM_LBUTTONDOWN = 0x0201, $WM_LBUTTONUP = 0x0202 @@ -51924,7 +52343,7 @@ Return $success EndFunc Func isEveryFileInstalled($bSilent = False) Local $bResult = False, $iCount = 0 -Local $aCheckFiles = [@ScriptDir & "\COCBot", $g_sLibPath, @ScriptDir & "\Images", @ScriptDir & "\imgxml", $g_sLibPath & "\helper_functions.dll", $g_sLibPath & "\ImageSearchDLL.dll", $g_sLibPath & "\MBRBot.dll", $g_sLibPath & "\MyBot.run.dll", $g_sLibPath & "\sqlite3.dll", $g_sLibPath & "\opencv_core220.dll", $g_sLibPath & "\opencv_imgproc220.dll"] +Local $aCheckFiles = [@ScriptDir & "\COCBot", $g_sLibPath, @ScriptDir & "\Images", @ScriptDir & "\imgxml", $g_sLibPath & "\helper_functions.dll", $g_sLibPath & "\ImageSearchDLL.dll", $g_sLibPath & "\MBRBot.dll", $g_sLibPath & "\MyBot.run.dll", $g_sLibPath & "\Newtonsoft.Json.dll", $g_sLibPath & "\sqlite3.dll", $g_sLibPath & "\opencv_core220.dll", $g_sLibPath & "\opencv_imgproc220.dll"] For $vElement In $aCheckFiles $iCount += FileExists($vElement) Next @@ -51932,14 +52351,16 @@ Local $xmls = _FileListToArrayRec(@ScriptDir & "\imgxml\", "*.xml", $FLTAR_FILES If IsArray($xmls) Then If Number($xmls[0]) < 570 Then SetLog("Verify '\imgxml\' folder, found " & $xmls[0] & " *.xml files.", $COLOR_ERROR) EndIf +Local $MsgBox = 0 +Local $sText1 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_01", "Hey Chief, we are missing some files!") +Local $sText2 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_02", "Please extract all files and folders and start this program again!") +Local $sText3 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_03", "Sorry, Start button disabled until fixed!") +Local $sText4 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_04", "Hey Chief, file name incorrect!") +Local $sText5 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_05", 'You have renamed the file "MyBot.run.exe"! Please change it back to MyBot.run.exe and restart the bot!') If $iCount = UBound($aCheckFiles) Then $bResult = True ElseIf Not $bSilent Then GUICtrlSetState($g_hBtnStart, $GUI_DISABLE) -Local $sText1 = "", $sText2 = "", $sText3 = "", $MsgBox = 0 -$sText1 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_01", "Hey Chief, we are missing some files!") -$sText2 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_02", "Please extract all files and folders and start this program again!") -$sText3 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_03", "Sorry, Start button disabled until fixed!") SetLog($sText1, $COLOR_ERROR) SetLog($sText2, $COLOR_ERROR) SetLog($sText3, $COLOR_ERROR) @@ -51950,15 +52371,11 @@ EndIf If @Compiled Then If Not StringInStr(@ScriptFullPath, "MyBot.run.exe", 1) Then If Not $bSilent Then -Local $sText1, $sText2, $MsgBox -$sText1 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_04", "Hey Chief, file name incorrect!") -$sText2 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_05", 'You have renamed the file "MyBot.run.exe"! Please change it back to MyBot.run.exe and restart the bot!') -$sText3 = GetTranslatedFileIni("MBR Popups", "CheckPrerequisites_Item_03", "Sorry, Start button disabled until fixed!") SetLog($sText1, $COLOR_ERROR) -SetLog($sText2, $COLOR_ERROR) +SetLog($sText5, $COLOR_ERROR) SetLog($sText3, $COLOR_ERROR) _ExtMsgBoxSet(1 + 64, $SS_CENTER, 0x004080, 0xFFFF00, 12, "Comic Sans MS", 500) -$MsgBox = _ExtMsgBox(48, GetTranslatedFileIni("MBR Popups", "Ok", "Ok"), $sText1, $sText2, 0) +$MsgBox = _ExtMsgBox(48, GetTranslatedFileIni("MBR Popups", "Ok", "Ok"), $sText1, $sText5, 0) GUICtrlSetState($g_hBtnStart, $GUI_DISABLE) EndIf $bResult = False @@ -64084,7 +64501,7 @@ OpenCoC() waitMainScreen() EndIf SetSwitchAccLog("Switched to Acc [" & $NextAccount + 1 & "]", $COLOR_SUCCESS) -If $g_bChkSharedPrefs Then +If $g_bChkSharedPrefs And Not($g_bUpdateSharedPrefs And $g_bUpdateSharedPrefsGoogleDisconnected) Then waitMainScreen() If IsMainPage() Then Click($aButtonSetting[0], $aButtonSetting[1], 1, 0, "Click Setting") @@ -66546,9 +66963,12 @@ Func _GUICtrlStatusBar_SetTextEx($hWnd, $sText = "", $iPart = 0, $iUFlag = 0) If $hWnd Then _GUICtrlStatusBar_SetText($hWnd, $sText, $iPart, $iUFlag) StatusBarManagedMyBotHost($sText) EndFunc +Global Enum $g_eForumAuthenticationWaiting, $g_eForumAuthenticationLogin, $g_eForumAuthenticationExit +Global $g_hGuiForumAuthentication = 0 +Global $g_hForumAuthenticationState = $g_eForumAuthenticationWaiting, $g_hForumAuthenticationLogin, $g_hForumAuthenticationExit, $g_hForumAuthenticationUser, $g_hForumAuthenticationPass Func ForumAuthentication() Local $sLogLogPleaseEnter = GetTranslatedFileIni("MBR Authentication", "LogPleaseEnter", "Please enter your Mybot.run Forum username and password") -Local $sLogPasswordIsSave = GetTranslatedFileIni("MBR Authentication", "LogPasswordIsSave", "Your password is not saved anywhere and secure!") +Local $sLogPasswordIsSave = GetTranslatedFileIni("MBR Authentication", "LogPasswordIsSave", "Password is only used once to authenticate and nowhere saved!") Local $sTitleUsername = GetTranslatedFileIni("MBR Authentication", "Username", "Username") Local $sTitlePassword = GetTranslatedFileIni("MBR Authentication", "Password", "Password") Local $sYouNeedToLogin = GetTranslatedFileIni("MBR Authentication", "YouNeedToLogin", "You need to login to MyBot.run Forum...") @@ -66561,11 +66981,21 @@ Local $sLogin = GetTranslatedFileIni("MBR Authentication", "Login", "Login") Local $sExit = GetTranslatedFileIni("MBR Authentication", "Exit", "Exit") GetTranslatedFileIni("MBR Authentication", "BotIsAuthenticated", "MyBot.run is authenticated") GetTranslatedFileIni("MBR Authentication", "BotIsNotAuthenticated", "Error authenticating Mybot.run") +Local $bNotAuthenticated =($g_hGuiForumAuthentication <> 0) +Local $sOldFile = @MyDocumentsDir & "\MyBot.run-Profiles\.mybot.run.authentication" +If FileExists($g_sPrivateAuthenticationFile) = 0 And FileExists($sOldFile) = 1 Then FileMove($sOldFile, $g_sPrivateAuthenticationFile) If FileExists($g_sPrivateAuthenticationFile) = 0 Or Not CheckForumAuthentication() Then +If $bNotAuthenticated Then +SetLog($sAuthenticationFailed1, $COLOR_ERROR) +SetLog($sAuthenticationFailed2, $COLOR_ERROR) +_Sleep(5000) +Return False +Else SetLog($sLogLogPleaseEnter, $COLOR_BLUE) SetLog($sLogPasswordIsSave, $COLOR_BLUE) Local $xyt = CreateSplashScreen("Form Login") Local $guiLogin = $g_hSplash +$g_hGuiForumAuthentication = $guiLogin Local $iW = $xyt[0] Local $iH = $xyt[1] Local $iSpace = 20 @@ -66578,18 +67008,17 @@ Local $hPass = GUICtrlCreateInput("", $iSpace + 100 + 5, $iButtonTop, 100, 20, B GUICtrlSetLimit($hPass, 128, 1) Local $iTextAddWidth = 30 Local $hText = GUICtrlCreateLabel($sYouNeedToLogin, $iSpace + 100 + 5 + 100 + 5 - $iTextAddWidth, $iButtonTop - 22, $iW - $iSpace -($iSpace + 100 + 5 + 100 + 5) + $iTextAddWidth, 20, $SS_RIGHT) -Local $hLogin = GUICtrlCreateButton($sLogin, $iW - 50 - $iSpace, $iButtonTop, 50, 25, $BS_DEFPUSHBUTTON) -Local $hExit = GUICtrlCreateButton($sExit, $iW -(50 + $iSpace + 50 + 5), $iButtonTop, 50, 25) +$g_hForumAuthenticationLogin = GUICtrlCreateButton($sLogin, $iW - 50 - $iSpace, $iButtonTop, 50, 25, $BS_DEFPUSHBUTTON) +GUICtrlSetOnEvent(-1, "ForumAuthenticationLogin") +$g_hForumAuthenticationExit = GUICtrlCreateButton($sExit, $iW -(50 + $iSpace + 50 + 5), $iButtonTop, 50, 25) +GUICtrlSetOnEvent(-1, "ForumAuthenticationExit") ControlFocus($guiLogin, "", $hUser) -Local $iOpt = Opt("GUIOnEventMode", 0) GUISetState(@SW_SHOW, $guiLogin) Local $bOk = False Local $hTimer = __TimerInit() While True -Switch GUIGetMsg() -Case $GUI_EVENT_CLOSE, $hExit -ExitLoop -Case $hLogin +Switch $g_hForumAuthenticationState +Case $g_eForumAuthenticationLogin Local $sUser = GUICtrlRead($hUser) Local $sPass = GUICtrlRead($hPass) If $sUser = "" Or $sPass = "" Then @@ -66605,8 +67034,8 @@ Else GUICtrlSetData($hText, $sLoginFailed) EndIf EndIf -Case Else -_WinAPI_PostMessage($guiLogin, $WM_SYSCOMMAND, 0xF012, 0) +Case $g_eForumAuthenticationExit +ExitLoop EndSwitch If __TimerDiff($hTimer) / 1000 > 15 * 60 Then SetLog($sAuthenticationFailed1, $COLOR_ERROR) @@ -66614,13 +67043,22 @@ SetLog($sAuthenticationFailed2, $COLOR_ERROR) $bOk = True ExitLoop EndIf +$g_hForumAuthenticationState = $g_eForumAuthenticationWaiting +Sleep(100) WEnd GUIDelete($guiLogin) -Opt("GUIOnEventMode", $iOpt) +$g_hGuiForumAuthentication = 0 If Not $bOk Then BotClose() EndIf +EndIf Return True EndFunc +Func ForumAuthenticationLogin() +$g_hForumAuthenticationState = $g_eForumAuthenticationLogin +EndFunc +Func ForumAuthenticationExit() +$g_hForumAuthenticationState = $g_eForumAuthenticationExit +EndFunc Func setupProfileComboBox() Local $profileString = "" Local $aProfiles = _FileListToArray($g_sProfilePath, "*", $FLTA_FOLDERS) @@ -66984,6 +67422,7 @@ _GUICtrlComboBox_SetCurSel($g_hCmbAndroidBackgroundMode, $g_iAndroidBackgroundMo _GUICtrlComboBox_SetCurSel($g_hCmbAndroidZoomoutMode, $g_iAndroidZoomoutMode) GUICtrlSetState($g_hChkAndroidAdbClickDragScript, $g_bAndroidAdbClickDragScript ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetState($g_hChkAndroidCloseWithBot, $g_bAndroidCloseWithBot ? $GUI_CHECKED : $GUI_UNCHECKED) +GUICtrlSetState($g_hChkUpdateSharedPrefs, $g_bUpdateSharedPrefs ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetData($g_hTxtAndroidRebootHours, $g_iAndroidRebootHours) _GUICtrlComboBox_SetCurSel($g_hCmbSuspendAndroid, AndroidSuspendFlagsToIndex($g_iAndroidSuspendModeFlags)) Case "Save" @@ -66994,6 +67433,7 @@ $g_bAndroidAdbClickEnabled =(GUICtrlRead($g_hChkAndroidAdbClick) = $GUI_CHECKED $g_bAndroidAdbClick = $g_bAndroidAdbClickEnabled $g_bAndroidAdbClickDragScript =(GUICtrlRead($g_hChkAndroidAdbClickDragScript) = $GUI_CHECKED ? True : False) $g_bAndroidCloseWithBot =(GUICtrlRead($g_hChkAndroidCloseWithBot) = $GUI_CHECKED ? True : False) +$g_bUpdateSharedPrefs =(GUICtrlRead($g_hChkUpdateSharedPrefs) = $GUI_CHECKED ? True : False) $g_iAndroidRebootHours = Int(GUICtrlRead($g_hTxtAndroidRebootHours)) cmbSuspendAndroid() EndSwitch @@ -67563,6 +68003,7 @@ GUICtrlSetState($g_hChkNotifyAlertMaintenance, $g_bNotifyAlertMaintenance ? $GUI GUICtrlSetState($g_hChkNotifyAlertBAN, $g_bNotifyAlertBAN ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetState($g_hChkNotifyBOTUpdate, $g_bNotifyAlertBOTUpdate ? $GUI_CHECKED : $GUI_UNCHECKED) GUICtrlSetState($g_hChkNotifyAlertSmartWaitTime, $g_bNotifyAlertSmartWaitTime ? $GUI_CHECKED : $GUI_UNCHECKED) +GUICtrlSetState($g_hChkNotifyAlertLaboratoryIdle, $g_bNotifyAlertLaboratoryIdle ? $GUI_CHECKED : $GUI_UNCHECKED) Case "Save" $g_bNotifyTGEnable =(GUICtrlRead($g_hChkNotifyTGEnable) = $GUI_CHECKED) $g_sNotifyTGToken = GUICtrlRead($g_hTxtNotifyTGToken) @@ -67583,6 +68024,7 @@ $g_bNotifyAlertMaintenance =(GUICtrlRead($g_hChkNotifyAlertMaintenance) = $GUI_C $g_bNotifyAlertBAN =(GUICtrlRead($g_hChkNotifyAlertBAN) = $GUI_CHECKED) $g_bNotifyAlertBOTUpdate =(GUICtrlRead($g_hChkNotifyBOTUpdate) = $GUI_CHECKED) $g_bNotifyAlertSmartWaitTime =(GUICtrlRead($g_hChkNotifyAlertSmartWaitTime) = $GUI_CHECKED) +$g_bNotifyAlertLaboratoryIdle =(GUICtrlRead($g_hChkNotifyAlertLaboratoryIdle) = $GUI_CHECKED) EndSwitch EndFunc Func ApplyConfig_600_19($TypeReadSave) @@ -69152,6 +69594,7 @@ $g_iAndroidInactiveTransparency = Int(IniRead($g_sProfileConfigPath, "android", $g_iAndroidSuspendModeFlags = Int(IniRead($g_sProfileConfigPath, "android", "suspend.mode", $g_iAndroidSuspendModeFlags)) $g_iAndroidRebootHours = Int(IniRead($g_sProfileConfigPath, "android", "reboot.hours", $g_iAndroidRebootHours)) $g_bAndroidCloseWithBot = Int(IniRead($g_sProfileConfigPath, "android", "close", $g_bAndroidCloseWithBot ? 1 : 0)) = 1 +$g_bUpdateSharedPrefs = Int(IniRead($g_sProfileConfigPath, "android", "shared_prefs.update", $g_bUpdateSharedPrefs ? 1 : 0)) = 1 $g_iAndroidProcessAffinityMask = Int(IniRead($g_sProfileConfigPath, "android", "process.affinity.mask", $g_iAndroidProcessAffinityMask)) If $g_bBotLaunchOption_Restart = True Or $g_asCmdLine[0] < 2 Then Local $sAndroidEmulator = IniRead($g_sProfileConfigPath, "android", "emulator", "") @@ -69474,6 +69917,7 @@ IniReadS($g_bNotifyAlertMaintenance, $g_sProfileConfigPath, "notify", "AlertPBMa IniReadS($g_bNotifyAlertBAN, $g_sProfileConfigPath, "notify", "AlertPBBAN", False, "Bool") IniReadS($g_bNotifyAlertBOTUpdate, $g_sProfileConfigPath, "notify", "AlertPBUpdate", False, "Bool") IniReadS($g_bNotifyAlertSmartWaitTime, $g_sProfileConfigPath, "notify", "AlertSmartWaitTime", False, "Bool") +IniReadS($g_bNotifyAlertLaboratoryIdle, $g_sProfileConfigPath, "notify", "AlertLaboratoryIdle", False, "Bool") EndFunc Func ReadConfig_600_19() $g_bNotifyScheduleHoursEnable =(IniRead($g_sProfileConfigPath, "notify", "NotifyHoursEnable", "0") = "1") @@ -70224,6 +70668,7 @@ _Ini_Add("android", "emulator", $g_sAndroidEmulator) _Ini_Add("android", "instance", $g_sAndroidInstance) _Ini_Add("android", "reboot.hours", $g_iAndroidRebootHours) _Ini_Add("android", "close",($g_bAndroidCloseWithBot ? "1" : "0")) +_Ini_Add("android", "shared_prefs.update",($g_bUpdateSharedPrefs ? "1" : "0")) _Ini_Add("android", "process.affinity.mask", $g_iAndroidProcessAffinityMask) EndFunc Func SaveConfig_Debug() @@ -70463,6 +70908,7 @@ _Ini_Add("notify", "AlertPBMaintenance", $g_bNotifyAlertMaintenance ? 1 : 0) _Ini_Add("notify", "AlertPBBAN", $g_bNotifyAlertBAN ? 1 : 0) _Ini_Add("notify", "AlertPBUpdate", $g_bNotifyAlertBOTUpdate ? 1 : 0) _Ini_Add("notify", "AlertSmartWaitTime", $g_bNotifyAlertSmartWaitTime ? 1 : 0) +_Ini_Add("notify", "AlertLaboratoryIdle", $g_bNotifyAlertLaboratoryIdle ? 1 : 0) EndFunc Func SaveConfig_600_19() ApplyConfig_600_19(GetApplyConfigSaveAction()) @@ -72350,6 +72796,8 @@ GetDroid4XBackgroundMode() GetKOPLAYERBackgroundMode() GetMEmuBackgroundMode() GetNoxBackgroundMode() +ConfigureSharedFolderBlueStacks() +ConfigureSharedFolderBlueStacks2() getChatString(0, 0, 0) getChatStringChinese(0, 0) getChatStringKorean(0, 0) @@ -72718,8 +73166,8 @@ Opt("GUIEventOptions", 1) Opt("GUICloseOnESC", 0) Opt("WinTitleMatchMode", 3) Opt("GUIOnEventMode", 1) -Opt("MouseClickDelay", 10) -Opt("MouseClickDownDelay", 10) +Opt("MouseClickDelay", $g_iAndroidControlClickDelay) +Opt("MouseClickDownDelay", $g_iAndroidControlClickDownDelay) Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) InitializeBot() @@ -72967,6 +73415,17 @@ $g_bOnlyInstance = $g_hMutex_MyBot <> 0 SetDebugLog("My Bot is " &($g_bOnlyInstance ? "" : "not ") & "the only running instance") EndFunc Func SetupFilesAndFolders() +Local $sOldProfiles = @MyDocumentsDir & "\MyBot.run-Profiles" +If FileExists($sOldProfiles) = 1 And FileExists($g_sPrivateProfilePath) = 0 Then +SetLog("Moving shared_prefs profiles folder...") +If DirMove($sOldProfiles, $g_sPrivateProfilePath) = 0 Then +SetLog("Error moving folder " & $sOldProfiles, $COLOR_ERROR) +SetLog("to new location " & $g_sPrivateProfilePath, $COLOR_ERROR) +SetLog("Please resolve manually!", $COLOR_ERROR) +Else +SetLog("Moved shared_prefs profiles to " & $g_sPrivateProfilePath, $COLOR_SUCCESS) +EndIf +EndIf DirCreate($g_sProfilePresetPath) DirCreate($g_sPrivateProfilePath & "\" & $g_sProfileCurrentName) DirCreate($g_sProfilePath & "\" & $g_sProfileCurrentName) @@ -73002,7 +73461,8 @@ SetDebugLog("$g_sProfileCurrentName = " & $g_sProfileCurrentName) SetDebugLog("$g_sProfileLogsPath = " & $g_sProfileLogsPath) EndFunc Func FinalInitialization(Const $sAI) -If CheckPrerequisites(True) Then +Local $bCheckPrerequisitesOK = CheckPrerequisites(True) +If $bCheckPrerequisitesOK Then MBRFunc(True) setAndroidPID() SetBotGuiPID() @@ -73027,10 +73487,15 @@ WEnd If $g_iGuiPID = @AutoItPID Then SetDebugLog("GUI Process not received, close bot") BotClose() +$bCheckPrerequisitesOK = False Else SetDebugLog("Linked to GUI Process " & $g_iGuiPID) EndIf EndIf +DestroySplashScreen(False) +If $bCheckPrerequisitesOK Then +ForumAuthentication() +EndIf DestroySplashScreen() CheckVersion() UpdateMultiStats() @@ -73052,9 +73517,6 @@ $g_iBotAction = $eBotStart If $g_bBotLaunchOption_HideAndroid Then $g_bIsHidden = True If $g_bBotLaunchOption_MinimizeBot Then BotMinimizeRequest() EndIf -If $bCheckPrerequisitesOK Then -ForumAuthentication() -EndIf Local $hStarttime = _Timer_Init() CheckEmuNewVersions() NotifyGetLastMessageFromTelegram() @@ -73113,6 +73575,7 @@ If Not $g_bRunState Then Return If $g_bRestart = True Then ContinueLoop checkObstacles() If $g_bRestart = True Then ContinueLoop +If $g_bUpdateSharedPrefs Then PullSharedPrefs() If $g_bQuicklyFirstStart = True Then $g_bQuicklyFirstStart = False Else @@ -73424,8 +73887,8 @@ If Not $g_bRunState Then Return If _Sleep($DELAYATTACKMAIN2) Then Return Return True Else -SetLog("No one of search condition match:", $COLOR_WARNING) -SetLog("Waiting on troops, heroes and/or spells according to search settings", $COLOR_WARNING) +SetLog("None of search condition match:", $COLOR_WARNING) +SetLog("Search, Trophy or Army Camp % are out of range in search setting", $COLOR_WARNING) $g_bIsSearchLimit = False $g_bIsClientSyncError = False $g_bQuickAttack = False diff --git a/imgxml/Resources/ClanGamesImages/MainLoop/Caravan/caravan_0_90.xml b/imgxml/Resources/ClanGamesImages/MainLoop/Caravan/caravan_0_88.xml similarity index 100% rename from imgxml/Resources/ClanGamesImages/MainLoop/Caravan/caravan_0_90.xml rename to imgxml/Resources/ClanGamesImages/MainLoop/Caravan/caravan_0_88.xml diff --git a/imgxml/Storages/All/Collector_12_90.xml b/imgxml/Storages/All/Collector_12_89.xml similarity index 100% rename from imgxml/Storages/All/Collector_12_90.xml rename to imgxml/Storages/All/Collector_12_89.xml diff --git a/imgxml/Storages/All/Drill_1_89.xml b/imgxml/Storages/All/Drill_1_87.xml similarity index 100% rename from imgxml/Storages/All/Drill_1_89.xml rename to imgxml/Storages/All/Drill_1_87.xml diff --git a/imgxml/Storages/All/Drill_3_90.xml b/imgxml/Storages/All/Drill_3_88.xml similarity index 100% rename from imgxml/Storages/All/Drill_3_90.xml rename to imgxml/Storages/All/Drill_3_88.xml diff --git a/imgxml/Storages/All/Drill_4_89.xml b/imgxml/Storages/All/Drill_4_90.xml similarity index 100% rename from imgxml/Storages/All/Drill_4_89.xml rename to imgxml/Storages/All/Drill_4_90.xml diff --git a/imgxml/Storages/All/Drill_6_89.xml b/imgxml/Storages/All/Drill_6_88.xml similarity index 100% rename from imgxml/Storages/All/Drill_6_89.xml rename to imgxml/Storages/All/Drill_6_88.xml diff --git a/imgxml/Storages/All_Snow/Drill_7_90.xml b/imgxml/Storages/All/Drill_7_92.xml similarity index 100% rename from imgxml/Storages/All_Snow/Drill_7_90.xml rename to imgxml/Storages/All/Drill_7_92.xml diff --git a/imgxml/Storages/All/Mines_12_87.xml b/imgxml/Storages/All/Mines_12_85.xml similarity index 100% rename from imgxml/Storages/All/Mines_12_87.xml rename to imgxml/Storages/All/Mines_12_85.xml diff --git a/imgxml/Storages/All_Snow/Drill_1_89.xml b/imgxml/Storages/All_Snow/Drill_1_87.xml similarity index 100% rename from imgxml/Storages/All_Snow/Drill_1_89.xml rename to imgxml/Storages/All_Snow/Drill_1_87.xml diff --git a/imgxml/Storages/All_Snow/Drill_3_90.xml b/imgxml/Storages/All_Snow/Drill_3_88.xml similarity index 100% rename from imgxml/Storages/All_Snow/Drill_3_90.xml rename to imgxml/Storages/All_Snow/Drill_3_88.xml diff --git a/imgxml/Storages/All_Snow/Drill_4_89.xml b/imgxml/Storages/All_Snow/Drill_4_90.xml similarity index 100% rename from imgxml/Storages/All_Snow/Drill_4_89.xml rename to imgxml/Storages/All_Snow/Drill_4_90.xml diff --git a/imgxml/Storages/Drills/Drill_7_90.xml b/imgxml/Storages/All_Snow/Drill_7_92.xml similarity index 100% rename from imgxml/Storages/Drills/Drill_7_90.xml rename to imgxml/Storages/All_Snow/Drill_7_92.xml diff --git a/imgxml/Storages/Drills/Drill_1_89.xml b/imgxml/Storages/Drills/Drill_1_87.xml similarity index 100% rename from imgxml/Storages/Drills/Drill_1_89.xml rename to imgxml/Storages/Drills/Drill_1_87.xml diff --git a/imgxml/Storages/Drills/Drill_3_90.xml b/imgxml/Storages/Drills/Drill_3_88.xml similarity index 100% rename from imgxml/Storages/Drills/Drill_3_90.xml rename to imgxml/Storages/Drills/Drill_3_88.xml diff --git a/imgxml/Storages/Drills/Drill_4_89.xml b/imgxml/Storages/Drills/Drill_4_90.xml similarity index 100% rename from imgxml/Storages/Drills/Drill_4_89.xml rename to imgxml/Storages/Drills/Drill_4_90.xml diff --git a/imgxml/Storages/Drills/Drill_7_92.xml b/imgxml/Storages/Drills/Drill_7_92.xml new file mode 100644 index 000000000..7b3c41707 --- /dev/null +++ b/imgxml/Storages/Drills/Drill_7_92.xml @@ -0,0 +1 @@ +LO238ELf5AlNAtCoqWpnf9Gbz57a9bZnV7tl4I1aB6a3aGs/YUI1pM+hD0myInL3xcbROsG5Px8DwTpOOOecDPFyhhJOPw+pR9jS+Ivx+Ol58QEhqNvVGp16FM6Cs6GOvLrSwCdIZ3qR2efJILdsqTYlHZFt35anwEUzBLsd12nPYk6i7pJ30OvYQvBm6whOr3Ns3p6vdNvJsTVFB+cyVg3/4xCqUHw/IH0U1DRGH4/o2F01WiDsoTTNUM9cAg+gliQ4+6yUHQwpMpxLuhG78hPl0VFXWgzE0Z9n4+Uw24Zu1t+mmVlBi3zIXa2hz96e4tX/6P6Pi1MCbTtsNbK5Sskpi7lpXR4ROWNUoX2mJPVtQKtcdq4o5NdG5vMHrVRBPxZrNGKpc8VgM86nvCrwmUv2148AOqqUCuT1vwAlOv4qpm2h83q2Wgmvu+Ky8+rc396gBlFbAAYDWJ8DJ3JXyAunfltfSkLQDXaKo7O4vvM3IvRA7WBsz5dtfCt416/b1s/glMCX9/GslAVbyFFOsNBffUGKeSpI/fPk8etriDJO3Nb4MNJdemOkqyOo/4wUZ7WTFqkHGLVUx2zA/6MNwgugdgHg67oj/BqxbcKW1rPtGriAkDyogqZo25solMsAWKma9yUpxSbbT15h7pwO+MvpnAFXrzB6dZ4ku7EjJJa+qRBZ0ZJPSJ4AhtnXaSZlesseZh/hIr2el6C4/MEQpF4S1jFdhr13wq3/2yirVFr45XVETf3wLCsUWArc8Rn+wl+EWzHIA9pTg8+Wqdg+gntE3IiZFzK2I5ufrmp9Rhk52hF+6x/uRBdVsjEd6i9ZXjNP2b4AG3OrS/L4vNNmMyd7jxborhoYp3ushW3PiOwDEprWmfpsFw== \ No newline at end of file diff --git a/imgxml/Storages/Drills/Level/Drill_7_93.xml b/imgxml/Storages/Drills/Level/Drill_7_96.xml similarity index 100% rename from imgxml/Storages/Drills/Level/Drill_7_93.xml rename to imgxml/Storages/Drills/Level/Drill_7_96.xml diff --git a/lib/MyBot.run.dll b/lib/MyBot.run.dll index e30f13b9e..617931dbf 100644 Binary files a/lib/MyBot.run.dll and b/lib/MyBot.run.dll differ diff --git a/lib/adb.scripts/shell.init.Nox.script b/lib/adb.scripts/shell.init.Nox.script index a62d0e655..16914a94b 100644 --- a/lib/adb.scripts/shell.init.Nox.script +++ b/lib/adb.scripts/shell.init.Nox.script @@ -1,2 +1,3 @@ echo Android Steady Shell PID=$PPID +set export=$(mkdir /mnt/shell/emulated/0/Others 2>/dev/null) mount.vboxsf other /mnt/shell/emulated/0/Others \ No newline at end of file diff --git a/lib/adb/adb.license b/lib/adb/adb.license new file mode 100644 index 000000000..c495b4d4a --- /dev/null +++ b/lib/adb/adb.license @@ -0,0 +1,65 @@ +This is the Android Software Development Kit License Agreement +1. Introduction +1.1 The Android Software Development Kit (referred to in the License Agreement as the "SDK" and specifically including the Android system files, packaged APIs, and Google APIs add-ons) is licensed to you subject to the terms of the License Agreement. The License Agreement forms a legally binding contract between you and Google in relation to your use of the SDK. +1.2 "Android" means the Android software stack for devices, as made available under the Android Open Source Project, which is located at the following URL: http://source.android.com/, as updated from time to time. +1.3 A "compatible implementation" means any Android device that (i) complies with the Android Compatibility Definition document, which can be found at the Android compatibility website (http://source.android.com/compatibility) and which may be updated from time to time; and (ii) successfully passes the Android Compatibility Test Suite (CTS). +1.4 "Google" means Google LLC, a Delaware corporation with principal place of business at 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States. +2. Accepting this License Agreement +2.1 In order to use the SDK, you must first agree to the License Agreement. You may not use the SDK if you do not accept the License Agreement. +2.2 By clicking to accept, you hereby agree to the terms of the License Agreement. +2.3 You may not use the SDK and may not accept the License Agreement if you are a person barred from receiving the SDK under the laws of the United States or other countries, including the country in which you are resident or from which you use the SDK. +2.4 If you are agreeing to be bound by the License Agreement on behalf of your employer or other entity, you represent and warrant that you have full legal authority to bind your employer or such entity to the License Agreement. If you do not have the requisite authority, you may not accept the License Agreement or use the SDK on behalf of your employer or other entity. +3. SDK License from Google +3.1 Subject to the terms of the License Agreement, Google grants you a limited, worldwide, royalty-free, non-assignable, non-exclusive, and non-sublicensable license to use the SDK solely to develop applications for compatible implementations of Android. +3.2 You may not use this SDK to develop applications for other platforms (including non-compatible implementations of Android) or to develop another SDK. You are of course free to develop applications for other platforms, including non-compatible implementations of Android, provided that this SDK is not used for that purpose. +3.3 You agree that Google or third parties own all legal right, title and interest in and to the SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law, and any and all other proprietary rights. Google reserves all rights not expressly granted to you. +3.4 You may not use the SDK for any purpose not expressly permitted by the License Agreement. Except to the extent required by applicable third party licenses, you may not copy (except for backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part of the SDK. +3.5 Use, reproduction and distribution of components of the SDK licensed under an open source software license are governed solely by the terms of that open source software license and not the License Agreement. +3.6 You agree that the form and nature of the SDK that Google provides may change without prior notice to you and that future versions of the SDK may be incompatible with applications developed on previous versions of the SDK. You agree that Google may stop (permanently or temporarily) providing the SDK (or any features within the SDK) to you or to users generally at Google's sole discretion, without prior notice to you. +3.7 Nothing in the License Agreement gives you a right to use any of Google's trade names, trademarks, service marks, logos, domain names, or other distinctive brand features. +3.8 You agree that you will not remove, obscure, or alter any proprietary rights notices (including copyright and trademark notices) that may be affixed to or contained within the SDK. +4. Use of the SDK by You +4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under the License Agreement in or to any software applications that you develop using the SDK, including any intellectual property rights that subsist in those applications. +4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) the License Agreement and (b) any applicable law, regulation or generally accepted practices or guidelines in the relevant jurisdictions (including any laws regarding the export of data or software to and from the United States or other relevant countries). +4.3 You agree that if you use the SDK to develop applications for general public users, you will protect the privacy and legal rights of those users. If the users provide you with user names, passwords, or other login information or personal information, you must make the users aware that the information will be available to your application, and you must provide legally adequate privacy notice and protection for those users. If your application stores personal or sensitive information provided by users, it must do so securely. If the user provides your application with Google Account information, your application may only use that information to access the user's Google Account when, and for the limited purposes for which, the user has given you permission to do so. +4.4 You agree that you will not engage in any activity with the SDK, including the development or distribution of an application, that interferes with, disrupts, damages, or accesses in an unauthorized manner the servers, networks, or other properties or services of any third party including, but not limited to, Google or any mobile communications carrier. +4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any data, content, or resources that you create, transmit or display through Android and/or applications for Android, and for the consequences of your actions (including any loss or damage which Google may suffer) by doing so. +4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or to any third party for) any breach of your obligations under the License Agreement, any applicable third party contract or Terms of Service, or any applicable law or regulation, and for the consequences (including any loss or damage which Google or any third party may suffer) of any such breach. +5. Your Developer Credentials +5.1 You agree that you are responsible for maintaining the confidentiality of any developer credentials that may be issued to you by Google or which you may choose yourself and that you will be solely responsible for all applications that are developed under your developer credentials. +6. Privacy and Information +6.1 In order to continually innovate and improve the SDK, Google may collect certain usage statistics from the software including but not limited to a unique identifier, associated IP address, version number of the software, and information on which tools and/or services in the SDK are being used and how they are being used. Before any of this information is collected, the SDK will notify you and seek your consent. If you withhold consent, the information will not be collected. +6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in accordance with Google's Privacy Policy. +7. Third Party Applications +7.1 If you use the SDK to run applications developed by a third party or that access data, content or resources provided by a third party, you agree that Google is not responsible for those applications, data, content, or resources. You understand that all data, content or resources which you may access through such third party applications are the sole responsibility of the person from which they originated and that Google is not liable for any loss or damage that you may experience as a result of the use or access of any of those third party applications, data, content, or resources. +7.2 You should be aware the data, content, and resources presented to you through such a third party application may be protected by intellectual property rights which are owned by the providers (or by other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute or create derivative works based on these data, content, or resources (either in whole or in part) unless you have been specifically given permission to do so by the relevant owners. +7.3 You acknowledge that your use of such third party applications, data, content, or resources may be subject to separate terms between you and the relevant third party. In that case, the License Agreement does not affect your legal relationship with these third parties. +8. Using Android APIs +8.1 Google Data APIs +8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be protected by intellectual property rights which are owned by Google or those parties that provide the data (or by other persons or companies on their behalf). Your use of any such API may be subject to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create derivative works based on this data (either in whole or in part) unless allowed by the relevant Terms of Service. +8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you shall retrieve data only with the user's explicit consent and only when, and for the limited purposes for which, the user has given you permission to do so. If you use the Android Recognition Service API, documented at the following URL: https://developer.android.com/reference/android/speech/RecognitionService, as updated from time to time, you acknowledge that the use of the API is subject to the Data Processing Addendum for Products where Google is a Data Processor, which is located at the following URL: https://privacy.google.com/businesses/gdprprocessorterms/, as updated from time to time. By clicking to accept, you hereby agree to the terms of the Data Processing Addendum for Products where Google is a Data Processor. +9. Terminating this License Agreement +9.1 The License Agreement will continue to apply until terminated by either you or Google as set out below. +9.2 If you want to terminate the License Agreement, you may do so by ceasing your use of the SDK and any relevant developer credentials. +9.3 Google may at any time, terminate the License Agreement with you if: (A) you have breached any provision of the License Agreement; or (B) Google is required to do so by law; or (C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated its relationship with Google or ceased to offer certain parts of the SDK to you; or (D) Google decides to no longer provide the SDK or certain parts of the SDK to users in the country in which you are resident or from which you use the service, or the provision of the SDK or certain SDK services to you by Google is, in Google's sole discretion, no longer commercially viable. +9.4 When the License Agreement comes to an end, all of the legal rights, obligations and liabilities that you and Google have benefited from, been subject to (or which have accrued over time whilst the License Agreement has been in force) or which are expressed to continue indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall continue to apply to such rights, obligations and liabilities indefinitely. +10. DISCLAIMER OF WARRANTIES +10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE. +10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE. +10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +11. LIMITATION OF LIABILITY +11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. +12. Indemnification +12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless Google, its affiliates and their respective directors, officers, employees and agents from and against any and all claims, actions, suits or proceedings, as well as any and all losses, liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any person or defames any person or violates their rights of publicity or privacy, and (c) any non-compliance by you with the License Agreement. +13. Changes to the License Agreement +13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK. When these changes are made, Google will make a new version of the License Agreement available on the website where the SDK is made available. +14. General Legal Terms +14.1 The License Agreement constitutes the whole legal agreement between you and Google and governs your use of the SDK (excluding any services which Google may provide to you under a separate written agreement), and completely replaces any prior agreements between you and Google in relation to the SDK. +14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is contained in the License Agreement (or which Google has the benefit of under any applicable law), this will not be taken to be a formal waiver of Google's rights and that those rights or remedies will still be available to Google. +14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision of the License Agreement is invalid, then that provision will be removed from the License Agreement without affecting the rest of the License Agreement. The remaining provisions of the License Agreement will continue to be valid and enforceable. +14.4 You acknowledge and agree that each member of the group of companies of which Google is the parent shall be third party beneficiaries to the License Agreement and that such other companies shall be entitled to directly enforce, and rely upon, any provision of the License Agreement that confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall be third party beneficiaries to the License Agreement. +14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE. +14.6 The rights granted in the License Agreement may not be assigned or transferred by either you or Google without the prior written approval of the other party. Neither you nor Google shall be permitted to delegate their responsibilities or obligations under the License Agreement without the prior written approval of the other party. +14.7 The License Agreement, and your relationship with Google under the License Agreement, shall be governed by the laws of the State of California without regard to its conflict of laws provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located within the county of Santa Clara, California to resolve any legal matter arising from the License Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction. January 16, 2019 + +See: https://developer.android.com/studio/releases/platform-tools.html \ No newline at end of file diff --git a/lib/adb/info.txt b/lib/adb/info.txt deleted file mode 100644 index e69de29bb..000000000