LibItemUpgradeInfo-1.0

LibItemUpgradeInfo-1.0 provides information about item upgrades applied to items.


Functions

:GetUpgradeID(itemString)

Arguments

itemString
String - An itemLink or itemString denoting the item

Returns

upgradeID
Number - The upgrade ID (possibly 0), or nil if the input is invalid or does not contain upgrade info


:GetCurrentUpgrade(id)

Returns the current upgrade level of the item, e.g. 1 for a 1/2 item.

Arguments

id
Number - The upgrade ID of the item (obtained via GetUpgradeID())

Returns

upgradeLevel
Number - The current upgrade level of the item, or nil if the item cannot be upgraded


:GetMaximumUpgrade(id)

Returns the maximum upgrade level of the item, e.g. 2 for a 1/2 item.

Arguments

id
Number - The upgrade ID of the item (obtained via GetUpgradeID())

Returns

upgradeLevel
Number - The maximum upgrade level of the item, or nil if the item cannot be upgraded


:GetItemLevelUpgrade(id)

Returns the item level increase that this upgrade is worth, e.g. 4 for a 1/2 item or 8 for a 2/2 item.

Arguments

id
Number - The upgrade ID of the item (obtained via GetUpgradeID())

Returns

ilvlDelta
Number - The item level increase of the item, or 0 if the item cannot be or has not been upgraded


:GetItemUpgradeInfo(itemString)

Returns the current upgrade level, maximum upgrade level, and item level increase for an item.

Arguments

itemString
String - An itemLink or itemString denoting the item

Returns

nil if the item is invalid or cannot be upgraded, otherwise:

curUpgradeLevel
Number - The current upgrade level of the item
maxUpgradeLevel
Number - The maximum upgrade level of the item
lvlDelta
Number - The item level increase of the item


:GetHeirloomTrueLevel(itemString)

Returns the true item level for an heirloom.

Arguments

itemString
String - An itemLink or itemString denoting the item

Returns

ilvl
Number - The true item level of the item, or nil if the input is invalid
isTrue
Boolean - true if the returned item level is the "true" item level of an heirloom, or false if the item was not an heirloom or some error occurred while scanning the tooltip.


:GetUpgradedItemLevel(itemString)

Returns the true item level of the item, including upgrades and heirlooms.

Arguments

itemString
String - An itemLink or itemString denoting the item

Returns

ilvl
Number - The true item level of the item, or nil if the input is invalid

Example

local ItemUpgradeInfo = LibStub("LibItemUpgradeInfo-1.0")
local item = GetInventoryItemLink("player", 1)
local id = ItemUpgradeInfo:GetUpgradeID(item)
local upgrade = ItemUpgradeInfo:GetCurrentUpgrade(id)
if upgrade then
	local max = ItemUpgradeInfo:GetMaximumUpgrade(id)
	local delta = ItemUpgradeInfo:GetItemLevelUpgrade(id)
	local ilvl = ItemUpgradeInfo:GetUpgradedItemLevel(item)
	DEFAULT_CHAT_FRAME:AddMessage(("%s %d/%d (+%d -> %d)"):format(item, upgrade, max, delta, ilvl))
else
	DEFAULT_CHAT_FRAME:AddMessage(item .. " cannot be upgraded")
end

Same code using the GetItemUpgradeInfo() convenience function:

local ItemUpgradeInfo = LibStub("LibItemUpgradeInfo-1.0")
local item = GetInventoryItemLink("player", 1)
local upgrade, max, delta = ItemUpgradeInfo:GetItemUpgradeInfo(item)
if upgrade then
	local ilvl = ItemUpgradeInfo:GetUpgradedItemLevel(item)
	DEFAULT_CHAT_FRAME:AddMessage(("%s %d/%d (+%d -> %d)"):format(item, upgrade, max, delta, ilvl))
else
	DEFAULT_CHAT_FRAME:AddMessage(item .. " cannot be upgraded")
end

You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of alar alar Aug 30, 2015 at 10:12 UTC - 0 likes

    @backclipped: Go

    AH, thank you, was starting to check it right now, I'll verify your suggestion asap

  • Avatar of backclipped backclipped Aug 17, 2015 at 20:13 UTC - 0 likes

    Hi,

    Timewarped Warforged items are not supported.

    edit:

    actually found the fix for it:

    scantooltip=((s13==1 or s13==2) and s14==615)
    
    Last edited Aug 21, 2015 by backclipped
  • Avatar of scotepi scotepi Jul 10, 2015 at 19:24 UTC - 0 likes

    @alar: Go

    Thank you! I use this for Simple iLevel and since I no longer play I moved the internal methods to this lib. Good to see its staying updated.

  • Avatar of alar alar Jul 08, 2015 at 07:13 UTC - 1 like

    @ckaotik: Go

    Hi all, I volunteered to maintain Libitemupgradeinfo. Thank you for the informations, I hope I'll release an update in the next weekend Stay tuned

    Last edited Jul 08, 2015 by alar
  • Avatar of ckaotik ckaotik Jul 07, 2015 at 19:29 UTC - 0 likes

    Sad to hear you're no longer playing, eridius :( Still gonna post my discoveries here.

    The only new entry for the item levels table seems to be this for timewarped items:

    [512] = { ilevel = 545 },
    

    6.2 changed the item link format, and added another value (specialization id) before the upgradeID.

    itemID:enchant:gem1:gem2:gem3:gem4:suffixID:uniqueID:level:specializationID:upgradeId:instanceDifficultyID:numBonusIDs:bonusID1:bonusID2...
    

    Adding an extra %d+ to GetUpgradeID is therefore necessary:

    function lib:GetUpgradeID(itemString)
    	return tonumber(itemString:match("item:%d+:%d+:%d+:%d+:%d+:%d+:%-?%d+:%-?%d+:%d+:%d+:(%d+)"))
    end
    
  • Avatar of eridius eridius Jun 25, 2015 at 19:49 UTC - 0 likes

    I'm no longer playing World of Warcraft. If anyone wants to volunteer to maintain this addon (updating it for new versions is very easy, there's a debug function you call to spit out the table changes), please let me know.

  • Avatar of eridius eridius Nov 29, 2014 at 20:59 UTC - 0 likes

    @olzenkhaw: Go

    I really don't want to maintain a database of Garrosh heirlooms. Beyond that, what you're suggesting will only work for Garrosh heirlooms and won't work for any others. The tooltip approach that I implemented should work for all heirlooms.

  • Avatar of olzenkhaw olzenkhaw Nov 29, 2014 at 09:54 UTC - 0 likes

    <<reply 2407652>>

    U don need to scan the tooltip to get the item level of Garrosh heirloom.
    Below is the heirloom id and respective ilvl based on player's level. (3 = normal, 2 = heroic, 1 = mythic)

    local GarroshBoA = {
        [3] = {105679,105673,105677,105672,105678,105671,105675,105670,105674,105680},
        [2] = {104405,104403,104406,104404,104401,104400,104402,104399,104409,104407},
        [1] = {105692,105686,105690,105685,105691,105684,105688,105683,105687,105693},
    }

    local GarroshBoAScaling = {
            ----        M,  H,   N
        [90] = {582,569,556},
        [91] = {586,574,562},
        [92] = {590,579,569},
        [93] = {593,584,575},
        [94] = {597,589,582},
        [95] = {601,595,588},
        [96] = {605,600,594},
        [97] = {609,605,601},
        [98] = {612,610,607},
        [99] = {616,615,614},
        [100] = {620,620,620},
    }

    function GarroshBoAItemLevel(itemID, unitid)
        local itemLevel=0;
        local m,n;
        local sw=false;
        for m = 1,3 do
            for n = 1, 10 do
                if GarroshBoA[m][n] == tonumber(itemID) then
                    itemLevel = GarroshBoAScaling[UnitLevel(unitid)][m];
                    sw=true;
                    break;
                end
            end
            if sw then break end
        end
        return itemLevel;
    end

    formula for the item level is:
    [level 90 item level based on difficulity] + (620 - [level 90 item level based on difficulity]) / 10 * (player's level - 90)

    For example:
    mythic garrosh wep on lvl 90 is 582,
    so the item level on lvl 98 is 582 + (620 - 582) / 10 * (98 - 90) = 612.4 = 612

    Last edited Nov 29, 2014 by olzenkhaw
  • Avatar of eridius eridius Nov 29, 2014 at 09:23 UTC - 0 likes

    @JayCanuck: Go

    I just pushed out an update, v1.0.8, that handles heirlooms.

  • Avatar of eridius eridius Nov 28, 2014 at 21:05 UTC - 0 likes

    @JayCanuck: Go

    I looked into this a couple of days ago. It seems that Garrosh Heirlooms report their item level as being the ilvl they count as when at the minimum. Bonus IDs don't seem to play into it. As near as I can figure, the only way to get the "real" item level is to either build a database of all known heirlooms and their level ranges so the current ilvl can be calculated, or to scan a tooltip to get the "current" ilvl every time.

    It may be worth implementing the tooltip approach. We could at least cache each combination of (itemid, playerlevel) and the resulting itemlevel that maps to.