Skip to content

Commit

Permalink
Version 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
codebroken committed Jul 4, 2015
1 parent 878d5b6 commit 3dc3448
Show file tree
Hide file tree
Showing 70 changed files with 4,516 additions and 2,165 deletions.
25 changes: 19 additions & 6 deletions BrokenBot.au3
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#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, 2.8.0)
#pragma compile(FileVersion, 2.8.0)
#pragma compile(ProductVersion, 3.1.0)
#pragma compile(FileVersion, 3.1.0)

#include <GUIConstants.au3>

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

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

Global $StartupLanguage = IniRead(@ScriptDir & "\config\default.ini", "config", "language", "English")
Expand Down Expand Up @@ -79,14 +79,27 @@ _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") )
GUICtrlSetData($btnStart, GetLangText("btnStart"))
GUICtrlSetState($btnStart, $GUI_ENABLE)
While 1
If $StartImmediately Then
Expand Down
Binary file modified BrokenBot.exe
Binary file not shown.
Binary file modified BrokenBot.org/BrokenBot32.dll
Binary file not shown.
4 changes: 3 additions & 1 deletion BrokenBot.org/functions/ImageSearch/checkDarkElix.au3
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Func checkDarkElix()
$DEx = 0
$DEy = 0
Return False ; return 0
ElseIf $res[0] = -2 Then
SetLog(GetLangText("msgLicense"), $COLOR_RED)
Else
$res = StringSplit($res[0], "|", 2)
$DEx = $res[1]
Expand All @@ -33,7 +35,7 @@ Func checkDarkElix()
Return True
EndIf
Else
SetLog(GetLangText("msgDLLFailure"), $COLOR_RED)
SetLog(GetLangText("msgDLLError"), $COLOR_RED)
$DEx = 0
$DEy = 0
Return False ; return 0
Expand Down
6 changes: 4 additions & 2 deletions BrokenBot.org/functions/ImageSearch/checkTownhall.au3
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Func checkTownhall()
$THx = 0
$THy = 0
Return "-" ; return 0
ElseIf $res[0] = -2 Then
SetLog(GetLangText("msgLicense"), $COLOR_RED)
Else
$res = StringSplit($res[0], "|", 2)
$THx = $res[1]
Expand All @@ -32,11 +34,11 @@ Func checkTownhall()
If $res[4] < 7 Then
Return $THText[0]
Else
Return $THText[$res[4]-6]
Return $THText[$res[4] - 6]
EndIf
EndIf
Else
SetLog(GetLangText("msgDLLFailure"), $COLOR_RED)
SetLog(GetLangText("msgDLLError"), $COLOR_RED)
$THx = 0
$THy = 0
Return "-" ; return 0
Expand Down
52 changes: 37 additions & 15 deletions BrokenBot.org/functions/Other/GeneralFunctions.au3
Original file line number Diff line number Diff line change
Expand Up @@ -70,41 +70,63 @@ Func GetLangText($Key)
$ReturnStr = ""
If IsDeclared("cmbLanguage") Then
$array = _GUICtrlComboBox_GetListArray($cmbLanguage)
$CurrLangSel = $array[_GUICtrlComboBox_GetCurSel($cmbLanguage)+1]
$CurrLangSel = $array[_GUICtrlComboBox_GetCurSel($cmbLanguage) + 1]
$ReturnStr = IniRead(@ScriptDir & "\BrokenBot.org\languages\" & $CurrLangSel & ".ini", "general", $Key, "")
If $ReturnStr = "" Then
$ReturnStr = IniRead(@ScriptDir & "\BrokenBot.org\languages\English.ini", "general", $Key, "")
EndIf
;~ If IsDeclared("txtLog") And IsDeclared("statLog") Then
;~ SetLog("SL:" & $StartupLanguage)
;~ SetLog("CL:" & $CurrLangSel)
;~ SetLog("Key:" & $Key)
;~ SetLog("Result:" & $ReturnStr)
;~ EndIf
Else
$ReturnStr = IniRead(@ScriptDir & "\BrokenBot.org\languages\" & $StartupLanguage & ".ini", "general", $Key, "")
If $ReturnStr = "" Then
$ReturnStr = IniRead(@ScriptDir & "\BrokenBot.org\languages\English.ini", "general", $Key, "")
EndIf
;~ If IsDeclared("txtLog") And IsDeclared("statLog") Then
;~ SetLog("SL:" & $StartupLanguage)
;~ SetLog("Key:" & $Key)
;~ SetLog("Result:" & $ReturnStr)
;~ EndIf
EndIf
Return $ReturnStr
EndFunc
EndFunc ;==>GetLangText

Func PopulateLanguages()
$searchfile = FileFindFirstFile(@ScriptDir & "\BrokenBot.org\languages\*.ini")
$txtLang = ""
While True
$newfile = FileFindNextFile($searchfile)
If @error Then ExitLoop
$txtLang = $txtLang & StringLeft($newfile, StringLen($newfile)-4) & "|"
$txtLang = $txtLang & StringLeft($newfile, StringLen($newfile) - 4) & "|"
WEnd
FileClose($searchfile)
$txtLang = StringLeft($txtLang, StringLen($txtLang) - 1)
_GUICtrlComboBox_ResetContent($cmbLanguage)
GUICtrlSetData($cmbLanguage, $txtLang)
EndFunc
EndFunc ;==>PopulateLanguages

Func _Decrypt($sData)
Local $hKey = _Crypt_DeriveKey("DE8D16C2C59B93F3F0682250B", 0x00006610)
Local $sDecrypted = BinaryToString(_Crypt_DecryptData(Binary($sData), $hKey, $CALG_USERKEY))
_Crypt_DestroyKey($hKey)
Return $sDecrypted
EndFunc ;==>_Decrypt

Func _Encrypt($sData)
Local $hKey = _Crypt_DeriveKey("DE8D16C2C59B93F3F0682250B", 0x00006610)
Local $bEncrypted = _Crypt_EncryptData($sData, $hKey, $CALG_USERKEY)
_Crypt_DestroyKey($hKey)
Return $bEncrypted
EndFunc ;==>_Encrypt

Func urlencode($str, $plus = True)
Local $i, $return, $tmp, $exp
$return = ""
$exp = "[a-zA-Z0-9-._~]"
If $plus Then
$str = StringReplace($str, " ", "+")
$exp = "[a-zA-Z0-9-._~+]"
EndIf
For $i = 1 To StringLen($str)
$tmp = StringMid($str, $i, 1)
If StringRegExp($tmp, $exp, 0) = 1 Then
$return &= $tmp
Else
$return &= StringMid(StringRegExpReplace(StringToBinary($tmp, 4), "([0-9A-Fa-f]{2})", "%$1"), 3)
EndIf
Next
Return $return
EndFunc ;==>urlencode
68 changes: 68 additions & 0 deletions BrokenBot.org/functions/Other/HSL.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Func _SatSearch($iLeft, $iTop, $iWidth, $iHeight, $satMin, $satMax)
_CaptureRegion($iLeft, $iTop, $iLeft + $iWidth, $iTop + $iHeight)
Local $RGB[3]
For $x = 0 To $iWidth - 1
For $y = 0 To $iHeight - 1
$color = _GetPixelColor($x, $y)
$RGB[0] = Dec(StringMid(String($Color), 1, 2))
$RGB[1] = Dec(StringMid(String($Color), 3, 2))
$RGB[2] = Dec(StringMid(String($Color), 5, 2))
$HSL = RGBtoHSL($RGB)
If $HSL[1] > $satMin And $HSL[1] < $satMax Then Return True
Next
Next
Return False
EndFunc ;==>_MultiPixelSearch


Func RGBtoHSL($arColors)
Const $MaxHSL = 100
Const $MaxRGB = 255

If UBound($arColors) <> 3 Or UBound($arColors, 0) <> 1 Then Return SetError(1, 0, 0)

Local $nH, $nS, $nL
Local $nR = Number($arColors[0])/$MaxRGB
Local $nG = Number($arColors[1])/$MaxRGB
Local $nB = Number($arColors[2])/$MaxRGB

Local $nMax = $nR
If $nMax < $nG Then $nMax = $nG
If $nMax < $nB Then $nMax = $nB

Local $nMin = $nR
If $nMin > $nG Then $nMin = $nG
If $nMin > $nB Then $nMin = $nB

Local $nMinMaxSum = ($nMax + $nMin)
Local $nMinMaxDiff = ($nMax - $nMin)

$nL = $nMinMaxSum/2
If $nMinMaxDiff = 0 Then
$nH = 0
$nS = 0
Else
If $nL < 0.5 Then
$nS = $nMinMaxDiff/$nMinMaxSum
Else
$nS = $nMinMaxDiff/(2 - $nMinMaxSum)
EndIf

Switch $nMax
Case $nR
$nH = ($nG - $nB)/(6 * $nMinMaxDiff)
Case $nG
$nH = ($nB - $nR)/(6 * $nMinMaxDiff) + 1/3
Case $nB
$nH = ($nR - $nG)/(6 * $nMinMaxDiff) + 2/3
EndSwitch
If $nH < 0 Then $nH += 1
If $nH > 1 Then $nH -= 1
EndIf

$arColors[0] = $nH * $MaxHSL
$arColors[1] = $nS * $MaxHSL
$arColors[2] = $nL * $MaxHSL

Return $arColors
EndFunc
Loading

0 comments on commit 3dc3448

Please sign in to comment.