Thread Tools Display Modes
12-09-06, 03:21 PM   #1
ayradyss
A Theradrim Guardian
 
ayradyss's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 68
GetItemInfo()

Anyone know if there's a function to extract enchant info from an itemID like there is for items? GetItemInfo() doesn't seem to actually work for enchants...
  Reply With Quote
12-09-06, 03:46 PM   #2
Nymbia
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 22
Originally Posted by ayradyss
Anyone know if there's a function to extract enchant info from an itemID like there is for items? GetItemInfo() doesn't seem to actually work for enchants...
Well, the very nature of an item id implies that there's no attached enchant data. If you have a chat link or item hyperlink, enchant data is stored in a field of the item data string.

So really, the question becomes: which items are you wanting enchant info from?



(or maybe I've misunderstood your question and you really mean chat links for the actual enchants, in which case,
Code:
local _,_, id = string.find(link, "enchant:(%d+)")
will pluck an enchant id out of an enchant link for you.)
  Reply With Quote
12-09-06, 04:24 PM   #3
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
Are you after the information about an enchant spell (the trade window tooltip), or info on the enchant on an item from it's itemlink?

If it's the former, you have to parse the tooltip from GameTooltip:SetHyperlink()

If it's the latter, one of the ints in the itemstring is the enchant. You can find a full list on WoWWiki.
  Reply With Quote
12-11-06, 07:12 PM   #4
ayradyss
A Theradrim Guardian
 
ayradyss's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 68
Clarification :)

GetItemInfo(itemid) returns the item name and link, among various and sundry other data - meaning that for any item in local cache I need only the item ID to generate a link or the name.

Unfortunately, this doesn't work for enchant:## id's. GetItemInfo() returns nil regardless of whether I've seen the enchant link itself.

I'm working on database efficiency for RecipeBook here, and trying to avoid storing the full name and link of the items.

For example: I can store 2582 - and when needed, assuming local cache, generate both the name "Green Woolen Vest" and the link "|cffffffff|Hitem:2582:0:0:0:0:0:0:0|h[Green Woolen Vest]|h|r" using GetItemInfo(2582).
I cannot store 7857 and generate "|cffffffff|Henchant:7857|h[Enchant Chest - Health]|h|r" even if I've seen/possess/can do the enchantment. Even if I generate a tooltip from "enchant:7857" I have to parse the tooltip and create my own name and link for the item rather than being able to use a Blizzard function.

I want to be able to store 7857 and do the same for enchantments that I am for items.
  Reply With Quote
12-11-06, 11:27 PM   #5
Tekkub
A Molten Giant
 
Tekkub's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 960
Hrm... well the real question is, is there ever a chance that setting an enchant tooltip will cause a disconnect, like setting a bad item tooltip can? If no, then you should be safe to save the id's and grab what you need out of a tooltip.

Also, in the past I've seen the client "autocomplete" partial item links. You don't always need the full link including color and name, just sending the partial link would fill it in. Perhaps the same can be done with enchant links? I'll test tonight.
  Reply With Quote
12-12-06, 07:21 PM   #6
ayradyss
A Theradrim Guardian
 
ayradyss's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 68
A good thought. I'll have to look into it.
  Reply With Quote
12-13-06, 08:07 PM   #7
sivarak
A Defias Bandit
Join Date: Dec 2006
Posts: 2
is there a command to show item id?
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » GetItemInfo()

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