Thread: Honor Tracking
View Single Post
02-07-17, 05:01 PM   #11
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Feel free to use mine

Lua Code:
  1. if UnitLevel("player") ~= MAX_PLAYER_LEVEL then return end
  2.  
  3. local HonorBar = CreateFrame("StatusBar",  nil, UIParent)
  4. HonorBar:SetOrientation("VERTICAL")
  5. HonorBar:SetSize(WIDTH, HEIGHT)
  6. HonorBar:SetPoint("LEFT", UIParent, -12, 0)
  7. HonorBar:SetStatusBarTexture(TEXTURE)
  8. HonorBar:SetStatusBarColor(BARCOLOR)
  9.  
  10. local function UpdateHonorBar()
  11.     local Current, Max = UnitHonor("player"), UnitHonorMax("player")
  12.     HonorBar:SetMinMaxValues(0, Max)
  13.     HonorBar:SetValue(Current)
  14. end
  15.  
  16. HonorBar:SetScript("OnEnter", function(self)
  17.     local Current, Max = UnitHonor("player"), UnitHonorMax("player")
  18.     local Level = UnitHonorLevel("player")
  19.     local LevelMax = GetMaxPlayerHonorLevel()
  20.     local Prestige = UnitPrestige("player")
  21.    
  22.     GameTooltip:ClearLines()
  23.     GameTooltip:SetOwner(self, "ANCHOR_CURSOR", 0, -4)  
  24.    
  25.     if Max == 0 then
  26.         GameTooltip:AddLine(PVP_HONOR_PRESTIGE_AVAILABLE)
  27.         GameTooltip:AddLine(PVP_HONOR_XP_BAR_CANNOT_PRESTIGE_HERE)
  28.     else       
  29.         GameTooltip:AddLine("|cffffd200Honor Exp|r")
  30.         GameTooltip:AddDoubleLine("Current Honor:", Current .. "/" .. Max .. " - " .. math.floor(Current/Max*100) .. "%", 1, 1, 1, 1, 1, 1)
  31.         GameTooltip:AddDoubleLine("Current Honor Rank:", Level .. "/" .. LevelMax, 1, 1, 1, 1, 1, 1)
  32.         GameTooltip:AddDoubleLine("Prestige Level:", Prestige, 1, 1, 1, 1, 1, 1)
  33.     end
  34.  
  35.     GameTooltip:Show()
  36. end)
  37.    
  38. HonorBar:SetScript("OnLeave", function() GameTooltip:Hide() end)
  39.  
  40. HonorBar:RegisterEvent("PLAYER_ENTERING_WORLD")
  41. HonorBar:RegisterEvent("HONOR_XP_UPDATE")
  42. HonorBar:RegisterEvent("HONOR_LEVEL_UPDATE")
  43. HonorBar:RegisterEvent("HONOR_PRESTIGE_UPDATE")
  44.  
  45. HonorBar:SetScript("OnEvent", UpdateHonorBar)
  Reply With Quote