Skip to content

Commit

Permalink
2.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
codebroken committed May 30, 2015
1 parent 2132e78 commit 0548d4a
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 8 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.0)
#pragma compile(FileVersion, 2.7.0)
#pragma compile(ProductVersion, 2.7.1)
#pragma compile(FileVersion, 2.7.1)

#include <GUIConstants.au3>

$sBotVersion = "2.7.0"
$sBotVersion = "2.7.1"
$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.
5 changes: 5 additions & 0 deletions BrokenBot.org/functions/ImageSearch/checkDarkElix.au3
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
; 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
;
Func checkDarkElix()
_CaptureRegion()
$sendHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
Expand Down
44 changes: 44 additions & 0 deletions BrokenBot.org/functions/ImageSearch/checkTownhall.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
; 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
;
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)
_WinAPI_DeleteObject($sendHBitmap)
If IsArray($res) Then
If $res[0] = -1 Then
; failed to find TH
If $DebugMode = 1 Then _GDIPlus_ImageSaveToFile($hBitmap, $dirDebug & "NegTH-" & @HOUR & @MIN & @SEC & ".png")
$THx = 0
$THy = 0
Return "-" ; return 0
Else
$res = StringSplit($res[0], "|", 2)
$THx = $res[1]
$THy = $res[2]
If $DebugMode = 1 Then
$hClone = _GDIPlus_BitmapCloneArea($hBitmap, $THx - 30, $THy - 30, 60, 60, _GDIPlus_ImageGetPixelFormat($hBitmap))
$j = 1
Do
If Not FileExists($dirDebug & "PosTH-x" & $THx & "y" & $THy & " (" & $j & ").jpg") Then ExitLoop
$j = $j + 1
Until $j = 1000
_GDIPlus_ImageSaveToFile($hClone, $dirDebug & "PosTH-x" & $THx & "y" & $THy & " (" & $j & ").jpg")
_GDIPlus_ImageDispose($hClone)
EndIf
If $res[4] < 7 Then
Return $THText[0]
Else
Return $THText[$res[4]-6]
EndIf
EndIf
Else
SetLog(GetLangText("msgDLLFailure"), $COLOR_RED)
$DEx = 0
$DEy = 0
Return "-" ; return 0
EndIf
EndFunc ;==>checkTownhall
45 changes: 45 additions & 0 deletions BrokenBot.org/functions/Village/collectResources.au3
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; 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
;
Func collectResources()
Local $i, $j = 0
Local $foundResource = false
If $ichkCollect = 1 Then
SetLog(GetLangText("msgCollecting"), $COLOR_BLUE)
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)
_WinAPI_DeleteObject($sendHBitmap)
If IsArray($res) Then
If $res[0] = -1 and NOT $foundResource Then
; failed to find Resources
SetLog(GetLangText("msgNoResources"), $COLOR_RED)
$ResX = 0
$ResY = 0
ExitLoop
Else
$expRet = StringSplit($res[0], "|")
$numBldg = $expRet[0]
For $j = 2 To UBound($expRet) - 1 step 6
$ResX = $expRet[$j]
$ResY = $expRet[$j+1]
Click($ResX, $ResY)
Click(1, 1)
Sleep(300)
Next
$foundResource = true
EndIf
Else
SetLog(GetLangText("msgDLLFailure"), $COLOR_RED)
$ResX = 0
$ResY = 0
Return False ; return 0
EndIf
$i += 1
Until $i = 2
EndIf
Return
EndFunc ;==>checkDarkElix
2 changes: 2 additions & 0 deletions BrokenBot.org/functions/functions.au3
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "GUI\WindowFixing.au3"

#include "ImageSearch\checkDarkElix.au3"
#include "ImageSearch\checkTownhall.au3"

#include "Other\checkupdate.au3"
#include "Other\GeneralFunctions.au3"
Expand All @@ -17,3 +18,4 @@
#include "Strategies\Strategies.au3"

#include "Village\TroopSize.au3"
#include "Village\collectResources.au3"
1 change: 1 addition & 0 deletions BrokenBot.org/languages/English.ini
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ msgInstallandRestart = "Successful! Installing and restarting..."
msgAppearsStuck = "We appear to be stuck. Resetting troop counts."
msgSevereStuck = "Continually stuck. Just acting as if we have a full army camp."
msgDLLError = "DLL error: Something bad happened!"
msgNoResources = "No resources found for collection"
boxAlreadyRunning = "Bot is already running."
boxCompile1 = "Don't Run/Compile Script (x64)! try to Run/Compile Script (x86) to getting this bot work."
boxCompile2 = "If this message still appear, try to re-install your AutoIt with newer version."
Expand Down
2 changes: 0 additions & 2 deletions COCBot/Functions.au3
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "functions\Image Search\ImageSearch.au3"
#include "functions\Image Search\checkButtonUpgrade.au3"
#include "functions\Image Search\checkDeadBase.au3"
#include "functions\Image Search\checkTownhall.au3"
#include "functions\Image Search\checkWall.au3"

#include "functions\Main Screen\checkMainScreen.au3"
Expand Down Expand Up @@ -72,7 +71,6 @@
#include "functions\Village\BoostAllBuilding.au3"
#include "functions\Village\BoostBarracks.au3"
#include "functions\Village\CheckFullSpellFactory.au3"
#include "functions\Village\Collect.au3"
#include "functions\Village\DonateCC.au3"
#include "functions\Village\DonateCheckArmyCamp.au3"
#include "functions\Village\DonateTrain.au3"
Expand Down
4 changes: 2 additions & 2 deletions COCBot/functions/Village/MainLoop.au3
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Func runBot() ;Bot that runs everything in order
BoostAllBuilding()
If StatusCheck() Then Return

Collect()
collectResources()
If StatusCheck() Then Return

Laboratory()
Expand Down Expand Up @@ -112,7 +112,7 @@ Func Idle($Plugin) ;Sequence that runs until Full Army
If StatusCheck() Then Return
SetLog(GetLangText("msgWaitingFull"), $COLOR_PURPLE)
If $iCollectCounter > $COLLECTATCOUNT Then ; This is prevent from collecting all the time which isn't needed anyway
Collect()
collectResources()
If StatusCheck() Then Return
$iCollectCounter = 0
EndIf
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.0
Latest version: 2.7.1

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

### 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.
* Moved resource collection to our improved image recognition system.

### v2.7.0
* Improved image recognition system. Does a much better job of finding the dark elixir storage.
* Search delay is randomized now. You still use the same UI selection for the general speed of searching but the actual speed is randomized near the value you select.
Expand Down
Binary file removed images/Collectors/resimg.png
Binary file not shown.

0 comments on commit 0548d4a

Please sign in to comment.