Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 119 additions & 119 deletions BrokenBot.au3
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
#RequireAdmin
#AutoIt3Wrapper_UseX64=n
#pragma compile(Icon, "BrokenBot.org\images\icons\brokenbot.ico")
#pragma compile(FileDescription, BrokenBot.org - Clash of Clans Bot)
#pragma compile(ProductName, BrokenBot.org - Clash of Clans Bot)
#pragma compile(ProductVersion, 3.1.0)
#pragma compile(FileVersion, 3.1.0)

#include <GUIConstants.au3>

$sBotVersion = "3.1.0"
$sBotTitle = "BrokenBot.org - Break FREE - v" & $sBotVersion

If FileExists(@ScriptDir & "\.developer") Then
$sBotTitle = "BrokenBot.org - In Development"
EndIf

Global $StartupLanguage = IniRead(@ScriptDir & "\config\default.ini", "config", "language", "English")

If _Singleton($sBotTitle, 1) = 0 Then
MsgBox(0, "", GetLangText("boxAlreadyRunning"))
Exit
EndIf

If @AutoItX64 = 1 Then
MsgBox(0, "", GetLangText("boxCompile1") & @CRLF & GetLangText("boxCompile2"))
Exit
EndIf

If Not FileExists(@ScriptDir & "\License.txt") Then
$license = InetGet("http://www.gnu.org/licenses/gpl-3.0.txt", @ScriptDir & "\License.txt")
InetClose($license)
EndIf

#include "COCBot\Global Variables.au3"
#include "COCBot\GUI Design.au3"
#include "COCBot\Functions.au3"
#include "BrokenBot.org\functions\functions.au3"
#include "COCBot\GUI Control.au3"
#include-once

; Event registration
GUIRegisterMsg($WM_COMMAND, "GUIControl")
GUIRegisterMsg($WM_SYSCOMMAND, "GUIControl")
GUIRegisterMsg(0x0003, "_WinMoved")

; Initialize everything
DirCreate($dirLogs)
DirCreate($dirLoots)
DirCreate($dirAllTowns)
DirCreate($dirDebug)
DirCreate($dirAttack)
DirCreate($dirConfigs)
DirCreate($dirStrat)
readConfig()
applyConfig()
checkupdate()
_PluginDefaults()
_btnRefresh()
_GUICtrlListBox_SetCurSel($lstStrategies, 0)
_lstStrategies()

HotKeySet("^!+p", "_ScreenShot")

$sTimer = TimerInit()
AdlibRegister("SetTime", 1000)

Local $StartImmediately = False
If IsArray($CmdLine) Then
If $CmdLine[0] = 1 Then $StartImmediately = True
If $CmdLine[0] = 2 Then
; Add option to start with specific profile
EndIf
EndIf

$hHBitmap = _ScreenCapture_Capture("", 0, 0, 860, 720)
$ret = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotRedLineCheck", "ptr", $hHBitmap, "int", 1, "int", 1, "int", 0, "int", 0, "int", 0)
_WinAPI_DeleteObject($hHBitmap)
If Not IsArray($ret) Then
If MsgBox($MB_ICONWARNING + $MB_OKCANCEL, GetLangText("msgMissing"), GetLangText("msgMissing1") & @CRLF & @CRLF & GetLangText("msgMissing2") & @CRLF & @CRLF & GetLangText("msgMissing3") & " " & GetLangText("msgMissing4") & " " & GetLangText("msgMissing5") & @CRLF & @CRLF & GetLangText("msgMissing6")) = $IDOK Then
ShellExecute("https://www.microsoft.com/en-us/download/details.aspx?id=40784")
DllClose($KernelDLL)
_GDIPlus_Shutdown()
_Crypt_Shutdown()
_GUICtrlRichEdit_Destroy($txtLog)
Exit
EndIf
ElseIf $ret[0] = -2 Then
MsgBox(48, "BrokenBot.org", GetLangText("msgLicense") & @CRLF & @CRLF & "Please visit BrokenBot.org")
EndIf

If IniRead(@LocalAppDataDir & "\BrokenBot.org.ini", "default", "1", "") = "" Or IniRead(@LocalAppDataDir & "\BrokenBot.org.ini", "default", "2", "") = "" Then
GUICtrlSetImage($btnBBValidate, @ScriptDir & "\images\Resource\bad.bmp")
GUICtrlSetTip($btnBBValidate, GetLangText("tipBBValidBad"))
Else
GUICtrlSetData($inpBBPassword, _Decrypt(IniRead(@LocalAppDataDir & "\BrokenBot.org.ini", "default", "2", "")))
_btnBBValidate()
GUICtrlSetData($inpBBPassword, "")
EndIf

;Only enable button start after all Initiation done.
GUICtrlSetData($btnStart, GetLangText("btnStart"))
GUICtrlSetState($btnStart, $GUI_ENABLE)
While 1
If $StartImmediately Then
$StartImmediately = False
btnStart()
EndIf
Switch TrayGetMsg()
Case $tiAbout
MsgBox(64 + $MB_APPLMODAL + $MB_TOPMOST, $sBotTitle, "Clash of Clans Bot" & @CRLF & @CRLF & _
"Version: " & $sBotVersion & @CRLF & _
"Released under the GNU GPLv3 license.", 0, $frmBot)
Case $tiExit
SetLog(GetLangText("msgExit"), $COLOR_ORANGE)
ExitLoop
EndSwitch
Sleep(50)
WEnd
#RequireAdmin
#AutoIt3Wrapper_UseX64=n
#pragma compile(Icon, "BrokenBot.org\images\icons\brokenbot.ico")
#pragma compile(FileDescription, BrokenBot.org - Clash of Clans Bot)
#pragma compile(ProductName, BrokenBot.org - Clash of Clans Bot)
#pragma compile(ProductVersion, 3.2.0)
#pragma compile(FileVersion, 3.2.0)
#include <GUIConstants.au3>
$sBotVersion = "3.2.0"
$sBotTitle = "BrokenBot.org - Break FREE - v" & $sBotVersion
If FileExists(@ScriptDir & "\.developer") Then
$sBotTitle = "BrokenBot.org - In Development"
EndIf
Global $StartupLanguage = IniRead(@ScriptDir & "\config\default.ini", "config", "language", "English")
If _Singleton($sBotTitle, 1) = 0 Then
MsgBox(0, "", GetLangText("boxAlreadyRunning"))
Exit
EndIf
If @AutoItX64 = 1 Then
MsgBox(0, "", GetLangText("boxCompile1") & @CRLF & GetLangText("boxCompile2"))
Exit
EndIf
If Not FileExists(@ScriptDir & "\License.txt") Then
$license = InetGet("http://www.gnu.org/licenses/gpl-3.0.txt", @ScriptDir & "\License.txt")
InetClose($license)
EndIf
#include "COCBot\Global Variables.au3"
#include "COCBot\GUI Design.au3"
#include "COCBot\Functions.au3"
#include "BrokenBot.org\functions\functions.au3"
#include "COCBot\GUI Control.au3"
#include-once
; Event registration
GUIRegisterMsg($WM_COMMAND, "GUIControl")
GUIRegisterMsg($WM_SYSCOMMAND, "GUIControl")
GUIRegisterMsg(0x0003, "_WinMoved")
; Initialize everything
DirCreate($dirLogs)
DirCreate($dirLoots)
DirCreate($dirAllTowns)
DirCreate($dirDebug)
DirCreate($dirAttack)
DirCreate($dirConfigs)
DirCreate($dirStrat)
readConfig()
applyConfig()
checkupdate()
_PluginDefaults()
_btnRefresh()
_GUICtrlListBox_SetCurSel($lstStrategies, 0)
_lstStrategies()
HotKeySet("^!+p", "_ScreenShot")
$sTimer = TimerInit()
AdlibRegister("SetTime", 1000)
Local $StartImmediately = False
If IsArray($CmdLine) Then
If $CmdLine[0] = 1 Then $StartImmediately = True
If $CmdLine[0] = 2 Then
; Add option to start with specific profile
EndIf
EndIf
$hHBitmap = _ScreenCapture_Capture("", 0, 0, 860, 720)
$ret = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotRedLineCheck", "ptr", $hHBitmap, "int", 1, "int", 1, "int", 0, "int", 0, "int", 0)
_WinAPI_DeleteObject($hHBitmap)
If Not IsArray($ret) Then
If MsgBox($MB_ICONWARNING + $MB_OKCANCEL, GetLangText("msgMissing"), GetLangText("msgMissing1") & @CRLF & @CRLF & GetLangText("msgMissing2") & @CRLF & @CRLF & GetLangText("msgMissing3") & " " & GetLangText("msgMissing4") & " " & GetLangText("msgMissing5") & @CRLF & @CRLF & GetLangText("msgMissing6")) = $IDOK Then
ShellExecute("https://www.microsoft.com/en-us/download/details.aspx?id=40784")
DllClose($KernelDLL)
_GDIPlus_Shutdown()
_Crypt_Shutdown()
_GUICtrlRichEdit_Destroy($txtLog)
Exit
EndIf
ElseIf $ret[0] = -2 Then
MsgBox(48, "BrokenBot.org", GetLangText("msgLicense") & @CRLF & @CRLF & "Please visit BrokenBot.org")
EndIf
If IniRead(@LocalAppDataDir & "\BrokenBot.org.ini", "default", "1", "") = "" Or IniRead(@LocalAppDataDir & "\BrokenBot.org.ini", "default", "2", "") = "" Then
GUICtrlSetImage($btnBBValidate, @ScriptDir & "\images\Resource\bad.bmp")
GUICtrlSetTip($btnBBValidate, GetLangText("tipBBValidBad"))
Else
GUICtrlSetData($inpBBPassword, _Decrypt(IniRead(@LocalAppDataDir & "\BrokenBot.org.ini", "default", "2", "")))
_btnBBValidate()
GUICtrlSetData($inpBBPassword, "")
EndIf
;Only enable button start after all Initiation done.
GUICtrlSetData($btnStart, GetLangText("btnStart"))
GUICtrlSetState($btnStart, $GUI_ENABLE)
While 1
If $StartImmediately Then
$StartImmediately = False
btnStart()
EndIf
Switch TrayGetMsg()
Case $tiAbout
MsgBox(64 + $MB_APPLMODAL + $MB_TOPMOST, $sBotTitle, "Clash of Clans Bot" & @CRLF & @CRLF & _
"Version: " & $sBotVersion & @CRLF & _
"Released under the GNU GPLv3 license.", 0, $frmBot)
Case $tiExit
SetLog(GetLangText("msgExit"), $COLOR_ORANGE)
ExitLoop
EndSwitch
Sleep(50)
WEnd
Binary file modified BrokenBot.exe
Binary file not shown.
Binary file modified BrokenBot.org/BrokenBot32.dll
Binary file not shown.
97 changes: 97 additions & 0 deletions BrokenBot.org/BrokenBotHelper.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
; This code was created for public use by BrokenBot.org and falls under the GPLv3 license.
; This code can be incorporated into open source/non-profit projects free of charge and without consent.
; **NOT FOR COMMERCIAL USE** by any project which includes any part of the code in this sub-directory without express written consent of BrokenBot.org
; You **MAY NOT SOLICIT DONATIONS** from any project which includes any part of the code in this sub-directory without express written consent of BrokenBot.org
;
; External script that can run necessary image detection functions asynchronously from main autoit code.

; Passed to function: Pointer to BB, pointer to return variable, Background mode, Left, Top, Right, Bottom, Function, ID, MaxNum, Mask, SpeedBoost
#NoTrayIcon

#include <WinAPI.au3>
#include <ScreenCapture.au3>
#include <GDIPlus.au3>


$Title = "BlueStacks App Player"
$HWnD = WinGetHandle($Title)
Dim $BSpos[2]

_GDIPlus_Startup()

$BackgroundMode = Number($CmdLine[2])
$iLeft = Number($CmdLine[3])
$iTop = Number($CmdLine[4])
$iRight = Number($CmdLine[5])
$iBottom = Number($CmdLine[6])

If $BackgroundMode = 1 Then
$iW = Number($iRight) - Number($iLeft)
$iH = Number($iBottom) - Number($iTop)
$hDC_Capture = _WinAPI_GetWindowDC(ControlGetHandle($Title, "", "[CLASS:BlueStacksApp; INSTANCE:1]"))
$hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture)
$hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $iW, $iH)
$hObjectOld = _WinAPI_SelectObject($hMemDC, $hHBitmap)
DllCall("user32.dll", "int", "PrintWindow", "hwnd", $HWnD, "handle", $hMemDC, "int", 0)
_WinAPI_SelectObject($hMemDC, $hHBitmap)
_WinAPI_BitBlt($hMemDC, 0, 0, $iW, $iH, $hDC_Capture, $iLeft, $iTop, 0x00CC0020)
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
_WinAPI_DeleteDC($hMemDC)
_WinAPI_SelectObject($hMemDC, $hObjectOld)
_WinAPI_ReleaseDC($HWnD, $hDC_Capture)
Else
$aPos = ControlGetPos($Title, "", "[CLASS:BlueStacksApp; INSTANCE:1]")
$tPoint = DllStructCreate("int X;int Y")
DllStructSetData($tPoint, "X", $aPos[0])
DllStructSetData($tPoint, "Y", $aPos[1])
_WinAPI_ClientToScreen(WinGetHandle(WinGetTitle($Title)), $tPoint)
$BSpos[0] = DllStructGetData($tPoint, "X")
$BSpos[1] = DllStructGetData($tPoint, "Y")
$hHBitmap = _ScreenCapture_Capture("", $iLeft + $BSpos[0], $iTop + $BSpos[1], $iRight + $BSpos[0], $iBottom + $BSpos[1])
$hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)
EndIf

If $CmdLine[1] = 1 Then
$mH = $CmdLine[8]
$mS = $CmdLine[9]
$ci = $CmdLine[10]
$cl = $CmdLine[11]
$cr = $CmdLine[12]
$hCheckHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
$res = DllCall(@ScriptDir & "\BrokenBot32.dll", "str", "BrokenBotRedLineCheck", "ptr", $hCheckHBitmap, "int", $mH, "int", $mS, "int", $ci, "int", $cl, "int", $cr)
ElseIf $CmdLine[1] = 2 Then
$x = $CmdLine[8]
$y = $CmdLine[9]
$width = $CmdLine[10]
$height = $CmdLine[11]
$type = $CmdLine[12]
$leftaligned = $CmdLine[13]
$reversed = $CmdLine[14]
$hClone = _GDIPlus_BitmapCloneArea($hBitmap, $x, $y, $width, $height, _GDIPlus_ImageGetPixelFormat($hBitmap))
$hCheckHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hClone)
$res = DllCall(@ScriptDir & "\BrokenBot32.dll", "str", "BrokenBotReadText", "ptr", $hCheckHBitmap, "int", $type, "int", $leftaligned, "int", $reversed)
ElseIf $CmdLine[1] = 3 Then
$Function = $CmdLine[7]
$ID = $CmdLine[8]
$MaxNum = $CmdLine[9]
$Mask = $CmdLine[10]
$SpeedBoost = $CmdLine[11]

$hCheckHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
$res = DllCall(@ScriptDir & "\BrokenBot32.dll", "str", $Function, "ptr", $hCheckHBitmap, "int", number($ID), "int", 3, "int", number($MaxNum), "int", number($Mask), "int", number($SpeedBoost))
EndIf

_WinAPI_DeleteObject($hCheckHBitmap)
If IsArray($res) Then
RegWrite("HKEY_CURRENT_USER\Software\BrokenBot", "Transfer", "REG_SZ", $res[0])
Else
RegWrite("HKEY_CURRENT_USER\Software\BrokenBot", "Transfer", "REG_SZ", "-4")
EndIf

_WinAPI_DeleteObject($hHBitmap)
_GDIPlus_BitmapDispose($hBitmap)

_GDIPlus_Shutdown()

Exit

Binary file added BrokenBot.org/BrokenBotHelper.exe
Binary file not shown.
35 changes: 26 additions & 9 deletions BrokenBot.org/License.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
License
ANY and ALL code included (recursively) in this sub-directory of the project is Under GPLv3 with the following modification:

- This code was created for public use by BrokenBot.org and falls under the GPLv3 license.
- This code can be incorporated into open source/non-profit projects free of charge and without consent.
- **NOT FOR COMMERCIAL USE** by any project which includes any part of the code in this sub-directory without express written consent of BrokenBot.org
- You **MAY NOT SOLICIT DONATIONS** from any project which includes any part of the code in this sub-directory without express written consent of BrokenBot.org

- This license may not be modified by anyone other than BrokenBot.org
License
ANY and ALL code included (recursively) in this sub-directory of the project is Under GPLv3 with the following modification:

- This code was created for public use by BrokenBot.org and falls under the GPLv3 license.
- This code can be incorporated into open source/non-profit projects free of charge and without consent.
- **NOT FOR COMMERCIAL USE** by any project which includes any part of the code in this sub-directory without express written consent of BrokenBot.org
- You **MAY NOT SOLICIT DONATIONS** from any project which includes any part of the code in this sub-directory without express written consent of BrokenBot.org

- This license may not be modified by anyone other than BrokenBot.org


-----------------------------------------------------------------------------------------
This project utilizes the Open Source Computer Vision Library, Copyright 2015 Itseez

By downloading, copying, installing or using the software you agree to this license.
If you do not agree to this license, do not download, install, copy or use the software.

License Agreement
For Open Source Computer Vision Library
(3-clause BSD License)
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the names of the copyright holders nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided by the copyright holders and contributors �as is� and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall copyright holders or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
Loading