Register for your free account! | Forgot your password?

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

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

Advertisement



[GWA2] Useful GWA2 Functions

Discussion on [GWA2] Useful GWA2 Functions within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2024
Posts: 19
Received Thanks: 3
[GWA2] Useful GWA2 Functions

Here are some custom functions I have written for the gwa2 library. Nothing groundbreaking, just helpful for some of my scripts. Just wanted one place to consolidate them.

Code:
;~ Description: Returns the type of an item.
Func GetItemType($aItem)
    If Not IsDllStruct($aItem) Then $aItem = GetItemByItemID($aItem)    
    ; Assuming 'Type' is directly accessible in the item's structure and represents the item type.
    Local $itemType = DllStructGetData($aItem, 'Type')    
    Return $itemType
EndFunc   ;==>GetItemType
Code:
;~ Description: Returns Item Stat Range
Func GetItemDamageRange($aItem)
    If Not IsDllStruct($aItem) Then $aItem = GetItemByItemID($aItem)
    Local $lModString = GetModStruct($aItem)
    Local $lPos = StringInStr($lModString, "A8A7") ; Weapon Damage
    If $lPos = 0 Then $lPos = StringInStr($lModString, "C867") ; Energy (focus)
    If $lPos = 0 Then $lPos = StringInStr($lModString, "B8A7") ; Armor (shield)
	If $lPos = 0 Then
		Local $errorRange[2] = [-1, -1] ; Properly initialize the error array
		Return $errorRange ; Return the error array
	EndIf
    
    Local $damageRange[2] ; Declare an array to hold the damage range
    $damageRange[0] = Int("0x" & StringMid($lModString, $lPos - 4, 2)) ; Minimum damage
    $damageRange[1] = Int("0x" & StringMid($lModString, $lPos - 2, 2)) ; Maximum damage
    
    Return $damageRange ; Return the array
EndFunc
Code:
;~Description: Returns Item Max Stat
Func GetItemMaxDmg($aItem)
	If Not IsDllStruct($aItem) Then $aItem = GetItemByItemID($aItem)
	Local $lModString = GetModStruct($aItem)
	Local $lPos = StringInStr($lModString, "A8A7") ; Weapon Damage
	If $lPos = 0 Then $lPos = StringInStr($lModString, "C867") ; Energy (focus)
	If $lPos = 0 Then $lPos = StringInStr($lModString, "B8A7") ; Armor (shield)
	If $lPos = 0 Then Return 0
	Return Int("0x" & StringMid($lModString, $lPos - 2, 2))
EndFunc
*I think this one already existed, but included it anyway.

Code:
;Returns Item Name by Item Type
Func GetItemTypeName($itemType)
    Switch $itemType
        Case $TYPE_AXE
            Return "Axe"
        Case $TYPE_BOW
            Return "Bow"
        Case $TYPE_OFFHAND
            Return "Off-Hand"
        Case $TYPE_HAMMER
            Return "Hammer"
        Case $TYPE_WAND
            Return "Wand"
        Case $TYPE_SHIELD
            Return "Shield"
        Case $TYPE_STAFF
            Return "Staff"
        Case $TYPE_SWORD
            Return "Sword"
        Case $TYPE_DAGGERS
            Return "Daggers"
        Case $TYPE_SCYTHE
            Return "Scythe"
        Case $TYPE_SPEAR
            Return "Spear"
        Case Else
            Return "Unknown Type"
    EndSwitch
EndFunc   ;==>GetItemTypeName
To use GetItemTypeName($itemType), first use GetItemType($aItem)
I.E.
Local $lType = GetItemType($aItem) ;get item type value
Local $lItemTypeName = GetItemTypeName($lType) ;get item type name

Code:
;Returns Item Rarity Name
Func GetItemRarityName($itemRarity)
    Switch $itemRarity
        Case 2621
            Return "White"
        Case 2622
            Return "Gray"
        Case 2623
            Return "Blue"
        Case 2624
            Return "Gold"
        Case 2626
            Return "Purple"
        Case Else
            Return "Unknown Rarity"
    EndSwitch
EndFunc   ;==>GetItemRarityName
To use GetItemRarityName($itemRarity), first use GetRarity($aItem)
I.E
Local $lRarity = GetRarity($aItem) ; Get rarity value
Local $lRarityName = GetItemRarityName($lRarity) ; Get rarity name.


Code:
;Returns Item Requirement Name
Func GetReqName($Requirement)
	Switch $Requirement
		Case 1
			Return "Illusion Magic"
		Case 2
			Return "Domination Magic"
		Case 3
			Return "Inspiration Magic"			
		Case 4
			Return "Blood Magic"
		Case 5
			Return "Death Magic"
		Case 7
			Return "Curses"
		Case 8
			Return "Air Magic"
		Case 9
			Return "Earth Magic"
		Case 10
			Return "Fire Magic"
		Case 11
			Return "Water Magic"
		Case 12
			Return "Energy Storage"
		Case 13
			Return "Healing Prayers"
		Case 14
			Return "Smiting Prayers"
		Case 15
			Return "Protection Prayers"
		Case 16
			Return "Divine Favor"
		Case 17
			Return "Strength"
		Case 18
			Return "Axe Mastery"
		Case 19
			Return "Hammer Mastery"
		Case 20 
			Return "Sword Mastery"
		Case 21
			Return "Tactics"
		Case 25
			Return "Marksmanship"
		Case Else
			Return "Unknown Req Name"
		EndSwitch
EndFunc
To use GetReqName($Requirement), first use GetItemAttribute($aItem)
I.E.
Local $lItemAttribute = GetItemAttribute($aItem) ; Get item attribute.
Local $lReqName = GetReqName($lItemAttribute) ; Get requirement name.

Code:
Func CountMods($aItem)
    Local $modCount = 0 ; Initialize mod counter  
    Local $ModStruct = GetModStruct($aItem) ; Get mod structure string of item

    ; Array of mod identifier endings to check
    Local $modPatterns = ["A820","9820","8820","7820","6823","8823","7823","4823","1824","1821","4821","7824","0822","A823","1822","9823","A821","B821","7821","9821","8821","0821","C821","5821","2821","0823","1823","2823","D822","F822","B823","B822","F823","2825","1825","A822","6822","5822","7822","8822","3822"]
    ;A820:-DMG(ST) || 9820:-DMG(Hexed) || 8820:-DMG(EN) || 7820:-DMG(%) || 6823:+HP(EN) || 8823:+HP(ST) || 7823:+HP(HEX) || 4823:+HP || 1824:+1Attribute(%) || 1821:+AR Vs DamageType || 4821:+AR Vs EnemyType || 7824:Reduces X Duration 20% || 
    ;0822:HCT All Spells || A823:HSR All Spells || 1822:HCT Attribute || 9823:HSR Attribute || 
    ;A821:+AR(>50%HP) || B821:+AR(<50%HP) || 9821:+AR(EN) || 8821:+AR(Casting) || 7821:+AR(Attacking) || C821:+AR(Hexed) || 5821:+AR(vsPhysical) || 2821:+AR(vsElemental) || 0821:[+AR/+AR(-EnergyRegen)]
    ;0823:+Energy(>50%HP) || 1823:+Energy(<50%HP) || 2823:+Energy(Hexed) || F822:+Energy(EN) || D822:[+Energy/+Energy(-EnergyRegen)]
    ;B823:Double Adrenaline(%) || B822:+EN Duration(%) || F823:AR Penetration(%) || 2825:Vampiric || 1825:Zealous ||
    ;6822:+DMG(EN) || A822:+DMG(ST) || 5822:+DMG(Hexed) || 7822:+DMG(>50%HP) || 8822:+DMG(<50%HP) || 3822: +DMG/+DMG(-1Regen)/+DMG(-10AR)
	;missing: elemental damage mod || lengthens x duration 33% || DMG vs creature type

    ; Loop through each pattern and search in ModStruct
    For $i = 0 To UBound($modPatterns) - 1
        ; Regex checks 4 any chars followed by mod identifier
        If StringRegExp($ModStruct, '.{4}' & $modPatterns[$i]) Then 
            $modCount += 1 ; Increment counter for each match
        EndIf
    Next
    Return $modCount ; Return the total mod count found
EndFunc   ;==>CountMods
**CountMods currently works for all off-hands, shields, and wands.**

Code:
; Checks if there are other players present in the vicinity of the player and logs their names.
Func AreOtherPlayersPresent()
    Local $myLoginNumber = DllStructGetData(GetAgentByID(-2), 'LoginNumber') ; Your character's login number
    Local $playerNames = "" ; Initialize an empty string to store player names
    Local $playerFound = False ; Flag to indicate if any player was found

    For $i = 1 To GetMaxAgents() ; Iterates through all possible agent IDs
        Local $agent = GetAgentByID($i)
        If IsDllStruct($agent) Then ; Checks if $agent is a valid structure
            Local $loginNumber = DllStructGetData($agent, 'LoginNumber')
            If $loginNumber <> 0 And $loginNumber <> $myLoginNumber Then ; Checks if the agent is a player and not you
                Local $playerName = GetPlayerName($agent)
                ; Adjust the regex to allow spaces in player names.
                If $playerName <> "" And StringRegExp($playerName, "^[a-zA-Z0-9 ]+$") Then ; Checks if the name is valid
                    $playerFound = True
                    $playerNames &= $playerName &       [MENTION=3576271]CRLF[/MENTION] ; Append the player name to the list
                EndIf
            EndIf
        EndIf
    Next

    If $playerFound Then
        Logger("Players detected in the district: " & $playerNames) ; Log all detected player names
        Return True ; Returns true as players were found
    Else
        ;Logger("No Other Players Found") ; Log when no players are found
        Return False ; Returns false as no players were found
    EndIf
EndFunc
albino albatross is offline  
Reply


Similar Threads Similar Threads
[26.10.11] Grape™ MINI D3D {UPDATED} | Only useful functions
10/28/2011 - WarRock Hacks, Bots, Cheats & Exploits - 30 Replies
http://www.elitepvpers.com/forum/warrock-hacks-bot s-cheats-exploits/1513471-27-10-11-grape-mini-d3d- bugfix-only-useful-functions.html#post13576362
[23.10.11] Grape™ MINI D3D *comeback* | Only useful functions
10/27/2011 - WarRock Hacks, Bots, Cheats & Exploits - 82 Replies
Werbung: http://mg.hostingsociety.com/deimudda/images/logo .gif Zum Hack : Screenshot : http://img121.imageshack.us/img121/5871/screenac. png Virustotal : *Click*



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


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.