WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Knowing if an equippable item is "valid" for the player character's class (https://www.wowinterface.com/forums/showthread.php?t=56545)

Ammako 08-15-18 03:55 PM

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.

Xrystal 08-15-18 04:17 PM

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

sezz 08-15-18 08:49 PM

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

Ammako 08-15-18 10:18 PM

Maaan I forgot about that, the items that only differ between specs by their primary stats.

Xrystal 08-16-18 01:26 AM

Quote:

Originally Posted by Ammako (Post 329598)
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.


All times are GMT -6. The time now is 11:57 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI