Thursday, April 19, 2012

Is usable?

Does anyone know of a function, API or anything that will check if a player meets the requirements to use an item?

I have looked at IsUsableItem(item) but I believe it's just a flag to say if the item has a useable effect to it but doesn't check if the player meets the requirements to use it such as a required engineering skill level.

Any information is appreciated.

Thanks.|||I'm not sure if there's a global way of doing this.

If the item is in the Merchant frame then GetMerchantItemInfo returns a variable that tells you whether the item is usable.

Similarly, for the AH and Quest Frames you can use QueryAuctionItems and GetQuestItemInfo, etc. Other frames my have other functions.

For equippable items you could examine the ItemRef tooltip after SetItemRef.... and look at the colour of the equipment slot text...anything but red should be ok ?

Or possibly, if a tooltip has ANY red text, you might be able to consider it un-usable.

For example :

local r, g, b = ItemRefTooltipTextRight3:GetTextColor();

Blizzard will return numbers with a large number of decimal places so you might want to round the figures down to 3 where the colour red would be :

r = 0.999

g = 0.125

b = 0.125

.....

Or maybe there is a MUCH easier way and I've overlooked it...|||I'm looking specifically at inventory items. I'll play around with the colored text idea.

Thanks.

No comments:

Post a Comment