1. #1
    Deleted

    How to get the Prestige Icon of the player. [Solved]

    So i want to show my prestige texture on my addon but I need help how
    to get the texture.
    When I do
    pLevel = UnitPrestige("player")
    local picon, pname = GetPrestigeInfo(pLevel)
    picon only contains a number like "1375577".

    how do I convert this into an icon?
    Last edited by mmoc25fb373f9a; 2017-11-29 at 12:23 AM.

  2. #2
    That is called a file ID. The vast majority of texture functions that used to accept paths now accept file IDs. Just put that number in where a file path would go.

    Code:
    texture:SetTexture(1375577)
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  3. #3
    Deleted
    That doesnt work for me ;(
    Code:
    dataobj = ldb:NewDataObject("LDBHonor",
    	{ type  = "data source", 
    	  label = "LDBHonor",
    	  text  = "LDBHonor",
    	  icon  = texture:SetTexture(1375577),
    	  OnLeave = function() GameTooltip:Hide() end,
    	} )
    that only gives me errors?
    only things like
    Code:
    icon  = "Interface\\Icons\\inv_misc_coin_01"
    works but i obviously want to show the prestige icon.
    Last edited by mmoc25fb373f9a; 2017-11-23 at 12:26 AM.

  4. #4
    No, you replace any path with just the number itself. What I provided was just an example. What you're doing there is setting the icon part of that LDB object as a texture object instead of the file ID it should be.

    Code:
    icon  = "Interface\\Icons\\inv_misc_coin_01"
    
    -- OR
    
    icon  = 1375577

    Here's my example with both a path and the ID:

    Code:
    texture:SetTexture("Interface\\Icons\\inv_misc_coin_01")
    
    -- OR
    
    texture:SetTexture(1375577)

    Also, for future reference, if someone is helping you or you're looking for help and you get an error, please copy and paste the full error instead of just saying you got errors. You can trim off the big addon list on the bottom of the error unless that is specifically requested. The errors provide important information to help figure out the problem. In this case though, I knew the issue since you provided the code you're using.
    Last edited by Kanegasi; 2017-11-23 at 02:00 AM.
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  5. #5
    Deleted
    if I use icon = 1375577 I dont get ANY Icon to show up thats why I look for a way to
    convert the number to something like Interface\\Icons\\inv_misc_coin_01
    (Interface\\Icons\\inv_misc_coin_01 is just an example as I havent found prestige images anywhere?)

    and if I use
    Code:
    dataobj = ldb:NewDataObject("LDBHonor",
    	{ type  = "data source", 
    	  label = "LDBHonor",
    	  text  = "LDBHonor",
    	  icon  = texture:SetTexture(1375577),
    	  OnLeave = function() GameTooltip:Hide() end,
    	} )
    I get the error
    Code:
    Message: Interface\AddOns\LDBHonor\LDBHonor.lua:15: attempt to index global 'texture' (a nil value)
    Count: 1
    Stack: Interface\AddOns\LDBHonor\LDBHonor.lua:15: attempt to index global 'texture' (a nil value)
    [C]: ?
    Interface\AddOns\LDBHonor\LDBHonor.lua:15: in main chunk
    Last edited by mmoc25fb373f9a; 2017-11-23 at 07:17 AM.

  6. #6
    It seems whatever LDB display addon you're using isn't properly setting textures. The file ID should be fine. 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.

    Install FileDataLib, then use the following code for the icon:

    Code:
    icon = GetFileName((GetPrestigeInfo(UnitPrestige("player"))))

    Blizzard does not provide a way to convert file IDs to file paths. When you gain a new prestige level, you may have to /reload your ui.
    Last edited by Kanegasi; 2017-11-23 at 08:10 PM.
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  7. #7
    Deleted
    Quote Originally Posted by Kanegasi View Post
    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.

    Quote Originally Posted by Kanegasi View Post
    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!

    Quote Originally Posted by Kanegasi View Post
    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?

    Quote Originally Posted by Kanegasi View Post
    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.

  8. #8
    Quote Originally Posted by Fummockelchen View Post
    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?
    I thought about that, but wasn't sure about all the other icons I saw there or how the numbers line up. This is all the prestige icons in that folder:



    They go from 1 to 8, but then there's sublevels, like 2-2 or 4-1. I assume GetPrestigeInfo handles that part. You'll have to make your own function that translates what UnitPrestige returns to the correct icon if you know which icon goes to which level.

    As for how TOM_RUS got that info, a handful of people have private datamining tools. However, how I got those files, is through a console extraction.
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  9. #9
    Deleted
    okay with the help of your picture and


    it is as follows (mayhaps that helps someone else one day too):
    Code:
    1375574 Prestige Level 1 - prestige-icon-1.blp
    1375575 Prestige Level 2 - prestige-icon-2.blp
    1375576 Prestige Level 3 - prestige-icon-3.blp
    1375577 Prestige Level 4 - prestige-icon-4.blp
    
    1551554 Prestige Level 5 - prestige-icon-2-1.blp
    1551555 Prestige Level 6 - prestige-icon-2-2.blp
    1551556 Prestige Level 7 - prestige-icon-2-3.blp
    1551557 Prestige Level 8 - prestige-icon-2-4.blp
    1567394 Prestige Level 9 - prestige-icon-2-5.blp
    
    1597388 Prestige Level 10 - prestige-icon-3-2.blp
    1597390 Prestige Level 11 - prestige-icon-3-3.blp
    1597392 Prestige Level 12 - prestige-icon-3-4.blp
    1597394 Prestige Level 13 - prestige-icon-3.5.blp
    
    1597397 Prestige Level 14 - prestige-icon-4.2.blp
    1597398 Prestige Level 15 - prestige-icon-4.3.blp
    1597399 Prestige Level 16 - prestige-icon-4.4.blp
    1597400 Prestige Level 17 - prestige-icon-4.5.blp
    
    1713158 Prestige Level 18 - prestige-icon-5.1.blp
    1713159 Prestige Level 19 - prestige-icon-5.2.blp
    1713160 Prestige Level 20 - prestige-icon-5.3.blp
    1713161 Prestige Level 21 - prestige-icon-5.4.blp

    Thanks alot for your help!
    Last edited by mmoc25fb373f9a; 2017-11-24 at 10:04 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •