- Using LibItemUpgradeInfo library to retrive the item level of upgraded items.
This commit is contained in:
+2
-2
@@ -385,14 +385,14 @@ local ButtonMetaFunctions = {}
|
||||
end
|
||||
|
||||
-- icon
|
||||
function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding)
|
||||
function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight)
|
||||
if (not self.icon) then
|
||||
self.icon = self:CreateTexture (nil, "artwork")
|
||||
self.icon:SetSize (self.height*0.8, self.height*0.8)
|
||||
self.icon:SetPoint ("left", self.widget, "left", 4 + (leftpadding or 0), 0)
|
||||
self.icon.leftpadding = leftpadding or 0
|
||||
self.widget.text:ClearAllPoints()
|
||||
self.widget.text:SetPoint ("left", self.icon, "right", textdistance or 2, 0)
|
||||
self.widget.text:SetPoint ("left", self.icon, "right", textdistance or 2, 0 + (textheight or 0))
|
||||
end
|
||||
|
||||
self.icon:SetTexture (texture)
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
local dversion = 13
|
||||
local dversion = 14
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
|
||||
@@ -95,6 +95,7 @@ local embed_functions = {
|
||||
"www_icons",
|
||||
"GetTemplate",
|
||||
"GetFrameworkFolder",
|
||||
"ShowPanicWarning",
|
||||
}
|
||||
|
||||
DF.table = {}
|
||||
|
||||
@@ -1433,6 +1433,29 @@ function DF:IconPick (callback, close_when_select, param1, param2)
|
||||
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function DF:ShowPanicWarning (text)
|
||||
if (not DF.PanicWarningWindow) then
|
||||
DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent)
|
||||
DF.PanicWarningWindow:SetHeight (80)
|
||||
DF.PanicWarningWindow:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
DF.PanicWarningWindow:SetBackdropColor (1, 0, 0, 0.2)
|
||||
DF.PanicWarningWindow:SetPoint ("topleft", UIParent, "topleft", 0, -250)
|
||||
DF.PanicWarningWindow:SetPoint ("topright", UIParent, "topright", 0, -250)
|
||||
|
||||
DF.PanicWarningWindow.text = DF.PanicWarningWindow:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
DF.PanicWarningWindow.text:SetPoint ("center", DF.PanicWarningWindow, "center")
|
||||
DF.PanicWarningWindow.text:SetTextColor (1, 0.6, 0)
|
||||
end
|
||||
|
||||
DF.PanicWarningWindow.text:SetText (text)
|
||||
DF.PanicWarningWindow:Show()
|
||||
end
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
local simple_panel_counter = 1
|
||||
local simple_panel_mouse_down = function (self, button)
|
||||
if (button == "RightButton") then
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
tag Release-60203-13
|
||||
e6891431a6dba965732ae5a3510fab17cdb29283
|
||||
Alar of Daggerspine <alar@aspide.it>
|
||||
2015-11-20 13:31:33 +0100
|
||||
|
||||
6.2.3 Update
|
||||
|
||||
--------------------
|
||||
|
||||
Alar of Daggerspine:
|
||||
- Updated for 6.2.3
|
||||
Thanks to Semlar for giving me the updated ids
|
||||
|
||||
Signed-off-by: Alar of Daggerspine <alar@aspide.it>
|
||||
@@ -0,0 +1,451 @@
|
||||
local MAJOR, MINOR = "LibItemUpgradeInfo-1.0", 13
|
||||
local type,tonumber,GetItemInfoFromHyperlink=type,tonumber,GetItemInfoFromHyperlink
|
||||
local library,previous = _G.LibStub:NewLibrary(MAJOR, MINOR)
|
||||
local lib=library --#lib Needed to keep Eclipse LDT happy
|
||||
if not lib then return end
|
||||
local pp=print
|
||||
--[===[@debug@
|
||||
if LibDebug then LibDebug() end
|
||||
--@end-debug@]===]
|
||||
local upgradeTable = {
|
||||
[ 1] = { upgrade = 1, max = 1, ilevel = 8 },
|
||||
[373] = { upgrade = 1, max = 3, ilevel = 4 },
|
||||
[374] = { upgrade = 2, max = 3, ilevel = 8 },
|
||||
[375] = { upgrade = 1, max = 3, ilevel = 4 },
|
||||
[376] = { upgrade = 2, max = 3, ilevel = 4 },
|
||||
[377] = { upgrade = 3, max = 3, ilevel = 4 },
|
||||
[378] = { ilevel = 7 },
|
||||
[379] = { upgrade = 1, max = 2, ilevel = 4 },
|
||||
[380] = { upgrade = 2, max = 2, ilevel = 4 },
|
||||
[445] = { upgrade = 0, max = 2, ilevel = 0 },
|
||||
[446] = { upgrade = 1, max = 2, ilevel = 4 },
|
||||
[447] = { upgrade = 2, max = 2, ilevel = 8 },
|
||||
[451] = { upgrade = 0, max = 1, ilevel = 0 },
|
||||
[452] = { upgrade = 1, max = 1, ilevel = 8 },
|
||||
[453] = { upgrade = 0, max = 2, ilevel = 0 },
|
||||
[454] = { upgrade = 1, max = 2, ilevel = 4 },
|
||||
[455] = { upgrade = 2, max = 2, ilevel = 8 },
|
||||
[456] = { upgrade = 0, max = 1, ilevel = 0 },
|
||||
[457] = { upgrade = 1, max = 1, ilevel = 8 },
|
||||
[458] = { upgrade = 0, max = 4, ilevel = 0 },
|
||||
[459] = { upgrade = 1, max = 4, ilevel = 4 },
|
||||
[460] = { upgrade = 2, max = 4, ilevel = 8 },
|
||||
[461] = { upgrade = 3, max = 4, ilevel = 12 },
|
||||
[462] = { upgrade = 4, max = 4, ilevel = 16 },
|
||||
[465] = { upgrade = 0, max = 2, ilevel = 0 },
|
||||
[466] = { upgrade = 1, max = 2, ilevel = 4 },
|
||||
[467] = { upgrade = 2, max = 2, ilevel = 8 },
|
||||
[468] = { upgrade = 0, max = 4, ilevel = 0 },
|
||||
[469] = { upgrade = 1, max = 4, ilevel = 4 },
|
||||
[470] = { upgrade = 2, max = 4, ilevel = 8 },
|
||||
[471] = { upgrade = 3, max = 4, ilevel = 12 },
|
||||
[472] = { upgrade = 4, max = 4, ilevel = 16 },
|
||||
[491] = { upgrade = 0, max = 4, ilevel = 0 },
|
||||
[492] = { upgrade = 1, max = 4, ilevel = 4 },
|
||||
[493] = { upgrade = 2, max = 4, ilevel = 8 },
|
||||
[494] = { upgrade = 0, max = 6, ilevel = 0 },
|
||||
[495] = { upgrade = 1, max = 6, ilevel = 4 },
|
||||
[496] = { upgrade = 2, max = 6, ilevel = 8 },
|
||||
[497] = { upgrade = 3, max = 6, ilevel = 12 },
|
||||
[498] = { upgrade = 4, max = 6, ilevel = 16 },
|
||||
[503] = { upgrade = 3, max = 3, ilevel = 1 },
|
||||
[504] = { upgrade = 3, max = 4, ilevel = 12 },
|
||||
[505] = { upgrade = 4, max = 4, ilevel = 16 },
|
||||
[506] = { upgrade = 5, max = 6, ilevel = 20 },
|
||||
[507] = { upgrade = 6, max = 6, ilevel = 24 },
|
||||
[529] = { upgrade = 0, max = 2, ilevel = 0 },
|
||||
[530] = { upgrade = 1, max = 2, ilevel = 5 },
|
||||
[531] = { upgrade = 2, max = 2, ilevel = 10 },
|
||||
|
||||
}
|
||||
do
|
||||
local stub = { ilevel = 0 }
|
||||
setmetatable(upgradeTable, { __index = function(t, key)
|
||||
return stub
|
||||
end})
|
||||
end
|
||||
|
||||
-- GetUpgradeID(itemString)
|
||||
--
|
||||
-- Arguments:
|
||||
-- itemString - String - An itemLink or itemString denoting the item
|
||||
--
|
||||
-- Returns:
|
||||
-- Number - The upgrade ID (possibly 0), or nil if the input is invalid or
|
||||
-- does not contain upgrade info
|
||||
function lib:GetUpgradeID(itemString)
|
||||
--local instaid,upgradeid =itemString:match("item:%d+:%d+:%d+:%d+:%d+:%d+:%-?%d+:%-?%d+:%d+:(%d+):%d:%d:(%d)")
|
||||
local instaid,upgradeid =itemString:match("item:%d+:%d+:%d+:%d+:%d+:%d+:%-?%d+:%-?%d+:%d+:%d+:(%d+):%d+:%d+:(%d+)")
|
||||
instaid=tonumber(instaid) or 7
|
||||
if instaid >0 and (instaid-4)%8==0 then
|
||||
return tonumber(upgradeid)
|
||||
end
|
||||
end
|
||||
|
||||
-- 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:
|
||||
-- Number - The current upgrade level of the item. Returns nil if the item
|
||||
-- cannot be upgraded
|
||||
function lib:GetCurrentUpgrade(id)
|
||||
return upgradeTable[id].upgrade
|
||||
end
|
||||
|
||||
-- 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:
|
||||
-- Number - The maximum upgrade level of the item. Returns nil if the item
|
||||
-- cannot be upgraded
|
||||
function lib:GetMaximumUpgrade(id)
|
||||
return upgradeTable[id].max
|
||||
end
|
||||
|
||||
-- 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:
|
||||
-- Number - The item level increase of the item. Returns 0 if the item
|
||||
-- cannot be or has not been upgraded
|
||||
function lib:GetItemLevelUpgrade(id)
|
||||
return upgradeTable[id].ilevel
|
||||
end
|
||||
|
||||
-- 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 if the item can be upgraded:
|
||||
-- Number - The current upgrade level of the item
|
||||
-- Number - The maximum upgrade level of the item
|
||||
-- Number - The item level increase of the item
|
||||
-- or if the item cannot be upgraded:
|
||||
-- nil
|
||||
-- nil
|
||||
-- 0
|
||||
-- or if the item is invalid or does not contain upgrade info:
|
||||
-- nil
|
||||
function lib:GetItemUpgradeInfo(itemString)
|
||||
local id = self:GetUpgradeID(itemString)
|
||||
if id then
|
||||
local cur = self:GetCurrentUpgrade(id)
|
||||
local max = self:GetMaximumUpgrade(id)
|
||||
local delta = self:GetItemLevelUpgrade(id)
|
||||
return cur, max, delta
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- GetHeirloomTrueLevel(itemString)
|
||||
--
|
||||
-- Returns the true item level for an heirloom.
|
||||
--
|
||||
-- Arguments:
|
||||
-- itemString - String - An itemLink or itemString denoting the item
|
||||
--
|
||||
-- Returns:
|
||||
-- Number, Boolean - The true item level of the item. If the item is not
|
||||
-- an heirloom, or an error occurs when trying to scan the
|
||||
-- item tooltip, the second return value is false. Otherwise
|
||||
-- the second return value is true. If the input is invalid,
|
||||
-- (nil, false) is returned.
|
||||
do
|
||||
-- Convert the ITEM_LEVEL constant into a pattern for our use
|
||||
local itemLevelPattern = _G["ITEM_LEVEL"]:gsub("%%d", "(%%d+)")
|
||||
|
||||
local scanningTooltip
|
||||
local heirloomCache = {}
|
||||
function lib:GetHeirloomTrueLevel(itemString)
|
||||
if type(itemString) ~= "string" then return nil,false end
|
||||
local scantooltip=false
|
||||
local header,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14 = strsplit(":", itemString, 16)
|
||||
s13=tonumber(s13) or 0
|
||||
s14=tonumber(s14) or 0
|
||||
scantooltip=(s13==1 or s13==2) and (s14==693 or s14==615) -- Really to be better tested
|
||||
scantooltip=true
|
||||
local _, itemLink, rarity, itemLevel = GetItemInfo(itemString)
|
||||
if (not itemLink) then
|
||||
return nil,false
|
||||
end
|
||||
if not scantooltip then
|
||||
scantooltip=rarity == _G.LE_ITEM_QUALITY_HEIRLOOM
|
||||
end
|
||||
if scantooltip then
|
||||
local ilvl = heirloomCache[itemLink]
|
||||
if ilvl ~= nil then
|
||||
return ilvl, true
|
||||
end
|
||||
if not scanningTooltip then
|
||||
scanningTooltip = _G.CreateFrame("GameTooltip", "LibItemUpgradeInfoTooltip", nil, "GameTooltipTemplate")
|
||||
scanningTooltip:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
|
||||
end
|
||||
scanningTooltip:ClearLines()
|
||||
local rc,message=pcall(scanningTooltip.SetHyperlink,scanningTooltip,itemLink)
|
||||
if (not rc) then
|
||||
return nil,false
|
||||
end
|
||||
-- line 1 is the item name
|
||||
-- line 2 may be the item level, or it may be a modifier like "Heroic"
|
||||
-- check up to line 4 just in case
|
||||
for i = 2, 4 do
|
||||
local label, text = _G["LibItemUpgradeInfoTooltipTextLeft"..i], nil
|
||||
if label then text=label:GetText() end
|
||||
if text then
|
||||
ilvl = tonumber(text:match(itemLevelPattern))
|
||||
if ilvl ~= nil then
|
||||
heirloomCache[itemLink] = ilvl
|
||||
return ilvl, true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return itemLevel, false
|
||||
end
|
||||
end
|
||||
|
||||
-- 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:
|
||||
-- Number - The true item level of the item, or nil if the input is invalid
|
||||
function lib:GetUpgradedItemLevel(itemString)
|
||||
-- check for heirlooms first
|
||||
local ilvl, isTrue = self:GetHeirloomTrueLevel(itemString)
|
||||
if isTrue then
|
||||
return ilvl
|
||||
end
|
||||
-- not an heirloom? fall back to the regular item logic
|
||||
local id = self:GetUpgradeID(itemString)
|
||||
if ilvl and id then
|
||||
ilvl = ilvl + self:GetItemLevelUpgrade(id)
|
||||
end
|
||||
return ilvl
|
||||
end
|
||||
local GetItemInfo=GetItemInfo
|
||||
lib.itemcache=lib.itemcache or
|
||||
setmetatable({miss=0,tot=0},{
|
||||
__index=function(table,key)
|
||||
if (not key) then return "" end
|
||||
if (key=="miss") then return 0 end
|
||||
if (key=="tot") then return 0 end
|
||||
local cached={GetItemInfo(key)}
|
||||
if #cached==0 then return nil end
|
||||
local itemLink=cached[2]
|
||||
if not itemLink then return nil end
|
||||
local itemID=lib:GetItemID(itemLink)
|
||||
local name=cached[1]
|
||||
rawset(table,itemLink,cached)
|
||||
rawset(table,itemID,cached)
|
||||
rawset(table,name,cached)
|
||||
table.miss=table.miss+1
|
||||
return cached
|
||||
end
|
||||
|
||||
})
|
||||
local CachedGetItemInfo --#function
|
||||
do
|
||||
local cache,select,unpack=lib.itemcache,select,unpack
|
||||
function CachedGetItemInfo(key,index)
|
||||
if not key then return nil end
|
||||
index=index or 1
|
||||
cache.tot=cache.tot+1
|
||||
local cached=cache[key]
|
||||
if cached and type(cached)=='table' then
|
||||
return select(index,unpack(cached))
|
||||
else
|
||||
rawset(cache,key,nil) -- voiding broken cache entry
|
||||
end
|
||||
end
|
||||
end
|
||||
---
|
||||
-- Parses an itemlink and returns itemId without calling API again
|
||||
-- @param #Lib self
|
||||
-- @param #string itemlink
|
||||
-- @return #number itemId or 0
|
||||
function lib:GetItemID(itemlink)
|
||||
if (type(itemlink)=="string") then
|
||||
local itemid,context=GetItemInfoFromHyperlink(itemlink)
|
||||
return tonumber(itemid) or 0
|
||||
--return tonumber(itemlink:match("Hitem:(%d+):")) or 0
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
---
|
||||
--
|
||||
-- Returns a caching version of GetItemInfo. Can be used to override the original one.
|
||||
-- Adds a second parameter to directly retrieving a specific value
|
||||
-- (Note: internally uses select so it's actually like calling select(n,GetItemInfo(itemID))
|
||||
--
|
||||
-- Arguments:
|
||||
-- self #lib self
|
||||
--
|
||||
-- Returns:
|
||||
-- #function The new function
|
||||
function lib:GetCachingGetItemInfo()
|
||||
return CachedGetItemInfo
|
||||
end
|
||||
function lib:GetCacheStats()
|
||||
local c=lib.itemcache
|
||||
local h=c.tot-c.miss
|
||||
local perc=( h>0) and h/c.tot*100 or 0
|
||||
return c.miss,h,perc
|
||||
end
|
||||
if lib.itemframe and lib.itemframe.UnregisterEvent then
|
||||
lib.itemframe:UnregisterEvent('GET_ITEM_INFO_RECEIVED')
|
||||
end
|
||||
|
||||
--[===========[ ]===========]
|
||||
--[===[ Debug utilities ]===]
|
||||
--[===========[ ]===========]
|
||||
|
||||
local function compareTables(t1, t2)
|
||||
local seen = {}
|
||||
for k, v1 in pairs(t1) do
|
||||
seen[k] = true
|
||||
local v2 = rawget(t2, k)
|
||||
if not v2 then return false end
|
||||
if type(v1) ~= type(v2) then return false end
|
||||
if type(v1) == "table" then
|
||||
if not compareTables(v1, v2) then return false end
|
||||
elseif v1 ~= v2 then return false end
|
||||
end
|
||||
for k in pairs(t2) do
|
||||
if not seen[k] then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- prints the table rows in red and green
|
||||
-- omits the lead { and the trailing }
|
||||
local function printDiffTable(t1, t2)
|
||||
local keys, seen = {}, {}
|
||||
for k in pairs(t1) do
|
||||
keys[#keys+1] = k
|
||||
seen[k] = true
|
||||
end
|
||||
for k in pairs(t2) do
|
||||
if not seen[k] then
|
||||
keys[#keys+1] = k
|
||||
end
|
||||
end
|
||||
table.sort(keys)
|
||||
local function formatTable(t)
|
||||
local comps = {}
|
||||
for k, v in pairs(t) do
|
||||
comps[#comps+1] = ("%s = %d"):format(k, v)
|
||||
end
|
||||
return "{ " .. table.concat(comps, ", ") .. " }"
|
||||
end
|
||||
for _, k in ipairs(keys) do
|
||||
local v1, v2 = rawget(t1, k), rawget(t2, k)
|
||||
local equal
|
||||
if type(v1) == "table" and type(v2) == "table" then equal = compareTables(v1, v2)
|
||||
else equal = v1 == v2 end
|
||||
if not equal then
|
||||
if v1 then
|
||||
pp(("|cffff0000 [%d] = %s,|r"):format(k, formatTable(v1)))
|
||||
end
|
||||
if v2 then
|
||||
pp(("|cff00ff00 [%d] = %s,|r"):format(k, formatTable(v2)))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Scans the first 10000 upgrade IDs
|
||||
-- Run this with /run LibStub:GetLibrary("LibItemUpgradeInfo-1.0"):_CheckUpgradeTable()
|
||||
-- If you don't have Aspirant's Staff of Harmony cached it may error out, just try again.
|
||||
do
|
||||
local debugFrame
|
||||
local worker
|
||||
local newTable
|
||||
local debugTooltip
|
||||
function lib:_CheckUpgradeTable(itemLink)
|
||||
if worker then
|
||||
pp("|cffff0000LibItemUpgradeInfo-1.0: upgrade check already in progress")
|
||||
return
|
||||
end
|
||||
if not debugFrame then
|
||||
debugFrame = _G.CreateFrame("frame")
|
||||
debugFrame:Hide()
|
||||
debugFrame:SetScript("OnUpdate", function()
|
||||
local ok, result, count, max = pcall(worker)
|
||||
if not ok or result then
|
||||
debugFrame:Hide()
|
||||
worker = nil
|
||||
end
|
||||
if not ok then
|
||||
pp("|cffff0000LibItemUpgradeInfo-1.0 error: " .. result .. "|r")
|
||||
elseif result then
|
||||
pp("LibItemUpgradeInfo-1.0: scan complete")
|
||||
if compareTables(upgradeTable, newTable) then
|
||||
pp("LibItemUpgradeInfo-1.0: |cff00ff00No changes|r")
|
||||
else
|
||||
pp("LibItemUpgradeInfo-1.0: |cffff0000New table:|r {")
|
||||
ppDiffTable(upgradeTable, newTable)
|
||||
pp("}")
|
||||
end
|
||||
else
|
||||
pp("LibItemUpgradeInfo-1.0: scanning " .. count .. "/" .. max)
|
||||
end
|
||||
end)
|
||||
end
|
||||
if not debugTooltip then
|
||||
debugTooltip = _G.CreateFrame("GameTooltip", "LibItemUpgradeInfoDebugTooltip", nil, "GameTooltipTemplate")
|
||||
debugTooltip:SetOwner(_G.WorldFrame, "ANCHOR_NONE")
|
||||
end
|
||||
newTable = {}
|
||||
--local itemLink = "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:90:253:0:0:1:0|h[Aspirant's Staff of Harmony]|h|r"
|
||||
local itemLink = itemLink or "|cff0070dd|Hitem:89551:0:0:0:0:0:0:0:100:253:4:0:0:0|h[Aspirant's Staff of Harmony]|h|r"
|
||||
-- Livello è il 9,upgradeid il 14. Al decimo posto, un valore che deve essere 4 o 4+n *8) per far scattare l'uso dell'upgradeid
|
||||
local itemLevel = select(4, _G.GetItemInfo(itemLink))
|
||||
assert(itemLevel, "Can't find item level for itemLink")
|
||||
local count, max, batchsize = 0, 10000, 200
|
||||
worker = function()
|
||||
for i = count, math.min(max, count+batchsize) do
|
||||
local link = itemLink:gsub("%d+|h", i.."|h")
|
||||
debugTooltip:ClearLines()
|
||||
debugTooltip:SetHyperlink(link)
|
||||
local upgrade, max
|
||||
local curLevel, maxLevel = _G.LibItemUpgradeInfoDebugTooltipTextLeft3:GetText():match("^Upgrade Level: (%d+)/(%d+)")
|
||||
local ilvl = tonumber(_G.LibItemUpgradeInfoDebugTooltipTextLeft2:GetText():match("Item Level (%d+)"))
|
||||
if not ilvl then
|
||||
ilvl = tonumber(_G.LibItemUpgradeInfoDebugTooltipTextLeft3:GetText():match("Item Level (%d+)"))
|
||||
end
|
||||
assert(ilvl ~= nil, "Can't find ItemLevel in tooltip: " .. _G.LibItemUpgradeInfoDebugTooltipTextLeft2:GetText())
|
||||
if curLevel or maxLevel or ilvl ~= itemLevel then
|
||||
newTable[i] = { upgrade = tonumber(curLevel), max = tonumber(maxLevel), ilevel = ilvl - itemLevel }
|
||||
end
|
||||
end
|
||||
count = count + batchsize
|
||||
return (count > max), count, max
|
||||
end
|
||||
debugFrame:Show()
|
||||
end
|
||||
end
|
||||
|
||||
-- vim: set noet sw=4 ts=4:
|
||||
@@ -0,0 +1,13 @@
|
||||
## Interface: 60200
|
||||
## Title: Lib: ItemUpgradeInfo-1.0
|
||||
## Notes: Database of item upgrade IDs
|
||||
## Author: eridius
|
||||
## Version: Release-60203-13 6.2.2
|
||||
## X-Revision: 3155174
|
||||
## X-Category: Library
|
||||
## X-Curse-Packaged-Version: Release-60203-13
|
||||
## X-Curse-Project-Name: LibItemUpgradeInfo-1.0
|
||||
## X-Curse-Project-ID: libitemupgradeinfo-1-0
|
||||
## X-Curse-Repository-ID: wow/libitemupgradeinfo-1-0/mainline
|
||||
|
||||
LibItemUpgradeInfo-1.0.xml
|
||||
@@ -0,0 +1,4 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
|
||||
<Script file="LibStub\LibStub.lua"/>
|
||||
<Script file="Core.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,51 @@
|
||||
-- $Id: LibStub.lua 76 2007-09-03 01:50:17Z mikk $
|
||||
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info
|
||||
-- LibStub is hereby placed in the Public Domain
|
||||
-- Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke
|
||||
local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS!
|
||||
local LibStub = _G[LIBSTUB_MAJOR]
|
||||
|
||||
-- Check to see is this version of the stub is obsolete
|
||||
if not LibStub or LibStub.minor < LIBSTUB_MINOR then
|
||||
LibStub = LibStub or {libs = {}, minors = {} }
|
||||
_G[LIBSTUB_MAJOR] = LibStub
|
||||
LibStub.minor = LIBSTUB_MINOR
|
||||
|
||||
-- LibStub:NewLibrary(major, minor)
|
||||
-- major (string) - the major version of the library
|
||||
-- minor (string or number ) - the minor version of the library
|
||||
--
|
||||
-- returns nil if a newer or same version of the lib is already present
|
||||
-- returns empty library object or old library object if upgrade is needed
|
||||
function LibStub:NewLibrary(major, minor)
|
||||
assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)")
|
||||
minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.")
|
||||
|
||||
local oldminor = self.minors[major]
|
||||
if oldminor and oldminor >= minor then return nil end
|
||||
self.minors[major], self.libs[major] = minor, self.libs[major] or {}
|
||||
return self.libs[major], oldminor
|
||||
end
|
||||
|
||||
-- LibStub:GetLibrary(major, [silent])
|
||||
-- major (string) - the major version of the library
|
||||
-- silent (boolean) - if true, library is optional, silently return nil if its not found
|
||||
--
|
||||
-- throws an error if the library can not be found (except silent is set)
|
||||
-- returns the library object if found
|
||||
function LibStub:GetLibrary(major, silent)
|
||||
if not self.libs[major] and not silent then
|
||||
error(("Cannot find a library instance of %q."):format(tostring(major)), 2)
|
||||
end
|
||||
return self.libs[major], self.minors[major]
|
||||
end
|
||||
|
||||
-- LibStub:IterateLibraries()
|
||||
--
|
||||
-- Returns an iterator for the currently registered libraries
|
||||
function LibStub:IterateLibraries()
|
||||
return pairs(self.libs)
|
||||
end
|
||||
|
||||
setmetatable(LibStub, { __call = LibStub.GetLibrary })
|
||||
end
|
||||
@@ -0,0 +1,13 @@
|
||||
## Interface: 50001
|
||||
## Title: Lib: LibStub
|
||||
## Notes: Universal Library Stub
|
||||
## Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel
|
||||
## X-Website: http://www.wowace.com/addons/libstub/
|
||||
## X-Category: Library
|
||||
## X-License: Public Domain
|
||||
## X-Curse-Packaged-Version: Release-60203-13
|
||||
## X-Curse-Project-Name: LibItemUpgradeInfo-1.0
|
||||
## X-Curse-Project-ID: libitemupgradeinfo-1-0
|
||||
## X-Curse-Repository-ID: wow/libitemupgradeinfo-1-0/mainline
|
||||
|
||||
LibStub.lua
|
||||
@@ -0,0 +1,41 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
local lib, oldMinor = LibStub:NewLibrary("Pants", 1) -- make a new thingy
|
||||
assert(lib) -- should return the library table
|
||||
assert(not oldMinor) -- should not return the old minor, since it didn't exist
|
||||
|
||||
-- the following is to create data and then be able to check if the same data exists after the fact
|
||||
function lib:MyMethod()
|
||||
end
|
||||
local MyMethod = lib.MyMethod
|
||||
lib.MyTable = {}
|
||||
local MyTable = lib.MyTable
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 1) -- try to register a library with the same version, should silently fail
|
||||
assert(not newLib) -- should not return since out of date
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 0) -- try to register a library with a previous, should silently fail
|
||||
assert(not newLib) -- should not return since out of date
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 2) -- register a new version
|
||||
assert(newLib) -- library table
|
||||
assert(rawequal(newLib, lib)) -- should be the same reference as the previous
|
||||
assert(newOldMinor == 1) -- should return the minor version of the previous version
|
||||
|
||||
assert(rawequal(lib.MyMethod, MyMethod)) -- verify that values were saved
|
||||
assert(rawequal(lib.MyTable, MyTable)) -- verify that values were saved
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 3 Blah") -- register a new version with a string minor version (instead of a number)
|
||||
assert(newLib) -- library table
|
||||
assert(newOldMinor == 2) -- previous version was 2
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", "Blah 4 and please ignore 15 Blah") -- register a new version with a string minor version (instead of a number)
|
||||
assert(newLib)
|
||||
assert(newOldMinor == 3) -- previous version was 3 (even though it gave a string)
|
||||
|
||||
local newLib, newOldMinor = LibStub:NewLibrary("Pants", 5) -- register a new library, using a normal number instead of a string
|
||||
assert(newLib)
|
||||
assert(newOldMinor == 4) -- previous version was 4 (even though it gave a string)
|
||||
@@ -0,0 +1,27 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
for major, library in LibStub:IterateLibraries() do
|
||||
-- check that MyLib doesn't exist yet, by iterating through all the libraries
|
||||
assert(major ~= "MyLib")
|
||||
end
|
||||
|
||||
assert(not LibStub:GetLibrary("MyLib", true)) -- check that MyLib doesn't exist yet by direct checking
|
||||
assert(not pcall(LibStub.GetLibrary, LibStub, "MyLib")) -- don't silently fail, thus it should raise an error.
|
||||
local lib = LibStub:NewLibrary("MyLib", 1) -- create the lib
|
||||
assert(lib) -- check it exists
|
||||
assert(rawequal(LibStub:GetLibrary("MyLib"), lib)) -- verify that :GetLibrary("MyLib") properly equals the lib reference
|
||||
|
||||
assert(LibStub:NewLibrary("MyLib", 2)) -- create a new version
|
||||
|
||||
local count=0
|
||||
for major, library in LibStub:IterateLibraries() do
|
||||
-- check that MyLib exists somewhere in the libraries, by iterating through all the libraries
|
||||
if major == "MyLib" then -- we found it!
|
||||
count = count +1
|
||||
assert(rawequal(library, lib)) -- verify that the references are equal
|
||||
end
|
||||
end
|
||||
assert(count == 1) -- verify that we actually found it, and only once
|
||||
@@ -0,0 +1,14 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
local proxy = newproxy() -- non-string
|
||||
|
||||
assert(not pcall(LibStub.NewLibrary, LibStub, proxy, 1)) -- should error, proxy is not a string, it's userdata
|
||||
local success, ret = pcall(LibStub.GetLibrary, proxy, true)
|
||||
assert(not success or not ret) -- either error because proxy is not a string or because it's not actually registered.
|
||||
|
||||
assert(not pcall(LibStub.NewLibrary, LibStub, "Something", "No number in here")) -- should error, minor has no string in it.
|
||||
|
||||
assert(not LibStub:GetLibrary("Something", true)) -- shouldn't've created it from the above statement
|
||||
@@ -0,0 +1,41 @@
|
||||
debugstack = debug.traceback
|
||||
strmatch = string.match
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
|
||||
-- Pretend like loaded libstub is old and doesn't have :IterateLibraries
|
||||
assert(LibStub.minor)
|
||||
LibStub.minor = LibStub.minor - 0.0001
|
||||
LibStub.IterateLibraries = nil
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(type(LibStub.IterateLibraries)=="function")
|
||||
|
||||
|
||||
-- Now pretend that we're the same version -- :IterateLibraries should NOT be re-created
|
||||
LibStub.IterateLibraries = 123
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(LibStub.IterateLibraries == 123)
|
||||
|
||||
|
||||
-- Now pretend that a newer version is loaded -- :IterateLibraries should NOT be re-created
|
||||
LibStub.minor = LibStub.minor + 0.0001
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(LibStub.IterateLibraries == 123)
|
||||
|
||||
|
||||
-- Again with a huge number
|
||||
LibStub.minor = LibStub.minor + 1234567890
|
||||
|
||||
loadfile("../LibStub.lua")()
|
||||
|
||||
assert(LibStub.IterateLibraries == 123)
|
||||
|
||||
|
||||
print("OK")
|
||||
@@ -14,6 +14,7 @@
|
||||
<Script file="LibGraph-2.0\LibGraph-2.0.lua"/>
|
||||
<Script file="LibWindow-1.1\LibWindow-1.1.lua"/>
|
||||
<Include file="LibCompress\lib.xml"/>
|
||||
<Include file="LibItemUpgradeInfo-1.0\LibItemUpgradeInfo-1.0.xml"/>
|
||||
|
||||
<Include file="DF\load.xml"/>
|
||||
</Ui>
|
||||
+19
-1
@@ -9,6 +9,8 @@ local floor = floor
|
||||
|
||||
local GetNumGroupMembers = GetNumGroupMembers
|
||||
|
||||
local ItemUpgradeInfo = LibStub("LibItemUpgradeInfo-1.0")
|
||||
|
||||
function _detalhes:UpdateGears()
|
||||
|
||||
_detalhes:UpdateParser()
|
||||
@@ -1105,9 +1107,24 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout)
|
||||
local _, _, _, iLevel, _, _, _, _, equipSlot = GetItemInfo (item)
|
||||
if (iLevel and iLevel >= 100) then
|
||||
|
||||
local _, _, _, _, _, _, _, _, _, _, _, upgradeTypeID, _, numBonusIDs, bonusID1, bonusID2 = strsplit (":", item)
|
||||
--local _, _, _, _, _, _, _, _, _, _, _, upgradeTypeID, _, numBonusIDs, bonusID1, bonusID2 = strsplit (":", item)
|
||||
|
||||
--> upgrades handle by LibItemUpgradeInfo-1.0
|
||||
--> http://www.wowace.com/addons/libitemupgradeinfo-1-0/
|
||||
if (ItemUpgradeInfo) then
|
||||
local upgrade, max, delta = ItemUpgradeInfo:GetItemUpgradeInfo (item)
|
||||
if (upgrade) then
|
||||
local ilvl = ItemUpgradeInfo:GetUpgradedItemLevel (item)
|
||||
item_level = item_level + (ilvl or iLevel)
|
||||
else
|
||||
item_level = item_level + iLevel
|
||||
end
|
||||
else
|
||||
item_level = item_level + iLevel
|
||||
end
|
||||
|
||||
--> timewarped
|
||||
--[[
|
||||
if (upgradeTypeID == "512" and bonusID1 == "615") then
|
||||
item_level = item_level + 660
|
||||
if (bonusID2 == "656") then
|
||||
@@ -1116,6 +1133,7 @@ function ilvl_core:CalcItemLevel (unitid, guid, shout)
|
||||
else
|
||||
item_level = item_level + iLevel
|
||||
end
|
||||
--]]
|
||||
|
||||
--> 16 = main hand 17 = off hand
|
||||
--> if using a two-hand, ignore the off hand slot
|
||||
|
||||
+2
-2
@@ -1233,10 +1233,10 @@
|
||||
|
||||
new_aura.trigger.custom = new_aura.trigger.custom:gsub ("@spellid", spellid)
|
||||
new_aura.trigger.custom = new_aura.trigger.custom:gsub ("@spell_casted", icon_text)
|
||||
|
||||
|
||||
--> size
|
||||
new_aura.fontSize = min (icon_size, 24)
|
||||
|
||||
|
||||
elseif (target == 42) then -- dispell
|
||||
|
||||
chat = nil
|
||||
|
||||
Reference in New Issue
Block a user