diff --git a/api/config.lua b/api/config.lua index a42fc3be..a7e8166a 100644 --- a/api/config.lua +++ b/api/config.lua @@ -764,6 +764,8 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("thirdparty", "swstats", "dock", "1") pfUI:UpdateConfig("thirdparty", "ktm", "skin", "1") pfUI:UpdateConfig("thirdparty", "ktm", "dock", "1") + pfUI:UpdateConfig("thirdparty", "twt", "skin", "1") + pfUI:UpdateConfig("thirdparty", "twt", "dock", "1") pfUI:UpdateConfig("thirdparty", "wim", "enable", "1") pfUI:UpdateConfig("thirdparty", "healcomm", "enable", "1") pfUI:UpdateConfig("thirdparty", "sortbags", "enable", "1") diff --git a/modules/gui.lua b/modules/gui.lua index a9ac46b6..f3b49419 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2267,6 +2267,8 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, "SWStats (" .. T["Dock"] .. ")", C.thirdparty.swstats, "dock", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "KLH Threat Meter (" .. T["Skin"] .. ")", C.thirdparty.ktm, "skin", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "KLH Threat Meter (" .. T["Dock"] .. ")", C.thirdparty.ktm, "dock", "checkbox", nil, nil, nil, nil, "vanilla") + CreateConfig(nil, "TW Threatmeter (" .. T["Skin"] .. ")", C.thirdparty.twt, "skin", "checkbox", nil, nil, nil, nil, "vanilla") + CreateConfig(nil, "TW Threatmeter (" .. T["Dock"] .. ")", C.thirdparty.twt, "dock", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "WIM", C.thirdparty.wim, "enable", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "HealComm", C.thirdparty.healcomm, "enable", "checkbox", nil, nil, nil, nil, "vanilla") CreateConfig(nil, "SortBags", C.thirdparty.sortbags, "enable", "checkbox", nil, nil, nil, nil, "vanilla") diff --git a/modules/thirdparty-vanilla.lua b/modules/thirdparty-vanilla.lua index abc2fba7..ace1460d 100644 --- a/modules/thirdparty-vanilla.lua +++ b/modules/thirdparty-vanilla.lua @@ -159,6 +159,79 @@ pfUI:RegisterModule("thirdparty-vanilla", "vanilla", function() end end) + HookAddonOrVariable("TWThreat", function() + local docktable = { "twt", "TODO", "TWTMain", + function() -- single + TWTMain:ClearAllPoints() + TWTMain:SetPoint("TOPLEFT", pfUI.chat.right, "TOPLEFT", 0, 0) + local width = pfUI.chat.right:GetWidth() - 3 + TWTMain:SetScale(width / TWTMain:GetWidth()) + TWTMainSettingsFrameHeightSlider:SetMinMaxValues(15, 30) + TWTMainSettingsFrameHeightSlider:SetValue(15) + TWT_CONFIG.windowScale = width / TWTMain:GetWidth() + TWTMain:SetHeight(pfUI.chat.right:GetHeight() / TWT_CONFIG.windowScale - TWT_CONFIG.barHeight) + TWTMainMainWindow_Resized() + end, + function() -- dual + TWTMain:ClearAllPoints() + TWTMain:SetPoint("TOPLEFT", pfUI.chat.right, "TOPLEFT", 0, 0) + local width = (pfUI.chat.right:GetWidth() - 3) / 2 + TWTMain:SetScale(width / TWTMain:GetWidth()) + TWT_CONFIG.windowScale = width / TWTMain:GetWidth() + TWTMain:SetHeight(pfUI.chat.right:GetHeight() / TWT_CONFIG.windowScale - TWT_CONFIG.barHeight) + TWTMainMainWindow_Resized() + end, + function() -- show + TWTMain:Show() + end, + function() -- hide + TWTMain:Hide() + end, + function() -- once + return + end + } + + pfUI.thirdparty.meters:RegisterMeter("threat", docktable) + + if C.thirdparty.twt.skin == "1" then + CreateBackdrop(TWTMain, nil, nil, (C.thirdparty.chatbg == "1" and .8)) + CreateBackdropShadow(TWTMain) + + if C.thirdparty.chatbg == "1" and C.chat.global.custombg == "1" then + local r, g, b, a = strsplit(",", C.chat.global.background) + TWTMain.backdrop:SetBackdropColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a)) + + local r, g, b, a = strsplit(",", C.chat.global.border) + TWTMain.backdrop:SetBackdropBorderColor(tonumber(r), tonumber(g), tonumber(b), tonumber(a)) + end + + TWTMainTitleBG:Hide() + TWTMainBarsBG:Hide() + + -- theme buttons + local buttons = { "TWTMainSettingsButton", "TWTMainLockButton", "TWTMainCloseButton" } + + for i, button in pairs(buttons) do + local b = _G[button] + if not b then return end + SkinButton(b) + + + local p,rt,rp,xo,yo = b:GetPoint() + if not b.pfSet then + b:SetPoint(p,rt,rp,xo - 5,yo) + b.pfSet = true + end + end + + -- buttons + TWTMainSettingsButton:SetText("O") + TWTMainLockButton:SetText("L") + TWTMainCloseButton:SetText("X") + end + end) + HookAddonOrVariable("SW_Stats", function() local docktable = { "swstats", "TODO", "SW_BarFrame1", function() -- single