GW Working Bots 2019!

05/07/2019 15:48 schnoesel21#526
Quote:
Originally Posted by smiley232 View Post
Code:
Func ChangeWeaponSetByPacket($aSet)
	Switch $aSet
		Case 1, 2, 3, 4
			Return SendPacket(0x8, 0x38, $aSet - 1)
		Case Else
			Return False
	EndSwitch
EndFunc
Do you know the sendpacket header and size for TargetNearestEnemy() as well? I tried to get it with a packet sniffer but nothing is coming up.

Thanks in advance
05/07/2019 16:52 smiley232#527
Quote:
Originally Posted by schnoesel21 View Post
Do you know the sendpacket header and size for TargetNearestEnemy() as well? I tried to get it with a packet sniffer but nothing is coming up.
for me it does not seem that there are packets involved in the targeting stuff.

as a workaround (if i need the 2nd and 3rd nearest agent as well) i currently use sorted arrays:
Code:
#include <Array.au3>

Func GetAgentArraySorted($aAgentType = 0)	;returns a 2-dimensional array([agentID, [distance]) sorted by distance
	Local $lDistance
	Local $lAgentArray = GetAgentArray($aAgentType)
	Local $lReturnArray[1][2]
	Local $lMe = GetAgentByID(-2)
	Local $AgentID

	For $i = 1 To $lAgentArray[0]
		$lDistance = (DllStructGetData($lMe, 'X') - DllStructGetData($lAgentArray[$i], 'X')) ^ 2 + (DllStructGetData($lMe, 'Y') - DllStructGetData($lAgentArray[$i], 'Y')) ^ 2
		$AgentID = DllStructGetData($lAgentArray[$i], 'ID')
		ReDim $lReturnArray[$i][2]
		$lReturnArray[$i - 1][0] = $AgentID
		$lReturnArray[$i - 1][1] = Sqrt($lDistance)
	Next
	_ArraySort($lReturnArray, 0, 0, 0, 1)
	Return $lReturnArray
EndFunc   ;==>GetAgentArraySorted

$AgentArray = GetAgentArraySorted()
For $i = 0 To UBound($AgentArray) - 1
	$Agent = GetAgentByID($AgentArray[$i][0])
Next
make sure to set the correct $aAgentType, so you dont pull items when you want to look for enemies (0xDB) or you dont pull npcs etc when you want to pick up items (0x400).
05/07/2019 17:02 schnoesel21#528
Quote:
Originally Posted by smiley232 View Post
for me it does not seem that there are packets involved in the targeting stuff.

as a workaround (if i need the 2nd and 3rd nearest agent as well) i currently use sorted arrays:
Code:
#include <Array.au3>

Func GetAgentArraySorted($aAgentType = 0)	;returns a 2-dimensional array([agentID, [distance]) sorted by distance
	Local $lDistance
	Local $lAgentArray = GetAgentArray($aAgentType)
	Local $lReturnArray[1][2]
	Local $lMe = GetAgentByID(-2)
	Local $AgentID

	For $i = 1 To $lAgentArray[0]
		$lDistance = (DllStructGetData($lMe, 'X') - DllStructGetData($lAgentArray[$i], 'X')) ^ 2 + (DllStructGetData($lMe, 'Y') - DllStructGetData($lAgentArray[$i], 'Y')) ^ 2
		$AgentID = DllStructGetData($lAgentArray[$i], 'ID')
		ReDim $lReturnArray[$i][2]
		$lReturnArray[$i - 1][0] = $AgentID
		$lReturnArray[$i - 1][1] = Sqrt($lDistance)
	Next
	_ArraySort($lReturnArray, 0, 0, 0, 1)
	Return $lReturnArray
EndFunc   ;==>GetAgentArraySorted

$AgentArray = GetAgentArraySorted()
For $i = 0 To UBound($AgentArray) - 1
	$Agent = GetAgentByID($AgentArray[$i][0])
Next
make sure to set the correct $aAgentType, so you dont pull items when you want to look for enemies (0xDB) or you dont pull npcs etc when you want to pick up items (0x400).
Thanks for that but i had a little bit of hope left we can use sendpacket for all the broken functions. :(
05/07/2019 19:44 elitestpvperofall#529
Anyone have a fix for SellItem? Doesn't seem to work anymore, does not crash but does not sell either.

From GWA2:
Code:
;~ Description: Sells an item.
Func SellItem($aItem, $aQuantity = 0)
	If IsDllStruct($aItem) = 0 Then $aItem = GetItemByItemID($aItem)
	If $aQuantity = 0 Or $aQuantity > DllStructGetData($aItem, 'Quantity') Then $aQuantity = DllStructGetData($aItem, 'Quantity')

	DllStructSetData($mSellItem, 2, $aQuantity * DllStructGetData($aItem, 'Value'))
	DllStructSetData($mSellItem, 3, DllStructGetData($aItem, 'ID'))
	Enqueue($mSellItemPtr, 12)
EndFunc   ;==>SellItem
Doesn't seem to use SendPacket. I'm unfamiliar with how GWA2 works so no clue how to fix it.
05/07/2019 20:07 Surimata#530
Check the following in your gwa2. Mine is selling.


Code:
SetValue('SellItemFunction', '0x' & Hex(GetScannedAddress('ScanSellItemFunction', -85), 8))
Code:
_('ScanSellItemFunction:')
AddPattern('8B4D2085C90F858E')

List of all CtoGS headers, it's from GWCA:
Code:
const unsigned short CtoGS_MSGDisconnect = 0x9;
const unsigned short CtoGS_MSGRequestItems = 0x97;
const unsigned short CtoGS_MSGRequestSpawn = 0x8D;
const unsigned short CtoGS_MSGRequestAgents = 0x96;
const unsigned short CtoGS_MSGCallTarget = 0x28;
const unsigned short CtoGS_MSGGoNPC = 0x3F;
const unsigned short CtoGS_MSGGoGadget = 0x57;
const unsigned short CtoGS_MSGGoPlayer = 0x39;
const unsigned short CtoGS_MSGPickUpItem = 0x45;
const unsigned short CtoGS_MSGAttack = 0x2C;
const unsigned short CtoGS_MSGCancelAction = 0x2E;
const unsigned short CtoGS_MSGOpenChest = 0x59;
const unsigned short CtoGS_MSGDropBuff = 0x2F;
const unsigned short CtoGS_MSGDropItem = 0x32;
const unsigned short CtoGS_MSGDropGold = 0x35;
const unsigned short CtoGS_MSGEquipItem = 0x36;
const unsigned short CtoGS_MSGDonateFaction = 0x3B;
const unsigned short CtoGS_MSGDialog = 0x41;
const unsigned short CtoGS_MSGMouseMove = 0x44;
const unsigned short CtoGS_MSGUseSkill = 0x4C;
const unsigned short CtoGS_MSGCallSkill = 0x2A;
const unsigned short CtoGS_MSGSetSkillbarSkill = 0x61;
const unsigned short CtoGS_MSGChangeSecondary = 0x47;
const unsigned short CtoGS_MSGSetAttributes = 0x10;
const unsigned short CtoGS_MSGLoadSkillbar = 0x62;
const unsigned short CtoGS_MSGRequestQuote = 0x52;
const unsigned short CtoGS_MSGTransactItem = 0x53;
const unsigned short CtoGS_MSGTransactTrade = 0x50;
const unsigned short CtoGS_MSGStartSalvage = 0x7C;
const unsigned short CtoGS_MSGSalvageMaterials = 0x7F;
const unsigned short CtoGS_MSGSalvageMod = 0x80;
const unsigned short CtoGS_MSGIdentifyItem = 0x71;
const unsigned short CtoGS_MSGMoveItem = 0x77;
const unsigned short CtoGS_MSGAcceptAllItems = 0x78;
const unsigned short CtoGS_MSGUseItem = 0x83;
const unsigned short CtoGS_MSGStartTrade = 0x4F;
const unsigned short CtoGS_MSGAcknowledgeTrade = 0x0;
const unsigned short CtoGS_MSGAcceptTrade = 0x7;
const unsigned short CtoGS_MSGCancelTrade = 0x1;
const unsigned short CtoGS_MSGAddItemTrade = 0x2;
const unsigned short CtoGS_MSGRemoveItemTrade = 0x5;
const unsigned short CtoGS_MSGChangeOffer = 0x6;
const unsigned short CtoGS_MSGSubmitOffer = 0x3;
const unsigned short CtoGS_MSGAddNpc = 0xA5;
const unsigned short CtoGS_MSGKickNpc = 0xAE;
const unsigned short CtoGS_MSGInvitePlayer = 0xA6;
const unsigned short CtoGS_MSGInvitePlayerByName = 0xA7;
const unsigned short CtoGS_MSGKickPlayer = 0xAF;
const unsigned short CtoGS_MSGAcceptPartyRequest = 0xA4;
const unsigned short CtoGS_MSGDenyPartyRequest = 0xA2;
const unsigned short CtoGS_MSGEnterChallenge = 0xAB;
const unsigned short CtoGS_MSGReturnToOutpost = 0xAD;
const unsigned short CtoGS_MSGAbandonQuest = 0x12;
const unsigned short CtoGS_MSGActivateQuest = 0x13;
const unsigned short CtoGS_MSGRequestQuest = 0x16;
const unsigned short CtoGS_MSGSetHeroAggression = 0x17;
const unsigned short CtoGS_MSGLockHeroTarget = 0x18;
const unsigned short CtoGS_MSGChangeHeroSkillSlotState = 0x1C;
const unsigned short CtoGS_MSGCommandHero = 0x1E;
const unsigned short CtoGS_MSGCommandAll = 0x1F;
const unsigned short CtoGS_MSGAddHero = 0x23;
const unsigned short CtoGS_MSGKickHero = 0x24;
const unsigned short CtoGS_MSGTravelGH = 0xB6;
const unsigned short CtoGS_MSGLeaveGH = 0xB8;
const unsigned short CtoGS_MSGTravelTo = 0xB7;
const unsigned short CtoGS_MSGSendChat = 0x69;
const unsigned short CtoGS_MSGSetDisplayedTitle = 0x5D;
const unsigned short CtoGS_MSGRemoveDisplayedTitle = 0x5E;
const unsigned short CtoGS_MSGSkipCinematic = 0x68;
const unsigned short CtoGS_MSGUnlockSkillByTome = 0x72;
const unsigned short CtoGS_MSGDeleteItem = 0x6E;
const unsigned short CtoGS_MSGSplitStack = 0x7A;
const unsigned short CtoGS_MSGChangeGold = 0x81;
const unsigned short CtoGS_MSGSwitchMode = 0xA1;
const unsigned short CtoGS_MSGLeaveParty = 0xA8;
const unsigned short CtoGS_MSGTick = 0xB5;
const unsigned short CtoGS_MSGDrawMap = 0x31;

Since i've updated the TargetNearestEnemy() function
from this

Code:
Func TargetNearestEnemy()
	Return PerformAction(0x93, 0x18)
EndFunc
to this (thanks to afmart ;))

Code:
Func TargetNearestEnemy()
	Local $target = GetNearestEnemyToAgent(-2)
        ChangeTarget($target)
EndFunc
I've had a lot of game crashes. I think this is caused by the ChangeTarget() function. In the GWCA code I see another offset for the memory pattern. I think that causes the error. Until now, all game clients are running again without major problems.

Code:
;SetValue('ChangeTargetFunction', '0x' & Hex(GetScannedAddress('ScanChangeTargetFunction', -119), 8))
SetValue('ChangeTargetFunction', '0x' & Hex(GetScannedAddress('ScanChangeTargetFunction', -0x78), 8))
Note: -0x78 is -120 in decimal

I would just like to know how to read this data from the memory ...
05/07/2019 20:30 kymsy#531
That's fucking great ! Well done my friend thank for the update it's working for me, i'm pretty sure there is plenty of other people sharing their functions too then we gonna make a huge database for the new gwa2 :)
05/07/2019 20:31 Coaxx123#532
All this code is mad too deep for my liking but that target nearest enemy function works fine on my vaettir bot and its on 400 runs now, no crashing

Although since the new updates I haven't been able to run both of my accounts on vaettirs, one seems to crash at 75-+ runs
05/07/2019 21:00 cruzmoreno27#533
are there any destroyer core farming?
05/07/2019 21:15 Coaxx123#534
Destroyer gloves are shit.
05/07/2019 21:27 kymsy#535
Quote:
Originally Posted by Coaxx123 View Post
All this code is mad too deep for my liking but that target nearest enemy function works fine on my vaettir bot and its on 400 runs now, no crashing

Although since the new updates I haven't been able to run both of my accounts on vaettirs, one seems to crash at 75-+ runs
I'm curious with which GW2A you're running it, because mine don't kill them and spam "tuck".. at least he ball well :)
05/07/2019 21:47 zyf#536
my JQ bot isn't buying zkeys , do you know what i have to do to fix it plz?
05/07/2019 21:49 Surimata#537
This is because your TargetNearestEnemy () and SendChat () functions are not up to date.
Take a look at my last post. This will allow you to repair the TargetNearestEnemy ().
The SendChat () must look like this:

Code:
;MemoryWrite($lAddress + 8, $aChannel & $lMessage, 'wchar[122]')
MemoryWrite($lAddress + 12, $aChannel & $lMessage, 'wchar[122]')
Your bot wants to put "stuck/" in the chat, but it cuts off the first position. That's why he writes the "tuck".
05/07/2019 22:00 Coaxx123#538
Quote:
Originally Posted by kymsy View Post
I'm curious with which GW2A you're running it, because mine don't kill them and spam "tuck".. at least he ball well :)

Code:
 Func TargetNearestEnemy()
	Local $target = GetNearestEnemyToAgent(-2)
        ChangeTarget($target)
EndFunc
Also add the code above, which will fix your bots dyslexia.
05/07/2019 22:14 kymsy#539
Thank for the answer guys, you are amazing !

Code:
			If $lBlocked > 0 Then
				If TimerDiff($ChatStuckTimer) > 3000 Then	; use a timer to avoid spamming /stuck
					SendChat("stuck", "/")
					$ChatStuckTimer = TimerInit()
				EndIf
				$lBlocked = 0
				$lHosCount = 0
			EndIf

			If GetDistance() > 1100 Then ; target is far, we probably got stuck.
				If TimerDiff($ChatStuckTimer) > 3000 Then ; dont spam
					SendChat("stuck", "/")
					$ChatStuckTimer = TimerInit()
					RndSleep(GetPing())
					If GetDistance() > 1100 Then ; we werent stuck, but target broke aggro. select a new one.
						TargetNearestEnemy()
					EndIf
				EndIf
			EndIf
		EndIf

So I'm wondering for the sendchat function if it's code i need to change ?

for the others i did it thank you :)
05/07/2019 23:10 hug56#540
Guys you are doing a great work !