------------------------------------------------------------------------ -- DogTag block for StatBlocks ------------------------------------------------------------------------ local SB = LibStub("AceAddon-3.0"):GetAddon("StatBlocks") local SB_DogTag = SB:NewModule("DogTag") local DT = LibStub("LibDogTag-2.0") local db local defaults = { profile = { unit = "player", tag = "[Health]", lock = nil, } } ------------------------------ -- Config -- ------------------------------ SB.Options.args.DogTag = { name = "Dog Tags", type = "group", args = { setUnit = { name = "Set Unit", type = 'input', set = function(_, val) db.unit = val DT:AddFontString(StatBlocksFont_DogTag, StatBlocks_DogTag, db.unit , db.tag ) end get = function() return db.unit end, }, SetTag = { name = "Set Tag", type = "input", multiLine = true, width = "fill", get = function() return db.tag end, set = function(_, val) db.tag = val DT:AddFontString(StatBlocksFont_DogTag, StatBlocks_DogTag, db.unit , db.tag ) end, desc = "Set the Tag for the Stats block", } }, } ------------------------------ -- Initialization -- ------------------------------ function SB_DogTag:OnInitialize() self.db = LibStub("AceDB-3.0"):New("StatBlocksDB_DogTag", defaults) db = self.db.profile end function SB_DogTag:OnEnable() SB:NewBlock("DogTag", SB_DogTag) SB.RegisterCallback(self, "SB_UpdateFont", "UpdateFont") DT:AddFontString(StatBlocksFont_DogTag, StatBlocks_DogTag, db.unit , db.tag ) end function SB_DogTag:UpdateFont(_, font) StatBlocksFont_DogTag:SetFont(font, 12) end