Quantcast
Knowing if an equippable item is "valid" for the player character's class - WoWInterface
Thread Tools Display Modes
08-15-18, 03:55 PM   #1
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Knowing if an equippable item is "valid" for the player character's class

I'm writing a thing to replace the non-functional IsContainerItemAnUpgrade(), because I can.

The core logic for my code is functional, but it doesn't check if an item is of the right armor type, or if it's even equipable at all by the player character's class. There doesn't seem to be an API function to directly check this. Is there an "agreed upon" good way of doing this?

I have an idea in mind involving hardcoded arrays and for loops, to check if the current item is valid for the player character's class, but I'm probably missing something and this is probably not the best way to do it. I'd rather not have to reinvent the wheel if somebody else already has a solution, anyway.
  Reply With Quote
08-15-18, 04:17 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,460
I would hazard a guess that if Blizzard has item tooltips showing specific spec requirements there may be a value on the GetItemInfo function's return values that offer that number. Maybe even a class value, if you are lucky. And hopefully primary stat, secondary stat etc info and that it is identifiable.

Short of that, the table info list idea might be the way to go ..

Create a table of class-armor combos and class-stat combos and check to see if the values match the item info when looking at an item .. if it passes the tests its a valid item.

Thats how I would do it anyway
__________________
  Reply With Quote
08-15-18, 08:49 PM   #3
sezz
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 119
I use itemClassID and itemSubClassID from GetItemInfo to to check if it's the correct armor type and then simply scan the tooltip for red colored text. It's not fast (and therefore propably not usable when you want to check all items in the bags at once), but reliable
  Reply With Quote
08-15-18, 10:18 PM   #4
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Maaan I forgot about that, the items that only differ between specs by their primary stats.
  Reply With Quote
08-16-18, 01:26 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,460
Originally Posted by Ammako View Post
Maaan I forgot about that, the items that only differ between specs by their primary stats.
Although, alot of items cater for multiple specs and just grey out the one not usable.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Knowing if an equippable item is "valid" for the player character's class

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off