Skip to content

Commit

Permalink
v0.5.134
Browse files Browse the repository at this point in the history
  • Loading branch information
d4kir92 committed Jan 3, 2025
1 parent c5c5450 commit 67f8f9c
Show file tree
Hide file tree
Showing 29 changed files with 181 additions and 21 deletions.
2 changes: 1 addition & 1 deletion DarkMode.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Interface-Cata: 40401
## Interface: 110002, 110005, 110007

## Version: 0.5.133
## Version: 0.5.134
## Title: DarkMode by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Cata.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 40401
## Version: 0.5.133
## Version: 0.5.134
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_TBC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20504
## Version: 0.5.133
## Version: 0.5.134
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Vanilla.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11505
## Version: 0.5.133
## Version: 0.5.134
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Wrath.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 30403
## Version: 0.5.133
## Version: 0.5.134
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
29 changes: 28 additions & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,33 @@ function DarkMode:Event(event, ...)
end
end
)

if TargetFrameTextureFrame and TargetFrameTextureFrameTexture then
function string:dm_endswith(suffix)
return self:sub(-#suffix) == suffix
end

TargetFrameDragon = TargetFrameTextureFrame:CreateTexture("TargetFrameDragon", "BACKGROUND")
TargetFrameDragon:SetSize(256, 128)
TargetFrameDragon:SetPoint("TOPRIGHT", TargetFrameTextureFrame, "TOPRIGHT", 0, 0)
TargetFrameDragon:SetTexture("Interface\\AddOns\\DarkMode\\media\\UI-TargetingFrame-Rare_Dragon")
hooksecurefunc(
TargetFrameTextureFrameTexture,
"SetTexture",
function(sel, texture)
TargetFrameDragon:SetDrawLayer("BACKGROUND", 1)
if texture:dm_endswith("UI-TargetingFrame-Rare") then
TargetFrameDragon:SetTexture("Interface\\AddOns\\DarkMode\\media\\UI-TargetingFrame-Rare_Dragon")
elseif texture:dm_endswith("UI-TargetingFrame-Elite") then
TargetFrameDragon:SetTexture("Interface\\AddOns\\DarkMode\\media\\UI-TargetingFrame-Elite_Dragon")
elseif texture:dm_endswith("UI-TargetingFrame-Rare-Elite") then
TargetFrameDragon:SetTexture("Interface\\AddOns\\DarkMode\\media\\UI-TargetingFrame-Rare-Elite_Dragon")
else
TargetFrameDragon:SetTexture("")
end
end
)
end
end

if DarkMode:IsEnabled("MASKBUFFSANDDEBUFFS", true) then
Expand Down Expand Up @@ -1638,7 +1665,7 @@ function DarkMode:Event(event, ...)
["name"] = "DarkMode",
["icon"] = 136122,
["dbtab"] = DMTAB,
["vTT"] = {{"DarkMode |T136122:16:16:0:0|t", "v|cff3FC7EB0.5.133"}, {DarkMode:Trans("LEFTCLICK"), DarkMode:Trans("MMBTNLEFT")}, {DarkMode:Trans("RIGHTCLICK"), DarkMode:Trans("MMBTNRIGHT")}},
["vTT"] = {{"DarkMode |T136122:16:16:0:0|t", "v|cff3FC7EB0.5.134"}, {DarkMode:Trans("LEFTCLICK"), DarkMode:Trans("MMBTNLEFT")}, {DarkMode:Trans("RIGHTCLICK"), DarkMode:Trans("MMBTNRIGHT")}},
["funcL"] = function()
DarkMode:ToggleSettings()
end,
Expand Down
2 changes: 1 addition & 1 deletion data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function DarkMode:GetUiColor(texture)
end

function DarkMode:GetUFColor(texture)
local r, g, b, a = DarkMode:GetColor(DarkMode:DMGV("COLORMODEUF", 1), "CUSTOMUFC")
local r, g, b, a = DarkMode:GetColor(DarkMode:DMGV("COLORMODEUNFR", 1), "CUSTOMUFC")
r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture)

return r, g, b, a
Expand Down
120 changes: 120 additions & 0 deletions libs/D4Lib/D4Frames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,121 @@ function D4:CreateSlider(tab)
return slider
end

function D4:GetColor(name, from)
if TAB == nil then
D4:MSG("[GetColor] Missing TAB", from)

return 0, 0, 0, 0
end

local r = TAB[name .. "_R"] or 0
local g = TAB[name .. "_G"] or 0
local b = TAB[name .. "_B"] or 0
local a = TAB[name .. "_A"] or 0

return r, g, b, a
end

function D4:SetColor(name, r, g, b, a)
if TAB == nil then
D4:MSG("[SetColor] Missing TAB")

return
end

TAB[name .. "_R"] = r or 0
TAB[name .. "_G"] = g or 0
TAB[name .. "_B"] = b or 0
TAB[name .. "_A"] = a or 0
end

function D4:ShowColorPicker(r, g, b, a, changedCallback, revertCallback)
if ColorPickerFrame.SetupColorPickerAndShow then
local info = {}
info.swatchFunc = changedCallback
info.hasOpacity = true
info.opacityFunc = changedCallback
info.cancelFunc = function() end
info.extraInfo = "TEST"
info.r = r
info.g = g
info.b = b
info.opacity = a
ColorPickerFrame:SetupColorPickerAndShow(info)
else
D4:MSG("[ShowColorPicker] Missing ColorPicker")
end
end

function D4:AddColorPicker(key, value, func, x, y)
if TAB == nil then
D4:MSG("[AddColorPicker] Missing TAB")

return
end

if TAB[key .. "_R"] == nil then
TAB[key .. "_R"] = value.R
end

if TAB[key .. "_G"] == nil then
TAB[key .. "_G"] = value.G
end

if TAB[key .. "_B"] == nil then
TAB[key .. "_B"] = value.B
end

if TAB[key .. "_A"] == nil then
TAB[key .. "_A"] = value.A
end

local btn = CreateFrame("Button", key, PARENT, "UIPanelButtonTemplate")
btn:SetSize(180, 25)
btn:SetPoint("TOPLEFT", PARENT, "TOPLEFT", x, Y)
btn:SetText(D4:Trans(key))
btn:SetScript(
"OnClick",
function()
local r, g, b, a = D4:GetColor(key)
if D4:GetWoWBuild() ~= "RETAIL" then
a = 1 - a
end

D4:ShowColorPicker(
r,
g,
b,
a,
function(restore)
local newR, newG, newB, newA
if restore then
newR, newG, newB, newA = unpack(restore)
else
local alpha = 1
if ColorPickerFrame.GetColorAlpha then
alpha = ColorPickerFrame:GetColorAlpha()
else
alpha = OpacitySliderFrame:GetValue()
end

if D4:GetWoWBuild() ~= "RETAIL" then
alpha = 1 - alpha
end

newA, newR, newG, newB = alpha, ColorPickerFrame:GetColorRGB()
end

D4:SetColor(key, newR, newG, newB, newA)
if func then
func()
end
end
)
end
)
end

--[[ FRAMES ]]
function D4:CreateFrame(tab)
tab.sw = tab.sw or 100
Expand Down Expand Up @@ -387,6 +502,11 @@ function D4:AppendSlider(key, value, min, max, steps, decimals, func, lstr)
Y = Y - 30
end

function D4:AppendColorPicker(key, value, func, x)
D4:AddColorPicker(key, value, func, x)
Y = Y - 30
end

function D4:CreateDropdown(key, value, choices, parent, func)
if TAB[key] == nil then
TAB[key] = value
Expand Down
9 changes: 7 additions & 2 deletions libs/D4Lib/D4Lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ local ICON_TAG_LIST_EN = {
["skull"] = 8,
}

function D4:SafeExec(sel, func)
if InCombatLockdown() and sel:IsProtected() then return end
func()
end

function D4:GetCVar(name)
if C_CVar and C_CVar.GetCVar then return C_CVar.GetCVar(name) end
if GetCVar then return GetCVar(name) end
Expand Down Expand Up @@ -243,8 +248,8 @@ if D4:GetWoWBuild() == "CLASSIC" then
TargetFrameHealthBarTextLeft:SetPoint("LEFT", TargetFrameHealthBar, "LEFT", 0, 0)
TargetFrameHealthBarTextRight:SetPoint("RIGHT", TargetFrameHealthBar, "RIGHT", 0, 0)
TargetFrameManaBarText:SetPoint("CENTER", TargetFrameManaBar, "CENTER", 0, 0)
TargetFrameManaBarTextLeft:SetPoint("LEFT", TargetFrameManaBar, "LEFT", 0, 0)
TargetFrameManaBarTextRight:SetPoint("RIGHT", TargetFrameManaBar, "RIGHT", 0, 0)
TargetFrameManaBarTextLeft:SetPoint("LEFT", TargetFrameManaBar, "LEFT", 2, 0)
TargetFrameManaBarTextRight:SetPoint("RIGHT", TargetFrameManaBar, "RIGHT", -2, 0)
TargetFrameHealthBar.LeftText = TargetFrameHealthBarTextLeft
TargetFrameHealthBar.RightText = TargetFrameHealthBarTextRight
TargetFrameManaBar.LeftText = TargetFrameManaBarTextLeft
Expand Down
10 changes: 9 additions & 1 deletion libs/D4Lib/D4Output.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ function D4:SetAddonOutput(name, icon)
end

function D4:MSG(...)
print(string.format("|cFFFFFF00[|r|cFFA0A0FF%s|r |T%s:0:0:0:0|t|cFFFFFF00]|r", nam, ico), ...)
print(string.format("|cFFFFFF00[|r|cFFA0A0FF%s|r |T%s:0:0:0:0|t|cFFFFFF00]|cFFA0A0FF", nam, ico), ...)
end

function D4:INFO(...)
print(string.format("|cFFFFFF00[|r|cFFA0A0FF%s|r |T%s:0:0:0:0|t|cFFFFFF00]|cFFFFFF00", nam, ico), ...)
end

function D4:ERR(...)
print(string.format("|cFFFFFF00[|r|cFFA0A0FF%s|r |T%s:0:0:0:0|t|cFFFFFF00]|cFFFF0000", nam, ico), ...)
end
2 changes: 1 addition & 1 deletion locale/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DarkMode:AddTrans("deDE", "MMBTNRIGHT", "Minimapknopf verstecken")
DarkMode:AddTrans("deDE", "GENERAL", "Allgemein")
DarkMode:AddTrans("deDE", "MMBTN", "Minimapknopf anzeigen")
DarkMode:AddTrans("deDE", "COLORMODE", "Farbmodus Ui")
DarkMode:AddTrans("deDE", "COLORMODEUF", "Farbmodus Einheitenfenster")
DarkMode:AddTrans("deDE", "COLORMODEUNFR", "Farbmodus Einheitenfenster")
DarkMode:AddTrans("deDE", "COLORMODETT", "Farbmodus Tooltips")
DarkMode:AddTrans("deDE", "COLORMODEAB", "Farbmodus Aktionsknöpfe")
DarkMode:AddTrans("deDE", "COLORMODEBAD", "Farbmodus Buffs und Debuffs")
Expand Down
2 changes: 1 addition & 1 deletion locale/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DarkMode:AddTrans("enUS", "MMBTNRIGHT", "Hide Minimap Button")
DarkMode:AddTrans("enUS", "GENERAL", "General")
DarkMode:AddTrans("enUS", "MMBTN", "Show Minimap Button")
DarkMode:AddTrans("enUS", "COLORMODE", "Color Mode Ui")
DarkMode:AddTrans("enUS", "COLORMODEUF", "Color Mode UnitFrames")
DarkMode:AddTrans("enUS", "COLORMODEUNFR", "Color Mode UnitFrames")
DarkMode:AddTrans("enUS", "COLORMODETT", "Color Mode Tooltips")
DarkMode:AddTrans("enUS", "COLORMODEAB", "Color Mode Actionbuttons")
DarkMode:AddTrans("enUS", "COLORMODEBAD", "Color Mode Buffs and Debuffs")
Expand Down
2 changes: 1 addition & 1 deletion locale/zhcn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DarkMode:AddTrans("zhCN", "MMBTNRIGHT", "隐藏小地图按钮")
DarkMode:AddTrans("zhCN", "GENERAL", "常规")
DarkMode:AddTrans("zhCN", "MMBTN", "显示小地图按钮")
DarkMode:AddTrans("zhCN", "COLORMODE", "界面染色")
DarkMode:AddTrans("zhCN", "COLORMODEUF", "头像染色")
DarkMode:AddTrans("zhCN", "COLORMODEUNFR", "头像染色")
DarkMode:AddTrans("zhCN", "COLORMODETT", "鼠标提示染色")
DarkMode:AddTrans("zhCN", "COLORMODEF", "窗口染色")
DarkMode:AddTrans("zhCN", "CUSTOMUIC", "指定界面颜色")
Expand Down
2 changes: 1 addition & 1 deletion locale/zhtw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DarkMode:AddTrans("zhTW", "MMBTNRIGHT", "隱藏小地圖按鈕")
DarkMode:AddTrans("zhTW", "GENERAL", "一般")
DarkMode:AddTrans("zhTW", "MMBTN", "顯示小地圖按鈕")
DarkMode:AddTrans("zhTW", "COLORMODE", "介面著色")
DarkMode:AddTrans("zhTW", "COLORMODEUF", "單位框架著色")
DarkMode:AddTrans("zhTW", "COLORMODEUNFR", "單位框架著色")
DarkMode:AddTrans("zhTW", "COLORMODETT", "滑鼠提示著色")
DarkMode:AddTrans("zhTW", "COLORMODEF", "視窗著色")
DarkMode:AddTrans("zhTW", "CUSTOMUIC", "指定介面顏色")
Expand Down
Binary file added media/UI-TargetingFrame-Elite_Dragon.blp
Binary file not shown.
Binary file added media/UI-TargetingFrame-Rare-Elite_Dragon.blp
Binary file not shown.
Binary file added media/UI-TargetingFrame-Rare_Dragon.blp
Binary file not shown.
Binary file removed media/border_thin.png
Binary file not shown.
Binary file removed media/default.png
Binary file not shown.
Binary file removed media/defaultEER.png
Binary file not shown.
Binary file removed media/defaultbuff.png
Binary file not shown.
Binary file removed media/defaultbuff2.png
Binary file not shown.
Binary file removed media/eyeborder.png
Binary file not shown.
Binary file removed media/gt_border.png
Binary file not shown.
Binary file removed media/krbtn_border.png
Binary file not shown.
Binary file removed media/mbtn_border.png
Binary file not shown.
Binary file removed media/mmicon_border.png
Binary file not shown.
Binary file removed media/zoom_border.png
Binary file not shown.
14 changes: 7 additions & 7 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ function DarkMode:InitDMSettings()
DMSettings:Hide()
end

DarkMode:SetVersion(AddonName, 136122, "0.5.133")
DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.133"))
DarkMode:SetVersion(AddonName, 136122, "0.5.134")
DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.134"))
DMSettings.CloseButton:SetScript(
"OnClick",
function()
Expand Down Expand Up @@ -413,7 +413,7 @@ function DarkMode:InitDMSettings()
function(sel, val)
sel:SetText(DarkMode:Trans("COLORMODEG") .. ": " .. DarkMode:GetColorModes()[val])
DarkMode:UpdateColors()
end, 1, getn(DarkMode:GetColorModes()), 1, {"COLORMODE", "COLORMODEUF", "COLORMODENP", "COLORMODETT", "COLORMODEAB", "COLORMODEBAD", "COLORMODEF"}
end, 1, getn(DarkMode:GetColorModes()), 1, {"COLORMODE", "COLORMODEUNFR", "COLORMODENP", "COLORMODETT", "COLORMODEAB", "COLORMODEBAD", "COLORMODEF"}
)

gCM:SetText(DarkMode:Trans("COLORMODEG") .. ": " .. DarkMode:GetColorModes()[DarkMode:DMGV("COLORMODEG", 1)])
Expand All @@ -433,15 +433,15 @@ function DarkMode:InitDMSettings()
DarkMode:AddColorPicker("CUSTOMUIC", DMSettings.SC, 0, 0)
local sCMUF = AddSlider(
4,
"COLORMODEUF",
DarkMode:DMGV("COLORMODEUF", 1),
"COLORMODEUNFR",
DarkMode:DMGV("COLORMODEUNFR", 1),
function(sel, val)
sel:SetText(DarkMode:Trans("COLORMODEUF") .. ": " .. DarkMode:GetColorModes()[val])
sel:SetText(DarkMode:Trans("COLORMODEUNFR") .. ": " .. DarkMode:GetColorModes()[val])
DarkMode:UpdateColors()
end, 1, getn(DarkMode:GetColorModes()), 1
)

sCMUF:SetText(DarkMode:Trans("COLORMODEUF") .. ": " .. DarkMode:GetColorModes()[DarkMode:DMGV("COLORMODEUF", 1)])
sCMUF:SetText(DarkMode:Trans("COLORMODEUNFR") .. ": " .. DarkMode:GetColorModes()[DarkMode:DMGV("COLORMODEUNFR", 1)])
tinsert(sliders, sCMUF)
DarkMode:AddColorPicker("CUSTOMUFC", DMSettings.SC, 0, 0)
--NP
Expand Down

0 comments on commit 67f8f9c

Please sign in to comment.