Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars > GW Bots
You last visited: Today at 16:27

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

Advertisement



Need help Listing Agents and Trader Functions

Discussion on Need help Listing Agents and Trader Functions within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2018
Posts: 10
Received Thanks: 0
Need help Listing Agents and Trader Functions

I need help on two things in the bot I am working on.

1.) I cannot get a consistent listing of Agents.

The code below is what am using.
It works sometimes. Usually need to restart the guild wars and the bot.
Most of the time , the list is generated , but all the names are blank.
Some of the time I see corruption in the output , after several outputs, that
have a lot of chinese looking characters.
I think everytime I restart the bot , it cant get the agent info anymore.
I can always get a good return value from GetMaxAgents.

Here is some output form Bergen Hot Springs...

Output when working:

LA2: 1 Name: Alesia [Healer Henchman]
LA2: 2 Name: Stefan [Fighter Henchman]
LA2: 3 Name: Orion [Mage Henchman]
LA2: 4 Name: Reyna [Archer Henchman]
LA2: 5 Name: Dunham [Enchanter Henchman]
LA2: 6 Name: Claude [Cultist Henchman]
LA2: 7 Name: Little Thom [Brawler Henchman]
LA2: 9 Name:
LA2: 15 Name: Krytan Herald
LA2: 16 Name: Andar D'leod
LA2: 17 Name: Dannel Smythe
LA2: 18 Name: Layman Josef
LA2: 19 Name: Penelope Randell
LA2: 20 Name: Kailan [Armor]
LA2: 21 Name: Luka [Merchant]
LA2: 22 Name: Sewell [Weapons]
LA2: 23 Name: Milny Samhammil [Collector]
LA2: 24 Name: Xunlai Agent [Storage]
LA2: 25 Name: Xunlai Chest
Done...


Output when not working:

LA2: 1 Name:
LA2: 2 Name:
LA2: 3 Name:
LA2: 4 Name:
LA2: 5 Name:
LA2: 6 Name:
LA2: 7 Name:
LA2: 9 Name:
LA2: 15 Name:
LA2: 16 Name:
LA2: 17 Name:
LA2: 18 Name:
LA2: 19 Name:
LA2: 20 Name:
LA2: 21 Name:
LA2: 22 Name:
LA2: 23 Name:
LA2: 24 Name:
LA2: 25 Name:
Done...

Code:
Func ListAgents2()
   
   Local $AgentId
   Local $AgentName
   Local $AgentArray

   Local $AgentArray = GetAgentArray( 0xDB )
   For $i = 1 To $AgentArray[0]
	  Local $AgentId = DllStructGetData( $AgentArray[$i] , 'ID')
	  Local $AgentName = GetAgentName( $AgentID )
	  ConsoleWrite( " LA2: " & $AgentID &  [MENTION=546457]tab[/MENTION] & "Name:" &  [MENTION=546457]tab[/MENTION] & $AgentName &  [MENTION=3576271]CRLF[/MENTION] )
   Next
	  ConsoleWrite( "Done..." &  [MENTION=3576271]CRLF[/MENTION] )
EndFunc ; ListAgents2


Code:
;~ Description: Quickly creates an array of agents of a given type
Func GetAgentArray($aType = 0)
	Local $lStruct
	Local $lCount
	Local $lBuffer = ''
	DllStructSetData($mMakeAgentArray, 2, $aType)
	MemoryWrite($mAgentCopyCount, -1, 'long')
	Enqueue($mMakeAgentArrayPtr, 8)
	Local $lDeadlock = TimerInit()
	Do
		Sleep(1)
		$lCount = MemoryRead($mAgentCopyCount, 'long')
	Until $lCount >= 0 Or TimerDiff($lDeadlock) > 5000
	If $lCount < 0 Then $lCount = 0
	For $i = 1 To $lCount
		$lBuffer &= 'Byte[448];'
	Next
	$lBuffer = DllStructCreate($lBuffer)
	DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $mAgentCopyBase, 'ptr', DllStructGetPtr($lBuffer), 'int', DllStructGetSize($lBuffer), 'int', '')
	Local $lReturnArray[$lCount + 1] = [$lCount]
	For $i = 1 To $lCount
		$lReturnArray[$i] = DllStructCreate('ptr vtable;byte unknown1[24];byte unknown2[4];ptr NextAgent;byte unknown3[8];long Id;float Z;byte unknown4[8];float BoxHoverWidth;float BoxHoverHeight;byte unknown5[8];float Rotation;byte unknown6[8];long NameProperties;byte unknown7[24];float X;float Y;byte unknown8[8];float NameTagX;float NameTagY;float NameTagZ;byte unknown9[12];long Type;float MoveX;float MoveY;byte unknown10[28];long Owner;byte unknown30[8];long ExtraType;byte unknown11[24];float AttackSpeed;float AttackSpeedModifier;word PlayerNumber;byte unknown12[6];ptr Equip;byte unknown13[10];byte Primary;byte Secondary;byte Level;byte Team;byte unknown14[6];float EnergyPips;byte unknown[4];float EnergyPercent;long MaxEnergy;byte unknown15[4];float HPPips;byte unknown16[4];float HP;long MaxHP;long Effects;byte unknown17[4];byte Hex;byte unknown18[18];long ModelState;long TypeMap;byte unknown19[16];long InSpiritRange;byte unknown20[16];long LoginNumber;float ModelMode;byte unknown21[4];long ModelAnimation;byte unknown22[32];byte LastStrike;byte Allegiance;word WeaponType;word Skill;byte unknown23[4];word WeaponItemId;word OffhandItemId')
		$lStruct = DllStructCreate('byte[448]', DllStructGetPtr($lReturnArray[$i]))
		DllStructSetData($lStruct, 1, DllStructGetData($lBuffer, $i))
	Next
	Return $lReturnArray
EndFunc   ;==>GetAgentArray
Code:
;~ Description: Returns the name of an agent.
Func GetAgentName($aAgent = -2)
	If IsDllStruct($aAgent) = 0 Then
		Local $lAgentID = ConvertID($aAgent)
		If $lAgentID = 0 Then Return ''
	Else
		Local $lAgentID = DllStructGetData($aAgent, 'ID')
	EndIf

	Local $lAddress = $mStringLogBase + 256 * $lAgentID
	Local $lName = MemoryRead($lAddress, 'wchar [128]')

	If $lName = '' Then
		DisplayAll(True)
		Sleep(100)
		DisplayAll(False)
	EndIf

	Local $lName = MemoryRead($lAddress, 'wchar [128]')
	$lName = StringRegExpReplace($lName, '[<]{1}([^>]+)[>]{1}', '')
	Return $lName
EndFunc   ;==>GetAgentName
2.) The Trader functions do not seem to be working anymore. They worked before when the agent listing worked. Now , it does not matter if the agent list works , the bot wll find the trader , and all requests come back false.
( again , it worked before , maybe the update , but i have updated GWA2 from the most recent update thread on this forum. )

Any insights will be helpfull.
Tyranna is offline  
Old 11/11/2019, 18:52   #2
 
elite*gold: 0
Join Date: Jun 2018
Posts: 10
Received Thanks: 0
Tried another trading bot to see if it worked and it does not either...
Tyranna is offline  
Old 11/12/2019, 00:16   #3
 
3vangelist's Avatar
 
elite*gold: 0
Join Date: Jan 2018
Posts: 46
Received Thanks: 14
Agent names are loaded by the game asynchronously, and won't always return the right string. If you need to identify an agent, use the player number instead.

As for the trader issue, this will probably have changed in a game update over the last 6 months.
3vangelist is offline  
Reply


Similar Threads Similar Threads
All Quest Functions Over 670 functions
06/08/2013 - Metin2 PServer Guides & Strategies - 21 Replies
Gretings this is very simple tut ther is all organized quest functions based on last pub rev 2089 If you know some quest functions is not ther let me know "if valid function of corse" addimage addmapsignal add_bgm_info
Looking for CabalRider Ph Agents/Dealers
06/07/2008 - Cabal Hacks, Bots, Cheats, Exploits & Macros - 0 Replies
Looking for ppl who is interested in becoming Agents/Dealers in Philippines for CabalRider Ph Bot. (very good profit margin! :P) Contact me at (YM) [email protected]. Cafe owners and forum/website owners will be most suitable but not a requirement. CabalRider is in free trial period for around 3 weeks. After that it will require top up every month. Hope to establish a network of dealers/agents asap before the end of trial period. Agent advantages include good profit margin, inclusing in the...
Agents Exploit
01/10/2006 - General Gaming Discussion - 0 Replies
Start a mission and abort in mission area. You should get a warning that you have 30 secs left till agents arrive. At the end of the timer you will get an agent. Each player gets their own agent. So if there is 4 team members in the mission area 4 agents summon. Now to avoid dying climb up a pipe so you're halfway from the ground and roof. If you do it right the agent cant hit you and others can gank him . Also I'm not sure but I think agents still die when you leave the mission...



All times are GMT +1. The time now is 16:28.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.