LibItemUpgradeInfo-1.0
LibItemUpgradeInfo-1.0 provides information about item upgrades applied to items.
Functions
:GetUpgradeID(itemString)
Arguments
- itemString
- String - An
itemLink
oritemString
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
oritemString
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
oritemString
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, orfalse
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
oritemString
denoting the item
Returns
- ilvl
- Number - The true item level of the item, or
nil
if the input is invalid
:IsBop(itemString)
Checks if an item is Bind On Pikcup.
Arguments
- itemString
- String - An
itemLink
oritemString
denoting the item
Returns
- flag
- Boolean - True if item is Bind on Pickup
:IsBoe(itemString)
Checks if an item is Bind On Equip.
Arguments
- itemString
- String - An
itemLink
oritemString
denoting the item
Returns
- flag
- Boolean - True if item is Bind on Equip
Example
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
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
@eridius
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
@JayCanuck
I just pushed out an update, v1.0.8, that handles heirlooms.
@JayCanuck
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.
I can confirm Garrosh heirloom item levels aren't reporting correctly. I suspect the BonusID fields added in 6.0.2 might be to blame, but that's just speculation.
Garrosh Heirlooms do not appear to be updating with their iLvL scaling. Any ideas on how to fix it?
Not a huge deal ... but my OCD kicks in every so often lol.
Thanks again for this awesome addon.
@scotepi
Thanks for the note, I just pushed v1.0.7 which should work with WoW 6.0.
Any ETA on an 6.0 update? One of my users has this for the fixed regex
@suicidalkatt
That's completely useless. The upgrade information is stored as one of the components of the itemLink. If you don't have an itemLink, then you have no upgrade info. GetItemInfo() isn't smart enough either to give you the base (un-upgraded) version of the item; an itemLink produced that way has no upgrade information at all.
My point about being able to use itemID or itemName within the API functions to easily cut a corner to be able to get item upgrade info without having to find the item link within users addon code.
A very simple function like this can get the required information within the library for the user:
Thanks! :) I'll check for 5.4 item upgrades again.
@ckaotik
v1.0.4 includes a new GetItemUpgradeInfo() function that returns cur, max, delta.
@ckaotik
I'll consider making the API changes you requested. However, v1.0.3 of this library should indeed include the new 5.4 item level upgrade ids. I'm not actually playing the game anymore, so I don't have any upgraded 5.4 gear to check, but I tested all ids up to 10000 to find the new 5.4 ones and they went into the v1.0.3 release. If you find some upgraded 5.4 gear that this library doesn't handle properly, please let me know what the itemString is.
@suicidalkatt
Using itemID or itemName will not work here, as those do not carry any information on item upgrades. You do need itemLinks (or the itemString portion of it) to get those pieces of data.
However, whenever I want to use this library, I always want to use something along the lines of
without having to grab the upgradeID first and then calculating those two values. Also, :GetItemLevelUpgrade should be callable with an itemLink/itemString, too.
I just noticed, it seems the new 5.4 item level upgrade ids are not yet included. Definitely needed!
I've embedded your library in my addon !SyLevel.
Thank you for your simple yet useful library!
http://www.wowinterface.com/downloads/fileinfo.php?id=22452
My one and only suggestion is perhaps expanding the library is the functionality of using itemName or itemID in place of itemString/itemLink.
Perhaps a function to return min / max upgrade progression or 'master' return function.