Today, 01:51 PM | #1 |
|
![]() 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 } ![]() Last edited by Saint-Ange : Today at 01:52 PM. Reason: typo |
![]() |
Today, 02:26 PM | #2 |
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.
|
|
![]() |
Today, 02:49 PM | #3 | |
|
|
|
![]() |
Today, 03:10 PM | #4 |
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. |
|
![]() |
Today, 03:52 PM | #5 | |
|
![]() Also I have checked your links but I haven't got the level yet, it's all giberish to me :° |
|
![]() |
Today, 05:08 PM | #6 |
|
I found a way to retrieve the CP and Level at my level in lua. it's not getting the crafting rank directly from a gear item but this will do :
Code:
function addon.OnInventorySlotUpdate(event, bagId, slotIndex) local itemLink = GetItemLink(bagId, slotIndex) local requiredLevel = GetItemLinkRequiredLevel(itemLink) local requiredCP = GetItemLinkRequiredChampionPoints(itemLink) -- Determine which value to use if requiredCP > 0 then -- If CP is required (level 50 items) d(string.format("Required Champion Points: %d", requiredCP)) elseif requiredLevel > 0 then -- If the level is between 1 and 50, use the required level d(string.format("Required Level: %d", requiredLevel)) end end Still, thanks for taking the time to answer me Baertram and Dolgubon Last edited by Saint-Ange : Today at 05:11 PM. |
![]() |
Today, 05:13 PM | #7 |
What are you referring to by 'subtype'?
As baertram mentions, the level displayed in an item's tooltip is not the same as the level of material needed to craft it. (And, indeed, you cannot craft e.g. lvl 5 items, but you can loot lvl 5 items) Additionally, jewelry has a different material 'level' progression. Let's start with the level required to equip an item. (Aka, what's in the tooltip/item link) There is GetItemLinkRequiredChampionPoints which will tell you how much CP is required to equip it, or just GetItemRequiredChampionPoints if you have the bag location. This will get you the level of the gear, but it's very difficult to go from that to the type of item required to craft it. There's two cases situations: At a crafting station, and not at a crafting station. There's also LibLazyCrafting which you could use to help out, and depending on your use case, it might just be simpler to use LLC overall. At a crafting station You don't need any lookup tables, though one can be useful to avoid needing to do loops. You'd probably want to use GetSmithingPatternMaterialItemInfo(luaindex patternIndex, luaindex materialIndex) You don't care about pattern index here, so just pass in 1 for that. Material index is weirder though, it would more accurately be named craftLevelIndex or something like that. 1 -> Lvl 1 item 2 -> Lvl 4 item 3 -> Lvl 6 item etc. It'll tell you what level for a given index, what material for the index, etc. At 8 (except for jewelry) it'll swap to the second tier of material. You can loop through this with each individual material index, but it's going to be easier to just have a hardcoded table of the material breakpoints. Once you have a material index you can use GetSmithingPatternMaterialItemLink which will give you the item link. Do note that this only works for the crafting type of the station you're currently at. Not at a crafting station This case sucks. You do not have those aforementioned API functions. They won't work, including the one that Baertram mentioned. You'll need to hardcode a bunch of stuff, starting with the ItemIds (or just item links I guess) for the materials. You can find those at line 1428 in Smithing.lua in LibLazyCrafting. From there, you could get the flavour text and search in that for the levels. Or you could hardcode the levels that each one corresponds to. LibLazyCrafting: This is still admittedly a kind of circuitous route, but it'll give you the item link of the material needed to craft an item. (Don't worry, this won't actually craft the item)Also, craftingTypeIndex -> This should be whatever type of station is needed to craft the item. e.g. CRAFTING_TYPE_BLACKSMITHING for heavy armour Code:
local llc = LibLazyCrafting:AddRequestingAddon("ExampleAddonName", false, function() end) local request = llc:CraftSmithingItemByLevel(1, isChampionLevel, level, 1, 0, false, craftingTypeIndex, 0, 1, false, "temporary") local craftingRequirements = llc:CompileRequirements(request) for itemId, amount in pairs(craftingRequirements) do local materials = {[ITEMTYPE_BLACKSMITHING_MATERIAL]=1,[ITEMTYPE_CLOTHIER_MATERIAL]=1, [ITEMTYPE_JEWELRYCRAFTING_MATERIAL]=1, [ITEMTYPE_WOODWORKING_MATERIAL]=1} if materials[GetItemLinkItemType(llc:getItemLinkFromItemId(itemId))] then -- this is the crafting material llc:cancelItemByReference("temporary") return llc:getItemLinkFromItemId(itemId) end Last edited by Dolgubon : Today at 05:19 PM. |
|
![]() |
Today, 05:25 PM | #8 | |
|
|
|
![]() |
Today, 07:01 PM | #9 |
That's the same thing, actually. If it would take iron ingots to craft, deconstruction will give back iron ingots. So you should still be able to use the same methods
|
|
![]() |
ESOUI » Developer Discussions » General Authoring Discussion » Getting the gear item level |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
![]() |
![]() |
![]() |
|
|