Quantcast

add skin script

Ou Junhui [09-20-21 - 12:50]
add skin script
Filename
rSkin/modules/MerInspect.lua
rSkin/modules/ThreatClassic2.lua
rSkin/rSkin.toc
diff --git a/rSkin/modules/MerInspect.lua b/rSkin/modules/MerInspect.lua
new file mode 100644
index 0000000..a980c98
--- /dev/null
+++ b/rSkin/modules/MerInspect.lua
@@ -0,0 +1,65 @@
+local _, ns = ...
+local B, C, L, DB, P = unpack(ns)
+local S = P:GetModule("Skins")
+local M = B:GetModule("Misc")
+
+local _G = getfenv(0)
+local select, pairs, type = select, pairs, type
+
+local function reskinFrame(frame)
+	frame:SetBackdrop(nil)
+	frame.SetBackdrop = B.Dummy
+	frame:SetBackdropColor(0, 0, 0, 0)
+	frame.SetBackdropColor = B.Dummy
+	frame:SetBackdropBorderColor(0, 0, 0, 0)
+	frame.SetBackdropBorderColor = B.Dummy
+	B.SetBD(frame, nil, 0, 0, 0, 0)
+end
+
+function S:MerInspect()
+	if not IsAddOnLoaded("MerInspect") then return end
+	if not S.db["MerInspect"] then return end
+
+	hooksecurefunc("ShowInspectItemListFrame", function(_, parent)
+		local frame = parent.inspectFrame
+		if not frame then return end
+
+		for i = 1, frame:GetNumChildren() do
+			local child = select(i, frame:GetChildren())
+			if child and child.itemString then
+				child.itemString:SetFont(child.itemString:GetFont(), 13, "OUTLINE") -- 装备字体描边
+			end
+		end
+
+		local f = parent:GetName()
+		if (f == "InspectFrame" or f == "PaperDollFrame") then
+			frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", -33, -15)
+		else
+			frame:SetPoint("TOPLEFT", parent, "TOPRIGHT", 1, 0)
+		end
+
+		if not frame.styled then
+			reskinFrame(frame)
+			frame.styled = true
+		end
+	end)
+
+	hooksecurefunc("ClassicStatsFrameTemplate_OnShow", function(self)
+		if not self.styled then
+			local category = {self.AttributesCategory, self.ResistanceCategory, self.EnhancementsCategory, self.SuitCategory}
+			for _, v in pairs(category) do
+				v.Background:Hide()
+				local line = v:CreateTexture(nil, "ARTWORK")
+				line:SetSize(180, C.mult)
+				line:SetPoint("BOTTOM", 0, 5)
+				line:SetColorTexture(1, 1, 1, .25)
+			end
+
+			B.StripTextures(self)
+			reskinFrame(self)
+			self.styled = true
+		end
+	end)
+end
+
+S:RegisterSkin("MerInspect", S.MerInspect)
\ No newline at end of file
diff --git a/rSkin/modules/ThreatClassic2.lua b/rSkin/modules/ThreatClassic2.lua
new file mode 100644
index 0000000..0e389f7
--- /dev/null
+++ b/rSkin/modules/ThreatClassic2.lua
@@ -0,0 +1,81 @@
+local _, ns = ...
+local B, C, L, DB, P = unpack(ns)
+local S = P:GetModule("Skins")
+
+local _G = getfenv(0)
+
+local function reskinStatusBar(self)
+	self:SetBackdrop(nil)
+	self.SetBackdrop = B.Dummy
+
+	local backdrop = self.edgeBackdrop or self.backdrop
+	if backdrop then
+		backdrop:SetBackdrop(nil)
+		backdrop.SetBackdrop = B.Dummy
+	end
+end
+
+local function delayFunc()
+	local frame = _G.ThreatClassic2BarFrame
+	if not frame then return end
+
+	local bg = B.SetBD(frame)
+	if frame.header:IsShown() then
+		bg:SetPoint("TOPLEFT", -C.mult, 18)
+	end
+
+	local frameBg = frame.bg
+	if frameBg then
+		frameBg:SetColorTexture(0, 0, 0, 0)
+		frameBg:SetVertexColor(0, 0, 0, 0)
+		frameBg.SetVertexColor = B.Dummy
+	end
+
+	local header = frame.header
+	if header then
+		reskinStatusBar(header)
+		header:SetStatusBarColor(0, 0, 0, 0)
+		header.SetStatusBarColor = B.Dummy
+		header.text:SetPoint("LEFT", header, 4, 0)
+	end
+
+	for _, child in pairs {frame:GetChildren()} do
+		if child:GetObjectType() == "StatusBar" and child.bg and child.val then
+			reskinStatusBar(child)
+			child.bg:SetVertexColor(0, 0, 0, 0)
+			child.bg.SetVertexColor = B.Dummy
+		end
+	end
+end
+
+function S:ThreatClassic2()
+	if not IsAddOnLoaded("ThreatClassic2") then return end
+	if not S.db["ClassicThreatMeter"] then return end
+
+	P:Delay(.5, delayFunc)
+end
+
+S:RegisterSkin("ThreatClassic2", S.ThreatClassic2)
+
+local function loadStyle(event, addon)
+	if addon ~= "ThreatClassic2" then return end
+
+	local charKey = DB.MyName .. " - " .. DB.MyRealm
+	ThreatClassic2DB = ThreatClassic2DB or {}
+	ThreatClassic2DB["profileKeys"] = ThreatClassic2DB["profileKeys"] or {}
+	ThreatClassic2DB["profileKeys"][charKey] = ThreatClassic2DB["profileKeys"][charKey] or charKey
+	ThreatClassic2DB["profiles"] = ThreatClassic2DB["profiles"] or {}
+	ThreatClassic2DB["profiles"][charKey] = ThreatClassic2DB["profiles"][charKey] or {}
+
+	local profileKey = ThreatClassic2DB["profileKeys"][charKey]
+	local profile = profileKey and ThreatClassic2DB["profiles"][profileKey]
+	if profile then
+		profile.bar = profile.bar or {}
+		profile.bar.texture = profile.bar.texture or "normTex"
+		profile.bar.padding = 2
+	end
+
+	B:UnregisterEvent(event, loadStyle)
+end
+
+B:RegisterEvent("ADDON_LOADED", loadStyle)
\ No newline at end of file
diff --git a/rSkin/rSkin.toc b/rSkin/rSkin.toc
index 76265e8..f283788 100644
--- a/rSkin/rSkin.toc
+++ b/rSkin/rSkin.toc
@@ -6,4 +6,6 @@
 ## OptionalDeps: MerInspect, ThreatClassic2, DBM, WeakAuras, ls_Toasts

 init.lua
-modules\ls_Toasts.lua
\ No newline at end of file
+modules\ls_Toasts.lua
+modules\MerInspect.lua
+modules\ThreatClassic2.lua
\ No newline at end of file