Jump to content

[V3.0.4][MOD} Unbreakable mode


Recommended Posts

As requested in suggestions:  https://gamebot.org/forums/thread-2400.html

Here is a Alpha release of code creating an unbreakable mode.  Looking for any gallant testers to provide feedback of errors or problems found.  I DO NOT recommend adding this MOD to any of the merged code compilations, it was created in a few hours and tested less than 18hrs so far. :blush:  Let's save the MOD merge opportunity for Beta version, OK?

Here goes:

In the main CGB Bot.au3 file make these changes:

[spoiler2=In the main CGB Bot.au3 file make these changes:

]

Approximately line 131 after the

    RequestCC()

    If _Sleep(1000) Then Return

    If $Restart = True Then ContinueLoo

Place this code:


   If GUICtrlRead($chkUnbreakable) = $GUI_CHECKED Then
    Unbreakable()
    ContinueLoop
   Endif

and before

   UpgradeWall()

    If _Sleep(1000) Then Return

 

[/spoiler2]

and

[spoiler2=add this new function to the very bottom of the file:]

add this function at the end of the file about line 236 for me:


#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.6.1
    This function was made to be used with software CoCgameBot v3.0.4
    Author:         KnowJack
    Script Function: unbreakable mode
 CoCgameBot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
 CoCgameBot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty;of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 You should have received a copy of the GNU General Public License along with CoCgameBot.  If not, see ;<[url=http://www.gnu.org/licenses/]http://www.gnu.org/licenses/[/url]>.
 #ce
Func Unbreakable()
;
; Special mode to complete unbreakable achievement
; Need to set max/min trophy on Misc tab to range where base can win defenses
; Enable mode with checkbox, and set desired time to be offline getting defense wins before base is reset.
;
   Local $x, $y, $iTime
   SetLog(" ====== Unbreakable Mode enabled! ====== ", $COLOR_GREEN)
   If $CurCamp < 1 Then
   SetLog("Oops, wait for troops", $COLOR_RED)
   Return ; no troops then cycle again
   EndIf
#comments-start
   _CaptureRegion()
   If _ImageSearch($tombstone, 0, $x, $y, 100) Then
  SetLog("Cleanup Tomb Stones!", $COLOR_BLUE)
  If _Sleep(500) Then Return
  PureClick($x, $y); click on a tombstone to remove them all
  If _Sleep(1000) Then Return
   EndIf
#comments-end
   DropTrophy()
   ClickP($TopLeftClient, 2, 100) ;clear screen, 2 clicks 100ms delay
   PrepareSearch() ; Break Shield
   If _Sleep(3000) Then Return
   SetLog("Returning Home For Defense", $COLOR_BLUE)
   ClickP($TopLeftClient, 2, 100) ;clear screen selection
   $i = 0
   While _ColorCheck(_GetPixelColor(63, 532,True), Hex(0xC00000, 6), 20) = False
   If _Sleep(1000) Then Return  ; wait for clouds to disappear and the end battle button to appear
   If $i > 15 then ExitLoop
   $i+= 1
   WEnd
   $i = 0
   While _ColorCheck(_GetPixelColor(63, 532,True), Hex(0xC00000, 6), 20) = True
   PureClick(62, 519) ;Click End Battle
   If _Sleep(1000) Then Return  ; wait for button to disappear
   If $i > 10 then ExitLoop
   $i+= 1
   WEnd
   ClickP($TopLeftClient, 2, 50) ;clear screen selections
   If _Sleep(1000) Then Return
   _WinAPI_EmptyWorkingSet(WinGetProcess($Title))
   SetLog("Closing Clash Of Clans", $COLOR_BLUE)
   $i = 0
   While _ColorCheck(_GetPixelColor(515, 410, True), Hex(0x60B010, 6), 20) = False
   PureClick(50, 700)  ; Hit BS Back button till confirm exit dialog appears
   If _Sleep(1000) Then Return
   If $i > 10 then ExitLoop
   $i+= 1
   WEnd
   PureClick(515, 400) ;Click Confirm to stop CoC
   Local $iTime = Number(GUICtrlRead($txtUnbreakable))
   If $iTime < 1 then $iTime = 1  ;error check user time input
   SetLog("Waiting " & $iTime & " Minutes for Defense Attacks", $COLOR_GREEN)
   If _Sleep($iTime*60*1000) Then Return  ; Eenemy attack time Wait
   $HWnD = WinGetHandle($Title)
   Local $RunApp = StringReplace(_WinAPI_GetProcessFileName(WinGetProcess($Title)), "Frontend", "RunApp")
   Run($RunApp & " Android com.supercell.clashofclans com.supercell.clashofclans.GameApp")
   If _Sleep(15000) Then Return  ; Wait for CoC restart
   ZoomOut()
   If _Sleep(1000) Then Return
 EndFunc

[/spoiler2]

[spoiler2=Now we need to edit the GUI files, first is CGB GUI Design.au3:]

add this code to approximately line 562 of the CGB GUI Design.au3 file.

immediately after this code:

  $txtTimeStopAtk = GUICtrlCreateInput("20", $x + 202, $y - 5, 30, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))

   GUICtrlSetTip(-1, $txtTip)

   GUICtrlSetLimit(-1, 2)

  $lblTimeStopAtk = GUICtrlCreateLabel("sec.", $x + 237, $y, -1, -1)


  $y+=27
  $chkUnbreakable = GUICtrlCreateCheckbox("Unbreakable Mode,  Wait Time:", $x, $y, -1, -1)
   $TxtTip = "Enable mode to farm defenses for Unbreakable achievement"
   GUICtrlSetTip(-1, $TxtTip)
   GUICtrlSetOnEvent(-1, "chkUnbreakable")
   $txtUnbreakable = GUICtrlCreateInput("5", $x + 170, $y, 30, 20, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_NUMBER))
   GUICtrlSetTip(-1, $txtTip)
   GUICtrlSetLimit(-1, 2)
   GUICtrlSetState(-1, $GUI_DISABLE)
  $lblUnbreakable = GUICtrlCreateLabel("Minutes", $x + 205, $y+5, -1, -1)

[/spoiler2]

[spoiler2=Now we need to edit the CGB GUI Control.au3 file:]

add this code anywhere between other functions, I added mine at line 226:



Func chkUnbreakable()
 If GUICtrlRead($chkUnbreakable) = $GUI_CHECKED Then
  GUICtrlSetState($txtUnbreakable, $GUI_ENABLE)
 Else
  GUICtrlSetState($txtUnbreakable, $GUI_DISABLE)
 EndIf
EndFunc

[/spoiler2]

Ok so that is all that is needed!

[spoiler2=Notes on using this MOD:]

1) It is strictly intended to farm defense wins to maximize the unbreakable achievement in CoC.

2) Using the MOD is simple,

a) enable unbreakable mode on the Advanced tab, under battle options

B) set the desired time to wait for defenses before rearming the base. Can be set to 1-99 minutes.

c) set the desired trophy range to "farm" defense wins on the Misc tab, don't forget to click use heros to save elixir and farm deadbase if it sees them.

d) set to use barracks mode and train low cost Barch as the drop troop or use in deadbase attack

Notes:

- The unbreakable mode setting is not saved in the config.ini file intentionally, so it resets every time the bot is closed. Only the trophy level is saved.

- Since the bot never searches for attacks in this mode the dead/weak/all/bully/TH snipe settings are not used

- All of the Conditions, Values settings on the Search tab, and all the settings on the Basics tab will impact deadbase farming while trophy drop, so make sure to set these values.

Ok, now ready to start the unbreakable farming bot.

The process for farming defense wins is:

Normal startup - find buildings, empty collectors, rearm traps,

- Village report

- Pushbullet (if enabled)

- Donate (if enabled)

- Train troops

- Boost (if enabled)

- request CC

- drop trophy (if needed, and if you enable deadbase attack on the misc tab, it will attack juicy bases too)

- Start attack to break shield (if exists)

- Close Clash of Clans

- Wait user set time

- restart CoC,

Then do it all again, and again, and again, and again... :D

[/spoiler2]

[spoiler2=Ok, HOW DOES THIS HELP ME?]

This new bot mode works best when used in the 200-800 trophy range, and need to use a range based on your TH level and defenses. 

For example: 

My TH6 got 100 defense wins in 1st 18hrs of code debug in 400-600 trophy range.

My TH9 got a similar 20 wins in 2 hrs in the 800-1000 range.

Can you farm defenses in higher ranges? Yes.

BUT be careful, If the range is too high, your base gets starred and you lose, and don't farm defense wins.

 

Why does this low trophy range work?

There is cult of gamers in CoC that believe all old bases drop to 0 trophy when abandoned by their owners.  Before the recent game update, the attack search range was only 200 trophy, so many would drop to sub-200 to farm loaded dead bases. Since they constant win trophy farming, they are constantly dropping trophy @ 200-300 trophy just above the prime farming zone. :D  Of course if they had CG Bot, they wouldn't do it :) 

Hence this new mode enables you to farm these dropped trophy!

Make sense now?  Search the web for sub-200 farming for more information. 

BTW - Latest reports say the old sub-200 is now sub-600 or even sub-800.  SC has also starting removing abandoned bases for them available search pool after couple of months, so many don't drop to 0 trophy anymore. 

But many people lured by old forum posts of easy loot still drop to these lower trophy levels and 100% goblin raid for loot. 

Wish you luck receiving defense wins, and the free gems for completing the achievement.

PS - I don't recommend that anyone farm for defense wins till achievement completion. Your profile will be very interesting with 1000 defense wins, when most only have 1-100 in a normal season.

[/spoiler2]

Best of luck, and look forward to your inputs on this MOD.

Cheers!

Link to post
Share on other sites
  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

@scarface008:

Thanks! Did I get the rest of it right? You are the expert! :D

I know zero can work, but I didn't use it for several reasons.

- The V3.0.4 code will hang up if the use hero is checked and its not available or there is no troop to drop. Should be fixed in next version, but I didn't want to deal with additional forum complaints on a known problem.

- current bot configuration allows for attacking dead base while dropping trophy, that takes an army to accomplish.

So setting a min of 1 says there is an army training.

As you well know, the process flow coded can actually need 5-20 troops to drop 200 cups in range each time it drops?

Will likely have to add some additional error proofing to this later to avoid the inevitable misconfigured GUI. Such as need to verify drop trophy settings and ensure there is $isfullarmy=true if deadbase is selected, and maybe even that training is set to barracks mode or custom army type 1 troops is not zero?

There's a lot more work required to make it safe regardless of the user inputs.

Cheers!

Link to post
Share on other sites

@scarface008:

Thanks!  Did I get the rest of it right? You are the expert!  :D

I know zero can work' date=' but I didn't use it for several reasons.

- The V3.0.4 code will  hang up if the use hero is checked and its not available or there is no troop to drop.  Should be fixed in next version, but I didn't want to deal with additional forum complaints on a known problem.

- current bot configuration allows for attacking dead base while dropping trophy, that takes an army to accomplish.  

So setting a min of 1 says there is an army training.

As you well know, the process flow coded can actually need 5-20 troops to drop 200 cups in range each time it drops?

Will likely have to add some additional error proofing to this later to avoid the inevitable misconfigured GUI.  Such as need to verify drop trophy settings and ensure there is $isfullarmy=true  if deadbase is selected, and maybe even that training is set to barracks mode or custom army type 1 troops is not zero?  

There's a lot more work required to make it safe regardless of the user inputs.  

Cheers!

[/quote']

@knowjack you are unbeatable hehe nice work man Thanks :)

Link to post
Share on other sites

Edited the spoiler. Tell me if something is amiss <_<

My dear personal potato hero - you missed editing the very last spoiler tag?

What is the new BBCode you changed it to?

Thanks!

@Synnex:

I won't release files for general use, not till the code has more test time and is further improved.

But, a little birdy whispered in my ear earlier that this might end up in official release as well. :)

stay tuned...

Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...