local A, L = ... local thinBackdrop = rLib.CopyTable(oUF_SimpleConfig.backdrop) thinBackdrop.edgeSize = 2 thinBackdrop.inset = 2 thinBackdrop.insets = {left=2,right=2,top=2,bottom=2} thinBackdrop.bgColor = {0.23,0.23,0.23,1} thinBackdrop.edgeColor = {0,0,0,1} local function HideDBMSpark(self) local spark = _G[self.frame:GetName().."BarSpark"] spark:SetAlpha(0) spark:SetTexture(nil) end local function ResetBackdrop(self) if self.backdrop then self.backdrop:SetBackdrop(nil) end end local function ApplyDBMStyle(self) local frame = self.frame local frame_name = frame:GetName() local tbar = _G[frame_name.."Bar"] local texture = _G[frame_name.."BarTexture"] local icon1 = _G[frame_name.."BarIcon1"] local icon2 = _G[frame_name.."BarIcon2"] local name = _G[frame_name.."BarName"] local timer = _G[frame_name.."BarTimer"] -- tex if texture then texture:SetTexture(oUF_SimpleConfig.textures.statusbar) end -- reset backdrop ResetBackdrop(tbar) ResetBackdrop(icon1) ResetBackdrop(icon2) name:ClearAllPoints() timer:ClearAllPoints() icon1:ClearAllPoints() icon2:ClearAllPoints() icon1:Hide() icon2:Hide() -- bar local barHeight = self.owner.Options.Height local barWidth = self.owner.Options.Width if self.enlarged then barHeight = self.owner.Options.HugeHeight/2 barWidth = self.owner.Options.HugeWidth end tbar:SetSize(barWidth, barHeight) tbar:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, 0) -- frame frame:SetScale(oUF_SimpleConfig.globalscale) -- backdrop local iconOffsetX = 0 if self.enlarged then iconOffsetX = 5 tbar.backdrop = L.CreateBackdrop(tbar) if DBT.Options.IconLeft then icon1:Show() icon1.backdrop = L.CreateBackdrop(icon1) elseif DBT.Options.IconRight then icon2:Show() icon2.backdrop = L.CreateBackdrop(icon2) end else tbar.backdrop = L.CreateBackdrop(tbar, nil, thinBackdrop) end -- icon icon1:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMLEFT', -iconOffsetX, 0) icon2:SetPoint('BOTTOMLEFT', frame, 'BOTTOMRIGHT', iconOffsetX, 0) -- text if self.enlarged then name:SetPoint("BOTTOMLEFT", tbar, "TOPLEFT", 3, 3) timer:SetPoint("BOTTOMRIGHT", tbar, "TOPRIGHT", -3, 3) else name:SetPoint("LEFT", tbar, "LEFT", 3, 0) timer:SetPoint("RIGHT", tbar, "RIGHT", -3, 0) end end local function SkinDBM() -- Default notice message local RaidNotice_AddMessage_ = RaidNotice_AddMessage RaidNotice_AddMessage = function(noticeFrame, textString, colorInfo) if strfind(textString, "|T") then if strmatch(textString, ":(%d+):(%d+)") then local size1, size2 = strmatch(textString, ":(%d+):(%d+)") size1, size2 = size1 + 3, size2 + 3 textString = gsub(textString,":(%d+):(%d+)",":"..size1..":"..size2..":0:0:64:64:5:59:5:59") elseif strmatch(textString, ":(%d+)|t") then local size = strmatch(textString, ":(%d+)|t") size = size + 3 textString = gsub(textString,":(%d+)|t",":"..size..":"..size..":0:0:64:64:5:59:5:59|t") end end return RaidNotice_AddMessage_(noticeFrame, textString, colorInfo) end if not IsAddOnLoaded("DBM-Core") then return end hooksecurefunc(DBT, "CreateBar", function(self) for bar in self:GetBarIterator() do if not bar.injected then hooksecurefunc(bar, "Update", HideDBMSpark) hooksecurefunc(bar, "ApplyStyle", ApplyDBMStyle) bar:ApplyStyle() bar.injected = true end end end) -- Force Settings if not DBM_AllSavedOptions["Default"] then DBM_AllSavedOptions["Default"] = {} end -- DBM_AllSavedOptions["Default"]["BlockVersionUpdateNotice"] = true DBM_AllSavedOptions["Default"]["EventSoundVictory"] = "None" if IsAddOnLoaded("DBM-VPYike") then DBM_AllSavedOptions["Default"]["CountdownVoice"] = "VP:Yike" DBM_AllSavedOptions["Default"]["ChosenVoicePack"] = "Yike" end local hugeBarWidth, hugeBarHeight = unpack(oUF_SimpleConfig.target.castbar.size) local barWidth, barheight = 150, 20 if not DBT_AllPersistentOptions["Default"] then DBT_AllPersistentOptions["Default"] = {} end -- place on top of details local Details = _G.Details local timerX, timerY = (-(barWidth/2)-10+1)*oUF_SimpleConfig.globalscale, Details and 185 or 69 -- normal bar DBT_AllPersistentOptions["Default"]["DBM"].BarYOffset = 4 DBT_AllPersistentOptions["Default"]["DBM"].Height = barheight DBT_AllPersistentOptions["Default"]["DBM"].Width = barWidth DBT_AllPersistentOptions["Default"]["DBM"].ExpandUpwards = true DBT_AllPersistentOptions["Default"]["DBM"].TimerPoint = "BOTTOMRIGHT" DBT_AllPersistentOptions["Default"]["DBM"].TimerX = timerX DBT_AllPersistentOptions["Default"]["DBM"].TimerY = timerY -- huge bar DBT_AllPersistentOptions["Default"]["DBM"].HugeBarYOffset = 8 DBT_AllPersistentOptions["Default"]["DBM"].ExpandUpwardsLarge = true DBT_AllPersistentOptions["Default"]["DBM"].HugeHeight = hugeBarHeight DBT_AllPersistentOptions["Default"]["DBM"].HugeWidth = hugeBarWidth if _G.oUF_SimpleTarget then local point, _, _, xOfs, yOfs = _G.oUF_SimpleTarget:GetPoint(1) DBT_AllPersistentOptions["Default"]["DBM"].HugeTimerPoint = point DBT_AllPersistentOptions["Default"]["DBM"].HugeTimerX = xOfs*oUF_SimpleConfig.globalscale DBT_AllPersistentOptions["Default"]["DBM"].HugeTimerY = yOfs+hugeBarHeight*3+18 end -- rearrange DBT:Rearrange() end rSkin:RegisterSkin('DBM', SkinDBM)