Jump to content
Sign in to follow this  
ChacalGyn

Drop Trophies in BuildersBase

Recommended Posts

I forgot to add that.

 

Func BB_Attack($Nside = 1, $SIDESNAMES = "TR|TL", $iTroopToDeploy = 4 )
    $g_iLoopCount += 1

-----------

Updated:

Fixed okay button

 

						Setlog("Exit battle", $COLOR_INFO)
						Click($ClickOkX, $ClickOkY)

 

Edited by Argentino

Share this post


Link to post
Share on other sites
1 minuto atrás, Argentino disse:

I forgot to add that.

 

Func BB_Attack($Nside = 1, $SIDESNAMES = "TR|TL", $iTroopToDeploy = 4 )
    $g_iLoopCount += 1

 

 

Thanks Friend :thumbsup:

 

Please you don't need to create new post's with new contents. Just update your 1st one

 

Regards

Share this post


Link to post
Share on other sites
hace 2 horas, SpartanUBPT dijo:

This project is for droop trophies or for make attack possible in builderbase? 

it attack now, test, It is said to drop trophy but in 50% of cases it is able to win, even 100%. Test this with minions and balloons.

hace 2 horas, ChacalGyn dijo:

 

Thanks Friend :thumbsup:

 

Please you don't need to create new post's with new contents. Just update your 1st one

 

Regards

Will you let me use this mod and be? because I did not know that to edit linux you had to ask permission from Linus Torvalds.

-----------

Updated:

Fixed okay button

 

				; Okay pixel
					If _Sleep(500) Then Return
					Local $iOkayColor[3][3] = [[0xBEE758, 0, 1], [0xA8DD49, 0, 1], [0x7BC726, 0, 1]]
					Local $iOkayPixel = _MultiPixelSearch(279, 378, 646, 685, 1, 1, Hex(0xBFE85A, 6), $iOkayColor, 35)
					
					If IsArray($iOkayPixel) Then
						Local $ClickOkX = $iOkayPixel[0], $ClickOkY = $iOkayPixel[1]
						Setlog("Exit battle", $COLOR_INFO)
						Click($ClickOkX, $ClickOkY)
				; ---

 

Edited by Argentino
  • Downvote 1

Share this post


Link to post
Share on other sites
Agora, Argentino disse:

Will you let me use this mod and be? because I did not know that to edit linux you had to ask permission from Linus Torvalds.

 

:joy: You are funny

 

It's free code. You and All can do anything you want

 

 

Share this post


Link to post
Share on other sites
On 10/9/2018 at 19:38, ChacalGyn dijo:

 

:joy: You are funny

 

It's free code. You and All can do anything you want

 

 

; #FUNCTION# ====================================================================================================================
; Name ..........: BB_DropTrophies
; Description ...: 
; Author ........: Chackall++
; Modified ......:
; Remarks .......: This file is part of MyBot, previously known as ClashGameBot. Copyright 2015-2016
;                  MyBot is distributed under the terms of the GNU GPL
; Related .......:
; Link ..........: https://github.com/MyBotRun/MyBot/wiki
; Example .......: No
; ===============================================================================================================================
Global $g_iLoopCount = 0

Func BB_DropTrophies()
	Local $iCheck = 0
	Local $iClickMachineX = 0
	Local $iClickMachineY = 0
	Local $i = 0
	Local $j = 0
	$g_iLoopCount = 0

	Local $cPixColor  = ''
	Local $Nside      = 1
	Local $SIDESNAMES = "TR|TL"

	Local $bDegug     = False
	Local $bContinue  = True

	Local $OkButtom[4]     = [ 400, 495 + $g_iBottomOffsetY, 0xE2F98B, 20 ]
	Local $OkBatleEnd[4]   = [ 630, 400 + $g_iBottomOffsetY, 0xE2FA8C, 20 ]
	Local $TroopSlot[4]    = [  40, 638 + $g_iBottomOffsetY, 0x404040, 20 ]
	Local $NextSlotActive[7] = [0x4C92D3, 0x5298E0, 0x4C92D3, 0x5598E0, 0x5498E0, 0x5198E0, 0x5094D8]
	Local $NextSlotOff[7]  = [0x464646, 0x454545, 0x454545, 0x464646, 0x454545, 0x5198E0, 0x5198E0]
	Local $NextSlotAdd     = 72
	Local $TroopsToDrop    = 0
	
	If _Sleep($DELAYRESPOND) Then Return
	If $g_iTxtBB_DropTrophies > 0 Then $g_aiCurrentLootBB[$eLootTrophyBB] = getTrophyMainScreen(67, 84)
	If _Sleep($DELAYRESPOND) Then Return

	If $g_bChkBB_DropTrophies Then
		; Click attack button and find a match
		If $g_iTxtBB_DropTrophies > 0 Then
			$i = $g_aiCurrentLootBB[$eLootTrophyBB] - $g_iTxtBB_DropTrophies
		Endif
		If $i > 0 Then 

			If BB_PrepareAttack() Then

				If _Sleep($DELAYCHECKOBSTACLES3 * 2) Then Return

				; Deploy All Troops From Slot's
				Setlog(" ====== BB Attack ====== ", $COLOR_INFO)
				For $i = 0 to 6
					If ($i > 0) Then 
						$TroopSlot[0] += $NextSlotAdd
						$TroopSlot[2] = $NextSlotOff[$i]
					EndIf
					$j = 0
					$cPixColor = _GetPixelColor($TroopSlot[0], $TroopSlot[1], True)
					
					$TroopsToDrop = getTroopCountBig( $TroopSlot[0]+24, $TroopSlot[1]-7 )
					If ($i > 0) Then 
						If _Sleep(120) Then Return 
						If Not _ColorCheck( $cPixColor, Hex($NextSlotOff[$i], 25), $TroopSlot[3]) Then
							ClickP($TroopSlot, 1, 0, "#0000")
							Local $x = $TroopSlot[0]
							Local $y = $TroopSlot[1]
							$bContinue = False
							For $b = 0 to 6
							$x += $NextSlotAdd
								If _ColorCheck(_GetPixelColor($x, $y), Hex($NextSlotActive[$b], 25), 25) Then 
								$bContinue = True
								EndIf
							Next
						EndIf					
					EndIf
					If $bContinue Then
						While Not _ColorCheck( $cPixColor, Hex($TroopSlot[2], 25), $TroopSlot[3])
							BB_Attack($Nside, $SIDESNAMES, 8)
							If $g_iLoopCount >= 8 Then ExitLoop
							If $bDegug Then SetLog("BB: Drop Troops - Slot[ " & String( $i + 1 ) & " ], code: 0x" & $cPixColor & " [ " & String( $j ) & " ] Num:[ " & $TroopsToDrop & " ]", $COLOR_DEBUG)
							If _Sleep(12) Then Return 
							$j += 1
							If $j > 6 Then ExitLoop
							$cPixColor = _GetPixelColor($TroopSlot[0], $TroopSlot[1], True)
						WEnd
						If $bDegug Then SetLog("BB: Last Slot Color [ " & String( $i + 1 ) & " ], code: 0x" & $cPixColor & " [ " & String( $i + 1 ) & " ]", $COLOR_DEBUG)
					EndIf
				Next
				While $bContinue = True
				If _Sleep(500) Then Return
				; Okay pixel
					If _Sleep(500) Then Return
					Local $iOkayColor[3][3] = [[0xBEE758, 0, 1], [0xA8DD49, 0, 1], [0x7BC726, 0, 1]]
					Local $iOkayPixel = _MultiPixelSearch(279, 378, 646, 685, 1, 1, Hex(0xBFE85A, 6), $iOkayColor, 35)
										
					If IsArray($iOkayPixel) Then
						Setlog("Exit battle", $COLOR_INFO)
						Click($iOkayPixel[0], $iOkayPixel[1])
						
						Local $iOkayPixel2 = _MultiPixelSearch(86, 436, 822, 544, 1, 1, Hex(0xBFE85A, 6), $iOkayColor, 35)
						
						If _Sleep(500) Then Return
						If IsArray($iOkayPixel2) Then

							Setlog("Click: Okay button", $COLOR_INFO)
							Click($iOkayPixel2[0], $iOkayPixel2[1])
							$bContinue = False 
							
							If _Sleep(500) Then Return
							ClickP($aAway, 1, 0, "#0000")
							
							$bContinue = False
							
						EndIf
				; ---
						Else
						If _Sleep(500) Then Return
						Local $iOffColor[3][3] = [[0x4C49D5, 0, 1], [0x4C49D5, 0, 1], [0x4C49D5, 0, 1]]
						Local $iButtonPixel = _MultiPixelSearch(22, 658, 472, 726, 1, 1, Hex(0x4C49D5, 6), $iOffColor, 35)
						
						If IsArray($iButtonPixel) Then
							If $iCheck = 0 Then 
							Setlog("Boy on map", $COLOR_GREEN)
							$iClickMachineX = $iButtonPixel[0]
							$iClickMachineY = $iButtonPixel[1]
	
							ClickP($iButtonPixel, 100, 0, "#0000") ; Drop Troop
	
							If _Sleep($DELAYDROPTROOP1 / 5) Then Return
							AttackClick(557, 251, 1, SetSleep(0), 0, "#0000")
							$iCheck = 0
							ElseIf $iCheck = 1 Then
							AttackClick($iClickMachineX + 20, $iClickMachineY + 20, 1, SetSleep(0), 0, "#0000")
							EndIf
						EndIf
					EndIf
					
				WEnd
				SetLog("Finished attack",$COLOR_GREEN)
				WaitMainScreen()

				If _Sleep($DELAYCHECKOBSTACLES4) Then Return 
			EndIf

			If _Sleep($DELAYCHECKOBSTACLES4) Then Return
			ClickP($aAway, 1, 0, "#0000")

		Else
			Setlog("Ignore BB Drop Trophies: [Not Needed] [ " & String( $g_iTxtBB_DropTrophies ) & " ]", $COLOR_INFO)
		EndIf
	Else
		Setlog("Ignore BB Drop Trophies [ Disabled ]", $COLOR_INFO)
	Endif

EndFunc	;==> BB_DropTrophies

Func ChkBB_DropTrophies()
	$g_bChkBB_DropTrophies = (GUICtrlRead($g_hChkBB_DropTrophies) = $GUI_CHECKED) ? 1 : 0
EndFunc   ;==>ChkBB_DropTrophies

Func TxtBB_DropTrophies()
	$g_iTxtBB_DropTrophies = GUICtrlRead($g_hTxtBB_DropTrophies)
EndFunc   ;==>TxtBB_DropTrophies

""drop trophy""", because the truth is that when it works it is quite effective.

Edited by Argentino
  • Upvote 2

Share this post


Link to post
Share on other sites
33 minutos atrás, Argentino disse:

""drop trophy""", because the truth is that when it works it is quite effective.

 

Hi Friend !

 

Can you please focus in your 1st post ( and submit code only there )

* If you use Git just point the RAW url

** Will be nice if you delete any content after this one. Spam code make this topic too confuse :3

 

Look at Live content. Impossible to compare with your updates.

https://raw.githubusercontent.com/ChackBR/MyBot_v7/master/COCBot/MOD/functions/BB_DropTrophies.au3

https://raw.githubusercontent.com/ChackBR/MyBot_v7/master/COCBot/MOD/functions/BB_PrepareAttack.au3

 

Regards

Edited by ChacalGyn

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...