/trunk
local function getCurrencyItem(index) |
local currencyLink = GetCurrencyListLink(index) |
if(currencyLink) then |
return currencyLink:match("currency:(%d+)") or nil |
return tonumber(currencyLink:match("currency:(%d+)")) or nil |
end |
end |
local function curLoop(res,id) |
unitname = units[k]['name'] |
for a,b in pairs(v) do |
if(a == id and b['count']>0) then |
res[unitname] = b['count'] |
if(b['max']>0) then |
res[unitname] = addon:colorize(format("%s/%s",b['count'],b['max']),b['count']==b['max'] and "ff0000" or "ffffff") |
else |
local function SetCurrencyByID(tooltip,itemID) |
if(itemID) then |
local res = curLoop({},itemID) |
if(res) then |
if(type(res) == 'table') then |
tooltip:AddLine(" ") |
for name, b in pairs(res) do |
for curName, b in pairs(res) do |
if(addon:GetPref(modul.name .. "Tooltip")) then |
tooltip:AddLine(format("%s %s: %s",addon:getIcon(itemID),name,b)) |
tooltip:AddLine(format("%s %s: %s",addon:getIcon(itemID),curName,b)) |
end |
end |
end |
SetCurrencyByID(tooltip,getCurrencyItem(index)) |
end |
local function GameTooltip_SetHyperlink(tooltip, link) |
SetCurrencyByID(tooltip,link:match("currency:(%d+)")) |
SetCurrencyByID(tooltip,tonumber(link:match("currency:(%d+)"))) |
end |
function events:CURRENCY_DISPLAY_UPDATE(event) |
if(playerID) then |
modul['db'][playerID] = modul['db'][playerID] or {} |
for index=1,GetCurrencyListSize() do |
local name, isHeader, isExpanded, isUnused, isWatched, count, icon, maximum, hasWeeklyLimit, currentWeeklyAmount =GetCurrencyListInfo(index) |
local curName, isHeader, isExpanded, isUnused, isWatched, count, icon, maximum, hasWeeklyLimit, currentWeeklyAmount =GetCurrencyListInfo(index) |
local itemID = getCurrencyItem(index) |
if((not isHeader) and itemID) then |
modul['db'][playerID][tonumber(itemID)] = { |