Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars > GW Bots
You last visited: Today at 08:01

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

Advertisement



Need help understanding GetRarity function

Discussion on Need help understanding GetRarity function within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2010
Posts: 4
Received Thanks: 8
Need help understanding GetRarity function

I'm rewriting a bot and running into some trouble.

Is there a way to know the rarity of an item before picking it up? GetRarity doesn't seem to work on a targeted item on the ground (ModelId and rarity return 0 - oddly, though, type does not).

Speaking of which, is there a reference to what an item's "type" is (as returned from DLLStructGetData($item,"type"))?
Rappy99 is offline  
Old 06/20/2020, 02:12   #2
 
elite*gold: 0
Join Date: Jul 2019
Posts: 98
Received Thanks: 51
Sure you can filter things out on the ground. Just need to add a filter function. A common one in the bots that are public have a function like this:

Code:
Func CanPickUp($aItem)
   Local $lRarity = GetRarity($aItem)
   
   If $lRarity == $RARITY_PURPLE Then
		Return False
   Else
		 Return True
   EndIf
EndFunc	;==>CanPickUp
Here are some constants for rarity and type:

Code:
;Rarity
Global Const $RARITY_WHITE	= 2621
Global Const $RARITY_GRAY	= 2622
Global Const $RARITY_BLUE	= 2623
Global Const $RARITY_GOLD	= 2624
Global Const $RARITY_PURPLE	= 2626
Global Const $RARITY_GREEN	= 2627
Global Const $RARITY_RED	= 33026

;Type
Global Const $TYPE_SALVAGE				= 0
Global Const $TYPE_LEADHAND				= 1
Global Const $TYPE_AXE					= 2
Global Const $TYPE_BAG					= 3
Global Const $TYPE_BOOTS				= 4
Global Const $TYPE_BOW					= 5
Global Const $TYPE_BUNDLE				= 6
Global Const $TYPE_CHESTPIECE			= 7
Global Const $TYPE_RUNE_AND_MOD			= 8
Global Const $TYPE_USABLE				= 9
Global Const $TYPE_DYE					= 10
Global Const $TYPE_MATERIAL_AND_ZCOINS	= 11
Global Const $TYPE_OFFHAND				= 12
Global Const $TYPE_GLOVES				= 13
Global Const $TYPE_CELESTIAL_SIGIL		= 14
Global Const $TYPE_HAMMER				= 15
Global Const $TYPE_HEADPIECE			= 16
Global Const $TYPE_TROPHY_2				= 17	; SalvageItem / CC Shards?
Global Const $TYPE_KEY					= 18
Global Const $TYPE_LEGGINS				= 19
Global Const $TYPE_GOLD_COINS			= 20
Global Const $TYPE_QUEST_ITEM			= 21
Global Const $TYPE_WAND					= 22
Global Const $TYPE_SHIELD				= 24
Global Const $TYPE_STAFF				= 26
Global Const $TYPE_SWORD				= 27
Global Const $TYPE_KIT					= 29	; + Keg Ale
Global Const $TYPE_TROPHY				= 30
Global Const $TYPE_SCROLL				= 31
Global Const $TYPE_DAGGERS				= 32
Global Const $TYPE_PRESENT				= 33
Global Const $TYPE_MINIPET				= 34
Global Const $TYPE_SCYTHE				= 35
Global Const $TYPE_SPEAR				= 36
Global Const $TYPE_BOOKS				= 43	; Encrypted Charr Battle Plan/Decoder, Golem User Manual, Books
Global Const $TYPE_COSTUME_BODY			= 44
Global Const $TYPE_COSTUME_HEADPICE		= 45
Global Const $TYPE_NOT_EQUIPPED			= 46
list comprehension is offline  
Old 06/20/2020, 02:23   #3
 
elite*gold: 0
Join Date: Apr 2010
Posts: 4
Received Thanks: 8
Unfortunately, that looks very similar to what I have, but it's not working for me.

Code:
Global Const $Rarity_Gold   = 2624
Global Const $Rarity_Purple = 2626
Global Const $Rarity_Blue   = 2623
Global Const $Rarity_White  = 2621

CanPickUp(GetCurrentTarget())

Func CanPickUp($lItem)
	If IsDllStruct($lItem) = 0 Then $lItem = GetAgentByID($lItem)

	Local $lModelID = DllStructGetData(($lItem), 'ModelId')
	Local $aExtraID = DllStructGetData($lItem, 'ExtraId')
	Local $lRarity = GetRarity($lItem)
	Local $Requirement = GetItemReq($lItem)

	MsgBox(0,"Stuff",$lModelID & " - " & $aExtraID & " - " & $lRarity & " - " & $Requirement)
EndFunc
I've not been able to get beyond this point because all of those variables return 0.
Rappy99 is offline  
Old 06/20/2020, 12:59   #4
 
elite*gold: 0
Join Date: Jan 2019
Posts: 32
Received Thanks: 16
The problem is that you are still working with an agent, and not with an item. It's no surprise that your code doesn't work, since you are trying to extract item info from an agent.
You have to convert (maybe not the right word) the agent into an item first:
Code:
Func CanPickUp($lAgent)
	If IsDllStruct($lAgent) = 0 Then $lAgent = GetAgentByID($lAgent)
	Local $lAgentId = DllStructGetData($lAgent, "Id")
	Local $lItem = GetItemByAgentID($lAgentId)
	.
	.
	.
FriendlyFarmer is offline  
Thanks
1 User
Old 06/20/2020, 20:27   #5
 
elite*gold: 0
Join Date: Mar 2019
Posts: 37
Received Thanks: 30
@

your code is wrong as Farmer already explained, what are you trying to do ? you just want to PickUp gold items of a specific type and req ?

an example to pick up only gold shields and swords:
Code:
Local $t = DllStructGetData($aItem, 'Type')
Local $r = GetRarity($aItem)
If $t = 24 Or $t = 27 Then
	If $r = 2624 Then
		Return True
	EndIf
Also from what i understand you searching for the weapon types ?

; Axe (Type 2)
; Bow (Type 5)
; Offhand (Type 12)
; Hammer (Type 15)
; Wand (Type 22)
; Shield (Type 24)
; Staff (Type 26)
; Sword (Type 27)
; Dagger (Type 32)
; Scythe (Type 35)
; Spear (Type 36)
CoderAndy is offline  
Thanks
1 User
Old 06/20/2020, 22:42   #6
 
elite*gold: 0
Join Date: Apr 2010
Posts: 4
Received Thanks: 8
Quote:
Originally Posted by FriendlyFarmer View Post
The problem is that you are still working with an agent, and not with an item. It's no surprise that your code doesn't work, since you are trying to extract item info from an agent.
You have to convert (maybe not the right word) the agent into an item first
That was indeed the issue. Thank you very much. I'm still getting used to what functions in GWA2 need to be passed.
Rappy99 is offline  
Reply


Similar Threads Similar Threads
std::function of a function returning an std::function
11/11/2013 - C/C++ - 19 Replies
Nun muss ich nach langer Zeit auch mal wieder einen Thread erstellen, weil mir Google nicht mehr weiterhelfen kann. Ich verzweifle an Folgendem Vorhaben: #include <Windows.h> #include <string> #include <iostream> using namespace std;
Running Function 2 after Function 1 finished
09/15/2013 - AutoIt - 3 Replies
Hey, its me again. Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all. The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run. #AutoIt3Wrapper_UseX64=n...
[VIP-function] ToxicSYS [VIP-function]
08/14/2010 - WarRock Hacks, Bots, Cheats & Exploits - 1 Replies
heeeey E-pvpers :pimp: this is a new hack by TSYS Status : UNDETECTED Functions (VIDEO) : YouTube - WarRock - Bikini event VIP hack
Reading the WoW chat through port sniffing
04/04/2009 - World of Warcraft - 4 Replies
Hello, I was wondering what would be the best way to decode WoW packages directly from a packet stream captured by for instance tcpdump (libpcap). I attached a file containing a raw packet. It clearly states "Trade - City" with some clutter and then a cleartext chat message. Can someone help me out with this?
Chat Logfile Reading Offline
12/31/2005 - Conquer Online 2 - 2 Replies
Anyone know or have any programs that allows us to read chat logs without having to log into CO to do so? the log files are in a .txt format but in gibberish that u can&#39;t read, is there a program or is it possible to make a program to read the chat logs without having to log or open CO? any help will be appreciated, thanx.



All times are GMT +1. The time now is 08:01.


Powered by vBulletin®
Copyright ©2000 - 2021, 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.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

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