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
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
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
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
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
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






