Code:
;#########################################################################
; FishBOT by Yorkfire taken from Psycosis, Foobie and Pantless Krab's
; original version.
;
; Version 1.0 beta
;
; Note - By using the Fishing bot designed for World of Warcraft
; You understand the risks and agree that you will take all
; responsibility for this code. The creater takes no responsibility
; for whatever happens to users who use and/or modify this code
;#########################################################################
;#######################################
; Values read from the Settings.ini file
;#######################################
$HotKey = IniRead ("Settings.ini", "HotKey", "HotKey", "1")
$CatchAmount = IniRead ("Settings.ini", "CatchAmount", "CatchAmount", "50")
$splash_tolerance = IniRead ("Settings.ini", "Splash", "SplashTolerance", "20")
$splash_search_step = IniRead ("Settings.ini", "Splash", "SplashSearchStep", "1")
$bobber_search_tolerance = IniRead ("Settings.ini", "Bobber","BobberSearchTolerance", "20")
$bobber_search_step = IniRead ("Settings.ini", "Bobber","BobberSearchStep", "2")
$color_choice = IniRead ("Settings.ini", "colorchoice", "colorchoice", "3")
; Color Definitions
$1 = IniRead ("Settings.ini", "Color", "1", "0xA72C0B")
; dark blue in the blue feather
$2 = IniRead ("Settings.ini", "Color", "2", "0x1B222E")
; dark red in the red feather
$3 = IniRead ("Settings.ini", "Color", "3", "0x210B04")
$4 = IniRead ("Settings.ini", "Color", "4", "0xA72C0B")
$5 = IniRead ("Settings.ini", "Color", "5", "0xA72C0B")
;beige on the bobber cork
$6 = IniRead ("Settings.ini", "Color", "6", "0xB08D65")
$7 = IniRead ("Settings.ini", "Color", "7", "0xA72C0B")
$8 = IniRead ("Settings.ini", "Color", "8", "0xA72C0B")
$9 = IniRead ("Settings.ini", "Color", "9", "0xA72C0B")
$10 = IniRead ("Settings.ini", "Color", "10", "0xA72C0B")
$11 = IniRead ("Settings.ini", "Color", "11", "0xA72C0B")
$12 = IniRead ("Settings.ini", "Color", "12", "0xA72C0B")
$13 = IniRead ("Settings.ini", "Color", "13", "0xA72C0B")
$14 = IniRead ("Settings.ini", "Color", "14", "0xA72C0B")
$15 = IniRead ("Settings.ini", "Color", "15", "0xA72C0B")
;###########
; Globals
;###########
$title = "jegerdensejesteiverdenher"
$win_title = "World of Warcraft"
; Sets up the Borders to fish in
$top_border_height = 23
$left_border_width = 4
; Sets up the Screen resolution $ make sure its in windowed mode
$screen_width = 800
$screen_height = 600
; Just a simple Timer
$time_to_wait = Random(30000, 35000, 1)
dim $start_time
dim $color_to_use
dim $catch_counter = 0
dim $CastAmt = 0
dim $BobberAmt = 0
dim $SplashAmt = 0
;#########################################################################
; Hot Keys Section
;
; Set up a Hot key to be used later to end the script
;#########################################################################
HotKeySet("{PAUSE}", "request_end")
;#########################################################################
; Fish Bot View Paremeters
;
; Sets up the boundaries of the fishbot on the screen and returns
; some visual confirmation by moving the mouse in a square showing
; where the bot will be searching for the fishing bobber
;#########################################################################
if not WinExists($win_title, "") then
msg($win_title & " window must be open.")
Exit
endif
WinActivate($win_title, "")
WinSetOnTop($win_title, "", 0)
Sleep(500)
check_window()
$win_pos = WinGetPos($win_title, "")
$win_x = $win_pos[0] + $left_border_width
$win_y = $win_pos[1] + $top_border_height
$top = $win_y + (.25 * $screen_height)
$bottom = $top + (.35 * $screen_height) - 1
$left = $win_x + (.15 * $screen_width)
$right = $left + $screen_width - (.15 * 2.0 * $screen_width) - 1
Start_Bot()
;###########################
; Visual confirmation
; Area scanned for bobber
;###########################
MouseMove($left, $top, 0)
MouseMove($right, $top, 5)
MouseMove($right, $bottom, 5)
MouseMove($left, $bottom, 5)
MouseMove($left, $top, 5)
cast_pole()
find_float()
;#########################################################################
;
; Function find_float
;
; Once bobber has been cast the bobber needs to be found via colors
; The most prominent color is the red so by default that is enabled
; More colors have been defined and you may switch them if you want
; The only reason to switch them is when fishing in Stormwind or at
; night when colors are all very diffrent.
;#########################################################################
func find_float()
;##################################################################
; This is the search tolerance. In areas where the bobber
; colors really stand out, you can use a fairly high threshold.
; In areas where the bobber colors are fairly muted in with
; the background, you will have to lower the values considerably.
;##################################################################
$bobber_search_tolerance = IniRead ("Settings.ini", "Bobber", "BobberSearchTolerance", "20")
;########################################################################
; It's better to use lower values here in favor of accurate searching.
; This will take more time for it to detect the bobber, but usually
; the splash doesn't occur until at least 30% of the time has run out,
; and by that time, it should have detected the bobber (assuming the
; color values and tolerance are correct).
;########################################################################
$bobber_search_step = IniRead ("Settings.ini", "Bobber", "BobberSearchStep", "2")
;#########################################################################
; Search for float. In certain lighting, the part of the float may look
; more purple than blue. In this case, using $color_red tends to work
; the best with a tolerance of 20.
;#########################################################################
choose_color()
$var = 0
while 1
if TimerDiff($start_time) >= $time_to_wait then
cast_pole()
endif
$var = $var + 1
IniWrite("Settings.ini", "BobberSearch", "BobberSearch", " " & $var)
$pos = PixelSearch($left, $top, $right, $bottom, $color_to_use, $bobber_search_tolerance, $bobber_search_step)
if @error then
SetError(0)
else
MouseMove($pos[0], $pos[1], 2)
$BobberAmt = $BobberAmt + 1
$BobberSuccessRate = ($BobberAmt/$CastAmt)
$BobberSuccessRate = Round($BobberSuccessRate * 100, 2)
IniWrite("Settings.ini", "BobberSuccessRate", "BobberSuccessRate", " " & $BobberSuccessRate & "%")
find_splash($pos[0], $pos[1] )
endif
Sleep(10)
wend
endfunc
; ############################################################################
func find_splash($float_x, $float_y)
$search_left = $float_x - 42
$search_right = $search_left + 62
$search_top = $float_y - 42
$search_bottom = $search_top + 74
; Usually you do not have to modify the search color for the splash, as the pixels
; have a very distinctive, bright color.
; ######################################################
; SPLASH DETECTION COLORS
; Remove the semicolon for the one you choose
; And place a semicolon before the ones you do not use
; ######################################################
; Feralas (Facing West)
; $splash_color = 0x8FB676
; Hillsbrad
; $splash_color = 0x6C766A
; Steamwheedle
$splash_color = 0xA8BEB5
; Sometimes 30 tolerance works well, sometimes 20 is better in lit areas to avoid catching highlights
; in other things.
$splash_tolerance = IniRead ("Settings.ini", "Splash", "SplashTolerance", "20")
; The search step can be pretty small here (1 to 3) without worries because the search area is
; so small once it has been narrowed down - speed isn't much of an issue.
$splash_search_step = IniRead ("Settings.ini", "Splash", "SplashSearchStep", "1")
$var = 0
; Search for splash
while TimerDiff($start_time) < $time_to_wait
$var = $var + 1
IniWrite("Settings.ini", "SplashSearch", "SplashSearch", " " & $var)
$pos = PixelSearch($search_left, $search_top, $search_right, $search_bottom, $splash_color, $splash_tolerance, $splash_search_step)
if @error then
SetError(0)
else
$SplashAmt = $SplashAmt + 1
$SplashSuccessRate = ($SplashAmt/$BobberAmt)
$SplashSuccessRate = Round($SplashSuccessRate * 100, 2)
IniWrite("Settings.ini", "SplashSuccessRate", "SplashSuccessRate", " " & $SplashSuccessRate & "%")
; Click on the splash
$RandomClick = Random(800, 3000, 1)
send("{SHIFTDOWN}")
MouseClick("right");, $pos[0], $pos[1], 1, 2)
Sleep($RandomClick)
send("{ShiftUP}")
Sleep(5500)
$catch_counter = $catch_counter + 1
if $catch_counter = $catchamount then
$SessionSuccessRate = ($SplashAmt/$CastAmt)
$SessionSuccessRate = Round($SessionSuccessRate * 100, 2)
IniWrite("Settings.ini", "SessionSuccessRate", "SessionSuccessRate", " " & $SessionSuccessRate & "%")
Send("{Esc}")
Sleep(1500)
MouseClick("left", 405, 345, 1, 3)
exit
endif
ExitLoop
endif
Sleep(10)
wend
; Cast pole and start all over again.
cast_pole()
endfunc
; ##############################################################################
func cast_pole()
$RandomNum = Random(1000, 3000, 1)
$start_time = TimerInit()
Send($HotKey)
Sleep($RandomNum)
$CastAmt = $CastAmt + 1
endfunc
; ##############################################################################
func check_window()
$dimensions = WinGetClientSize($win_title, "")
if $dimensions[0] <> $screen_width or $dimensions[1] <> $screen_height then
msg("Invalid window size. You must use " & $screen_width & "x" & $screen_height & " resolution in window mode.")
Exit
endif
endfunc
; ##############################################################################
func msg($text)
MsgBox(0, $title, $text)
endfunc
; ##############################################################################
func msg_array($title, $array, $num_elements)
dim $text
$text = $array[0]
for $j = 1 to $num_elements - 1
$text = $text & ", " & $array[$j]
next
MsgBox(0, $title, $text)
endfunc
; ##########################################################
func request_end()
$MB_YESNO = 4
$MB_YES = 6
if MsgBox($MB_YESNO, $title, "End script?") == $MB_YES then
Exit
endif
endfunc
;###########################################################
func Start_Bot()
$MB_YESNO = 4
$MB_YES = 6
if MsgBox($MB_YESNO, $title, "Make sure you have done the following before you begin." & @CRLF & _
@CRLF & "1: Face your character away from the sun or moon." & @CRLF & _
"2: Set your character view to first person mode." & @CRLF & _
"3: Adjust your horizon line so that it is" & @CRLF & _
" approximately 2 inches from the top of the screen." & @CRLF & _
"4: Equip your fishing pole." & @CRLF & @CRLF & @CRLF & _
" Press Yes to continue." & @CRLF & _
" Press No to exit.") == $MB_Yes then
if MsgBox($MB_YESNO, $title, "Do you want to Run Setup?") == $MB_Yes then
RunSetup()
endif
else
Exit
endif
endfunc
; ##########################################################
func drain_timer()
Msg("Restart")
$start_time = $start_time - $time_to_wait
endfunc
; ##########################################################
func choose_color()
;#########################################################
; This is the color used to pixelsearch for the bobber.
; Select a good color on the bobber that
; is prominent on the screen
;#########################################################
Select
Case $color_choice = 1
$color_to_use = $1
Case $color_choice = 2
$color_to_use = $2
Case $color_choice = 3
$color_to_use = $3
Case $color_choice = 4
$color_to_use = $4
Case $color_choice = 5
$color_to_use = $5
Case $color_choice = 6
$color_to_use = $6
Case $color_choice = 7
$color_to_use = $7
Case $color_choice = 8
$color_to_use = $8
Case $color_choice = 9
$color_to_use = $9
Case $color_choice = 10
$color_to_use = $10
Case $color_choice = 11
$color_to_use = $11
Case $color_choice = 12
$color_to_use = $12
Case $color_choice = 13
$color_to_use = $13
Case $color_choice = 14
$color_to_use = $14
Case $color_choice = 15
$color_to_use = $15
Case Else
ErrorMsg()
$color_to_use = $3
$color_choice = 3
EndSelect
IniWrite("Settings.ini", "ColorChoice", "ColorChoice", " " & $color_choice)
endfunc
; ##########################################################
func RunSetup()
$MB_YESNO = 4
$MB_YES = 6
$CatchAmount = InputBox($title, "How many items do you want the bot to find?" _
& @CRLF & "Enter a value between 1 and 500", "" & $CatchAmount, "", 251, 244)
If $CatchAmount >= 1 AND $CatchAmount <= 500 then
IniWrite("Settings.ini", "CatchAmount", "CatchAmount", " " & $CatchAmount)
Else
ErrorMsg()
IniWrite("Settings.ini", "CatchAmount", "CatchAmount", " 50")
endif
$HotKey = InputBox($title, "Enter which hotkey you use for casting your fishing pole." _
& @CRLF & "Example: 1", "" & $HotKey, "", 251, 244)
If $HotKey <> "" then
IniWrite("Settings.ini", "HotKey", "HotKey", " " & $HotKey)
Else
$HotKey = 1
ErrorMsg()
IniWrite("Settings.ini", "HotKey", "HotKey", " 1")
endif
$color_choice = InputBox($title, "Enter a number for the color you wish to use." _
& @CRLF & "1: Dark Purple" & @CRLF & "2: Dark Blue" & @CRLF & "3: Dark Red" & @CRLF & _
"4: Stormwind Daylight Blue" & @CRLF & "5: Stormwind Daylight Red" & @CRLF & _
"6: Beige" & @CRLF & "7: Night Blue" & @CRLF & "8: Wailing Caverns" & @CRLF & _
"9-15: Custom Colors", "" & $color_choice, "", 251, 244)
choose_color()
if MsgBox($MB_YESNO, $title, "Do you want to setup advanced settings?") == $MB_Yes then
AdvancedSetup()
endif
endfunc
; ##########################################################
func AdvancedSetup()
$Bobber_Search_Tolerance = InputBox($title, "Enter tolerance value for the bobber?" _
& @CRLF & "Value should be between 0 and 30", "" & $Bobber_Search_tolerance, "", 251, 244)
If $Bobber_Search_Tolerance <> "" AND $Bobber_Search_Tolerance <= 30 then
IniWrite("Settings.ini", "Bobber", "BobberSearchTolerance", " " & $Bobber_Search_tolerance)
Else
ErrorMsg()
IniWrite("Settings.ini", "Bobber", "BobberSearchTolerance", " 20")
endif
$Bobber_Search_Step = InputBox($title, "Enter step value for the bobber?" _
& @CRLF & "Value should be between 1 and 5", "" & $Bobber_Search_Step, "", 251, 244)
If $Bobber_Search_Step >= 1 AND $Bobber_Search_Step <= 5 then
IniWrite("Settings.ini", "Bobber", "BobberSearchStep", " " & $Bobber_Search_Step)
Else
ErrorMsg()
IniWrite("Settings.ini", "Bobber", "BobberSearchStep", " 2")
endif
$splash_tolerance = InputBox($title, "Enter tolerance value for the splash?" _
& @CRLF & "Value should be between 0 and 30", "" & $splash_tolerance, "", 251, 244)
If $splash_tolerance <> "" AND $splash_tolerance <= 30 then
IniWrite("Settings.ini", "Splash", "SplashTolerance", " " & $splash_tolerance)
Else
ErrorMsg()
IniWrite("Settings.ini", "Splash", "SplashTolerance", " 20")
endif
$splash_search_step = InputBox($title, "Enter step value for the splash?" _
& @CRLF & "Value should be between 1 and 5", "" & $splash_Search_step, "", 251, 244)
If $splash_search_step >= 1 AND $splash_search_step <= 5 then
IniWrite("Settings.ini", "Splash", "SplashSearchStep", " " & $splash_Search_step)
Else
ErrorMsg()
IniWrite("Settings.ini", "Splash", "SplashSearchStep", " 1")
endif
endfunc
; ##########################################################
func ErrorMsg()
MsgBox(0, $title, "Incorrect value entered or the user pressed cancel. Default value will be used!")
endfunc
; ##########################################################
Troubleshooting