Quantcast WoWInterface - View Single Post - Checking if item is usable
View Single Post
03-27-15, 09:07 PM   #1
A Scalebane Royal Guard
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 425
Checking if item is usable

This is driving me crazy. How can I check if an item actually is usable?
IsUsableItem() is not what I'm looking for. This is what I use in my OnTooltipSetItem script:
Lua Code:
  1. ...
  2. elseif  MerchantFrame:IsVisible()        then CLICK_STRING = G.CLICK.SELL;
  3. elseif  IsEquippedItem(self:GetItem())   then CLICK_STRING = G.CLICK.REPLACE;
  4. elseif  IsEquippableItem(self:GetItem()) then CLICK_STRING = G.CLICK.EQUIP;
  5. elseif  IsUsableItem(self:GetItem())     then CLICK_STRING = G.CLICK.USE;
  6. ...
CLICK_STRING is added to the tooltip depending on the outcome of this check.
However, the last line adds to pretty much any item that isn't currently locked out.
This means even grey, non-usable items will get the "Use" string added to it.

How can I check explicitly for items that have a Use effect?

Edit: For anyone else asking this question, the answer is here:
Originally Posted by SDPhantom View Post
I remember using GetItemSpell() to poke around and see what spells different items triggered. As far as I remember, it only returns spell name and rank if there is one attached to said item.

Last edited by MunkDev : 03-28-15 at 02:52 PM.
  Reply With Quote