Skip to content

Commit

Permalink
v2.8.0
Browse files Browse the repository at this point in the history
speedBoost, PushBullet fixes, image recognition
  • Loading branch information
codebroken committed Jun 7, 2015
1 parent 0548d4a commit 878d5b6
Show file tree
Hide file tree
Showing 36 changed files with 66 additions and 28 deletions.
6 changes: 3 additions & 3 deletions BrokenBot.au3
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#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.7.1)
#pragma compile(FileVersion, 2.7.1)
#pragma compile(ProductVersion, 2.8.0)
#pragma compile(FileVersion, 2.8.0)

#include <GUIConstants.au3>

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

If FileExists (@ScriptDir & "\.developer") Then
Expand Down
Binary file modified BrokenBot.exe
Binary file not shown.
Binary file modified BrokenBot.org/BrokenBot32.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion BrokenBot.org/functions/ImageSearch/checkDarkElix.au3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Func checkDarkElix()
_CaptureRegion()
$sendHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
$res = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotMatchBuilding", "ptr", $sendHBitmap, "int", 13, "int", 3, "int", 1, "int", 1)
$res = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotMatchBuilding", "ptr", $sendHBitmap, "int", 13, "int", 3, "int", 1, "int", 1, "int", (IsChecked($chkSpeedBoost) ? (1) : (0)))
_WinAPI_DeleteObject($sendHBitmap)
If IsArray($res) Then
If $res[0] = -1 Then
Expand Down
6 changes: 3 additions & 3 deletions BrokenBot.org/functions/ImageSearch/checkTownhall.au3
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Func checkTownhall()
_CaptureRegion()
$sendHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
$res = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotMatchBuilding", "ptr", $sendHBitmap, "int", 1, "int", 3, "int", 1, "int", 1)
$res = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotMatchBuilding", "ptr", $sendHBitmap, "int", 1, "int", 3, "int", 1, "int", 1, "int", (IsChecked($chkSpeedBoost) ? (1) : (0)))
_WinAPI_DeleteObject($sendHBitmap)
If IsArray($res) Then
If $res[0] = -1 Then
Expand Down Expand Up @@ -37,8 +37,8 @@ Func checkTownhall()
EndIf
Else
SetLog(GetLangText("msgDLLFailure"), $COLOR_RED)
$DEx = 0
$DEy = 0
$THx = 0
$THy = 0
Return "-" ; return 0
EndIf
EndFunc ;==>checkTownhall
16 changes: 9 additions & 7 deletions BrokenBot.org/functions/Strategies/SharedFunction.au3
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ Func ChkDisconnection($disconnected = False)
If _ImageSearch(@ScriptDir & "\images\Lost.bmp", 1, $dummyX, $dummyY, 50) = 1 Then
If $dummyX > 320 and $dummyX < 350 and $dummyY > 330 and $dummyY < 350 Then
$disconnected = True
$speedBump += 500
If $speedBump > 5000 Then
$speedBump=5000
SetLog("Lost Connection! Already searching slowly, not changing anything.", $COLOR_RED)
Else
SetLog("Lost Connection! Slowing search speed by 0.5 secs.", $COLOR_RED)
EndIf
;Looks like lost connection is not related to search speed, test run without bump
SetLog("Lost Connection!", $COLOR_RED)
;~ $speedBump += 500
;~ If $speedBump > 5000 Then
;~ $speedBump=5000
;~ SetLog("Lost Connection! Already searching slowly, not changing anything.", $COLOR_RED)
;~ Else
;~ SetLog("Lost Connection! Slowing search speed by 0.5 secs.", $COLOR_RED)
;~ EndIf
EndIf
EndIf

Expand Down
2 changes: 1 addition & 1 deletion BrokenBot.org/functions/Village/collectResources.au3
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Func collectResources()
Do
_CaptureRegion()
$sendHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
$res = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotMatchBuilding", "ptr", $sendHBitmap, "int", 27, "int", 3, "int", 17, "int", 1)
$res = DllCall(@ScriptDir & "\BrokenBot.org\BrokenBot32.dll", "str", "BrokenBotMatchBuilding", "ptr", $sendHBitmap, "int", 27, "int", 3, "int", 17, "int", 1, "int", (IsChecked($chkSpeedBoost) ? (1) : (0)))
_WinAPI_DeleteObject($sendHBitmap)
If IsArray($res) Then
If $res[0] = -1 and NOT $foundResource Then
Expand Down
2 changes: 2 additions & 0 deletions BrokenBot.org/languages/English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ btnCloseBR = "Close"
heroSkill = "0 = Activate at low HP"
heroSkill2 = ">0 = Activate after number of seconds"
lblDisconnected = "Disconnected :"
chkSpeedBoost = "speedBoost"
chkSpeedBoostTip = "Uses more CPU, but will find buildings faster"
msgMissing = "Missing required file!"
msgMissing1 = "Your system appears to be missing a required file (MSVCP120.DLL) for redline detection to work."
msgMissing2 = "You may continue but the bot will not work as intended."
Expand Down
3 changes: 3 additions & 0 deletions COCBot/GUI Design.au3
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ $cmbLanguage = GUICtrlCreateCombo("", 30, 130, 347, 20, BitOR($CBS_DROPDOWNLIST,
PopulateLanguages()
_GUICtrlComboBox_SetCurSel($cmbLanguage, _GUICtrlComboBox_FindStringExact($cmbLanguage, $StartupLanguage))

$chkSpeedBoost = GUICtrlCreateCheckbox(GetLangText("chkSpeedBoost"), 40, 170, 100, 15)
GUICtrlSetTip(-1, GetLangText("chkSpeedBoostTip"))

$grpUpdate = GUICtrlCreateGroup(GetLangText("grpUpdate"), 20, 225, 375, 60)
$chkUpdate = GUICtrlCreateCheckbox(GetLangText("chkUpdate"), 40, 250, 225, 15)
GUICtrlSetBkColor($chkUpdate, $COLOR_WHITE)
Expand Down
8 changes: 6 additions & 2 deletions COCBot/Global Variables.au3
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ Global $prevTab = 0
Global $slideOut = 0
Global $slideIn = 0

;Troop types
Global Enum $eBarbarian, $eArcher, $eGiant, $eGoblin, $eWallbreaker, $eMinion, $eHog, $eValkyrie, $eKing, $eQueen, $eCastle, $eLSpell
;Troop types, from 0 ~ 19 so far
Global Enum $eBarbarian, $eArcher, $eGiant, $eGoblin, $eWallbreaker, _
$eBalloon, $eWizard, $eHealer, $eDragon, $ePekka, _
$eMinion, $eHog, $eValkyrie, $eGolem, $eWitch, _
$eLavaHound, _
$eKing, $eQueen, $eCastle, $eLSpell

;Attack Settings
; Shift outer corners 1 pixel for more random drop space
Expand Down
5 changes: 5 additions & 0 deletions COCBot/functions/Config/readConfig.au3
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ Func readConfig() ;Reads config and sets it to the variables
Else
GUICtrlSetState($chkStayAlive, $GUI_UNCHECKED)
EndIf
If IniRead($config, "config", "speedboost", "0") = 1 Then
GUICtrlSetState($chkSpeedBoost, $GUI_CHECKED)
Else
GUICtrlSetState($chkSpeedBoost, $GUI_UNCHECKED)
EndIf

;---------------------------------------------------------------------------------------
; Base location settings ---------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions COCBot/functions/Config/saveConfig.au3
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ Func saveConfig() ;Saves the controls settings to the config
Else
IniWrite($config, "config", "stayalive", 0)
EndIf
If IsChecked($chkSpeedBoost) Then
IniWrite($config, "config", "speedboost", 1)
Else
IniWrite($config, "config", "speedboost", 0)
EndIf

;---------------------------------------------------------------------------------------
; Base location settings ---------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Notification/PushBullet.au3
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Func _RemoteControl()
$oHTTP = ObjCreate("WinHTTP.WinHTTPRequest.5.1")
$access_token = $PushBullettoken
$oHTTP.Open("Get", "https://api.pushbullet.com/v2/pushes?active=true", False)
$oHTTP.Open("Get", "https://api.pushbullet.com/v2/pushes?active=true&limit=3", False)
$oHTTP.SetCredentials($access_token, "", 0)
$oHTTP.SetRequestHeader("Content-Type", "application/json")
$oHTTP.Send()
Expand Down
2 changes: 1 addition & 1 deletion COCBot/functions/Other/General Functions.au3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Func SetTime()
Local $time = _TicksToTime(Int(TimerDiff($sTimer)), $hour, $min, $sec)
If _GUICtrlTab_GetCurSel($tabMain) = 7 Then GUICtrlSetData($lblresultruntime, StringFormat("%02i:%02i:%02i", $hour, $min, $sec))
If IsChecked($lblpushbulletremote) Then
If StringRight(StringFormat("%02i", $sec),1) = "0" Then
If StringRight(StringFormat("%02i", $sec),2) = "30" Then
_RemoteControl()
EndIf
EndIf
Expand Down
7 changes: 4 additions & 3 deletions COCBot/functions/Strategies/Standard/Attack.au3
Original file line number Diff line number Diff line change
Expand Up @@ -654,8 +654,9 @@ Func Standard_Attack($AttackMethod = 1)
EndFunc ;==>Standard_Attack

Func Standard_DropNukes()
;No need to check dark storage again, already checked during search
;If checkDarkElix() Then
;Only check dark storage again when necessary
If $DEx+$DEy = 0 Then checkDarkElix()
If $DEx+$DEy > 0 Then
$nLSpell = -1
$nSpellQty = 0
For $i = 0 To 8
Expand All @@ -678,7 +679,7 @@ Func Standard_DropNukes()
$z = $z + 1
Until $nSpellQty = 0 Or $z = 100
EndIf
;EndIf
EndIf
EndFunc ;==>Standard_DropNukes

;Drops Clan Castle troops, given the slot and x, y coordinates.
Expand Down
1 change: 0 additions & 1 deletion COCBot/functions/Strategies/Standard/ReadyCheck.au3
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Func Standard_miniReadyCheck()
Else ;SearchFailed=False
;reset SearchCount only when last search wasn't failed
$SearchCount = 0
$SearchFailed = False
EndIf

If not AdjustSearchCond() Then
Expand Down
16 changes: 12 additions & 4 deletions COCBot/functions/Strategies/Standard/Search.au3
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Func Standard_Search()

$hTimerClickNext = TimerInit() ;Next button already pressed before call here

;safe to reset flag here. If failed and return -1, this flag will be set again.
$SearchFailed = False

While 1
$calculateCondition = False
GUICtrlSetData($lblresultsearchcost, GUICtrlRead($lblresultsearchcost) + $SearchCost)
Expand Down Expand Up @@ -41,7 +44,10 @@ Func Standard_Search()
EndIf
$calculateCondition = True

;Initial working variables
$GoodBase = False
$DEx = 0
$DEy = 0
Local $conditionlogstr
$NukeAttack = False

Expand Down Expand Up @@ -74,10 +80,12 @@ Func Standard_Search()

If $THLoc = "Out" And IsChecked($chkDeadActivate) And IsChecked($chkDeadSnipe) And $BaseData[0] Then
SetLog(GetLangText("msgOutDeadFound"), $COLOR_PURPLE)
Return 0
$AttackMethod = 0
ExitLoop
ElseIf $THLoc = "Out" And IsChecked($chkAnyActivate) And IsChecked($chkSnipe) And Not $BaseData[0] Then
SetLog(GetLangText("msgOutLiveFound"), $COLOR_PURPLE)
Return 1
$AttackMethod = 1
ExitLoop
EndIf

; Variables to check whether to attack dead bases
Expand Down Expand Up @@ -180,7 +188,6 @@ Func Standard_Search()
EndIf

If $GoodBase Then
$SearchFailed = False
ExitLoop
Else
_CaptureRegion()
Expand Down Expand Up @@ -226,7 +233,8 @@ Func Standard_Search()
SetLog(GetLangText("msgPushMatch"), $COLOR_GREEN)
EndIf
SetLog(GetLangText("msgSearchComplete"), $COLOR_BLUE)
;Match found, reset stuckCount flag before run readycheck again.
;Match found, reset stuckCount flag & searchfailed falg before run readycheck again.
$SearchFailed = False
$stuckCount = 0
_BlockInputEx(0, "", "", $HWnD)
Return $AttackMethod
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BrokenBot.org - Clash of Clans Bot
Latest version: 2.7.1
Latest version: 2.8.0

## Community
Forums available for discussion at: http://www.brokenbot.org/page.php?p=main
Expand Down
9 changes: 9 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## Change Log:

### v2.8.0
* Major stability enhancements
* Speed optimization - we cut the time it takes to find a well hidden TH by 60% from our previous release. It now takes 1.2sec on average vs never finding it or taking 20 seconds like our competitors. **speedBoost must be enabled.
* Precision enhancements - We have reduced our image recognition error rate from 4% down to 2.4% - Nearly 10 times better than other bots!
* Resource collection - we had to lower the thresholds to make sure we collect some of your harder to detect resources. The side-effect is you will see it clicking walls sometimes for a fraction of a second. This is expected and controlled, it will not perform an erroneous action.
* Implemented speedBoost - found on the config tab. Check this to locate DE and TH faster at the cost of more CPU load during searching.
* Fixed PushBullet. We now check the server for up to 3 new commands once every minute. Bot may respond to commands slightly slower but this will prevent us from being blocked from using their servers.
* Various bug fixes related to searching.

### v2.7.1
* Improved townhall recognition. No, seriously. It is so much better than it was before! No more trying to attack outside townhalls that don't exist or skipping over perfectly good bases with tons of loot just because the bot can't recognize the townhall.
* Some more dark elixir storage tweaks. We are trying to make sure you don't waste those zaps.
Expand Down
Binary file removed images/TH/townhall1.bmp
Binary file not shown.
Binary file removed images/TH/townhall11.bmp
Binary file not shown.
Binary file removed images/TH/townhall12.bmp
Binary file not shown.
Binary file removed images/TH/townhall13.bmp
Binary file not shown.
Binary file removed images/TH/townhall14.bmp
Binary file not shown.
Binary file removed images/TH/townhall2.bmp
Binary file not shown.
Binary file removed images/TH/townhall21.bmp
Binary file not shown.
Binary file removed images/TH/townhall22.bmp
Binary file not shown.
Binary file removed images/TH/townhall23.bmp
Binary file not shown.
Binary file removed images/TH/townhall3.bmp
Binary file not shown.
Binary file removed images/TH/townhall31.bmp
Binary file not shown.
Binary file removed images/TH/townhall32.bmp
Binary file not shown.
Binary file removed images/TH/townhall33.bmp
Binary file not shown.
Binary file removed images/TH/townhall41.bmp
Binary file not shown.
Binary file removed images/TH/townhall42.bmp
Binary file not shown.
Binary file removed images/TH/townhall43.bmp
Binary file not shown.
Binary file removed images/broken_logo.jpg
Binary file not shown.

0 comments on commit 878d5b6

Please sign in to comment.