Code:
#include <nomadmemory.au3>
#include <Math.au3>
Global Const = "World of WarCraft (build 6803)"
Global Const = 0x00C4CEF8
Global Const = 0x00CD7F5C
Global Const = 0x00CD7F60
Global Const = 0x00CD7F64
Global Const = 0x00B759C8
Global Const = 0x00000000
Global Const = 0x007D1640
Global Const =0x00C092F8
Global Const =0x00C092F5
;+---------------------------------------------------------------
;|Incase Blizzard thinks about changing wintitle or process name.
;|
= 'World of Warcraft'
= 'WoW.exe'
;|
;+---------------------------------------------------------------
;===============================================================================
;
; Function Name: _WoWPid()
; Description: Returns WoW pid. Needed to read WoW memory.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - Return WoW PID.
; On Failure - Return 0.
; @error handling: 0 - No error.
; 1 - Unable to find PID.
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.01
;
; Changes: V.1.00 - Suggestion.
; V.1.01 - Code rewritten by CodeMaster Rapture, will return the same code just alot more cleaner.
;
;===============================================================================
Func _WoWPid()
Local = ProcessExists()
If ( == 0) Then
= ProcessExists()
EndIf
If ( == 0) Then
SetError(1)
Else
SetError(0)
EndIf
Return
EndFunc;==> _WoWPid()
;===============================================================================
;
; Function Name: _WoWActivate()
; Description: Activates WoW window if needed. Will not activate if window is active.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - 1 activated window, 0 window was active.
; On Failure - Returns 0 and sets @error to 1 if window is not found.
; @error handling: 0 - No error.
; 1 - No Window found.
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;===============================================================================
Func _WoWActivate()
= WinGetTitle()
If WinExists() = 0 Then
SetError(1)
Return 0
EndIf
If WinActive(, '') = 0 Then
WinActivate(, '')
SetError(0)
Return 1
Else
SetError(0)
Return 0
EndIf
EndFunc;==> _WoWActivate()
;===============================================================================
;
; Function Name: _WoWHide()
; Description: Hides WoW window if needed. Will not hide if window is hidden.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - 1 window hidden, 0 window was hidden.
; On Failure - Returns 0 and sets @error to 1 if window is not found.
; @error handling: 0 - No error.
; 1 - No Window found.
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;===============================================================================
Func _WoWHide()
= WinGetTitle()
If WinExists() = 0 Then
SetError(1)
Return 0
EndIf
If WinActive(, '') = 1 Then
WinSetState(, '', @SW_MINIMIZE)
SetError(0)
Return 1;window was hidden.
Else
SetError(0)
Return 0;window was not active.
EndIf
EndFunc;==> _WoWHide()
;===============================================================================
;
; Function Name: _WoWPos()
; Description: Get position and size of WoW window.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - Returns = X position, = Y position, = Width, = Height.
; On Failure - Returns 0 and sets @error to 1 if window is not found.
; @error handling: 0 - No error.
; 1 - No Window found.
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;===============================================================================
Func _WoWPos()
= WinGetTitle()
If WinExists() = 0 Then
SetError(1)
Return 0
EndIf
= WinGetPos(, '')
SetError(0)
Return
EndFunc
;===============================================================================
;
; Function Name: _WoWPath()
; Description: Path to where WoW is located, by reading reg.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - Return path to where WoW.exe is located.
; On Failure - FileSelectFolder window is shown, and path will be stored.
; @error handling: 0 - No error.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;===============================================================================
Func _WoWPath()
= RegRead("HKEY_LOCAL_MACHINESOFTWAREBlizzard EntertainmentWorld of Warcraft", "InstallPath")
If = '' Then
= FileSelectFolder("Select your " & & " folder.", "")
= & ""
RegWrite("HKEY_LOCAL_MACHINESOFTWAREBlizzard EntertainmentWorld of Warcraft", "InstallPath", "REG_SZ", )
=
SetError(0)
Return
EndIf
SetError(0)
Return
EndFunc;==> _WoWPath()
;===============================================================================
;
; Function Name: _WoWMemOpen()
; Description: Open memory handle.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running, and nomadmemory.au3
; Return Value(s): On Success - WoW memory handle.
; On Failure - return 0 and @error set to 1.
; @error handling: 0 - No error.
; 1 - Unable to open memory.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;===============================================================================
Func _WoWMemOpen()
= _MemoryOpen (_WoWPid())
Local = _MemoryRead (, , 'char[35]')
If ( <> ) Then
MsgBox(16, "Critical Error", "These pointers are for " & )
EndIf
Return
EndFunc;==> _WoWMemOpen()
;===============================================================================
;
; Function Name: _WoWMemRead(,,)
; Description: Reads memory adress, use handle previously opened with _WoWMemOpen()
; Parameter(s): - Memory adress you want to read, , - float,int etc...
;
; Requirement(s): World of Warcraft running, and nomadmemory.au3
; Return Value(s): On Success - Retun value og adress.
; On Failure - return 0 and @error set to 1.
; @error handling: 0 - No error.
; 1 - Unable to open memory.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWMemRead(, , )
= _MemoryRead (, , )
If @error Then
SetError(1)
Return 0
EndIf
SetError(0)
Return
EndFunc;==> _WoWMemRead()
;===============================================================================
;
; Function Name: _WoWMemClose()
; Description: Close memory handle, use handle previously opened with _WoWMemOpen()
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running, and nomadmemory.au3
; Return Value(s): On Success - return 1 and @error set to 0.
; On Failure - return 0 and @error set to 1.
; @error handling: 0 - No error.
; 1 - Unable to open memory.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWMemClose()
_MemoryClose ()
If @error Then
SetError(1)
Return 0
EndIf
SetError(0)
Return 1
EndFunc;==> _WoWMemClose()
;===============================================================================
;
; Function Name: _WoWMemCord()
; Description: Returns array[3][2] [][Memory adress,Info,Value]
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running, and nomadmemory.au3
; Return Value(s): On Success - returns array.
; On Failure - return 0 and @error set to 1.
; @error handling: 0 - No error.
; 1 - Unable to open memory.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWMemCord();Needs ideas...
Dim [3]
[0] =
[1] = 'X-Cord'
[2] = Floor(_WoWMemRead([0], , 'float'))
If @error Then
SetError(1)
Return 0
EndIf
[0] =
[1] = 'Y-Cord'
[2] = Floor(_WoWMemRead([0], , 'float'))
If @error Then
SetError(1)
Return 0
EndIf
[0] =
[1] = 'Z-Cord'
[2] = Floor(_WoWMemRead([0], , 'float'))
If @error Then
SetError(1)
Return 0
EndIf
[0] =
[1] = 'Rotation'
[2] = Floor(_WoWMemRead([0], , 'float') / (3.14159265358979 / 180))
If @error Then
SetError(1)
Return 0
EndIf
Return
EndFunc;==> _WoWMemCord()
;===============================================================================
;
; Function Name: _WoWRotateTo(,,)
; Description: Rotate to cord X an Y, also needs handle.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running, and nomadmemory.au3
; Return Value(s): On Success - rotates char to given X,Y cord.
; On Failure - None.
; @error handling: 0 - No error.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWRotateTo(, , )
= 1; Turning Factor, If your toons spins like a tornado try setting this to 10. Default is 1. Min is 1 fast; Max is 50 slow.
= _WoWRotNeeded(, , )
_WoWActivate()
= WinGetTitle()
If WinExists() = 0 Then
SetError(1)
Return 0
EndIf
= WinGetPos()
MouseMove((( / 2) + ) , (( / 2) + ), 0)
MouseDown("right")
Sleep(20)
Do
= _WoWMemCord()
= 0
= [2]
Do
+= 1
If > 359 Then
= 0
EndIf
+= 1
Until =
If > 180 Then
= 1
= (360 - ) * 5
Else
= 0
= * 5
EndIf
If = 1 Then
If > 400 Then
_MouseMovePlus(+400 / , 0)
ElseIf > 300 And < 400 Then
_MouseMovePlus(+300 / , 0)
ElseIf > 200 And < 300 Then
_MouseMovePlus(+200 / , 0)
ElseIf > 100 And < 200 Then
_MouseMovePlus(+100 / , 0)
Else
_MouseMovePlus(+50 / , 0)
EndIf
Else
If > 400 Then
_MouseMovePlus(-400 / , 0)
ElseIf > 300 And < 400 Then
_MouseMovePlus(-300 / , 0)
ElseIf > 200 And < 300 Then
_MouseMovePlus(-200 / , 0)
ElseIf > 100 And < 200 Then
_MouseMovePlus(-100 / , 0)
Else
_MouseMovePlus(-50 / , 0)
EndIf
EndIf
= _WoWMemCord()
If > [2] Then
= - [2]
Else
= [2] -
EndIf
Until < 3
MouseUp('right')
EndFunc;==> _WoWRotateTo()
;===============================================================================
;
; Function Name: _WoWRotNeeded(,,)
; Description: Rotation needed to cord X an Y, also needs handle.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running, and nomadmemory.au3
; Return Value(s): On Success - returns value needed to rotate to X,Y.
; On Failure - None.
; @error handling: 0 - No error.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWRotNeeded(, , )
Local = 4 * ATan(1)
= _WoWMemCord()
= [2]
= [2]
=
=
= -180 /
= ATan(( - ) / ( - )) *
If < Then
If < 0 Then
= 360 +
Else
;~ = 270 +
EndIf
EndIf
If >= Then
If < 0 Then
= 180 +
Else
= 180 +
EndIf
EndIf
If Floor() = "360" Then = 0
Return Floor()
EndFunc;==> _WoWRotNeeded()
;===============================================================================
;
; Function Name: _MouseMovePlus(,,)
; Description: Great mousemovement tool.
; Parameter(s): ,,
;
; Requirement(s): user32.dll
; Return Value(s): On Success - ??
; On Failure - ??
; @error handling:
;
; Author(s): Oxin8
;
; Date: 09.02.2006
; Uppdated: ???
; Version: ???
;
;==============================================================================
Func _MouseMovePlus(, , = 0)
Local = 1
Local = 32768
DllCall("user32.dll", "none", "mouse_event", _
"long", + ( * ), _
"long", , _
"long", , _
"long", 0, _
"long", 0)
EndFunc;==> _MouseMovePlus()
;===============================================================================
;
; Function Name: _WoWStart()
; Description: Starts World of Warcraft it its not running.
; Parameter(s): NONE.
;
; Requirement(s): Having WoW.
; Return Value(s): On Success - Starts WoW if its not running else returns 0
; On Failure - None.
; @error handling: 0 - WoW was allready running.
; 1 - WoW was started.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWStart()
= _WoWPid()
If = 0 Then
Run(_WoWPath() & , _WoWPath())
Return 1
EndIf
Return 0
EndFunc;==> _WoWStart()
;===============================================================================
;
; Function Name: _WoWLogin()
; Description: Login to account.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - 0 = Loggs on to desired account.
; On Failure - 1 = Allready logged inn past intro screen.
; @error handling: None.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 02.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWLogin(, , )
_WoWActivate()
= WinGetTitle()
= _WoWPos()
WinMove(, '', 0 + , 0 + , 808, 634)
If _WoWScreen() = 0 Then
MouseClick('left', 371 + , 343 + , 1, 0)
Send()
MouseClick('left', 371 + , 400 + , 1, 0)
Send()
MouseClick('left', 371 + , 450 + , 1, 0)
Return 1
Else
Return 0
EndIf
EndFunc;==> _WoWLogin()
;===============================================================================
;
; Function Name: _WoWCharSelect()
; Description: Logonto desired char, select char number counting 1 to max chars.
; Parameter(s): , choose number betewwn 1 to max char, counting from top to bottom.
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - Logs on to desired char.
; On Failure - None.
; @error handling: 0 - None.
; 1 - window does not exist.
;
; Author(s): jokke
;
; Date: 02.06.2007
; Uppdated: 04.06.2007
; Version: V.1.00
;
; Changes: V.1.0 Release.
; V.1.1 Rewritten poor code.
;
;==============================================================================
Func _WoWCharSelect()
_WoWActivate()
= WinGetTitle()
= _WoWPos()
WinMove(, '', 0 + , 0 + , 808, 634)
Dim = 42
*=
MouseClick('left', 641 + , 73 + + , 2, 0)
EndFunc;==> _WoWCharSelect()
;===============================================================================
;
; Function Name: _WoWDistance(,,)
; Description: Calculates distance to desired X, Y pos. Requires handle.
; Parameter(s): = X-cordinate, = Y-cordinate, = Memory handle.
;
; Requirement(s): World of Warcraft running, nomadmemory.au3
; Return Value(s): On Success - Returns calculated distance to desired X, Y pos.
; On Failure - None.
; @error handling: 0 - None.
;
; Author(s): jokke, Zephir
;
; Date: 02.06.2007
; Uppdated: 04.06.2007
; Version: V.1.01
;
; Changes: V.1.00 - Release (was broken)
; V.1.01 - Zephir rewrote it and its working, thanks to him.
;
;==============================================================================
Func _WoWDistance(, , )
= _WoWMemCord()
= Sqrt(( - [2]) ^ 2+ ( - [2]) ^ 2)
Return
EndFunc;==> _WoWDistance()
;===============================================================================
;
; Function Name: _WoWScreen()
; Description: Reads memory to determine witch screen your at. Intro / Char-Logged on.
; Parameter(s): NONE.
;
; Requirement(s): World of Warcraft running, nomadmemory.au3
; Return Value(s): On Success - 0 - 10, 0 = Intro screen, 1 - 10 = class.
; On Failure - None.
; @error handling: 0 - Sucseeded reading memory.
; 1 - Unable to read memory?
;
; Author(s): jokke
;
; Date: 03.06.2007
; Uppdated: 03.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWScreen()
= _WoWMemRead(, , 'char[9]')
SetError(0)
If = 'Intro' Then
Return 0
ElseIf = 'BloodElf' Then
Return 1
ElseIf = 'Draenei' Then
Return 2
ElseIf = 'Dwarf' Then
Return 3
ElseIf = 'Gnome' Then
Return 4
ElseIf = 'Human' Then
Return 5
ElseIf = 'NightElf' Then
Return 6
ElseIf = 'OrcTroll' Then
Return 7
ElseIf = 'Tauren' Then
Return 8
ElseIf = 'OrcTroll' Then
Return 9
ElseIf = 'Undead' Then
Return 10
EndIf
SetError(1)
EndFunc;==> _WoWScreen()
;===============================================================================
;
; Function Name: _WoWRotationMargin(,,)
; Description: returns closest angle to position maxvalue 180*
; Parameter(s): ,,
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - Current angle needed to get to target.
; On Failure - None.
; @error handling: 0 - Sucseeded reading memory.
; 1 - Unable to read memory?
;
; Author(s): jokke
;
; Date: 04.06.2007
; Uppdated: 04.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWRotationMargin(, , )
= _WoWRotNeeded(, , )
= _WoWMemCord()
= 0
= [2]
Do
+= 1
If > 359 Then
= 0
EndIf
+= 1
Until =
If > 180 Then
= 1
= (360 - )
Else
= 0
=
EndIf
Return
EndFunc;==> _WoWRotationMargin()
;===============================================================================
;
; Function Name: _WoWGotTo(,,, = 4, = 3)
; Description: walk to target position.
; Parameter(s): ,,, = 4 (if angle to target > XXX adjust), = 3 (units witin then sucseed)
;
; Requirement(s): World of Warcraft running.
; Return Value(s): On Success - Walking you to desired position.
; On Failure - None.
; @error handling: 0 - ?
; 1 - ?
;
; Author(s): jokke
;
; Date: 04.06.2007
; Uppdated: 04.06.2007
; Version: V.1.00
;
;==============================================================================
Func _WoWGotTo(, , , = 2, = 1)
_WoWActivate()
Send("{w down}")
Do
If _WoWRotNeeded(, , ) > Then
_WoWRotateTo(, , )
EndIf
= _WoWMemCord()
= _Max(([2] + [2]) , ( + )) - _Min(([2] + [2]) , ( + ))
Until <
Send("{w up}")
EndFunc;==> _WoWGotTo()