GW Working Bots 2020

03/14/2020 15:25 oneshout#76
Quote:
Originally Posted by Betzi4 View Post
Okay yeah, this did it. Thanks. Just a question, are you checking header values manually with updates when comparing to GWCA, or do you have some handy tool or whatever?
It take 2 min manually ;) if you are not sure, do some test (i'm not english and my english learning is bad, just to say you it's not difficult to find the good header)
03/14/2020 18:20 ninjamoment#77
@[Only registered and activated users can see links. Click Here To Register...]
où trouver une liste des en-têtes mis à jour?
Avez-vous également une fonction de prise en charge qui fonctionne?

Also thank you for all your help, I am learning the bot and having a lot of fun.
03/14/2020 18:31 phat34#78
For Next Loops are your friend when finding new headers.... -- you might have to reload GW a few times to find them however...
03/14/2020 19:00 oneshout#79
Quote:
Originally Posted by ninjamoment View Post
@[Only registered and activated users can see links. Click Here To Register...]
où trouver une liste des en-têtes mis à jour?
Avez-vous également une fonction de prise en charge qui fonctionne?

Also thank you for all your help, I am learning the bot and having a lot of fun.
you can find the list of Opcodes [Only registered and activated users can see links. Click Here To Register...]
03/14/2020 19:00 ninjamoment#80
Quote:
Originally Posted by phat34 View Post
For Next Loops are your friend when finding new headers.... -- you might have to reload GW a few times to find them however...
ah I see, youre just brute force guessing them lol fair enough!

Im trying to figure out how to use the PickUpItem Function as it is currently not working. I know that I am not calling this function properly, but in the old code they literally just call

PickUpItem() but this is erroring that incorrect parameters are being used?

PHP Code:
Func PickUpItem($aItem)
    
Local $lAgentID

    
If IsDllStruct($aItem) = 0 Then
        $lAgentID 
$aItem
    
ElseIf DllStructGetSize($aItem) < 400 Then
        $lAgentID 
DllStructGetData($aItem'AgentID')
    Else
        
$lAgentID DllStructGetData($aItem'ID')
    EndIf

    Return 
SendPacket(0xC$HEADER_ITEM_PICKUP$lAgentID0)
EndFunc   ;==>PickUpItem 
03/14/2020 19:06 oneshout#81
Quote:
Originally Posted by ninjamoment View Post
ah I see, youre just brute force guessing them lol fair enough!

Im trying to figure out how to use the PickUpItem Function as it is currently not working. I know that I am not calling this function properly, but in the old code they literally just call

PickUpItem() but this is erroring that incorrect parameters are being used?

PHP Code:
Func PickUpItem($aItem)
    
Local $lAgentID

    
If IsDllStruct($aItem) = 0 Then
        $lAgentID 
$aItem
    
ElseIf DllStructGetSize($aItem) < 400 Then
        $lAgentID 
DllStructGetData($aItem'AgentID')
    Else
        
$lAgentID DllStructGetData($aItem'ID')
    EndIf

    Return 
SendPacket(0xC$HEADER_ITEM_PICKUP$lAgentID0)
EndFunc   ;==>PickUpItem 
No problem with this function, What is your header for $HEADER_ITEM_PICKUP on GWA2 ?
03/14/2020 19:09 ninjamoment#82
Quote:
Originally Posted by oneshout View Post
No problem with this function, What is your header for $HEADER_ITEM_PICKUP on GWA2 ?

0x46
03/14/2020 19:40 Zvend#83
Quote:
Originally Posted by ninjamoment View Post
0x46
your function and header seems o.k.

nothe that the AgentID must be an GroundItem.
If you re not near the item. you will see that nothing happens and shortly after few seconds u port to the item.
(this means the server knows u re picking the item up but ur client not.)

If this is the case for u then everything is fine. Else just use a move_to to the item before sending the packet.

If it still crashes then try to send other packets and if it does crash then its probably ur sendPacket function.
03/14/2020 19:41 oneshout#84
Quote:
Originally Posted by ninjamoment View Post
0x46
A Zvend said, test with a move_to before sending the packet
But maybe it come from the pickuploot function tho; Pickupitem is call inside the pickuploot

ex:
Code:
 Func PickUpLoot()
	Local $lAgent
	Local $aitem
	Local $lDeadlock
	For $i = 1 To GetMaxAgents()
		If GetIsDead(-2) Then Return
		$lAgent = GetAgentByID($i)
		If DllStructGetData($lAgent, 'Type') <> 0x400 Then ContinueLoop
		$aitem = GetItemByAgentID($i)
		If CanPickUp($aitem) Then
			PickUpItem($aitem)
			$lDeadlock = TimerInit()
			While GetAgentExists($i)
				Sleep(100)
				If GetIsDead(-2) Then Return
				If TimerDiff($lDeadlock) > 10000 Then ExitLoop
			WEnd
		EndIf
	Next
 EndFunc   ;==>PickUpLoot
and of course a canpickup function that can be a custom one like this for exemple :
Code:
Func CanPickUp($aItem)
	Local $lModelID = DllStructGetData(($aItem), 'ModelID')
	Local $lRarity = GetRarity($aItem)
	Local $Pcon = IsPcon($aItem)
	  Switch $Pcon
	  Case True
	  $PconsItemCount = $PconsItemCount + 1
	  GUICtrlSetData($PconsItemLabel,$PconsItemCount)
	  Return True
   EndSwitch
	If $lModelID == 2511 And GetGoldCharacter() < 99000 Then Return True	; gold coins (only pick if character has less than 99k in inventory)
    If $lModelID > 21785 And $lModelID < 21806 Then Return False	; Elite/Normal Tomes
	If $lModelID == $ITEM_ID_DYES Then	; if dye
		Switch DllStructGetData($aItem, "ExtraID")
			Case $ITEM_EXTRAID_BLACKDYE, $ITEM_EXTRAID_WHITEDYE ; only pick white and black ones
				Return False
			Case Else
				Return False
		EndSwitch
	EndIf
	If $lRarity == $RARITY_GOLD 			Then Return True; gold items
	If $lModelID == $ITEM_ID_LOCKPICKS 		Then Return True ; Lockpicks
	If $lModelID == $ITEM_ID_GLACIAL_STONES Then Return False ; glacial stones
	If $lModelID == $ITEM_ID_WAYFARERS_MARK	Then Return False ; Wayfarers Mark
	; ==== Pcons ====
	If $lModelID == $ITEM_ID_TOTS 			Then Return True
	If $lModelID == $ITEM_ID_GOLDEN_EGGS 	Then Return True
	If $lModelID == $ITEM_ID_BUNNIES 		Then Return True
	If $lModelID == $ITEM_ID_GROG 			Then Return True
	If $lModelID == $ITEM_ID_CLOVER 		Then Return True
	If $lModelID == $ITEM_ID_PIE			Then Return True
	If $lModelID == $ITEM_ID_CIDER			Then Return True
	If $lModelID == $ITEM_ID_POPPERS		Then Return True
	If $lModelID == $ITEM_ID_ROCKETS		Then Return True
	If $lModelID == $ITEM_ID_CUPCAKES		Then Return True
	If $lModelID == $ITEM_ID_SPARKLER		Then Return True
	If $lModelID == $ITEM_ID_HONEYCOMB		Then Return True
	If $lModelID == $ITEM_ID_VICTORY_TOKEN	Then Return True
	If $lModelID == $ITEM_ID_LUNAR_TOKEN	Then Return True
	If $lModelID == $ITEM_ID_HUNTERS_ALE	Then Return True
	If $lModelID == $ITEM_ID_LUNAR_TOKENS	Then Return True
	If $lModelID == $ITEM_ID_KRYTAN_BRANDY	Then Return True
	If $lModelID == $ITEM_ID_BLUE_DRINK		Then Return True
    If $lModelID == $ITEM_ID_GHOST_IN_A_BOX Then Return True
	If $lModelID == $ITEM_ID_SHAMROCK_ALE	Then Return True

	; If you want to pick up more stuff add it here
	Return False
EndFunc   ;==>CanPickUp
03/14/2020 19:46 ninjamoment#85
@[Only registered and activated users can see links. Click Here To Register...] - Alright that is an interesting thought, it looks like the loot is right beside me and also its not crashing the GW client only the Autoit program, not sure if that makes a difference. Thank you so much for your input!
@[Only registered and activated users can see links. Click Here To Register...] - I will try that bit of code and see if it works! Also thank you so much for taking the time to help me out! :):feelsgoodman:
@[Only registered and activated users can see links. Click Here To Register...] - It looks like my GWA2 was missing the PickUpLoot function!!!!!!

It is now picking up the items! Thanks!

Im going to be working on the Merchant/Sell functions now to try and get this bot 100% working and I will reupload for everyone! thanks again!

Okay, I have run the bot a few times, and it is picking up correctly and traveling without any problems.

Once the bot sees I have less than 4 or 5 slots (I forget how many exactly) travels to GH to talk to the merchant. I have been using the Out("Made it this Far") to try and pinpoint where the issue is happening. :p

Looks like I'm having an issue inside this section

PHP Code:
 Func Merchant()
    
Dim $Waypoints_by_Merchant[29][3] = [ _
            
[$BurningIsle, -4439, -2088], _
            
[$BurningIsle, -4772, -362], _
            
[$BurningIsle, -36371088], _
            
[$BurningIsle, -2506988], _
            
[$DruidsIsle, -20372964], _
            
[$FrozenIsle992660], _
            
[$FrozenIsle71834], _
            
[$FrozenIsle, -29979], _
            
[$HuntersIsle51567789], _
            
[$HuntersIsle44165656], _
            
[$IsleOfTheDead, -4066, -1203], _
            
[$NomadsIsle51294748], _
            
[$WarriorsIsle41598540], _
            
[$WarriorsIsle55759054], _
            
[$WizardsIsle42888263], _
            
[$WizardsIsle35839040], _
            
[$ImperialIsle141512448], _
            
[$ImperialIsle174611516], _
            
[$IsleOfJade88253384], _
            
[$IsleOfJade101423116], _
            
[$IsleOfMeditation, -3318084], _
            
[$IsleOfMeditation, -17458681], _
            
[$IsleOfMeditation, -21978076], _
            
[$IsleOfWeepingStone, -30958535], _
            
[$IsleOfWeepingStone, -39887588], _
            
[$CorruptedIsle, -46705630], _
            
[$IsleOfSolitude29701532], _
            
[$IsleOfWurms82843578], _
            
[$UnchartedIsle1503, -2830]]
    For 
$i 0 To (UBound($Waypoints_by_Merchant) - 1)
        If (
$Waypoints_by_Merchant[$i][0] == TrueThen
            
Do
                
GenericRandomPath($Waypoints_by_Merchant[$i][1], $Waypoints_by_Merchant[$i][2], Random(60802))
            
Until CheckArea($Waypoints_by_Merchant[$i][1], $Waypoints_by_Merchant[$i][2])
        EndIf
    
Next

    Out
("Going to Merchant")

    Do
        
RndSleep(Random(250,500))
        
Local $Me GetAgentByID(-2)
        
Out("Made it this far")
        
Local $guy GetNearestNPCToCoords(DllStructGetData($Me'X'), DllStructGetData($Me'Y'))
    
Until DllStructGetData($guy'Id') <> 0
    ChangeTarget
($guy)
    
RndSleep(Random(250,500))
    
GoNPC($guy)
    
RndSleep(Random(250,500))
    Do
        
MoveTo(DllStructGetData($guy'X'), DllStructGetData($guy'Y'), 40)
        
RndSleep(Random(500,750))
        
GoNPC($guy)
        
RndSleep(Random(250,500))
        
Local $Me GetAgentByID(-2)
    
Until ComputeDistance(DllStructGetData($Me'X'), DllStructGetData($Me'Y'), DllStructGetData($guy'X'), DllStructGetData($guy'Y')) < 250
    RndSleep
(Random(1000,1500))

EndFunc ;~ Merchant 
So I'm looking over at the GWA2 and my header that I believe it is using is

PHP Code:
Global Const $HEADER_NPC_TALK 0x3F 
And GWA2 is using the Function GetNearestNPCToCoords() below
PHP Code:
Func GetNearestNPCToCoords($aX$aY)
    
Local $lNearestAgent$lNearestDistance 100000000
    Local $lDistance
    Local $lAgentArray 
GetAgentArray(0xDB)

    For 
$i 1 To $lAgentArray[0]
        If 
DllStructGetData($lAgentArray[$i], 'Allegiance') <> 6 Then ContinueLoop
        
If DllStructGetData($lAgentArray[$i], 'HP') <= 0 Then ContinueLoop
        
If BitAND(DllStructGetData($lAgentArray[$i], 'Effects'), 0x0010) > 0 Then ContinueLoop

        $lDistance 
= ($aX DllStructGetData($lAgentArray[$i], 'X')) ^ + ($aY DllStructGetData($lAgentArray[$i], 'Y')) ^ 2

        
If $lDistance $lNearestDistance Then
            $lNearestAgent 
$lAgentArray[$i]
            
$lNearestDistance $lDistance
        
EndIf
    
Next

    SetExtended
(Sqrt($lNearestDistance))
    Return 
$lNearestAgent
EndFunc   
;==>GetNearestNPCToCoords 
I tried changing the Header but it appears that the header is correct as the merchant is being highlighted?
03/14/2020 22:27 ninjamoment#86
Here is my own current Vaettir build with build notes. Not everything is working so be sure to read the notes!

Please note I just started learning like 2 days ago but I have a background in C# in Object-Oriented programming so please be patient, I am doing this for fun. :bandit:

Love you!
03/14/2020 23:11 oneshout#87
Quote:
Originally Posted by ninjamoment View Post

So I'm looking over at the GWA2 and my header that I believe it is using is

PHP Code:
Global Const $HEADER_NPC_TALK 0x3F 
I tried changing the Header but it appears that the header is correct as the merchant is being highlighted?
try this instead :

Code:
Global Const $HEADER_NPC_TALK = 0x40
03/14/2020 23:31 arkazann#88
Quote:
Originally Posted by ninjamoment View Post
Here is my own current Vaettir build with build notes. Not everything is working so be sure to read the notes!

Please note I just started learning like 2 days ago but I have a background in C# in Object-Oriented programming so please be patient, I am doing this for fun. :bandit:

Love you!
thank you, it works
03/14/2020 23:34 jimmytwiggs#89
So i am working on updating a W/N Raptor farm bot now instead. I was crashing due to hard mode header for a bit but got that figured out. But now i am getting a disconnect from server instead at same place it seems.

Code:
Global Const $HEADER_MODE_SWITCH = 0xA3
Code:
Func SetUpFastWay()
	SwitchMode(1)
	Out("Setting up Resign")
	MoveTo(19649, 16791)
	Move(20084, 16854)
	Sleep(3000)
	Out("Travel: Riven Earth")
	WaitMapLoading($MAP_ID_RIVEN)
	Move(-26309, -4112)
	Sleep(3000)
	Out("Travel: Rata Sum")
	WaitMapLoading($MAP_ID_RATA)
EndFunc
I am disconnecting right around Setting up Resign message,either just before or just after. is something still wrong with that hard mode command? I checked the gwa2 and made sure switchmode and move and moveto were all there. Any thoughts?

I will share this bot once i get it working :)


EDIT - i commented out the hard mode switch and it still disconnected me. must be somewhere else in the code? unless its the movement but that seems odd. ill take another look.


EDIT EDIT - added some sleeps and logs to the code to better time where the crash was happening. Looks like its when it tried to add Xandra to the party. I commented that out and added her myself, it works. is there something wrong with this line?

Code:
AddHero(17) ;Xandra
but now i'm hitting a new crash down the line, i think counting inventory slots? gotta dig some more.


EDIT EDIT EDIT - it seems heroes are causing issues. The new crash was on DisableHeroSkills, now i am crashing on UseHeroSkill. Also on Dialouge but that seems like a different issue. Anyone else having hero issues?
03/15/2020 00:06 oneshout#90
Quote:
Originally Posted by jimmytwiggs View Post
So i am working on updating a W/N Raptor farm bot now instead. I was crashing due to hard mode header for a bit but got that figured out. But now i am getting a disconnect from server instead at same place it seems.

Code:
Global Const $HEADER_MODE_SWITCH = 0xA3
Code:
Func SetUpFastWay()
	SwitchMode(1)
	Out("Setting up Resign")
	MoveTo(19649, 16791)
	Move(20084, 16854)
	Sleep(3000)
	Out("Travel: Riven Earth")
	WaitMapLoading($MAP_ID_RIVEN)
	Move(-26309, -4112)
	Sleep(3000)
	Out("Travel: Rata Sum")
	WaitMapLoading($MAP_ID_RATA)
EndFunc
I am disconnecting right around Setting up Resign message,either just before or just after. is something still wrong with that hard mode command? I checked the gwa2 and made sure switchmode and move and moveto were all there. Any thoughts?

I will share this bot once i get it working :)


EDIT - i commented out the hard mode switch and it still disconnected me. must be somewhere else in the code? unless its the movement but that seems odd. ill take another look.
This bot add hero and use hero skills for the run but aren't updated for the moment ;)
your problem is somewhere here :

Code:
While 1
   Global $Me = GetAgentByID(-2)
   Checkmap()
	If $SuccessfulRunCount = 0 Then
		UpdateCounts()
		SwitchMode(1)
		AddHero(17) ;Xandra
		;AddHero(xx) ;Hayda
		StoreBoneDustIron()
		SetUpFastWay()
		DisableHeroSkills()
do the run without the need of hero...