Jump to content
Sign in to follow this  
YScorpion

[Code] KICK feature for MyBot 7.1.2 and Faster Donations (Update 23/04)

Recommended Posts

Here's an update to the kick mod for the latest MyBot version with a mod Speed up donations (ignore text requests when donating to all, longer loops, removed useless long waitings, begin donating at bottom then go up...), a very useful feature for those in donation clans:

 

There is the diff file to apply, i'm using it on

 

Quote

 

Locate your Clan Castle Manually On Bot in Misc Tab

 

 

Backup your Original Code First

1. Download: Donate Faster & GTFO.diff - MIRROR

2. Apply diff:

 

3. Enjoy

Finished Modification - Ready to go

Re Compile / Re Build the "MyBot.run.au3" file

 

MBR v7.1.2 TeamVN AIO MOD v1.6.1 with Fast Donate & GTFO.rar (For the Lazy)

 

For more information about how to compile or re build the code click this link

 

I'm not a coder, i just modified the original code to fit the new MBR version and wanted to share it with those who need it, all credits goes to the creator of the original code.

 

OLD METHOD (obsolete)

Spoiler

Step 1 : Open "ClickDrag.au3" (Folder 'COCBot\functions\Other')

Add the following code to end of file

Func MouseDrag($X1, $Y1, $X2, $Y2, $Button = "left", $Delay = 50)

	If Not IsHWnd($Title) And $Title <> "" Then
		$HWnD = WinGetHandle($Title)
	EndIf

	If Not IsHWnd($HWnD) Then
		Return SetError(1, "", False)
	EndIf

	If Not IsInt($X1) Or Not IsInt($Y1) Then
		Return SetError(2, "", False)
	EndIf

	If Not IsInt($X2) Or Not IsInt($Y2) Then
		Return SetError(3, "", False)
	EndIf

	If StringLower($Button) == "left" Then
		$Button = $WM_LBUTTONDOWN
		$Pressed = 1
	ElseIf StringLower($Button) == "right" Then
		$Button = $WM_RBUTTONDOWN
		$Pressed = 2
	ElseIf StringLower($Button) == "middle" Then
		$Button = $WM_MBUTTONDOWN
		$Pressed = 10
		If $Delay == 10 Then $Delay = 100
	EndIf

	$User32 = DllOpen("User32.dll")
	If @error Then Return SetError(4, "", False)

	DllCall($User32, "bool", "PostMessage", "hwnd", $HWnD, "int", $Button, "int", 0, "long", _MakeLong($X1, $Y1))
	If @error Then Return SetError(5, "", False)

	Sleep($Delay / 2)

	DllCall($User32, "bool", "PostMessage", "hwnd", $HWnD, "int", $WM_MOUSEMOVE, "int", $Pressed, "long", _MakeLong($X2, $Y2))
	If @error Then Return SetError(6, "", False)

	Sleep($Delay /2)

	DllCall($User32, "bool", "PostMessage", "hwnd", $HWnD, "int", $Button + 1, "int", 0, "long", _MakeLong($X2, $Y2))
	If @error Then Return SetError(7, "", False)

	DllClose($User32)
	Return SetError(0, 0, True)
 EndFunc

Step 2 : Open "getOcr.au3" (Folder '\COCBot\functions\Read Text')

Add the following code to line 125
 

 Func getArmyCampCapa($x_start, $y_start);  -> Gets army camp capacity --> train.au3, and used to read CC request time remaining
	Return getOcrAndCapture("coc-army", $x_start, $y_start, 66, 14, True)
EndFunc   ;==>getArmyCampCapa

Step 3 : Open "DonateCC.au3" (Folder 'COCBot\functions\Village')

Add the following code to end of file

Func GTFO()

	  Click(1, 1, 1, 1000)
	  Local  $Scroll,$len, $kick_y, $kicked = 0,$kicklimit, $mDonated, $mReceived, $Count = 1, $loopcount, $new, $p1, $p2,$lastNum, $lastNumCheck, $cp, $sNum
	  $p1 = 533 ; 483 FOR MAXLVL CLAN CASTLE, 533 FOR NORMAL CLAN CASTLE,  577 FOR UNDER UPGRADE CLAN CASTLE
	  $p2 = 660
	  $len = 0

	  $kicklimit=  GUICtrlRead($cmbgtfo)
	  If GUICtrlRead($chkGTFO) = 1 Then
		 SetLog("Started Kicking", $COLOR_RED)
	  Else
		 Return
	  EndIf


	  While $kicked < $kicklimit
		 Click(1, 1, 1, 1000)
		 If GUICtrlRead($chkGTFO) = 1 Then

			Click($aCCPos[0], $aCCPos[1]) ; click clan castle
			If _Sleep(500) Then ExitLoop

			$new = _PixelSearch(460, 650, 590, 670, Hex(0xC8997B, 6),20)
			If IsArray($new) Then
			   $p1 = $new[0]
			Else
			   SetLog("Error: Unable to Start Kicking", $COLOR_RED)
			   Return
			EndIf

			$loopcount = 0
		   Click($p1, $p2)

			While _ColorCheck( _GetPixelColor(60, 350, True), Hex(0x65B010, 6), 20) == False
			   If _Sleep(100) Then ExitLoop
			   $loopcount += 1
			   If $loopcount >= 50 Then
				   $loopcount = 0
				    Click(1, 1, 1, 1000)
				   SetLog("Unable to Load Clan Page.", $COLOR_RED)
				   Return
			   EndIf
			WEnd
			$KickPosX = -1
			$Scroll = 0
			$cp = 110
			$len = 0
			While 1
			   If $debugSetlog = 1 Then SetLog("Capture. cp: " & $cp , $COLOR_ORANGE)
			   _CaptureRegion(190, $cp, 220, 640)
			   $new = _PixelSearch(200, $cp, 210, 670, Hex(0xE73838, 6),20)
			   If IsArray($new) Then
				  $KickPosX = $new[0]
				  $KickPosY = $new[1]
				  $mDonated = getArmyCampCapa($new[0]+281,$new[1]-10)
				  $mReceived = getArmyCampCapa($new[0]+430,$new[1]-10)
				  $sNum = getTrophyVillageSearch($new[0]-180,$new[1]-18)
				  If $debugSetlog = 1 Then SetLog("Check For To Kick Members", $COLOR_RED)
				  If $debugSetlog = 1 Then SetLog($sNum & " # x:" & $new[0] & " y:"  & $new[1], $COLOR_RED)

				  If $mDonated >0 or $mReceived > 35 then
;~ 				  If $mDonated >0 then
					 Click($new[0], $new[1])
					 If _Sleep(250) Then ExitLoop
					 If $new[1] > 615 Then
						$kick_y = 700
					 Else
						$kick_y = $new[1] + 70
					 EndIf
					 Click($new[0] + 300, $kick_y) ; kick
					 If _Sleep(250) Then ExitLoop
					 Click(520, 240)
					 If _Sleep(250) Then ExitLoop
					 $kicked += 1
					 SetLog("Player #" & $sNum & "  Donated : " & $mDonated &  " - Received : " & $mReceived & " has been kicked out", $COLOR_RED)
					 If _Sleep(250) Then ExitLoop
					 ExitLoop
				  Else
					 $cp = $new[1]  + 20
;~ 					 ExitLoop
				  EndIf
			   Else
				  if $Scroll > 4 then
					  If $debugSetlog = 1 Then SetLog("Kicking bottom members", $COLOR_RED)
					  If $KickPosX > 0 Then
						If $debugSetlog = 1 Then SetLog($sNum & " # x:" & $KickPosX & " y:"  & $KickPosY, $COLOR_RED)
						Click($KickPosX, $KickPosY)
						If _Sleep(250) Then ExitLoop
						If $KickPosY  > 615 Then
						   $kick_y = 700
						Else
						   $kick_y = $KickPosY + 70
						EndIf
						Click($KickPosX + 300, $kick_y) ; kick
						If _Sleep(250) Then ExitLoop
						Click(520, 240)
						If _Sleep(250) Then ExitLoop
						$kicked += 1
						SetLog("Player #" & $sNum & "  Donated : " & $mDonated &  " - Received : " & $mReceived & " has been kicked out (Bottom)", $COLOR_RED)
					 Else
						If $debugSetlog = 1 Then SetLog("no members to kick", $COLOR_RED)
					 EndIf
					 ExitLoop 2
				  Else
					 MouseDrag(430,665,430,115,"left",500)
					 Click(50,80)
					 MouseDrag(430,175,430,174,"left",500)
					 Click(50,80)
					 $cp = 110
					 If $debugSetlog = 1 Then SetLog("Page Scroll : " & $Scroll, $COLOR_RED)
					 $Scroll = $Scroll + 1
				  EndIf
			   EndIf
			WEnd



		 Else
			SetLog("Enable Kicking First", $COLOR_RED)
			Return
		 EndIf
		 Click(1, 1, 1, 1000)
	  WEnd

	  SetLog("Finished Kicking", $COLOR_RED)
	  Click(1, 1, 1, 2000)
   EndFunc

Step 4 : Open "MBR GUI Design Child Village - Donate" (Folder 'COCBot\GUI')

Now find $chkExtraAlphabets = GUICtrlCreateCheckbox(GetTranslated(612,25, "Enable Cyrillic Alphabet Recognition"), $x - 15 , $y +175, -1, -1)

 

and modify it with the code shown below:

	$chkExtraAlphabets = GUICtrlCreateCheckbox(GetTranslated(612,25, "Enable Cyrillic Alphabet Recognition"), $x - 15 , $y +149, -1, -1)
	GUICtrlSetTip(-1, GetTranslated(612,26, "Check this to enable the Cyrillic Alphabet."))

	$chkGTFO = GUICtrlCreateCheckbox("KICK Members:", $x+250, $y+151, 85, 17)
;;			   GUICtrlSetState(-1, $GUI_CHECKED)
			   GUICtrlSetState(-1, $GUI_UNCHECKED)
            GUICtrlSetTip(-1, "Kick new members donating or already full"& @CRLF & _
			"Use 1 - 3 for Normal Kicking"& @CRLF & _
			"Use 4 - 6 For Massive Donating"& @CRLF & _
			"Use 7 - 10 For Forced Kicking")
    $cmbgtfo = GUICtrlCreateCombo("", $x + 340, $y + 149, 35, 21, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
            GUICtrlSetTip(-1, "Number of new members you want to kick.."& @CRLF & _
			"Use 1 - 3 for Normal Kicking"& @CRLF & _
			"Use 4 - 6 For Massive Donating"& @CRLF & _
			"Use 7 - 10 For Forced Kicking")
            GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10", "4")

Step 5 : Open "MyBot.run.au3"

find  Func runBot()

 then find Idle() add the following code Before it (line ~359) :

			   GTFO()
				If _Sleep($iDelayRunBot3) Then Return
				If $Restart = True Then ContinueLoop
			   Idle()

find  Func Idle()  

then modify the line  While $iReHere < 7  with While $iReHere < 30 (line ~ 357)

then find If $CommandStop = 0 And $bTrainEnabled = True Then (line ~496) and modify the following code after it like that:

		If $CommandStop = 0 And $bTrainEnabled = True Then
			If Not ($fullArmy) Then
				if 	$troops_maked_after_fullarmy = False and $actual_train_skip <  $max_train_skip Then
					$troops_maked_after_fullarmy = False
					Train()
					GTFO()
					If $Restart = True Then ExitLoop
					If _Sleep($iDelayIdle1) Then ExitLoop
					checkMainScreen(False)
				Else
					$actual_train_skip = $actual_train_skip +1
					if $actual_train_skip >= $max_train_skip Then
						$actual_train_skip = 0
						$troops_maked_after_fullarmy = false
					EndIf
					CheckOverviewFullArmy(True, False)  ; use true parameter to open train overview window
					getArmyHeroCount(False, False)
					getArmySpellCount(False, True) ; use true parameter to close train overview window
				EndIf
			EndIf
			If $fullArmy Then
				SetLog("Army Camp and Barracks are full, stop Training...", $COLOR_ACTION)
				$CommandStop = 3
			EndIf
		EndIf

 

The original topic has been closed:

 

 

Edited by YScorpion
Update to MBR 7.1.2
  • Upvote 8

Share this post


Link to post
Share on other sites
Quote

[21:56:34] Started Kicking
[21:56:41] Player #37  Donated : 19 - Received : 20 has been kicked out
[21:56:50] Player #39  Donated : 66 - Received : 15 has been kicked out
[21:56:59] Player #44  Donated : 40 - Received : 20 has been kicked out
[21:57:00] Error: Unable to Start Kicking
 

 

Share this post


Link to post
Share on other sites
2 hours ago, cat said:

How about a fast donation mod that has been promised for months? :) 

 

Dude, read my post, i clearly said that i'm not a coder, i just made the original code fit the new version of MBR :)

 

1 hour ago, matty95srk said:

[21:56:34] Started Kicking
[21:56:41] Player #37  Donated : 19 - Received : 20 has been kicked out
[21:56:50] Player #39  Donated : 66 - Received : 15 has been kicked out
[21:56:59] Player #44  Donated : 40 - Received : 20 has been kicked out
[21:57:00] Error: Unable to Start Kicking

 

So it does work mate, this code is meant to kick new members that donate or that received +35 troops ;)

If $mDonated >0 or $mReceived > 35 then

 

Share this post


Link to post
Share on other sites
7 hours ago, YScorpion said:

 

Dude, read my post, i clearly said that i'm not a coder, i just made the original code fit the new version of MBR :)

 

 

So it does work mate, this code is meant to kick new members that donate or that received +35 troops ;)

If $mDonated >0 or $mReceived > 35 then

 

" [21:57:00] Error: Unable to Start Kicking " it's doensn't work. But sometimes this error not appear.. :) thanx

 

edit: where i can set train less often? because now every time it donate it train..... 

Edited by matty95srk

Share this post


Link to post
Share on other sites

 YScorpion

Thank you so much for this bro ! i have a req n gtfo clan, its level 4 but 2 more wars is going level 5.

 

I have a question for you: we are like 15 coleaders right now, sometimes we are only 2 persons donating at the same time, we donate only barch, so when a request have 35 spaces we cant filled , the bot can kick even its not full the request? 

 

thank you agian for you time bro

Share this post


Link to post
Share on other sites
13 hours ago, gretabulldog said:

 YScorpion

Thank you so much for this bro ! i have a req n gtfo clan, its level 4 but 2 more wars is going level 5.

 

I have a question for you: we are like 15 coleaders right now, sometimes we are only 2 persons donating at the same time, we donate only barch, so when a request have 35 spaces we cant filled , the bot can kick even its not full the request? 

 

thank you agian for you time bro

Here's what this mod does:

-open clan window

-search for new member with troops donated>0 or troops received>35

-if the bot scrolls down the clan window 3 times and doesn't find any member that meet the conditions he will kick any new member randomly and exit the kicking loop

Share this post


Link to post
Share on other sites

Doesnt work on MEmu using mybot 6.1.2.1. ... It opens CC window but is unable to scroll down it keeps clicking the top middle where a copy menu keeps appearing,

if i scroll down manually it will kick a new member, basically its unable to scroll i believe the click drag isnt working on MEmu settings

Share this post


Link to post
Share on other sites

 

Follow Step By Step... Above link.

On 6/23/2016 at 8:29 AM, matty95srk said:

" [21:57:00] Error: Unable to Start Kicking " it's doensn't work. But sometimes this error not appear.. :) thanx

 

edit: where i can set train less often? because now every time it donate it train..... 

Due to My busy Schedule i am not able to spend time on bot. hope i will get some time to spend for coding...:thumbsup:

Edited by MediaHub
  • Upvote 1

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...