View Single Post
11-10-14, 10:37 AM   #4
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
The bar value won't work or the rested exp font string.

the line 71 to 81 is that doesn't work.

Lua Code:
  1. ---- /////////////////////  EXP BAR ///////////// ----
  2.  
  3. local Experience = CreateFrame("Frame", nil, UIParent)
  4.  
  5. local ExperienceBar = CreateFrame('StatusBar', nil, UIParent)
  6.  
  7. local ExperienceBarRested = CreateFrame('StatusBar', nil, UIParent)
  8.  
  9. local InvisFrame = CreateFrame("Frame", nil, ExperienceBar)
  10. InvisFrame:SetFrameStrata("HIGH")
  11. InvisFrame:SetFrameLevel(5)
  12. InvisFrame:SetAllPoints()
  13.  
  14. local ExperienceFont = InvisFrame:CreateFontString(nil, 'OVERLAY') 
  15.  
  16. local Current, Max = UnitXP("player"), UnitXPMax("player")
  17. local CurLvl = UnitLevel("player")
  18. local Rested = GetXPExhaustion()
  19. local IsRested = GetRestState()
  20.  
  21. local function UpdateExp()
  22.  
  23.     ExperienceBar:SetPoint('LEFT', oUF_AftermathhPlayer, -67, 52)
  24.     ExperienceBar:SetStatusBarTexture(AftermathhUI.media.texture)
  25.     ExperienceBar:SetSize(235, 18)
  26.     ExperienceBar:SetStatusBarColor(0.6, 0, 0.6)
  27.     ExperienceBar:SetBackdrop({
  28.         bgFile = AftermathhUI.media.blank,
  29.         insets = {top = -1, left = -1, bottom = -1, right = -1},
  30.     })
  31.     ExperienceBar:SetBackdropColor(unpack(AftermathhUI.media.backdropcolor))
  32.  
  33.     CreateBorderLight(ExperienceBar, AftermathhUI.media.bordersize, AftermathhUI.bordercolor, AftermathhUI.bordercolor, AftermathhUI.bordercolor, 3)
  34.  
  35.     ExperienceBar:EnableMouse()
  36.    
  37.     ExperienceBar:SetScript("OnEnter", function(self)
  38.         GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
  39.         GameTooltip:AddLine("|cffffd200Experience|r")
  40.         GameTooltip:AddDoubleLine("Current EXP", Current, 1, 1, 1, 1, 1, 1)
  41.         GameTooltip:AddDoubleLine("Remaining EXP", Max - Current, 1, 1, 1, 1, 1, 1)
  42.        
  43.         if Rested == nil then
  44.             GameTooltip:AddDoubleLine("Rested EXP", "0", 1, 1, 1, 1, 1, 1)
  45.         else
  46.             GameTooltip:AddDoubleLine("Rested EXP", Rested, 1, 1, 1, 1, 1, 1)
  47.         end
  48.  
  49.         GameTooltip:Show()
  50.     end)
  51.    
  52.     ExperienceBar:SetScript("OnLeave", function()
  53.         if GameTooltip:IsShown() then
  54.         GameTooltip:Hide()
  55.         end
  56.     end)
  57.    
  58.     ExperienceBarRested:SetSize(230, 18)
  59.     ExperienceBarRested:SetAlpha(0.5)
  60.     ExperienceBarRested:SetParent(ExperienceBar)
  61.     ExperienceBarRested:SetAllPoints(ExperienceBar)
  62.     ExperienceBarRested:SetStatusBarTexture(AftermathhUI.media.texture)
  63.     ExperienceBarRested:SetStatusBarColor(0, 144/255, 1)
  64.  
  65.     ExperienceFont:SetFont(AftermathhUI.media.font, 12, AftermathhUI.media.fontflag)   
  66.     if AftermathhUI.media.shadowoffset == true then
  67.         ExperienceFont:SetShadowOffset(1, -1)
  68.         ExperienceFont:SetShadowColor(0,0,0)
  69.     end
  70.    
  71.     ExperienceBar:SetMinMaxValues(0, Max)
  72.     ExperienceBar:SetValue(Current)
  73.    
  74.     if (IsRested == 1 and Rested) then     
  75.         ExperienceBarRested:SetMinMaxValues(0, Max)
  76.         ExperienceBarRested:SetValue(Rested + Current)
  77.         ExperienceFont:SetText(""..Current.." / "..Max.."("..Rested..")")
  78.     else
  79.         ExperienceBar:SetValue(0)
  80.         ExperienceFont:SetText(""..Current.." / "..Max.."")
  81.     end
  82. end
  83.    
  84. Experience:RegisterEvent("PLAYER_XP_UPDATE")
  85. Experience:RegisterEvent("PLAYER_LEVEL_UP")
  86. Experience:RegisterEvent("UPDATE_EXHAUSTION")
  87. Experience:RegisterEvent("PLAYER_ENTERING_WORLD")
  88. Experience:RegisterEvent("PLAYER_UPDATE_RESTING")
  89.  
  90. Experience:SetScript("OnEvent", UpdateExp)
  Reply With Quote