Thread Tools Display Modes
05-18-13, 04:28 AM   #1
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
LUA function for getting item enchants

Is there a way in the API to check the enchants on an item that I currently have equipped? I've been unable to find one so far...
  Reply With Quote
05-18-13, 04:50 AM   #2
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
To check for an enchant, you need to parse the itemstring.

You can get an itemlink for a slot in your inventory with GetInventoryItemLink:
lua Code:
  1. local slotId = GetInventorySlotInfo("ChestSlot")
  2. local link = GetInventoryItemLink("player", slotId)
  3. local itemId, enchantId, gem1, gem2, gem3, gem4 = link:match("item:(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)")
Tekkub's Bimbo is an excellent example of how you can detect enchants/gems.
  Reply With Quote
05-18-13, 05:07 AM   #3
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Ooh, I didn't know you could get that sort of info out of an item link... thanks

[edit]
I can't find anything about what these enchant/ gem numbers mean though, including in Bimbo... they aren't spell IDs nor item IDs.

Last edited by Malsomnus : 05-18-13 at 06:35 AM.
  Reply With Quote
05-18-13, 06:53 AM   #4
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
Well, there's this page: http://www.wowpedia.org/EnchantId

It doesn't look very updated. Not sure what the best practice is for dealing with enchantIds.
  Reply With Quote
08-29-13, 06:51 AM   #5
Taraezor
A Fallenroot Satyr
 
Taraezor's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2012
Posts: 21
Forgive the Necro but this thread shows up in searches and I don't want people to get the wring idea: The above discussion does NOT apply to the buffs Shaman put on their weapon.

Aside from parsing Tooltips and/or monitoring logs to see when Windfury etc were applied, there is no way of knowing the enchant put on a Shaman's weapon.

In the case of Shaman's, you will get a 0 (zero) in the colon separated string list.
  Reply With Quote
08-29-13, 08:09 AM   #6
Malsomnus
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Apr 2013
Posts: 203
Well, if this thread has already been resurrected...
I eventually solved the problem by creating an item link for a stat-less item with the given enchant ID and parsing its tooltip, and would like to thank the author of this add-on for the idea (and most of the implementation).

As for shamans, I used GetWeaponEnchantInfo to see if a weapon enchant exists, but this indeed does not tell me what the enchant is.
__________________
SanityCheck - If you've ever said the words "Sorry, I forgot" then you need this add-on.

Remember, every time you post a comment on an add-on, a kitten gets its wings!
  Reply With Quote
08-29-13, 08:11 AM   #7
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Taraezor View Post
Forgive the Necro but this thread shows up in searches and I don't want people to get the wring idea: The above discussion does NOT apply to the buffs Shaman put on their weapon.

Aside from parsing Tooltips and/or monitoring logs to see when Windfury etc were applied, there is no way of knowing the enchant put on a Shaman's weapon.

In the case of Shaman's, you will get a 0 (zero) in the colon separated string list.
What about this: http://wowprogramming.com/docs/api/GetWeaponEnchantInfo ?
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LUA function for getting item enchants


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