Façade’s Cabal Bot *SOURCE CODE*

For those who requested the source code here you go. Would greatly appreciate it if you leave the credits and name as is 🙂 Thank you.

 

If you have any questions and/or recommendations, please leave in the comment section below. (Improvements welcome)

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author:         Façade

Script Function:
Cabal PixelBot.

#ce ----------------------------------------------------------------------------
#include 
#include 
#include 
#include 
#include

 ; Set a HotKey
 HotKeySet("{F3}", "_Interrupt_HotKey") ;F3 to stop
 HotKeySet("{F4}", "CloseBot") ;F4 to quit

 ; Declare a flag
 $fInterrupt = 0

$dll = DllOpen("user32.dll")

Opt("GUIOnEventMode", 1) ; Change to OnEvent mode

$mainwindow = GUICreate("Façade's Cabal Bot", 350, 400) ;Create Window
GUISetOnEvent($GUI_EVENT_CLOSE, "CloseBot")
GUISetFont(10, 700)

#cs ----------------------------------------------------------------------------
INTERFACE
#ce ----------------------------------------------------------------------------

#cs ------------------------
MENU
#ce ------------------------

$filemenu = GUICtrlCreateMenu("&File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
GUICtrlSetOnEvent($exititem, "StopBot")

$helpmenu = GUICtrlCreateMenu("?")
$aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
GUICtrlSetOnEvent($aboutitem, "aboutmenu")

#cs ------------------------
LABELS, BUTTONS AND INPUT DEVICES
#ce ------------------------

; general interface
GUICtrlCreateLabel("xTop", 8, 10)
$xTop = GUICtrlCreateInput("", 44, 8, 100)
GUICtrlCreateLabel("yTop", 8, 42)
$yTop = GUICtrlCreateInput("", 44, 40, 100)
$SetVirtBoxTop = GUICtrlCreateButton("Set Top", 5, 74, 150)
GUICtrlSetOnEvent($SetVirtBoxTop, "SetTop")

GUICtrlCreateLabel("xBot", 170, 10)
$xBot = GUICtrlCreateInput("", 206, 8, 100)
GUICtrlCreateLabel("yBot", 170, 42)
$yBot = GUICtrlCreateInput("", 206, 40, 100)
$SetVirtBoxBot = GUICtrlCreateButton("Set Bottom", 175, 74, 150)
GUICtrlSetOnEvent($SetVirtBoxBot, "SetBot")

GUICtrlCreateLabel("Hp", 8, 120)
$xHpPos = GUICtrlCreateInput("", 30, 116, 50)
$yHpPos = GUICtrlCreateInput("", 82, 116, 50)
$HpColor = GUICtrlCreateInput("", 134, 116, 80)
$HpColorPreview = GUICtrlCreateInput("", 220, 116, 25)
$SetHpColor = GUICtrlCreateButton("Set Hp", 250, 113, 80)
GUICtrlSetOnEvent($SetHpColor, "SetHp")

GUICtrlCreateLabel("Reset Mob", 8, 150)
$xMobPos = GUICtrlCreateInput("", 80, 145, 40)
$yMobPos = GUICtrlCreateInput("", 122, 145, 40)
$MobColor = GUICtrlCreateInput("", 164, 145, 60)
$ResetMobPreview = GUICtrlCreateInput("", 230, 145, 25)
$SetMob = GUICtrlCreateButton("Set Point", 260, 143, 80)
GUICtrlSetOnEvent($SetMob, "Set_Mob")

GUICtrlCreateLabel("MOB COLORS", 8, 188)
$doRed = GUICtrlCreateCheckbox("Red", 14, 205, 75)
$doOrange = GUICtrlCreateCheckbox("Orange", 14, 225, 75)
$doYellow = GUICtrlCreateCheckbox("Yellow", 14, 245, 75)

$buffbutton = GUICtrlCreateCheckbox("Auto Buff", 150, 190, 100)

$potbutton = GUICtrlCreateCheckbox("Auto Pot", 150, 220, 100)
GUICtrlSetState($potbutton, $GUI_CHECKED)
GUICtrlSetOnEvent($potbutton, "enable_pot")

$HpAssist = GUICtrlCreateCheckbox("Hp Assist", 250, 220, 100)
GUICtrlSetOnEvent($HpAssist, "hp_assist")

$z_target = GUICtrlCreateCheckbox("Z-Targeting", 150, 250, 100)
GUICtrlSetOnEvent($z_target, "z_target")
GUICtrlSetState($z_target, $GUI_DISABLE)

$stopbutton = GUICtrlCreateButton("Stop Bot", 5, 348, 340)
GUICtrlSetOnEvent($stopbutton, "StopBot")
GUICtrlSetState($stopbutton, $GUI_DISABLE)

$startbutton = GUICtrlCreateButton("Start Bot", 5, 318, 340)
GUICtrlSetOnEvent($startbutton, "StartBot")

;GUISetState(@SW_SHOW) ;show Graphical User Interface

 GUISetState()

#cs ----------------------------------------------------------------------------
IDLETIME!
#ce ----------------------------------------------------------------------------

 ; Intercept Windows command messages with out own handler
 GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
Sleep(10)
WEnd

#cs ----------------------------------------------------------------------------
FUNCTIONALITY
#ce ----------------------------------------------------------------------------

Func SetTop()
While 1
If _IsPressed("1", $dll) Then
$coord = MouseGetPos()
$x = $coord[0]
$y = $coord[1]
;MsgBox(0, "Your Values", $x)
GUICtrlSetData($xTop, $x)
GUICtrlSetData($yTop, $y)
ExitLoop
EndIf
WEnd
EndFunc   ;==>SetTop

Func SetBot()
While 1
If _IsPressed("1", $dll) Then
$coord = MouseGetPos()
$x = $coord[0]
$y = $coord[1]
GUICtrlSetData($xBot, $x)
GUICtrlSetData($yBot, $y)
ExitLoop
EndIf
WEnd
EndFunc   ;==>SetBot

Func SetHp()
While 1
If _IsPressed("1", $dll) Then
$coord = MouseGetPos()
$x = $coord[0]
$y = $coord[1]
$getcolor = PixelGetColor($coord[0], $coord[1])
$color = Hex($getcolor, 6)
GUICtrlSetData($xHpPos, $x)
GUICtrlSetData($yHpPos, $y)
$fullcolor = "0x" & $color
GUICtrlSetData($HpColor, $fullcolor)
GUICtrlSetBkColor($HpColorPreview, $getcolor)
ExitLoop
EndIf
WEnd
EndFunc   ;==>SetHp

Func Set_Mob()
While 1
If _IsPressed("1", $dll) Then
$coord = MouseGetPos()
$x = $coord[0]
$y = $coord[1]
$getcolor = PixelGetColor($coord[0], $coord[1])
$mcolor = Hex($getcolor, 6)
GUICtrlSetData($xMobPos, $x)
GUICtrlSetData($yMobPos, $y)
$fullmobcolor = "0x" & $mcolor
GUICtrlSetData($MobColor, $fullmobcolor)
GUICtrlSetBkColor($ResetMobPreview, $getcolor)
ExitLoop
EndIf
WEnd
EndFunc   ;==>Set_Mob

Func enable_pot()
If GUICtrlRead($potbutton) = $GUI_UNCHECKED Then
GUICtrlSetState($HpColor, $GUI_DISABLE)
GUICtrlSetState($xHpPos, $GUI_DISABLE)
GUICtrlSetState($yHpPos, $GUI_DISABLE)
GUICtrlSetState($HpColorPreview, $GUI_DISABLE)
GUICtrlSetState($SetHpColor, $GUI_DISABLE)
GUICtrlSetState($HpAssist, $GUI_DISABLE)

EndIf
If GUICtrlRead($potbutton) = $GUI_CHECKED Then
GUICtrlSetState($HpColor, $GUI_ENABLE)
GUICtrlSetState($xHpPos, $GUI_ENABLE)
GUICtrlSetState($yHpPos, $GUI_ENABLE)
GUICtrlSetState($HpColorPreview, $GUI_ENABLE)
GUICtrlSetState($SetHpColor, $GUI_ENABLE)
GUICtrlSetState($HpAssist, $GUI_ENABLE)
EndIf
EndFunc   ;==>enable_pot

Func hp_assist()
If GUICtrlRead($HpAssist) = $GUI_CHECKED Then
GUICtrlSetState($doRed, $GUI_DISABLE)
GUICtrlSetState($doOrange, $GUI_DISABLE)
GUICtrlSetState($doYellow, $GUI_DISABLE)

EndIf
If GUICtrlRead($HpAssist) = $GUI_UNCHECKED Then
GUICtrlSetState($doRed, $GUI_ENABLE)
GUICtrlSetState($doOrange, $GUI_ENABLE)
GUICtrlSetState($doYellow, $GUI_ENABLE)
EndIf
EndFunc   ;==>enable_pot

Func z_target()
If GUICtrlRead($z_target) = $GUI_CHECKED Then
GUICtrlSetState($doRed, $GUI_DISABLE)
GUICtrlSetState($doRed, $GUI_UNCHECKED)
GUICtrlSetState($doOrange, $GUI_DISABLE)
GUICtrlSetState($doOrange, $GUI_UNCHECKED)
GUICtrlSetState($doYellow, $GUI_DISABLE)
GUICtrlSetState($doYellow, $GUI_UNCHECKED)

EndIf
If GUICtrlRead($z_target) = $GUI_UNCHECKED Then
GUICtrlSetState($doRed, $GUI_ENABLE)
GUICtrlSetState($doOrange, $GUI_ENABLE)
GUICtrlSetState($doYellow, $GUI_ENABLE)
EndIf
EndFunc   ;==>z_target

Func CloseBot()
DllClose($dll)
;  MsgBox(0, "GUI Event", "Exiting...")
Exit
EndFunc   ;==>CloseBot

Func StopBot()
GUICtrlSetState($startbutton, $GUI_ENABLE)
GUICtrlSetState($stopbutton, $GUI_DISABLE)
EndFunc   ;==>StopBot

Func StartBot()

GUICtrlSetState($startbutton, $GUI_DISABLE)
GUICtrlSetState($stopbutton, $GUI_ENABLE)

WinWaitNotActive ( "Façade's Cabal Bot", "", 2)

     ; Make sure the flag is cleared
     $fInterrupt = 0

$xTop1 = GUICtrlRead($xTop)
$yTop1 = GUICtrlRead($yTop)
$xBot1 = GUICtrlRead($xBot)
$yBot1 = GUICtrlRead($yBot)

$MobNameColor = "0xD1DB0A"
$YellowMob = "0xD1DB0A" ;"0xD8D702"
$OrangeMob = "0xD56F00"
$RedMob = "0xD31E18"

$xMyHp = GUICtrlRead($xHpPos)
$yMyHp = GUICtrlRead($yHpPos)
$myHpColor = GUICtrlRead($HpColor)

$xMobHp = GUICtrlRead($xMobPos)
$yMobHp = GUICtrlRead($yMobPos)
$MobHpColor = GUICtrlRead($MobColor)

While 1
If $fInterrupt <> 0 Then
Return
EndIf

$alive = PixelGetColor($xMobHp, $yMobHp)
If $alive = $MobHpColor or GUICtrlRead($HpAssist) = $GUI_CHECKED then

While $alive = $MobHpColor
if GUICtrlRead($HpAssist) = $GUI_UNCHECKED then
Send("1")
sleep(750)
sleep(750)
sleep(750)
sleep(750)

EndIf
$getHp = PixelGetColor($xMyHp, $yMyHp);

If ($getHp <> $myHpColor And GUICtrlRead($potbutton) == $GUI_CHECKED) _
   or ($getHp <> $myHpColor And GUICtrlRead($HpAssist) == $GUI_CHECKED) Then
Sleep(200)
Send("=")
Sleep(100)
EndIf

$alive = PixelGetColor($xMobHp, $yMobHp);

Send("{Space}")
Sleep(200)
Send("{Space}")
Sleep(200)
WEnd

ElseIf $alive <> $MobHpColor Then
Global $n
Global $coord = ""
if not IsArray($coord) and GUICtrlRead($doYellow) = $GUI_CHECKED then
$coord = PixelSearch($xTop1, $yTop1, $xBot1, $yBot1, $YellowMob, 15)
$n = @error
EndIf
if not IsArray($coord) and GUICtrlRead($doRed) = $GUI_CHECKED then
$coord = PixelSearch($xTop1, $yTop1, $xBot1, $yBot1, $RedMob, 15)
$n = @error
EndIf
if not IsArray($coord) and GUICtrlRead($doOrange) = $GUI_CHECKED then
$coord = PixelSearch($xTop1, $yTop1, $xBot1, $yBot1, $OrangeMob, 15)
$n = @error
EndIf

If IsArray($coord)Then
While @error = 0
$rand = Random(25, 35, 1)
$x = $coord[0]
$y = $coord[1] + $rand
MouseClick("left", $x, $y, 1)
$alive = PixelGetColor($xMobHp, $yMobHp)
ExitLoop

If $alive = $MobHpColor Then
ExitLoop
EndIf

;$coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$yellowmob,5)
;    $n = @error
WEnd

ElseIf $n And GUICtrlRead($buffbutton) == $GUI_CHECKED Then
$buff = Random(7, 9, 1)
Send($buff)
;Sleep(1500)
EndIf

EndIf

WEnd
EndFunc   ;==>StartBot

 Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
     ; The Func 2 button was pressed so set the flag
     If BitAND($wParam, 0x0000FFFF) =  $stopbutton Then $fInterrupt = 1
     Return $GUI_RUNDEFMSG
 EndFunc   ;==>_WM_COMMAND

 Func _Interrupt_HotKey()
     ; The HotKey was pressed so set the flag
     $fInterrupt = 2
GUICtrlSetState($startbutton, $GUI_ENABLE)
GUICtrlSetState($stopbutton, $GUI_DISABLE)
 EndFunc

#cs ------------------------
MENU FUNCTIONS
#ce ------------------------

Func aboutmenu()

MsgBox(0, "Façade's Cabal Bot V1.0", "For Updates and Feature Suggestions go to goo.gl/I5opJ")

EndFunc   ;==>aboutmenu

 

You may also like...

6 Responses

  1. sir..is this a copy paste code?

  2. MainStream says:

    Does this still work?

    • Petronald Green says:

      yea it does… In fact i used it just yesterday xD … At least a more heavily customized version

  3. CabalSEA says:

    i got error on line 10

  4. JF says:

    Hello! Could you please upload the latest code for science? I would appreciate it greatly, thank you. Wish you all the best.

Leave a Reply