Register for your free account! | Forgot your password?

You last visited: Today at 10:14

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Updated GWA2

Discussion on Updated GWA2 within the GW Exploits, Hacks, Bots, Tools & Macros forum part of the Guild Wars category.

Reply
 
Old 05/29/2020, 02:15   #151
 
elite*gold: 0
Join Date: Sep 2018
Posts: 89
Received Thanks: 75
Quote:
Originally Posted by corey54321 View Post
I think the GetAgentByName() function is broken that seems to be what is going on to make it work in any town.

I got it to work in eye of the north will salvage and buy kits and withdraw gold from chest if needed.

You can change lines
Code:
24 ZoneMap(642) ; to the town you want 
128 	GoNearestNPCToCoords(-2748.00, 1019.00) ; to the merchant in the same town of your choice
Can maybe use the ID's of each trader by town:

Code:
;~ Description: Return merchant depending on MapID.
Func GetMerchant($aMapID = GetMapID())
    Switch $aMapID
        Case 4, 5, 6, 52, 176, 177, 178, 179 ; proph gh
            Return 209
        Case 275, 276, 359, 360, 529, 530, 537, 538 ; factions and nf gh
            Return 196
        Case 10, 11, 12, 139, 141, 142, 49, 857
            Return 2036
        Case 109, 120, 154
            Return 1993
        Case 116, 117, 118, 152, 153, 38
            Return 1994
        Case 122, 35
            Return 2136
        Case 123, 124
            Return 2137
        Case 129, 348, 390
            Return 3402
        Case 130, 218, 230, 287, 349, 388
            Return 3403
        Case 131, 21, 25, 36
            Return 2086
        Case 132, 135, 28, 29, 30, 32, 39, 40
            Return 2101
        Case 133, 155, 156, 157, 158, 159, 206, 22, 23, 24
            Return 2107
        Case 134, 81
            Return 2011
        Case 136, 137, 14, 15, 16, 19, 57, 73
            Return 1989
        Case 138
            Return 1975
        Case 193, 234, 278, 288, 391
            Return 3618
        Case 194, 213, 214, 225, 226, 242, 250, 283, 284, 291, 292
            Return 3275
        Case 216, 217, 249, 251
            Return 3271
        Case 219, 224, 273, 277, 279, 289, 297, 350, 389
            Return 3617
        Case 220, 274, 51
            Return 3273
        Case 222, 272, 286, 77
            Return 3401
        Case 248
            Return 1207
        Case 303
            Return 3272
        Case 376, 378, 425, 426, 477, 478
            Return 5385
        Case 381, 387, 421, 424, 427, 554
            Return 5386
        Case 393, 396, 403, 414, 476
            Return 5666
        Case 398, 407, 428, 433, 434, 435
            Return 5665
        Case 431
            Return 4721
        Case 438, 545
            Return 5621
        Case 440, 442, 469, 473, 480, 494, 496
            Return 5613
        Case 450, 559
            Return 4989
        Case 474, 495
            Return 5614
        Case 479, 487, 489, 491, 492, 502, 818
            Return 4720
        Case 555
            Return 4988
        Case 624
            Return 6758
        Case 638
            Return 6060
        Case 639, 640
            Return 6757
        Case 641
            Return 6063
        Case 642
            Return 6047
        Case 643, 645, 650
            Return 6383
        Case 644
            Return 6384
        Case 648
            Return 6589
        Case 652
            Return 6231
        Case 675
            Return 6190
        Case 808
            Return 7448
        Case 814
            Return 104
    EndSwitch
EndFunc   ;==>GetMerchant

;~ Description: Return material trader depending on MapID.
Func GetMaterialTrader($aMapID)
    Switch $aMapID
        Case 4, 5, 6, 52, 176, 177, 178, 179 ; proph gh
            Return 204
        Case 275, 276, 359, 360, 529, 530, 537, 538 ; factions and nf gh
            Return 191
        Case 109, 49, 81
            Return 2017
        Case 193
            Return 3624
        Case 194, 242, 857
            Return 3285
        Case 250
            Return 3286
        Case 376
            Return 5391
        Case 398
            Return 5671
        Case 414
            Return 5674
        Case 424
            Return 5392
        Case 433
            Return 5672
        Case 438
            Return 5624
        Case 491
            Return 4726
        Case 492
            Return 4727
        Case 638
            Return 6763
        Case 640
            Return 6764
        Case 641
            Return 6065
        Case 642
            Return 6050
        Case 643
            Return 6389
        Case 644
            Return 6390
        Case 652
            Return 6233
        Case 77
            Return 3415
        Case 808
            Return 7452
        Case 818
            Return 4729
    EndSwitch
EndFunc   ;==>GetMaterialTrader

;~ Description: Return rare material trader depending on MapID.
Func GetRareMaterialTrader($aMapID)
    Switch $aMapID
        Case 4, 5, 6, 52, 176, 177, 178, 179 ; proph gh
            Return 205
        Case 275, 276, 359, 360, 529, 530, 537, 538 ; factions and nf gh
            Return 192
        Case 109
            Return 2003
        Case 193
            Return 3627
        Case 194, 250, 857
            Return 3288
        Case 242
            Return 3287
        Case 376
            Return 5394
        Case 398, 433
            Return 5673
        Case 414
            Return 5674
        Case 424
            Return 5393
        Case 438
            Return 5619
        Case 49
            Return 2044
        Case 491, 818
            Return 4729
        Case 492
            Return 4728
        Case 638
            Return 6766
        Case 640
            Return 6765
        Case 641
            Return 6066
        Case 642
            Return 6051
        Case 643
            Return 6392
        Case 644
            Return 6391
        Case 652
            Return 6234
        Case 77
            Return 3416
        Case 81
            Return 2089
    EndSwitch
EndFunc   ;==>GetRareMaterialTrader

;~ Description: Return rune trader depending on MapID.
Func GetRuneTrader($aMapID)
    Switch $aMapID
        Case 4, 5, 6, 52, 176, 177, 178, 179 ; proph gh
            Return 203
        Case 275, 276, 359, 360, 529, 530, 537, 538 ; factions and nf gh
            Return 190
        Case 109, 814
            Return 2005
        Case 193
            Return 3630
        Case 194, 242, 250
            Return 3291
        Case 248, 857
            Return 1981
        Case 396
            Return 5678
        Case 414
            Return 5677
        Case 438
            Return 5626
        Case 477
            Return 5396
        Case 487
            Return 4732
        Case 49
            Return 2045
        Case 502
            Return 4733
        Case 624
            Return 6770
        Case 640
            Return 6769
        Case 642
            Return 6052
        Case 643, 645
            Return 6395
        Case 644
            Return 6396
        Case 77
            Return 3421
        Case 808
            Return 7456
        Case 81
            Return 2091
        Case 818
            Return 4711
    EndSwitch
EndFunc   ;==>GetRuneTrader

;~ Description: Return dye trader depending on MapID.
Func GetDyeTrader($aMapID)
    Switch $aMapID
        Case 4, 5, 6, 52, 176, 177, 178, 179 ; proph gh
            Return 206
        Case 275, 276, 359, 360, 529, 530, 537, 538 ; factions and nf gh
            Return 193
        Case 109, 49, 81, 857
            Return 2016
        Case 193
            Return 3623
        Case 194, 242
            Return 3284
        Case 250
            Return 3283
        Case 286
            Return 3408
        Case 381, 477
            Return 5389
        Case 403
            Return 5669
        Case 414
            Return 5670
        Case 640
            Return 6762
        Case 642
            Return 6049
        Case 644
            Return 6388
        Case 77
            Return 3407
        Case 812
            Return 2113
        Case 818
            Return 4725
    EndSwitch
EndFunc   ;==>GetDyeTrader

; ~ Description: Return scroll trader depending on MapID.
Func GetScrollTrader($aMapID)
    Switch $aMapID
        Case 4, 5, 6, 52, 176, 177, 178, 179 ; proph gh
            Return 207
        Case 275, 276, 359, 360, 529, 530, 537, 538 ; factions and nf gh
            Return 194
        Case 109
            Return 2004
        Case 193
            Return 3629
        Case 194
            Return 3289
        Case 287
            Return 3419
        Case 396, 414
            Return 5675
        Case 426, 857
            Return 5398
        Case 442, 480
            Return 5627
        Case 49
            Return 2046
        Case 624
            Return 6767
        Case 638
            Return 6062
        Case 639, 640
            Return 6768
        Case 643, 644
            Return 6393
        Case 645
            Return 6394
        Case 77
            Return 3418
        Case 808
            Return 7454
    EndSwitch
EndFunc   ;==>GetScrollTrader
logicdoor is offline  
Old 05/29/2020, 03:44   #152
 
elite*gold: 0
Join Date: Dec 2010
Posts: 59
Received Thanks: 35
I looked into something like that but I was noticing a lot of the merchant have different ids and didn't want to invest a lot of time into in lol it works good enough for what im doing with it
corey54321 is offline  
Old 05/29/2020, 06:34   #153
 
elite*gold: 0
Join Date: Sep 2018
Posts: 89
Received Thanks: 75
Quote:
Originally Posted by corey54321 View Post
I looked into something like that but I was noticing a lot of the merchant have different ids and didn't want to invest a lot of time into in lol it works good enough for what im doing with it
Otherwise you could go by guild hall - I have all waypoints updated except the Rune Traders, only updated two guild halls there (annotated with comments).

Code:
#Region Checking Guild Hall
;~ Checks to see which Guild Hall you are in and the spawn point
Func CheckGuildHall()
	If GetMapID() == $GH_ID_Warriors_Isle Then
		$WarriorsIsle = True
		Out("Warrior's Isle")
	EndIf
	If GetMapID() == $GH_ID_Hunters_Isle Then
		$HuntersIsle = True
		Out("Hunter's Isle")
	EndIf
	If GetMapID() == $GH_ID_Wizards_Isle Then
		$WizardsIsle = True
		Out("Wizard's Isle")
	EndIf
	If GetMapID() == $GH_ID_Burning_Isle Then
		$BurningIsle = True
		Out("Burning Isle")
	EndIf
	If GetMapID() == $GH_ID_Frozen_Isle Then
		$FrozenIsle = True
		Out("Frozen Isle")
	EndIf
	If GetMapID() == $GH_ID_Nomads_Isle Then
		$NomadsIsle = True
		Out("Nomad's Isle")
	EndIf
	If GetMapID() == $GH_ID_Druids_Isle Then
		$DruidsIsle = True
		Out("Druid's Isle")
	EndIf
	If GetMapID() == $GH_ID_Isle_Of_The_Dead Then
		$IsleOfTheDead = True
		Out("Isle of the Dead")
	EndIf
	If GetMapID() == $GH_ID_Isle_Of_Weeping_Stone Then
		$IsleOfWeepingStone = True
		Out("Isle of Weeping Stone")
	EndIf
	If GetMapID() == $GH_ID_Isle_Of_Jade Then
		$IsleOfJade = True
		Out("Isle of Jade")
	EndIf
	If GetMapID() == $GH_ID_Imperial_Isle Then
		$ImperialIsle = True
		Out("Imperial Isle")
	EndIf
	If GetMapID() == $GH_ID_Isle_Of_Meditation Then
		$IsleOfMeditation = True
		Out("Isle of Meditation")
	EndIf
	If GetMapID() == $GH_ID_Uncharted_Isle Then
		$UnchartedIsle = True
		Out("Uncharted Isle")
	EndIf
	If GetMapID() == $GH_ID_Isle_Of_Wurms Then
		$IsleOfWurms = True
		Out("Isle of Wurms")
		If $IsleOfWurms = True Then
			CheckIsleOfWurms()
		EndIf
	EndIf
	If GetMapID() == $GH_ID_Corrupted_Isle Then
		$CorruptedIsle = True
		Out("Corrupted Isle")
		If $CorruptedIsle = True Then
			CheckCorruptedIsle()
		EndIf
	EndIf
	If GetMapID() == $GH_ID_Isle_Of_Solitude Then
		$IsleOfSolitude = True
		Out("Isle of Solitude")
	EndIf
EndFunc ;~ Check Guild halls

;~ If there is a missing Guild Hall from the below listing, it is because there is only 1 spawn point in that Guild Hall
Func CheckIsleOfWurms()
	If CheckArea(8682, 2265) Then
		OUT("Start Point 1")
		If Waypoint1() Then
			Return True
		Else
			Return False
		EndIf
	ElseIf CheckArea(6697, 3631) Then
		OUT("Start Point 2")
		If Waypoint2() Then
			Return True
		Else
			Return False
		EndIf
	ElseIf CheckArea(6716, 2929) Then
		OUT("Start Point 3")
		If Waypoint3() Then
			Return True
		Else
			Return False
		EndIf
	Else
		OUT("Where the fuck am I?")
		Return False
	EndIf
EndFunc

Func CheckCorruptedIsle()
	If CheckArea(-4830, 5985) Then
		OUT("Start Point 1")
		If Waypoint4() Then
			Return True
		Else
			Return False
		EndIf
	ElseIf CheckArea(-3778, 6214) Then
		OUT("Start Point 2")
		If Waypoint5() Then
			Return True
		Else
			Return False
		EndIf
	ElseIf CheckArea(-5209, 4468) Then
		OUT("Start Point 3")
		If Waypoint6() Then
			Return True
		Else
			Return False
		EndIf
	Else
		OUT("Where the fuck am I?")
		Return False
	EndIf
EndFunc

Func Waypoint1()
	MoveTo(8263, 2971)
EndFunc

Func Waypoint2()
	MoveTo(7086, 2983)
	MoveTo(8263, 2971)
EndFunc

Func Waypoint3()
	MoveTo(8263, 2971)
EndFunc

Func Waypoint4()
	MoveTo(-4830, 5985)
EndFunc

Func Waypoint5()
	MoveTo(-3778, 6214)
EndFunc

Func Waypoint6()
	MoveTo(-4352, 5232)
EndFunc

Func Chest()
	Dim $Waypoints_by_XunlaiChest[16][3] = [ _
			[$BurningIsle, -5285, -2545], _
			[$DruidsIsle, -1792, 5444], _
			[$FrozenIsle, -115, 3775], _
			[$HuntersIsle, 4855, 7527], _
			[$IsleOfTheDead, -4562, -1525], _
			[$NomadsIsle, 4630, 4580], _
			[$WarriorsIsle, 4224, 7006], _
			[$WizardsIsle, 4858, 9446], _
			[$ImperialIsle, 2184, 13125], _
			[$IsleOfJade, 8614, 2660], _
			[$IsleOfMeditation, -726, 7630], _
			[$IsleOfWeepingStone, -1573, 7303], _
			[$CorruptedIsle, -4868, 5998], _
			[$IsleOfSolitude, 4478, 3055], _
			[$IsleOfWurms, 8586, 3603], _
			[$UnchartedIsle, 4522, -4451]]
	For $i = 0 To (UBound($Waypoints_by_XunlaiChest) - 1)
		If ($Waypoints_by_XunlaiChest[$i][0] == True) Then
			Do
				GenericRandomPath($Waypoints_by_XunlaiChest[$i][1], $Waypoints_by_XunlaiChest[$i][2], Random(60, 80, 2))
			Until CheckArea($Waypoints_by_XunlaiChest[$i][1], $Waypoints_by_XunlaiChest[$i][2])
		EndIf
	Next
	Local $aChestName = "Xunlai Chest"
	Local $lChest = GetAgentByName($aChestName)
	If IsDllStruct($lChest) Then
		Out("Going to " & $aChestName)
		GoToNPC($lChest)
		RndSleep(Random(3000, 4200))
	EndIf
EndFunc ;~ Xunlai Chest

Func Merchant()
	Dim $Waypoints_by_Merchant[29][3] = [ _
			[$BurningIsle, -4439, -2088], _
			[$BurningIsle, -4772, -362], _
			[$BurningIsle, -3637, 1088], _
			[$BurningIsle, -2506, 988], _
			[$DruidsIsle, -2037, 2964], _
			[$FrozenIsle, 99, 2660], _
			[$FrozenIsle, 71, 834], _
			[$FrozenIsle, -299, 79], _
			[$HuntersIsle, 5156, 7789], _
			[$HuntersIsle, 4416, 5656], _
			[$IsleOfTheDead, -4066, -1203], _
			[$NomadsIsle, 5129, 4748], _
			[$WarriorsIsle, 4159, 8540], _
			[$WarriorsIsle, 5575, 9054], _
			[$WizardsIsle, 4288, 8263], _
			[$WizardsIsle, 3583, 9040], _
			[$ImperialIsle, 1415, 12448], _
			[$ImperialIsle, 1746, 11516], _
			[$IsleOfJade, 8825, 3384], _
			[$IsleOfJade, 10142, 3116], _
			[$IsleOfMeditation, -331, 8084], _
			[$IsleOfMeditation, -1745, 8681], _
			[$IsleOfMeditation, -2197, 8076], _
			[$IsleOfWeepingStone, -3095, 8535], _
			[$IsleOfWeepingStone, -3988, 7588], _
			[$CorruptedIsle, -4670, 5630], _
			[$IsleOfSolitude, 2970, 1532], _
			[$IsleOfWurms, 8284, 3578], _
			[$UnchartedIsle, 1503, -2830]]
	For $i = 0 To (UBound($Waypoints_by_Merchant) - 1)
		If ($Waypoints_by_Merchant[$i][0] == True) Then
			Do
				GenericRandomPath($Waypoints_by_Merchant[$i][1], $Waypoints_by_Merchant[$i][2], Random(60, 80, 2))
			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)
        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

Func RuneTrader()
	Dim $Waypoints_by_RuneTrader[35][3] = [ _
			[$BurningIsle, -3793, 1069], _
			[$BurningIsle, -2798, -74], _
			[$DruidsIsle, -989, 4493], _
			[$FrozenIsle, 71, 834], _
			[$FrozenIsle, 99, 2660], _
			[$FrozenIsle, -385, 3254], _
			[$FrozenIsle, -983, 3195], _
			[$HuntersIsle, 3267, 6557], _
			[$IsleOfTheDead, -3697, -2337], _  					; updated
			[$NomadsIsle, 1930, 4129], _
			[$NomadsIsle, 462, 4094], _
			[$WarriorsIsle, 4108, 8404], _
			[$WarriorsIsle, 3403, 6583], _
			[$WarriorsIsle, 3415, 5617], _
			[$WizardsIsle, 3610, 9619], _
			[$ImperialIsle, 759, 11465], _
			[$IsleOfJade, 8919, 3459], _
			[$IsleOfJade, 6789, 2781], _
			[$IsleOfJade, 6566, 2248], _
			[$IsleOfMeditation, -2197, 8076], _
			[$IsleOfMeditation, -1745, 8681], _
			[$IsleOfMeditation, -331, 8084], _
			[$IsleOfMeditation, 422, 8769], _
			[$IsleOfMeditation, 549, 9531], _
			[$IsleOfWeepingStone, -3988, 7588], _
			[$IsleOfWeepingStone, -3095, 8535], _
			[$IsleOfWeepingStone, -2431, 7946], _
			[$IsleOfWeepingStone, -1618, 8797], _
			[$CorruptedIsle, -4424, 5645], _
			[$CorruptedIsle, -4443, 4679], _
			[$IsleOfSolitude, 3172, 3728], _
			[$IsleOfSolitude, 3240, 5433], _
			[$IsleOfWurms, 8353, 2995], _						; updated
			[$IsleOfWurms, 6708, 3093], _
			[$UnchartedIsle, 2530, -2403]]
	For $i = 0 To (UBound($Waypoints_by_RuneTrader) - 1)
		If ($Waypoints_by_RuneTrader[$i][0] == True) Then
			Do
				GenericRandomPath($Waypoints_by_RuneTrader[$i][1], $Waypoints_by_RuneTrader[$i][2], Random(60, 80, 2))
			Until CheckArea($Waypoints_by_RuneTrader[$i][1], $Waypoints_by_RuneTrader[$i][2])
		EndIf
	Next
	Local $lRuneTrader = "Rune Trader"
	Local $lRune = GetAgentByName($lRuneTrader)
	If IsDllStruct($lRune) Then
		Out("Going to " & $lRuneTrader)
		GoToNPC($lRune)
		RndSleep(Random(3000, 4200))
	EndIf
 EndFunc   ;~ Runetrader

 Func RareMaterialTrader()
	Dim $Waypoints_by_RareMatTrader[36][3] = [ _
			[$BurningIsle, -3793, 1069], _
			[$BurningIsle, -2798, -74], _
			[$DruidsIsle, -989, 4493], _
			[$FrozenIsle, 71, 834], _
			[$FrozenIsle, 99, 2660], _
			[$FrozenIsle, -385, 3254], _
			[$FrozenIsle, -983, 3195], _
			[$HuntersIsle, 3267, 6557], _
			[$IsleOfTheDead, -3415, -1658], _
			[$NomadsIsle, 1930, 4129], _
			[$NomadsIsle, 462, 4094], _
			[$WarriorsIsle, 4108, 8404], _
			[$WarriorsIsle, 3403, 6583], _
			[$WarriorsIsle, 3415, 5617], _
			[$WizardsIsle, 3610, 9619], _
			[$ImperialIsle, 759, 11465], _
			[$IsleOfJade, 8919, 3459], _
			[$IsleOfJade, 6789, 2781], _
			[$IsleOfJade, 6566, 2248], _
			[$IsleOfMeditation, -2197, 8076], _
			[$IsleOfMeditation, -1745, 8681], _
			[$IsleOfMeditation, -331, 8084], _
			[$IsleOfMeditation, 422, 8769], _
			[$IsleOfMeditation, 549, 9531], _
			[$IsleOfWeepingStone, -3988, 7588], _
			[$IsleOfWeepingStone, -3095, 8535], _
			[$IsleOfWeepingStone, -2431, 7946], _
			[$IsleOfWeepingStone, -1618, 8797], _
			[$CorruptedIsle, -4424, 5645], _
			[$CorruptedIsle, -4443, 4679], _
			[$IsleOfSolitude, 3172, 3728], _
			[$IsleOfSolitude, 3221, 4789], _
			[$IsleOfSolitude, 3745, 4542], _
			[$IsleOfWurms, 8353, 2995], _
			[$IsleOfWurms, 6708, 3093], _
			[$UnchartedIsle, 2530, -2403]]
	For $i = 0 To (UBound($Waypoints_by_RareMatTrader) - 1)
		If ($Waypoints_by_RareMatTrader[$i][0] == True) Then
			Do
				GenericRandomPath($Waypoints_by_RareMatTrader[$i][1], $Waypoints_by_RareMatTrader[$i][2], Random(60, 80, 2))
			Until CheckArea($Waypoints_by_RareMatTrader[$i][1], $Waypoints_by_RareMatTrader[$i][2])
		EndIf
	Next
	Local $lRareTrader = "Rare Material Trader"
	Local $lRare = GetAgentByName($lRareTrader)
	If IsDllStruct($lRare) Then
		Out("Going to " & $lRareTrader)
		GoToNPC($lRare)
		RndSleep(Random(3000, 4200))
	EndIf
	;~This section does the buying
	TraderRequest($MATID)
	Sleep(500 + 3 * GetPing())
	While GetGoldCharacter() > 20*1000
		TraderRequest($MATID)
		Sleep(500 + 3 * GetPing())
		TraderBuy()
	WEnd
EndFunc   ;~ Rare Material trader

Func GenericRandomPath($aPosX, $aPosY, $aRandom = 50, $STOPSMIN = 1, $STOPSMAX = 5, $NUMBEROFSTOPS = -1)
	If $NUMBEROFSTOPS = -1 Then $NUMBEROFSTOPS = Random($STOPSMIN, $STOPSMAX, 1)
	Local $lAgent = GetAgentByID(-2)
	Local $MYPOSX = DllStructGetData($lAgent, "X")
	Local $MYPOSY = DllStructGetData($lAgent, "Y")
	Local $DISTANCE = ComputeDistance($MYPOSX, $MYPOSY, $aPosX, $aPosY)
	If $NUMBEROFSTOPS = 0 Or $DISTANCE < 200 Then
		MoveTo($aPosX, $aPosY, $aRandom)
	Else
		Local $M = Random(0, 1)
		Local $N = $NUMBEROFSTOPS - $M
		Local $STEPX = (($M * $aPosX) + ($N * $MYPOSX)) / ($M + $N)
		Local $STEPY = (($M * $aPosY) + ($N * $MYPOSY)) / ($M + $N)
		MoveTo($STEPX, $STEPY, $aRandom)
		GenericRandomPath($aPosX, $aPosY, $aRandom, $STOPSMIN, $STOPSMAX, $NUMBEROFSTOPS - 1)
	EndIf
EndFunc   ;==>GENERICRANDOMPATH
logicdoor is offline  
Old 05/29/2020, 11:07   #154
 
elite*gold: 0
Join Date: Apr 2018
Posts: 38
Received Thanks: 4
Could you please post which parts you changed in your GWA to get it to work? I changed the scanpattern, setvalue and headers but it's not working properly...
JohnyDee is offline  
Old 05/29/2020, 12:35   #155
 
elite*gold: 0
Join Date: Jan 2010
Posts: 28
Received Thanks: 45
Quote:
Originally Posted by JohnyDee View Post
Could you please post which parts you changed in your GWA to get it to work? I changed the scanpattern, setvalue and headers but it's not working properly...
who or what are you referring to?
cortexio is offline  
Old 05/29/2020, 14:55   #156
 
elite*gold: 0
Join Date: Jan 2010
Posts: 28
Received Thanks: 45
Quote:
Originally Posted by CoderAndy View Post
@

really nice that you shared all that cudos to you,

i will suggest finally someone needs to make a small tutorial on how to find patterns with olly or ida (i don't know which program you use anyway) and how you wrote the asm or at least link some tutorials that you read up or you know that will be helpful for all other ppl so even if GWA2 brakes with a new update ppl will have a guidance on how to update stuff, you will help your self the community and you will be a true maven,

i'm not so much in reverse engineering to make them by my own i'm trying to learn on how the packet encryption works in the game (mostly for educational purposes) and ppl don't want to share any information it's ridiculous.
Im very new to this also. The only knowledge i had was what mov,jmp,push,pop is and what ebp,esp and the other registers were.

The only reason i succeeded is because there was already existing code in GWA2 that i could base myself on. Without it, it would be pretty difficult for me also.

Lets take UseHeroSkill for example, because it's simple. I saw that it takes 3 arguments in GWA2, heroID, skillSlot and targetID.

Step 1. Like almost any function in GW, it will send a packet to the server about what u want to do. So because GWA2 already knows where the SendPacket function is, it was pretty easy. Just ConsoleWrite the "PacketSendFunction" value and you know where to find it in memory.

Step 2. Go to the SendPacket function (i use x64dbg.com). Set a breakpoint.

Step 3. Make the hero cast a spell on you. The breakpoint will trigger. And then you look at the stack and look for a function that pushed 3 arguments on the stack and where the values of those arguments somewhat resemble heroID, skillSlot and targetID. When you see them, you should be able to see which function pushed those 3 arguments on the stack.

Step 4. Go to that function in memory. Now this function is what u want. It's that function you are trying to replicate with your bot. And what this function did seemed to pretty easy to me. It pushes 3 things on the stack and then calls a certain address. That address it's calling, is obviously your UseHeroSkill function.

Step 5. At this point you can already create your asm code. It's basicly push arg1 push arg2 push arg3 call function and then increase esp by C(= 3) to push back the stack for your 3 arguments. note that your arguments are stored in eax by GWA2.

Step 6. In step 4 you found the address of the UseHeroSkill function. For testing purposes you can SetValue('UseHeroSkillFunction', "0x...THEADRESS...") without needing a pattern or anything. And then you could already test to code basically and see if GWA2 uses the function correctly. Or.. you could directly create a pattern for it. It's up to you. The patterns in GWA2 are basically a set of unique bytes. So in x32dbg you go to the UseHeroSkill function and find some unique bytes that cant be found anywhere else in the memory. Be sure those bytes dont contain any addresses. And that's your pattern. Then your offset is the amount of bytes between the start address of that function and the address of your unique bytes.

Step 7. So now you have your ASM code and your patterns. Now it's time to test it. First i set a breakpoint at the start of the HeroSkillFunction. And use a hero skill in game and then i look at the stack and see what order the arguments are in. Write it down.

Step 8. Now u want call the function using GWA2. But first put your breakpoint again. And now u look at the stack and make sure the arguments are in the same order and have the same values as when the game called the function. If they are the same, you did everything correct and the game should have used the hero skill.

And that's it.
cortexio is offline  
Thanks
7 Users
Old 05/29/2020, 15:58   #157
 
elite*gold: 0
Join Date: Apr 2018
Posts: 38
Received Thanks: 4
Quote:
Originally Posted by cortexio View Post
who or what are you referring to?
I was talking about Corey's salvage tool, I changed the 3 parts in my GWA2 code regarding salvage (Setvalue, scan and command as in your post about useheroskill), but the salvage tool does not work properly. I wanted to update my version of GWA2 instead of corey's, as it's been slightly modified.
JohnyDee is offline  
Old 05/29/2020, 16:09   #158
 
elite*gold: 0
Join Date: Dec 2010
Posts: 59
Received Thanks: 35
Quote:
Originally Posted by JohnyDee View Post
I was talking about Corey's salvage tool, I changed the 3 parts in my GWA2 code regarding salvage (Setvalue, scan and command as in your post about useheroskill), but the salvage tool does not work properly. I wanted to update my version of GWA2 instead of corey's, as it's been slightly modified.
Code:
Replace the old "_('CommandSalvage:')" part with:



Code:
 	_('CommandSalvage:')
	_('mov ebx,SalvageGlobal')
 	_('mov ecx,dword[eax+4]')
 	_('mov dword[ebx],ecx')
	_('add ebx,4')
 	_('mov ecx,dword[eax+8]')
 	_('mov dword[ebx],ecx')
 	_('mov ebx,dword[eax+4]')
 	_('push ebx')
 	_('mov ebx,dword[eax+8]')
 	_('push ebx')
 	_('mov ebx,dword[eax+c]')
 	_('push ebx')
 	_('call SalvageFunction')
 	_('add esp,C')
 	_('ljmp CommandReturn')
Replace old SetValue(... with:



Code:
SetValue('SalvageFunction', '0x' & Hex(GetScannedAddress('ScanSalvageFunction', -10), 8))
SetValue('SalvageGlobal', '0x' & Hex(MemoryRead(GetScannedAddress('ScanSalvageGlobal', 1) - 0x4), 8))
Replace old _('Scan... with:



Code:
_('ScanSalvageFunction:')
AddPattern('33C58945FC8B45088945F08B450C8945F48B45108945F88D45EC506A10C745EC7E')
_('ScanSalvageGlobal:')
AddPattern('8B5104538945F48B4108568945E88B410C578945EC8B4110528955E48945F0')
You also need to change the following headers for SalvageMaterials & mods



Code:
Global Const $HEADER_SALVAGE_MATS = 0x81
Global Const $HEADER_SALVAGE_MODS = 0x82
corey54321 is offline  
Thanks
1 User
Old 05/29/2020, 17:27   #159
 
elite*gold: 0
Join Date: Jan 2010
Posts: 28
Received Thanks: 45
Quote:
Originally Posted by JohnyDee View Post
I was talking about Corey's salvage tool, I changed the 3 parts in my GWA2 code regarding salvage (Setvalue, scan and command as in your post about useheroskill), but the salvage tool does not work properly. I wanted to update my version of GWA2 instead of corey's, as it's been slightly modified.
You always PM me your discord ID/username and we can have a look at it.
cortexio is offline  
Thanks
1 User
Old 05/29/2020, 18:37   #160
 
elite*gold: 0
Join Date: Mar 2020
Posts: 35
Received Thanks: 12
does anyone know how to open xunlai chest the way toolbox does it?
ooklaba is offline  
Old 05/29/2020, 20:59   #161
 
elite*gold: 0
Join Date: Dec 2010
Posts: 59
Received Thanks: 35
just use this input the chest location and it will walk over to it then talk to the chest or npc but u can access the storage functions with out going to the chest and and opening it but u have to be where a storage chest is available

GoNearestNPCToCoords(x,y )
corey54321 is offline  
Old 05/29/2020, 22:25   #162
 
elite*gold: 0
Join Date: Apr 2018
Posts: 38
Received Thanks: 4
Quote:
Originally Posted by corey54321 View Post
Code:
Replace the old "_('CommandSalvage:')" part with:



Code:
 	_('CommandSalvage:')
	_('mov ebx,SalvageGlobal')
 	_('mov ecx,dword[eax+4]')
 	_('mov dword[ebx],ecx')
	_('add ebx,4')
 	_('mov ecx,dword[eax+8]')
 	_('mov dword[ebx],ecx')
 	_('mov ebx,dword[eax+4]')
 	_('push ebx')
 	_('mov ebx,dword[eax+8]')
 	_('push ebx')
 	_('mov ebx,dword[eax+c]')
 	_('push ebx')
 	_('call SalvageFunction')
 	_('add esp,C')
 	_('ljmp CommandReturn')
Replace old SetValue(... with:



Code:
SetValue('SalvageFunction', '0x' & Hex(GetScannedAddress('ScanSalvageFunction', -10), 8))
SetValue('SalvageGlobal', '0x' & Hex(MemoryRead(GetScannedAddress('ScanSalvageGlobal', 1) - 0x4), 8))
Replace old _('Scan... with:



Code:
_('ScanSalvageFunction:')
AddPattern('33C58945FC8B45088945F08B450C8945F48B45108945F88D45EC506A10C745EC7E')
_('ScanSalvageGlobal:')
AddPattern('8B5104538945F48B4108568945E88B410C578945EC8B4110528955E48945F0')
You also need to change the following headers for SalvageMaterials & mods



Code:
Global Const $HEADER_SALVAGE_MATS = 0x81
Global Const $HEADER_SALVAGE_MODS = 0x82
Thanks, that's exactly what I changed, and oddly it stopped working after having salvaged a few trophies. I tried rebooting the game and everything and it wouldn't work at all. Very strange...
JohnyDee is offline  
Old 05/29/2020, 23:22   #163
 
elite*gold: 0
Join Date: Dec 2010
Posts: 59
Received Thanks: 35
I mean it works so maybe something wrong with your script also this wont work with the 10 use salvage kits works for the 25 use kits I would just use the gwa2 I posted and add the functions from your custom gwa2 to that one

I'm just amazed at how many different Versions of gwa2 is out kind of crazy to have 50bots using 50 different copies of gwa2 we need to get two working versions one with the headers and one with out and standardize and update it

If Custom Functions are needed the just need to be in the bot script instead of gwa2 just my opinions
corey54321 is offline  
Thanks
1 User
Old 06/02/2020, 05:23   #164
 
elite*gold: 0
Join Date: Mar 2020
Posts: 35
Received Thanks: 12
anyone have an update for

Code:
 	_('CommandRequestQuoteSell:')
 	_('mov dword[TraderCostID],0')
 	_('mov dword[TraderCostValue],0')
 	_('push 0')
 	_('push 0')
 	_('push 0')
 	_('add eax,4')
 	_('push eax')
 	_('push 1')
 	_('push 0')
 	_('mov ecx,d')
 	_('xor edx,edx')
 	_('call RequestQuoteFunction')
 	_('ljmp CommandReturn')

 	_('CommandTraderSell:')
 	_('push 0')
 	_('push 0')
 	_('push 0')
 	_('push dword[TraderCostValue]')
 	_('push 0')
 	_('push TraderCostID')
 	_('push 1')
 	_('mov ecx,d')
 	_('xor edx,edx')
 	_('call TraderFunction')
 	_('mov dword[TraderCostID],0')
 	_('mov dword[TraderCostValue],0')
 	_('ljmp CommandReturn')
tyvm!

btw @

you want to make sure you have enough Sleep() between startsalvage() and materialsalvage(), and after materialsalvage(), or the client will overload (usually error = 007 and you are kicked out to character select pane)

if you get other than error = 007 (i.e. game crashing and prompts you with send report to anet) then in my experience it's something more serious which is wrong with the code
ooklaba is offline  
Old 06/02/2020, 08:01   #165
 
elite*gold: 0
Join Date: Jul 2019
Posts: 103
Received Thanks: 83
Something to point out is that tracing back the calling address of the sendpacket function will let you find and fix a lot of functions. There is a caveat though since gwa2 uses a pseudo assembler to turn asm instructions into raw byte code it must be supported in the assembler. So if there is an instruction needed that currently isn't there you will have to add it to that code portion of the assembler. Other non packet related functions can easily be found by finding a value used for it and then setting an on access check like cheat engine will let you do for example.This lets you find functions that don't directly lead to a packet such as getting an agent by name.
list comprehension is offline  
Reply


Similar Threads Similar Threads
[GWA2] How to chase after updated header values?
11/14/2024 - GW Bots - 11 Replies
Hi all, First post, but have been following the tips all over this forum for about 6 months since I started writing my own bots. Recently the server headers changed, and although it looks like the community have pulled through and released a new version of GWA2 to reflect it, there are other headers that I'm using, that aren't in the vanilla GWA2 code. SendPacket(0x14, 0x6F, $lItemID, $lQuantity, $lBagID, $aSlot - 1) The above command would have previously told GW to move $lQuantity...
Leader/followbot - Updated with new GWA2/headers (functional)
07/21/2019 - GW Exploits, Hacks, Bots, Tools & Macros - 29 Replies
EDIT: Updated 6/16/18 Hey all, I updated the follow/leader bot with the new headers (I think there were a few that I didn't bother updating, since the script doesn't seem to use them anywhere). I haven't done extensive testing, but it's working for me so far. Please let me know if you get any errors/crashes, and I'll attempt to fix them. Enjoy!
GWA2 A/mo Vaettir Bot; Need Help!!
02/19/2012 - GW Bots - 1 Replies
http://www.elitepvpers.com/forum/gw-exploits-hacks -bots-tools-macros/1568881-gwa-vaettir-mo-farm-bot .html ENGLISH: I can't seem to get this to work. I've spent 3-4 hours, read the entire thread here, tried to search for a detailed guide on how to get this to work but it's not. What I've done was: Downloaded the 2 files shown in the Original Post... "GWA2 A_Mo Vaettirs Farm by bl4ck3lit3.zip" Extracted it to desktop Ran GW.EXE as admin. Set-up assassin with appropriate gear and...



All times are GMT +1. The time now is 10:15.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.