Originally Posted by
Kanegasi
It seems whatever LDB display addon you're using isn't properly setting textures.
Yeah its kinda strange,
Code:
local ldb = LibStub:GetLibrary("LibDataBroker-1.1",true)
local LibQTip = LibStub('LibQTip-1.0')
local _G = _G
local delay, counter = 1,0
local dataobj, tooltip
local _
dataobj = ldb:NewDataObject("LDBHonor",
{ type = "data source",
label = "LDBHonor",
text = "LDBHonor",
icon = "Interface\\PVPFrame\\Icons\\prestige-icon-04",
--icon = SetTexture(1375577), -- doesnt work ???
OnLeave = function() GameTooltip:Hide() end,
} )
function dataobj:OnEnter()
if tooltip then
LibQTip:Release(tooltip)
end
tooltip = LibQTip:Acquire("LDBHonor", 1, "CENTER")
tooltip:Clear()
local y, x = tooltip:AddLine()
local pIcon, pInfo = GetPrestigeInfo(UnitPrestige("player"))
if pInfo == "" then
pInfo = "no prestige yet"
end
tooltip:SetCell(y, 1, pInfo)
tooltip:SetAutoHideDelay(0.01, self)
tooltip:SmartAnchorTo(self)
tooltip:Show()
self.icon:SetTexture(pIcon) -- here it works? why?
end
function dataobj:UpdateText()
local output = "LDBHonor"
honorLevel = UnitHonorLevel("player")
maxHonor = UnitHonorMax("player")
curHonor = UnitHonor("player")
local picon, pname = GetPrestigeInfo(UnitPrestige("player"))
output = honorLevel .. " (" .. curHonor .. "/" .. maxHonor .. ")"
-- self.icon:SetTexture(pIcon) -- here it doesnt work again?
dataobj.text = output
dataobj.icon = picon
end
local function OnUpdate(self, elapsed)
counter = counter + elapsed
if counter >= delay then
dataobj:UpdateText()
counter = 0
end
end
local frame = CreateFrame("Frame")
frame:SetScript("OnUpdate", OnUpdate)
self.icon:SetTexture(pIcon) only works OnEnter and I dunno why ever other time I get "attempt to call method 'SetTexture' (a nil value)" as an Error-Message.
Originally Posted by
Kanegasi
I assume you want this to be automatic and you don't want to have to change the code every time you change prestige levels.
correct!
Originally Posted by
Kanegasi
Install
FileDataLib, then use the following code for the icon:
icon = GetFileName((GetPrestigeInfo(UnitPrestige("player"))))
looking at this I found prestige 1 - 4 bages are Interface\\PVPFrame\\Icons\\prestige-icon-(1-4).blp
seeing that it was last updated Jul 25, 2016 I now just need to find a way to find bages 5-21, any advise how to do that?
Originally Posted by
Kanegasi
Blizzard does not provide a way to convert file IDs to file paths.
Or any hint how TOM_RUS found all the data would also help.