WoW:API OffhandHasWeapon: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API OffhandHasWeapon to API OffhandHasWeapon without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{API/Uncategorized}}
{{wowapi}}
hasWeapon = OffhandHasWeapon()
 
Return whether a weapon is in the offhand slot.
 
----
;''Returns''
 
:;hasWeapon : Flag - 1 if an item of type Weapon is in the offhand slot, nil otherwise
 
 
Note: Shields, Held Off-Hand and other non-weapon items in this slot are typically not a weapon.  You can think of this return as the equivalent of:
 
local _,_,id = string.find(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")) or "","(item:%d+:%d+:%d+:%d+)")
local _,_,_,_,itemType = GetItemInfo(id)
return itemType=="Weapon"

Latest revision as of 04:46, 15 August 2023

WoW API < OffhandHasWeapon

hasWeapon = OffhandHasWeapon()

Return whether a weapon is in the offhand slot.


Returns
hasWeapon
Flag - 1 if an item of type Weapon is in the offhand slot, nil otherwise


Note: Shields, Held Off-Hand and other non-weapon items in this slot are typically not a weapon. You can think of this return as the equivalent of:

local _,_,id = string.find(GetInventoryItemLink("player",GetInventorySlotInfo("SecondaryHandSlot")) or "","(item:%d+:%d+:%d+:%d+)")
local _,_,_,_,itemType = GetItemInfo(id)
return itemType=="Weapon"