Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding WBs
#2
I managed to get it working; not quite as well as I wanted, but it will do for now.
Modified Build: Cross Bot 5.3.4 - 5.4.2.2
I simply modified Case 2 (Giants) to train 1 Giant or 1 WB at a time & set (in the front end) 1 barrack to train "Giants", the others Barbs & Archers. I end up with about 4-5 Giants & WBs, with 180 camp capacity (bigger camps would get 1-2 more). I added Sleep(65000) before Trainn() so it doesn't get backlogged & keep spitting out the same one. It takes about 15 min to fill my camps.
Added Giants to barrack options
Code:
$cmbBarrack1 = GUICtrlCreateCombo("", 275, 150, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants", "Barbarians") ; "Barbarians|Archers|Giants|Goblins"
$cmbBarrack2 = GUICtrlCreateCombo("", 275, 175, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants", "Barbarians") ; "Barbarians|Archers|Giants|Goblins"
$cmbBarrack3 = GUICtrlCreateCombo("", 275, 200, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants", "Archers") ; "Barbarians|Archers|Giants|Goblins"
$cmbBarrack4 = GUICtrlCreateCombo("", 275, 225, 110, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Barbarians|Archers|Giants", "Archers") ; "Barbarians|Archers|Giants|Goblins"
Modified Training so Giant would also train WB
Code:
Switch $barrackTroop[$i]
Case 0
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 329, $BSpos[1] + 297), 6), Hex(0xDC3F70, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(220, 320) ;Barbarian
WEnd
Case 1
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 217, $BSpos[1] + 297), 6), Hex(0xF8AD20, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(331, 320) ;Archer
WEnd
Case 2
;While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 217, $BSpos[1] + 297), 6), Hex(0xF8AD20, 6), 20)
;If $RunState = False Then ExitLoop (2)
If $Toggtroop = 1 Then
Click(650, 320, 1, 10) ;WBs
$Toggtroop = 0
Else
Click(432, 320, 1, 10) ;Giant
$Toggtroop = 1
EndIf
;Click(432, 320) ;Giant
;WEnd
Case 3
While _ColorCheckVariation(Hex(PixelGetColor($BSpos[0] + 217, $BSpos[1] + 297), 6), Hex(0xF8AD20, 6), 20)
If $RunState = False Then ExitLoop (2)
Click(546, 320) ;Goblins
WEnd
EndSwitch
Modified "Use All Troops" case
Code:
Func Attack() ;Selects which algorithm
While 1
SetLog("======Beginning Attack======")
Switch $icmbAlgorithm
Case 0 ;Barbarians + Archers
atkAlgorithmBarch()
Case 1 ;Use All Troops
;SetLog("Not Available yet, using Barch instead...")
If _Sleep(2000) Then ExitLoop
;atkAlgorithmBarch()
atkAlgorithmAllt()
EndSwitch
ExitLoop
WEnd
EndFunc   ;==>Attack
New function for Use All Troops (only updated 4 sides)
Code:
Func atkAlgorithmAllt() ;Attack Algorithm for Allt
While 1
Local $Giant = -1, $Wb = -1, $Barb = -1, $Arch = -1, $CC = -1
Global $King = -1, $Queen = -1
For $i = 0 To 6
If $atkTroops[$i][0] = "Giant" Then
$Giant = $i
ElseIf $atkTroops[$i][0] = "Wallbreaker" Then
$Wb = $i
ElseIf $atkTroops[$i][0] = "Barbarian" Then
$Barb = $i
ElseIf $atkTroops[$i][0] = "Archer" Then
$Arch = $i
ElseIf $atkTroops[$i][0] = "Clan Castle" Then
$CC = $i
ElseIf $atkTroops[$i][0] = "King" Then
$King = $i
ElseIf $atkTroops[$i][0] = "Queen" Then
$Queen = $i
EndIf
Next
If _Sleep(500) Then ExitLoop
Switch $deploySettings
Case 0 ;Two sides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetLog("~Attacking in two sides...")
If _Sleep(1000) Then ExitLoop
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 2) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 2) / 5) / 2)
SetLog("Dropping first wave of Barbarians")
For $i = 0 To 4 ;Drop first round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next
If _Sleep(1000) Then ExitLoop
SetLog("Dropping first wave of Archers")
For $i = 0 To 4 ;Drop first round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next
If _Sleep(2000) Then ExitLoop ;-------------------------------------------
SetLog("Dropping second wave of Barbarians")
For $i = 0 To 4 ;Drop second round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next
If _Sleep(1000) Then ExitLoop
SetLog("Dropping second wave of Archers")
For $i = 0 To 4 ;Drop second round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next
dropHeroes($TopLeft[3][0], $TopLeft[3][1], $King, $Queen)
If _Sleep(1000) Then ExitLoop
;If $CC <> -1 Then dropCC($TopLeft[3][0], $TopLeft[3][1], $CC)
Case 1 ;Three sides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetLog("~Attacking in three sides...")
If _Sleep(1000) Then ExitLoop
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 3) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 3) / 5) / 2)

SetLog("Dropping first wave of Barbarians")
For $i = 0 To 4 ;Drop first round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Archers")
For $i = 0 To 4 ;Drop first round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

If _Sleep(2000) Then ExitLoop ;-------------------------------------------

SetLog("Dropping second wave of Barbarians")
For $i = 0 To 4 ;Drop second round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping second wave of Archers")
For $i = 0 To 4 ;Drop second round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

dropHeroes($TopRight[3][0], $TopRight[3][1], $King, $Queen)
If _Sleep(1000) Then ExitLoop
;If $CC <> -1 Then dropCC($TopRight[3][0], $TopRight[3][1], $CC)
Case 2 ;Four sides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SetLog("~Attacking in all sides...")
If _Sleep(1000) Then ExitLoop
Local $numGiantPerSpot = Ceiling((($atkTroops[$Giant][1] / 4) / 5) / 2)
Local $numWbPerSpot = Ceiling((($atkTroops[$Wb][1] / 4) / 5) / 2)
Local $numBarbPerSpot = Ceiling((($atkTroops[$Barb][1] / 4) / 5) / 2)
Local $numArchPerSpot = Ceiling((($atkTroops[$Arch][1] / 4) / 5) / 2)

SetLog("Dropping first wave of Giants")
For $i = 0 To 4 ;Drop first round of Giants
Click(68 + (72 * $Giant), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numGiantPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numGiantPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numGiantPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numGiantPerSpot, 1)
Next

If _Sleep(4500) Then ExitLoop

SetLog("Dropping first wave of Wallbreakers")
For $i = 0 To 4 ;Drop first round of Wallbreakers
Click(68 + (72 * $Wb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numWbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numWbPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numWbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numWbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Barbarians")
For $i = 0 To 4 ;Drop first round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping first wave of Archers")
For $i = 0 To 4 ;Drop first round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

If _Sleep(2000) Then ExitLoop ;-------------------------------------------

SetLog("Dropping second wave of Barbarians")
For $i = 0 To 4 ;Drop second round of Barbarians
Click(68 + (72 * $Barb), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numBarbPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numBarbPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numBarbPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numBarbPerSpot, 1)
Next

If _Sleep(1000) Then ExitLoop

SetLog("Dropping second wave of Archers")
For $i = 0 To 4 ;Drop second round of Archers
Click(68 + (72 * $Arch), 595) ;Select Troop
If _Sleep(100) Then ExitLoop (2)
Click($TopLeft[$i][0], $TopLeft[$i][1], $numArchPerSpot, 1)
Click($TopRight[$i][0], $TopRight[$i][1], $numArchPerSpot, 1)
Click($BottomLeft[$i][0], $BottomLeft[$i][1], $numArchPerSpot, 1)
Click($BottomRight[$i][0], $BottomRight[$i][1], $numArchPerSpot, 1)
Next

dropHeroes($BottomLeft[3][0], $BottomLeft[3][1], $King, $Queen)
If _Sleep(1000) Then ExitLoop
;If $CC <> -1 Then dropCC($BottomLeft[3][0], $BottomLeft[3][1], $CC)
EndSwitch

If _Sleep(100) Then ExitLoop
SetLog("Dropping left over troops")
$atkTroops[$Barb][1] = Number(getNormal(40 + (72 * $Barb), 565))
$atkTroops[$Arch][1] = Number(getNormal(40 + (72 * $Arch), 565))

While $atkTroops[$Barb][1] <> 0
Click(68 + (72 * $Barb), 595)
Click($TopLeft[3][0], $TopLeft[3][1], $atkTroops[$Barb][1], 1)

$atkTroops[$Barb][1] = Number(getNormal(40 + (72 * $Barb), 565))
WEnd

If _Sleep(1000) Then ExitLoop

While $atkTroops[$Arch][1] <> 0
Click(68 + (72 * $Arch), 595)
Click($TopLeft[3][0], $TopLeft[3][1], $atkTroops[$Arch][1], 1)

$atkTroops[$Arch][1] = Number(getNormal(40 + (72 * $Arch), 565))
WEnd

If _Sleep(100) Then ExitLoop

;Activate KQ's power
If $checkKPower <> -1 Or $checkQPower <> -1 Then
SetLog("Waiting " & $delayActivateKQ / 1000 & " seconds before activating King/Queen")
_Sleep($delayActivateKQ)
If $checkKPower <> -1 Then
SetLog("Activate King's power")
Click(68 + (72 * $checkKPower), 595)
EndIf
If $checkQPower <> -1 Then
SetLog("Activate Queen's power")
Click(68 + (72 * $checkQPower), 595)
EndIf
EndIf

SetLog("~Finished Attacking, waiting to finish")
ExitLoop
WEnd
EndFunc   ;==>atkAlgorithmAllt

This is probably a sloppy way of doing it, but if anyone wants to try it out before it's officially an option, have at it Smile
Reply
 


Messages In This Thread
Adding WBs - by barracoda - 01-16-2015, 10:20 AM
RE: Adding WBs - by barracoda - 01-17-2015, 06:33 AM
RE: Adding WBs - by bushido-21 - 01-17-2015, 07:14 AM
RE: Adding WBs - by bushido-21 - 01-17-2015, 08:51 AM
RE: Adding WBs - by barracoda - 01-17-2015, 11:43 PM
RE: Adding WBs - by bushido-21 - 01-18-2015, 01:24 AM
RE: Adding WBs - by mine214 - 01-18-2015, 04:38 AM
RE: Adding WBs - by barracoda - 01-18-2015, 06:52 AM
RE: Adding WBs - by mine214 - 01-20-2015, 08:46 AM
RE: Adding WBs - by k3iroll - 01-20-2015, 12:48 PM
RE: Adding WBs - by barracoda - 01-20-2015, 12:24 PM
RE: Adding WBs - by barracoda - 01-21-2015, 10:17 AM
RE: Adding WBs - by SAIPER - 01-21-2015, 01:14 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)

About The Bytecode Club

We're a community focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website