Thread Tools Display Modes
06/28/15, 12:36 PM   #1
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Get the enchanting of an item

Hey there,

I'm trying to read the information of the used enchanting on a weapon/armor by help of the ZOs function ZO_LinkHandlerParseLink().

Curently I've tried the following:
Lua Code:
  1. local _, _, _, itemEnchantment, enchantPower1, enchantPower2 = ZO_LinkHandler_ParseLink(itemLink)

I'm not quite sure if the argument #4 is the correct one here? I read about it here:
http://www.esoui.com/forums/showthre...dler_ParseLink
->
http://wiki.esoui.com/ZO_LinkHandler_CreateLink

I get some values like 50572 or 43535 (even for an item that got no enchantment).

can anyone help me by chance and tell me how I can use the function ZO_LinkHandlerParseLink(itemLink) to get the enchantment on a weapon/armor the correct way?
Thanks a lot
  Reply With Quote
06/28/15, 12:39 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Oh I just missunderstood the format of the itemLink as it seems?

I guess I need to use the variable at the offset 8 then, instead of 4, as the first 4 are already fixed?
--name, color, type, id, +21 other attributes
  Reply With Quote
06/29/15, 01:16 AM   #3
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Lua Code:
  1. if (itemType == ITEMTYPE_WEAPON) then
  2.  
  3.     local haveenchantcharges = DoesItemLinkHaveEnchantCharges(itemLink)
  4.     if haveenchantcharges then
  5.         local maxenchantcharges = GetItemLinkMaxEnchantCharges(itemLink)
  6.     end
  7.  
  8. elseif (itemType == ITEMTYPE_ARMOR) then
  9.  
  10.     -- Enchant desc
  11.     local hasEnchant, enchantHeader, enchantDescription = GetItemLinkEnchantInfo(itemLink)
  12.    
  13.     if hasEnchant == true then
  14.         -- enchantHeader & enchantDescription are ~= nil and can be exploited
  15.     end
  16.    
  17. end
  Reply With Quote
06/30/15, 12:47 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Thx Ayantir,

I didn't find these functions in the ESOUI sources.

Question:
I wasn't able to test it so far, but can I use GetItemLinkEnchantInfo(itemLink) for ITEMTYPE_WEAPON too?
I'm asking because I don't need the "enchant charges" but the info IF it is enchanted and WHICH enchantment is used so I can compare the same weapon with different levels, enchantments and qualities.
  Reply With Quote
06/30/15, 01:25 PM   #5
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,578
It works on both, weapons and armor.
For example
Lua Code:
  1. GetItemLinkEnchantInfo("|H1:item:54917:252:50:45869:276:50:0:0:0:0:0:0:0:0:0:27:0:1:0:36:0|h|h") -- [Sword of the Two-Fanged Snake]
returns
Code:
true, "Decrease Health Enchantment", "Deals |cffffff367|r unresistable damage."
The method is used in ingame/tooltips/itemtooltips.lua:246.

Last edited by sirinsidiator : 06/30/15 at 01:27 PM.
  Reply With Quote
06/30/15, 04:23 PM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Thanks for the proof.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Get the enchanting of an item


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