Advertisement
Guest User

Buffs.lua

a guest
Apr 25th, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. local Addon = LibStub("AceAddon-3.0"):GetAddon("BasicUI")
  2. local Module = Addon:NewModule("Buffs")
  3.  
  4. local L = setmetatable({}, { __index = function(t,k)
  5. local v = tostring(k)
  6. rawset(t, k, v)
  7. return v
  8. end })
  9.  
  10. local db
  11. local defaults = {
  12. profile = {
  13. enable = true,
  14. scale = 1.19,
  15. }
  16. }
  17.  
  18. function Module:OnInitialize()
  19. self.db = Addon.db:RegisterNamespace("Buffs", defaults)
  20. db = self.db.profile
  21.  
  22. self:SetEnabledState(Addon:GetModuleEnabled("Buffs"))
  23. end
  24.  
  25. function Module:OnEnable()
  26. -- set up stuff here
  27. db = self.db.profile
  28.  
  29. BuffFrame:ClearAllPoints()
  30. BuffFrame:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -25, 0)
  31. BuffFrame:SetScale(db.scale)
  32. end
  33.  
  34. -- Leave this out if the module doesn't have any settings:
  35. function Module:Refresh()
  36. db = self.db.profile -- update the upvalue
  37.  
  38. -- change stuff here
  39. BuffFrame:SetScale(db.scale)
  40. end
  41.  
  42. -- Leave this out if the module doesn't have any options:
  43. local options
  44. function Module:GetOptions()
  45. options = options or {
  46. type = "group",
  47. name = L["Buffs"],
  48. desc = L["Buff Module for BasicUI."],
  49. get = function(info) return db[ info[#info] ] end,
  50. set = function(info, value) db[ info[#info] ] = value; end,
  51. args = {
  52. ---------------------------
  53. --Option Type Seperators
  54. sep1 = {
  55. type = "description",
  56. order = 2,
  57. name = " ",
  58. },
  59. sep2 = {
  60. type = "description",
  61. order = 3,
  62. name = " ",
  63. },
  64. sep3 = {
  65. type = "description",
  66. order = 4,
  67. name = " ",
  68. },
  69. sep4 = {
  70. type = "description",
  71. order = 5,
  72. name = " ",
  73. },
  74. ---------------------------
  75. enable = {
  76. type = "toggle",
  77. order = 1,
  78. name = L["Enable"],
  79. desc = L["Enables Buff Module."],
  80. width = "full",
  81. },
  82. scale = {
  83. type = "range",
  84. order = 5,
  85. name = L["Buff Scale"],
  86. --desc = L["Controls the scaling of the Buff Frames"],
  87. min = 0.05, max = 5, step = 0.05,
  88. disabled = function() return not db.enable end,
  89. set = function(info, value)
  90. db[ info[#info] ] = value
  91. Module:Refresh()
  92. end,
  93. },
  94. }
  95. }
  96. return options
  97. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement