Thread Tools Display Modes
01-06-23, 11:59 PM   #1
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
Question How do I get a spec's weapon skills?

I'm trying to make an addon to help equip gearSets, and it seems to work, except that it will try to equip items that the current spec can't actually equip. For armor, I'm just getting the subclass of the item with GetItemInfo(itemId) and comparing it to a kind of comparison table. I only did it that way because I was trying to get a working prototype, but I don't think that method is viable when it comes to weapon subtypes vs spec.

Does anyone have a solution for me, please? I suppose the underlying question here is, how do I check if an item is actually able to be equipped by the player with the current class and spec?

Last edited by pasiv : 01-07-23 at 02:23 AM.
  Reply With Quote
01-07-23, 12:43 AM   #2
briskman3000
A Flamescale Wyrmkin
 
briskman3000's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 108
IsEquippableItem() will tell you if you can equip something.
__________________
My Addons: Convert Ratings Honor Track
  Reply With Quote
01-07-23, 01:23 AM   #3
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
Hmmm... That sort of solves part of my problem, but not completely.

According to this https://wowpedia.fandom.com/wiki/API_IsEquippableItem

An that will return true even if you're on a class that doesn't meet the requirements. So like a piece of plate armor is technically an equippable item, but you can't actually equip it if you're a druid.

Last edited by pasiv : 01-07-23 at 02:19 AM.
  Reply With Quote
01-07-23, 03:48 AM   #4
briskman3000
A Flamescale Wyrmkin
 
briskman3000's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 108
Well that's just a dumb api call then.

You can use the item subclassID from GetItemInfo() on weapons too, if you go the way of building hard coded comparison tables as the 13th output from that call does output a valid ID number to use with Enum.ItemWeaponSubclass
__________________
My Addons: Convert Ratings Honor Track
  Reply With Quote
01-07-23, 06:05 AM   #5
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
haha damn. I was afraid it would come to that.
  Reply With Quote
01-07-23, 09:18 AM   #6
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,919
This one looks interesting but might be for a specific use
https://wowpedia.fandom.com/wiki/API...ValidForPlayer

And this one sounds useful and might be what you need
https://wowpedia.fandom.com/wiki/API...cToPlayerClass

This function is used on Weekly Rewards by Blizzard
https://github.com/Gethe/wow-ui-sour...wards.lua#L347


Might be easier than building a database of data up .. but if you have already done that keep this for your next code overhaul
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
01-07-23, 04:04 PM   #7
pasiv
A Murloc Raider
Join Date: Jul 2019
Posts: 7
I made my big ol table ��and then went to sleep. But I'll play around with those. Thanks!

How does the game decide whether that item you have will actually get equipped when you click it?


These are the results. Not sure whether I can use them. I'm testing whether a paladin can equip a plat helm that is already equipped.
Lua Code:
  1. local slot,id = 1,nil
  2. local itemLoc = ItemLocation:CreateFromEquipmentSlot(INVSLOT_HEAD)
  3. if itemLoc:IsValid() then
  4.    id = C_Item.GetItemID(itemLoc)
  5. end
  6.  
  7. print(id) --157961
  8. print(IsEquippableItem(id)) --true, although it would be true for any class
  9. print(C_Item.IsItemSpecificToPlayerClass(id)) --false.
  10. --print(C_Item.IsItemSpecificToPlayerClass(GetItemInfo(id))) --also false.  Not sure what I'm doing wrong.
  11. print(C_Item.IsItemConvertibleAndValidForPlayer(itemLoc)) --false

This might be the solution to my problem. Neeeds more testing

Lua Code:
  1. local table = GetItemSpecInfo(id)
  2. for k,v in pairs(table) do
  3.    print(k,v)
  4. end
  5. --Output
  6. --1, 65 -- PaladinHoly
  7. --2, 66 -- PaladinProtection
  8. --3, 70 -- Paladin Ret

Far as I can tell this only show true for armor + back (but haven't tried with weapons yet.)

Last edited by pasiv : 01-07-23 at 10:05 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How do I get a spec's weapon skills?

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