Thread Tools Display Modes
11-11-14, 09:11 AM   #21
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Made a repbar too if anyone want to use them you're welcome to do so

REP BAR:

Lua Code:
  1. local Reputation = CreateFrame("Frame", nil, UIParent)
  2.  
  3. local ReputationBar = CreateFrame('StatusBar', nil, UIParent)
  4.  
  5. local InvisFrame = CreateFrame("Frame", nil, ExperienceBar)
  6. InvisFrame:SetFrameStrata("HIGH")
  7. InvisFrame:SetFrameLevel(5)
  8. InvisFrame:SetAllPoints()
  9.  
  10. local ReputationBarFont = InvisFrame:CreateFontString(nil, 'OVERLAY')  
  11.  
  12. local function UpdateRep()
  13.     local Name, ID, Min, Max, Value = GetWatchedFactionInfo()  
  14.     ReputationBar:SetMinMaxValues(Min, Max)
  15.     ReputationBar:SetValue(Value)
  16.     ReputationBar:SetStatusBarColor(FACTION_BAR_COLORS[ID].r, FACTION_BAR_COLORS[ID].g, FACTION_BAR_COLORS[ID].b)
  17.     ReputationBarFont:SetText(""..Min.." / "..Max.." - "..Name.."")
  18. end
  19.  
  20. ReputationBar:SetPoint('LEFT', oUF_AftermathhPlayer, 223, -178)
  21. ReputationBar:SetStatusBarTexture(AftermathhUI.media.texture)
  22. ReputationBar:SetSize(235, 20)
  23. ReputationBar:SetBackdrop({
  24.     bgFile = AftermathhUI.media.blank,
  25.     insets = {top = -1, left = -1, bottom = -1, right = -1},
  26.     })
  27. ReputationBar:SetBackdropColor(unpack(AftermathhUI.media.backdropcolor))
  28.  
  29. CreateBorderLight(ReputationBar, AftermathhUI.media.bordersize, AftermathhUI.bordercolor, AftermathhUI.bordercolor, AftermathhUI.bordercolor, 3)
  30.  
  31. ReputationBar:EnableMouse()
  32.    
  33. ReputationBar:SetScript("OnEnter", function(self)
  34.     if (not GetWatchedFactionInfo()) then
  35.         return
  36.     end
  37.  
  38.     local Name, ID, Min, Max, Value = GetWatchedFactionInfo()
  39.     GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
  40.     GameTooltip:AddLine(string.format("%s (%s)", Name, _G["FACTION_STANDING_LABEL" .. ID]))
  41.     GameTooltip:AddLine(string.format("%d / %d (%d%%)", Value - Min, Max - Min, (Value - Min) / (Max - Min) * 100))
  42.     GameTooltip:Show()
  43.     GameTooltip:Show()
  44. end)
  45.    
  46. ReputationBar:SetScript("OnLeave", function()
  47.     if GameTooltip:IsShown() then
  48.     GameTooltip:Hide()
  49.     end
  50. end)
  51.  
  52. ReputationBar:SetAlpha(0)
  53. ReputationBar:HookScript("OnEnter", function(self) UIFrameFadeIn(self, 1.2, self:GetAlpha(), 1) end)
  54. ReputationBar:HookScript("OnLeave", function(self) UIFrameFadeIn(self, 0.8, self:GetAlpha(), 0) end)
  55.  
  56. ReputationBarFont:SetPoint('CENTER', ReputationBar)
  57. ReputationBarFont:SetFont(AftermathhUI.media.font, 12, AftermathhUI.media.fontflag)
  58. if AftermathhUI.media.shadowoffset == true then
  59.     ReputationBarFont:SetShadowOffset(1, -1)
  60.     ReputationBarFont:SetShadowColor(0,0,0)
  61. end
  62.  
  63. Reputation:RegisterEvent("UPDATE_FACTION")
  64. Reputation:RegisterEvent("PLAYER_ENTERING_WORLD")
  65.  
  66. Reputation:SetScript("OnEvent", UpdateRep)


EXP BAR:

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

WoWInterface » Developer Discussions » Lua/XML Help » Exp Bar issue update


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off