Thread Tools Display Modes
Today, 01:51 PM   #1
Saint-Ange
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Question Getting the gear item level

Hello,

Is there an other way to get a gear item level (armor/weapon/Jewelry) other than GetItemLink(bagId, slotIndex) and retrieve the SubType?

I'd like to get the crafting rank from armor/weapon/Jewelry no matter if looted or crafted, so I've made a table (00 are placeholders till I get the SubType) :

Code:
data.itemLevelToRankAndQuality = {
   -- level 1 to 14, rank 1
   { level = {00, 00, 00, 00, 00}, rank = 1, quality = 1 }, -- White (Normal)
   { level = {00, 00, 00, 00, 00}, rank = 1, quality = 2 }, -- Green (Fine)
   { level = {00, 00, 00, 00, 00}, rank = 1, quality = 3 }, -- Blue (Superior)
   { level = {00, 00, 00, 00, 00}, rank = 1, quality = 4 }, -- Purple (Epic)
   { level = {00, 00, 00, 00, 00}, rank = 1, quality = 5 }, -- Gold (Legendary)
   -- level 16 to 24, rank 2
   { level = {00, 00, 00, 00, 00}, rank = 2, quality = 1 }, -- White
   { level = {00, 00, 00, 00, 00}, rank = 2, quality = 2 }, -- Green
   { level = {00, 00, 00, 00, 00}, rank = 2, quality = 3 }, -- Blue
   { level = {00, 00, 00, 00, 00}, rank = 2, quality = 4 }, -- Purple
   { level = {00, 00, 00, 00, 00}, rank = 2, quality = 5 }, -- Gold
   -- level 26 to 34, rank 3
   { level = {29, 00, 00, 00, 00}, rank = 3, quality = 1 }, -- White
   { level = {32, 00, 00, 00, 00}, rank = 3, quality = 2 }, -- Green
   { level = {35, 00, 00, 00, 00}, rank = 3, quality = 3 }, -- Blue
   { level = {00, 00, 00, 00, 00}, rank = 3, quality = 4 }, -- Purple
   { level = {00, 00, 00, 00, 00}, rank = 3, quality = 5 }, -- Gold
   -- level 36 to 44, rank 4
   { level = {00, 00, 00, 00, 00}, rank = 4, quality = 1 }, -- White
   { level = {00, 00, 00, 00, 00}, rank = 4, quality = 2 }, -- Green
   { level = {00, 00, 00, 00, 00}, rank = 4, quality = 3 }, -- Blue
   { level = {00, 00, 00, 00, 00}, rank = 4, quality = 4 }, -- Purple
   { level = {00, 00, 00, 00, 00}, rank = 4, quality = 5 }, -- Gold
   -- level 46 to 54, rank 5
   { level = {00, 00, 00, 00, 00}, rank = 5, quality = 1 }, -- White
   { level = {00, 00, 00, 00, 00}, rank = 5, quality = 2 }, -- Green
   { level = {00, 00, 00, 00, 00}, rank = 5, quality = 3 }, -- Blue
   { level = {00, 00, 00, 00, 00}, rank = 5, quality = 4 }, -- Purple
   { level = {00, 00, 00, 00, 00}, rank = 5, quality = 5 }, -- Gold
   -- CP 10 to 30, rank 6
   { level = {00, 00, 00}, rank = 6, quality = 1 }, -- White
   { level = {00, 00, 00}, rank = 6, quality = 2 }, -- Green
   { level = {00, 00, 00}, rank = 6, quality = 3 }, -- Blue
   { level = {00, 00, 00}, rank = 6, quality = 4 }, -- Purple
   { level = {00, 00, 00}, rank = 6, quality = 5 }, -- Gold
   -- CP 40 to 60, rank 7
   { level = {00, 00, 00}, rank = 7, quality = 1 }, -- White
   { level = {00, 00, 00}, rank = 7, quality = 2 }, -- Green
   { level = {00, 00, 00}, rank = 7, quality = 3 }, -- Blue
   { level = {00, 00, 00}, rank = 7, quality = 4 }, -- Purple
   { level = {00, 00, 00}, rank = 7, quality = 5 }, -- Gold
   -- CP 70 to 80, rank 8
   { level = {00, 00}, rank = 8, quality = 1 }, -- White
   { level = {00, 00}, rank = 8, quality = 2 }, -- Green
   { level = {00, 00}, rank = 8, quality = 3 }, -- Blue
   { level = {00, 00}, rank = 8, quality = 4 }, -- Purple
   { level = {00, 00}, rank = 8, quality = 5 }, -- Gold
   -- CP 90 to 140, rank 9
   { level = {00, 00, 00, 00, 00, 70}, rank = 9, quality = 1 }, -- White
   { level = {00, 00, 00, 00, 00, 76}, rank = 9, quality = 2 }, -- Green
   { level = {00, 00, 00, 00, 00, 79}, rank = 9, quality = 3 }, -- Blue
   { level = {00, 00, 00, 00, 00, 00}, rank = 9, quality = 4 }, -- Purple
   { level = {00, 00, 00, 00, 00, 00}, rank = 9, quality = 5 }, -- Gold
   -- CP 150 to 160, rank 10
   { level = {74, 75}, rank = 10, quality = 1 }, -- White
   { level = {00, 78}, rank = 10, quality = 2 }, -- Green
   { level = {00, 81}, rank = 10, quality = 3 }, -- Blue
   { level = {00, 83}, rank = 10, quality = 4 }, -- Purple
   { level = {00, 86}, rank = 10, quality = 5 }, -- Gold
}
.. hence me asking here if there's a better way

Last edited by Saint-Ange : Today at 01:52 PM. Reason: typo
  Reply With Quote
Today, 02:26 PM   #2
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 414
It's not clear what information you have. Where is this item and why can you not use GetItemLink? There's multiple ways and reasons to get the level and quality, and various reasons why a table or similar might be required, but you haven't given enough information for us to say what to use.
  Reply With Quote
Today, 02:49 PM   #3
Saint-Ange
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Originally Posted by Dolgubon View Post
It's not clear what information you have. Where is this item and why can you not use GetItemLink? There's multiple ways and reasons to get the level and quality, and various reasons why a table or similar might be required, but you haven't given enough information for us to say what to use.
I want to retrieve the crafting rank of a gear item on EVENT_INVENTORY_SINGLE_SLOT_UPDATE though if I understood well itemLink does not contain that information hence me mapping the subType to displayed level on the tooltip.
  Reply With Quote
Today, 03:10 PM   #4
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 5,165
The crafting rank is nothing that's in the itemlink directly as it is level dependent afaik
So what you need would be a lookup table for GetItemLinkRequiredLevel(itemLink) and hardcode the needed crafting ranks.
Like smithing "iron" rank 1 = item levels 1 to 14
and so on

Unless vanilla UI code shows you how ZOs does it to show the level text "1 to 14" at the crafting tables UI?
Did you search that control and how it's text is build in vanilla code?
ZO_SmithingTopLevelCreationPanelMaterialListSelectedLabel
https://github.com/esoui/esoui/blob/...hared.lua#L305
Looks like the rank texts is in data.patternName, so check how it get's there and maybe it's using some API.
I think it's this line:
https://github.com/esoui/esoui/blob/...hared.lua#L876
Code:
 local patternName, baseName, _, numMaterials, numTraitsRequired, numTraitsKnown, resultingItemFilterType = GetSmithingPatternInfo(patternIndex)

But the quality is in the itenlink so no need to hardcode anything for that, unless your addon would need that somehow...

Last edited by Baertram : Today at 03:17 PM.
  Reply With Quote
Today, 03:52 PM   #5
Saint-Ange
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 16
Originally Posted by Baertram View Post
The crafting rank is nothing that's in the itemlink directly as it is level dependent afaik
So what you need would be a lookup table for GetItemLinkRequiredLevel(itemLink) and hardcode the needed crafting ranks.
Like smithing "iron" rank 1 = item levels 1 to 14
and so on

Unless vanilla UI code shows you how ZOs does it to show the level text "1 to 14" at the crafting tables UI?
Did you search that control and how it's text is build in vanilla code?
ZO_SmithingTopLevelCreationPanelMaterialListSelectedLabel
https://github.com/esoui/esoui/blob/...hared.lua#L305
Looks like the rank texts is in data.patternName, so check how it get's there and maybe it's using some API.
I think it's this line:
https://github.com/esoui/esoui/blob/...hared.lua#L876
Code:
 local patternName, baseName, _, numMaterials, numTraitsRequired, numTraitsKnown, resultingItemFilterType = GetSmithingPatternInfo(patternIndex)

But the quality is in the itenlink so no need to hardcode anything for that, unless your addon would need that somehow...
ok I tried again with GetItemLinkRequiredLevel(itemLink) and of course I get the .. level but what about the CP level, how do I get that?

Also I have checked your links but I haven't got the level yet, it's all giberish to me :°
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Getting the gear item level


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