Jump to content

World of Warcraft Fishing bot Fining color problem


 Share

Recommended Posts

Ok, well my friend has asked me to make him a World of Warcraft Fishing Bot...

I have not been able to do this as i cannot get the script to find the bobber!

Here is my script:

CODE
#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#Include <Misc.au3>

;///////////////// HOTKEYS

HotKeySet("{PAUSE}","QuitIt") ; Stop the bot at any time.

;////////////// THE $'s

$1 = 0

$2 = 0

$dll = DllOpen("user32.dll")

$color = "5E1909"

$filelog = "Filelog.txt"

;/////////// ENSURE THAT WORLD OF WARCRAFT IS RUNNING

If Not WinExists("World of Warcraft") Then

MsgBox(16, "WoW Fishing Bot", "World of Warcraft must already be running and you must be logged into your character.")

Exit

EndIf

;/////////////// THE GUI ///////////////////

$GUI = GUICreate("WoW - Fishbot", 251, 306, 193, 125)

$Contact = GUICtrlCreateButton("(Not allowed)", 8, 272, 130, 29, $BS_BITMAP)

GUICtrlSetImage(-1, "C:\Documents and Settings\Ashley\Desktop\FishBot\Contact\contactinfo.bmp", 0)

$Website = GUICtrlCreateButton("(Not allowed)", 144, 272, 102, 27, $BS_BITMAP)

GUICtrlSetImage(-1, "C:\Documents and Settings\Ashley\Desktop\FishBot\Website\website.bmp", 0)

$Start = GUICtrlCreateButton("Start", 168, 240, 75, 25, 0)

$Colorbox = GUICtrlCreateLabel(" Color to search ", 56, 240, 102, 17)

GUICtrlSetColor(-1, 0xFFFFFF)

GUICtrlSetBkColor(-1, 0xFF0000)

$info = GUICtrlCreateEdit("", 8, 8, 233, 225, $ES_WANTRETURN)

GUICtrlSetData(-1, StringFormat("Before you begin, please ensure that you have \r\nthe World of Warcraft window open, and that \r\nyou are logged in. Please also ensure that you \r\nare are stood next to a fair amount of fishable \r\nwater, and that you are fully zoomed in!(so that \r\nyou cannot see your character)\r\n\r\nNext please ensure that your fishing ability is in \r\nthe first spot on your casting bar.(1) And finaly \r\nplease ensure that you have auto-loot corspe \r\nturned on.\r\n\r\nPlease note: This bot will work better if you \r\nhave have World of Warcraft in the Windowed \r\nmode, but maximized!"))

GUISetState(@SW_SHOW)

;//////////////// SETUP

; Select the upper left of the search area

ToolTip('Please click in the top left of the area that you like to search',$1,$2,"",2)

While -1

If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure WoW stays active while user is selecting color

If _IsPressed("01",$dll) Then ExitLoop ; Exit loop when user left clicks

WEnd

$mouse = MouseGetPos()

$searchL = $mouse[0]

$searchT = $mouse[1]

Sleep(1000)

; Select the lower right of the search area

ToolTip('Please click in the bottom right of the area that you like to search',$1,$2,"",2)

While -1

If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure Wow stays active while user is selecting color

If _IsPressed("01",$dll) Then ExitLoop ; Exit loop when user left clicks

WEnd

$mouse = MouseGetPos()

$searchR = $mouse[0]

$searchB = $mouse[1]

Sleep(1000)

; Brings GUI to front

ToolTip('Press start when you are ready! you may now go AFK!',$1,$2,"",2)

If WinActive("WoW - Fishbot") = 0 Then WinActivate("WoW - Fishbot") ; Make sure WoW stays active while user is selecting color

Sleep(2000)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Start

Start()

Case $Website

;///////////// NOT YET MADE

Case $Contact

;////////////// NOT YET DONE

EndSwitch

WEnd

Func start()

While 1

If WinActive("World of Warcraft") = 0 Then WinActivate("World of Warcraft") ; Make sure WoW stays active while user is selecting color

Sleep(2000)

; Cast out your fishing line

;///////////// add 2 log

FileWriteLine($filelog, "Cast out fishing line!")

ToolTip("Casting out your Fishing Line",$1,$2,"",2)

Sleep(1000)

Send("1")

;///////////// add 2 log

FileWriteLine($filelog, "Deploying Bobber")

ToolTip("Waiting for Bobber to Deploy",$1,$2,"",2)

Sleep(3000)

;///////////

$timer = TimerInit() ; Set a timeout for finding bobber

While -1

ToolTip("Searching for Bobber... ",$1,$2,"",2)

$bobber = PixelSearch($searchL,$searchT,$searchR,$searchB,"0x" & Hex($color,6),10,1);Search for color

If @error <> 1 Then ExitLoop ; When color is found, Exit the loop to start looking for splash

If TimerDiff($timer) > 20000 Then

ToolTip("Bobber not found... Added to Log!",$1,$2,"",2)

;///////////// add log

FileWriteLine($filelog, "Blobber not found")

EndIf

Wend

;///////////// add 2 log

FileWriteLine($filelog, "Bobber Dectected!")

$timer = TimerInit() ; Set a timeout for finding splash

MouseMove($bobber[0], $bobber[1]) ; Move the mouse to the bobber.

While -1

ToolTip("Searching for Splash... ",$1,$2,"",2)

$splash = PixelSearch($bobber[0]-10,$bobber[1]-10,$bobber[0]+10,$bobber[1]+10,"0x" & Hex($color,6),10,1) ; Search a tiny square for the bobber color

If @error = 1 Then ExitLoop ; When the color isn't found, the bobber just bobbed (Splash Detected!)

If TimerDiff($timer) > 20000 Then

ToolTip("Splash not found... Added to Log!",$1,$2,"",2)

;///////////// add log

FileWriteLine($filelog, "Splash not found")

EndIf

Wend

ToolTip("Splash Detected!",$1,$2,"",2)

;///////////// add 2 log

FileWriteLine($filelog, "Splash Dectected!")

Sleep(Random(100,500))

MouseClick("Right", $bobber[0], $bobber[1], 1, 0) ; Even if the user moves the mouse, this instantly moves it to the bobber and right-clicks

Sleep(2000)

;///////////// add 2 log

FileWriteLine($filelog, "Successfully looted!")

ToolTip("Waiting to Recastline",$1,$2,"",2)

Sleep(1000)

;///////////// add 2 log

FileWriteLine($filelog, "Recasting line!")

WEnd

EndFunc

; Quit the script when the user presses {ESC}

Func QuitIt()

Exit

EndFunc

Link to comment
Share on other sites

I didn't build this but it might give you some ideas.

MsgBox(64, "World of Warcraft Fisher", "Please view the Readme.txt before running this fishing bot.")

#Tidy_Parameters = /pr 1 /tc 0 /gd 0 /rels 1 /sci 1

Opt("WinTitleMatchMode", 3)

#include <GUIConstants.au3>

#Include <Misc.au3>

Global $SetWin = 0, $Loop = 0, $OldSelect, $Casted = 0, $Sec = 28, $Timer, $SLeft, $SRight, $STop, $SBottom

Global $Splash = 0xF6F6F6, $Red = -1

$FishGUI = GUICreate("World of Warcraft Fisher", 225, 350)

GUISetFont(9, 800, 0, "MS Sans Serif")

GUISetBkColor(0xA6CAF0)

$RedPreview = GUICtrlCreateLabel("Please Select A Color!", 10, 265, 100, 75, -1, $WS_EX_CLIENTEDGE)

GUICtrlSetBkColor($RedPreview, -1)

$SplashPreview = GUICtrlCreateLabel("", 115, 265, 100, 75, -1, $WS_EX_CLIENTEDGE)

GUICtrlSetBkColor($SplashPreview, $Splash)

$ColorSelect = GUICtrlCreateCombo("", 10, 240, 205, 25)

GUICtrlSetData($ColorSelect, IniRead("Colors.ini", "Standard", "List", Default))

GUICtrlSetColor($ColorSelect, 0x800080)

$WindowDisplay = GUICtrlCreateInput("Window Not Found", 10, 10, 205, 20, BitOR($ES_CENTER, $ES_AUTOHSCROLL, $ES_READONLY))

GUICtrlSetColor($WindowDisplay, 0x800080)

$Start = GUICtrlCreateButton("Start", 10, 35, 100, 25, 0)

$STop = GUICtrlCreateButton("Stop", 115, 35, 100, 25, 0)

$Stats = GUICtrlCreateEdit("Statistics", 10, 65, 205, 170, BitOR($ES_READONLY, $WS_VSCROLL))

GUISetState(@SW_SHOW)

Global $MaxTime = $Sec * 1000

While 1

GUI()

Sleep(5)

WEnd

GUIDelete($FishGUI)

Exit

Func Bot()

WinActivate("World of Warcraft")

WinWaitActive("World of Warcraft")

Sleep(3000)

Local $WindowPosition = WinGetPos("World of Warcraft")

Local $BHeight = 23

Local $BWidth = 4

$ScreenSize = WinGetClientSize("World of Warcraft")

ReDim $ScreenSize[4]

$ScreenSize[2] = $WindowPosition[0] + $BWidth

$ScreenSize[3] = $WindowPosition[1] + $BHeight

$Top = $ScreenSize[3] + (.15 * $ScreenSize[1])

$Bottom = $Top + (.40 * $ScreenSize[1]) - 1

$Left = $ScreenSize[2] + (.05 * $ScreenSize[0])

$Right = $Left + $ScreenSize[0] - (.10 * 2.0 * $ScreenSize[0]) - 1

MouseMove($Left, $Top, 2)

MouseMove($Right, $Top, 2)

MouseMove($Right, $Bottom, 2)

MouseMove($Left, $Bottom, 2)

Do

While $Loop = 1

$Timer = TimerInit()

MouseMove(0, 0, 0)

Send("{SPACE}8")

Sleep(2000)

Send("1")

Sleep(3000)

Do

GUI()

Sleep(5)

$BobberPos = PixelSearch($Left, $Top, $Right, $Bottom, $Red, 10, 3)

CheckTimer(@error)

Until @error <> 1

If IsArray($BobberPos) Then

MouseMove($BobberPos[0], $BobberPos[1], 5)

$SLeft = $BobberPos[0] - 35

$SRight = $SLeft + 60

$STop = $BobberPos[1] - 35

$SBottom = $STop + 65

EndIf

Sleep(1000)

Do

GUI()

Sleep(5)

$SplashPos = PixelSearch($SLeft, $STop, $SRight, $SBottom, $Splash, 20, 2)

CheckTimer(@error)

Until @error <> 1

If IsArray($SplashPos) Then MouseClick("right", $SplashPos[0], $SplashPos[1], 1, 0)

Sleep(3000)

WEnd

Until $Loop = 0

EndFunc ;==>Bot

Func Window()

Local $Old = $SetWin

Select

Case WinExists("World of Warcraft") And WinGetProcess("World of Warcraft") = ProcessExists("WoW.exe")

$SetWin = 1

Case Else

$SetWin = 0

EndSelect

Select

Case $Old = $SetWin

; Do Nothing (Window has not changed)

Case $SetWin = 0

GUICtrlSetData($WindowDisplay, "")

GUICtrlSetData($WindowDisplay, "Window Not Found")

Case $SetWin = 1

GUICtrlSetData($WindowDisplay, "")

GUICtrlSetData($WindowDisplay, "FOUND : " & WinGetTitle("World of Warcraft"))

EndSelect

EndFunc ;==>Window

Func CheckTimer($PixelError)

If TimerDiff($Timer) >= $MaxTime Then

SetError(0)

Return -1

EndIf

SetError($PixelError)

EndFunc ;==>CheckTimer

Func GUI()

Local $Msg = GUIGetMsg()

Select

Case $Msg = $GUI_EVENT_CLOSE

MsgBox(0, "Exit...", "Thank you for using World of Warcraft Fisher!")

GUIDelete($FishGUI)

Exit

Case _IsPressed("1B") And $Loop = 1 Or $Msg = $STop And $Loop = 1

$Loop = 0

WinActivate("World of Warcraft Fisher")

WinWaitActive("World of Warcraft Fisher")

MsgBox(0, "World of Warcraft", "Fisher has stopped.")

Case $Msg = $Start And $Loop = 0

$Loop = 1

Select

Case $Red = -1

MsgBox(16, "Error", "Please select a color first.")

Case Else

Bot()

EndSelect

Case $OldSelect <> GUICtrlRead($ColorSelect) And $Msg = $ColorSelect

$OldSelect = GUICtrlRead($ColorSelect)

GUICtrlSetBkColor($RedPreview, IniRead("Colors.ini", "Standard", $OldSelect, -1))

GUICtrlSetData($RedPreview, "")

$Red = IniRead("Colors.ini", "Standard", $OldSelect, -1)

EndSelect

Window()

EndFunc ;==>GUI

Color.ini

[standard]

List=Stormwind City (Day)|Stormwind City (Night)|Lakeridge (Night)|Menethil Harbor(Day)|Menethil Harbor(Night) 1|Menethil Harbor(Night) 2|Menethil Harbor(Night) 3|Darkshire(Night)|Ashenvale(Night)|Durotar(Day)

Stormwind City (Day)=0xCA4622

Lakeridge (Night)=0x50321E

Stormwind City (Night)=0x350D0C

Menethil Harbor(Day)=0xA42D04

Menethil Harbor(Night) 1=0x883D25

Menethil Harbor(Night) 2=0x011E1D

Menethil Harbor(Night) 3=0x9E2807

Darkshire(Night)=0x2D160D

Ashenvale(Night)=0x271D24

Durotar(Day)=0xF0C99E

Readme.txt

Edited by JamesDover
Link to comment
Share on other sites

You can find the bobber easily by checking the state of your mouse in game using memory reverse engineering (if you know how to work with memory reading that is).

The problem is finding out when the fish bites.

Link to comment
Share on other sites

Can Anyone fix up my code as i dont not understand the other ones... i have looked at many others.....

All i need is the color of the bobber, and then it should be ok, and it will also need alot of testing.... also, i think some of the other code should be fixed up...(if the bobber is not found it will just continue to search for it)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...