Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MODULE_NAME = "Buffs"
- local ADDON_NAME = LibStub("AceAddon-3.0"):GetAddon("BasicUI")
- local MODULE = ADDON_NAME:NewModule(MODULE_NAME, "AceEvent-3.0")
- local L = setmetatable({}, { __index = function(t,k)
- local v = tostring(k)
- rawset(t, k, v)
- return v
- end })
- ------------------------------------------------------------------------
- -- Module Database
- ------------------------------------------------------------------------
- local db
- local defaults = {
- profile = {
- enable = true,
- scale = 1.19,
- }
- }
- ------------------------------------------------------------------------
- -- Module Functions
- ------------------------------------------------------------------------
- function MODULE:OnInitialize()
- self.db = ADDON_NAME.db:RegisterNamespace(MODULE_NAME, defaults)
- db = self.db.profile
- self:SetEnabledState(ADDON_NAME:GetModuleEnabled(MODULE_NAME))
- end
- function MODULE:OnEnable()
- -- set up stuff here
- db = self.db.profile
- BuffFrame:ClearAllPoints()
- BuffFrame:SetPoint('TOPRIGHT', Minimap, 'TOPLEFT', -25, 0)
- BuffFrame:SetScale(db.scale)
- end
- -- Leave this out if the module doesn't have any settings:
- function MODULE:Refresh()
- db = self.db.profile -- update the upvalue
- -- change stuff here
- BuffFrame:SetScale(db.scale)
- end
- ------------------------------------------------------------------------
- -- Module Options
- ------------------------------------------------------------------------
- -- Leave this out if the module doesn't have any options:
- local options
- function MODULE:GetOptions()
- if options then
- return options
- end
- local function isModuleDisabled()
- return not ADDON_NAME:GetModuleEnabled(MODULE_NAME)
- end
- options = {
- type = "group",
- name = L[MODULE_NAME],
- desc = L["Buff Module for BasicUI."],
- get = function(info) return db[ info[#info] ] end,
- set = function(info, value) db[ info[#info] ] = value end,
- disabled = isModuleDisabled(),
- args = {
- enable = {
- type = "toggle",
- order = 1,
- name = L["Enable"],
- desc = L["Enables Buff Module."],
- width = "full",
- disabled = false,
- },
- scale = {
- type = "range",
- order = -1,
- name = L["Buff Scale"],
- --desc = L["Controls the scaling of the Buff Frames"],
- min = 0.05, max = 5, step = 0.05,
- disabled = function() return isModuleDisabled() or not db.enable end,
- set = function(info, value)
- db[ info[#info] ] = value
- MODULE:Refresh()
- end,
- },
- }
- }
- return options
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement