Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-21-14, 12:34 PM   #1
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Reputation Bar Issue

Hi everyone!

I have some issues with FACTION_BAR_COLORS.

Why i dont know

Lua Code:
  1. Message: ...ce\AddOns\AftermathhUI\Modules\Blizzard\AfterRep.lua:60: attempt to index field '?' (a nil value)
  2. Time: 11/21/14 19:31:37
  3. Count: 2
  4. Stack: ...ce\AddOns\AftermathhUI\Modules\Blizzard\AfterRep.lua:60: in function <...ce\AddOns\AftermathhUI\Modules\Blizzard\AfterRep.lua:55>
  5.  
  6. Locals: FactionColors = <table> {
  7.  6 = <table> {
  8.  }
  9.  2 = <table> {
  10.  }
  11.  8 = <table> {
  12.  }
  13.  3 = <table> {
  14.  }
  15.  1 = <table> {
  16.  }
  17.  4 = <table> {
  18.  }
  19.  5 = <table> {
  20.  }
  21.  7 = <table> {
  22.  }
  23. }
  24. Name = nil
  25. ID = 0
  26. Min = 0
  27. Max = 0
  28. Value = 0
  29. (*temporary) = <function> defined =[C]:-1
  30. (*temporary) = <unnamed> {
  31.  0 = <userdata>
  32.  Shadow = <table> {
  33.  }
  34.  fadeInfo = <table> {
  35.  }
  36.  HasBorder = true
  37.  Border = <table> {
  38.  }
  39. }
  40. (*temporary) = nil
  41. (*temporary) = <userdata>
  42. (*temporary) = <userdata>
  43. (*temporary) = nil
  44. (*temporary) = nil
  45. (*temporary) = nil
  46. (*temporary) = nil
  47. (*temporary) = "attempt to index field '?' (a nil value)"
  48. ReputationBar = <unnamed> {
  49.  0 = <userdata>
  50.  Shadow = <table> {
  51.  }
  52.  fadeInfo = <table> {
  53.  }
  54.  HasBorder = true
  55.  Border = <table> {
  56.  }
  57. }
  58. ReputationBarFont = <unnamed> {
  59.  0 = <userdata>
  60. }


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

Last edited by Aftermathhqt : 11-21-14 at 12:37 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Reputation Bar Issue


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