Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
d4kir92 committed Mar 1, 2024
1 parent 325cb85 commit 406010a
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 82 deletions.
16 changes: 8 additions & 8 deletions DarkMode.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Interface-Wrath: 30403
## Interface: 100205

## Version: 0.4.32
## Version: 0.5.0
## Title: DarkMode by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand All @@ -16,14 +16,14 @@

libs\D4Lib\D4Lib.xml

libs/math.lua
libs/db.lua
libs\math.lua
libs\db.lua

locale/enUS.lua
locale/deDE.lua
locale/zhCN.lua
locale/zhTW.lua
libs/lang.lua
locale\enUS.lua
locale\deDE.lua
locale\zhCN.lua
locale\zhTW.lua
libs\lang.lua

data.lua
settings.lua
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.4.32
## Version: 0.5.0
## 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: 11501
## Version: 0.4.32
## Version: 0.5.0
## 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.4.32
## Version: 0.5.0
## 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
56 changes: 30 additions & 26 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,6 @@ function DarkMode:InitQuestLogFrame()
for index, name in pairs(DarkMode:GetFrameTextTable()) do
if _G[name] and debug then
DarkMode:FindTextsByName(name)
table.remove(DarkMode:GetFrameTextTable(), index)
end
end
end
Expand Down Expand Up @@ -686,10 +685,6 @@ function DarkMode:SearchUi(from)
end
end
end

if _G[name] and debug then
table.remove(tab, i)
end
end
elseif index == "Minimap" or index == "Artworks" or index == "Chat" or index == "Castbar" then
for ind, name in pairs(tab) do
Expand All @@ -707,35 +702,22 @@ function DarkMode:SearchUi(from)
if name ~= "MainMenuBarBackpackButtonNormalTexture" or DarkMode:GetWoWBuild() ~= "RETAIL" then
DarkMode:FindTexturesByName(name, "ui")
end

if _G[name] and debug then
table.remove(tab, ind)
end
end
elseif index == "Gryphons" then
if DarkMode:IsEnabled("GRYPHONS", true) then
for i, name in pairs(tab) do
DarkMode:FindTexturesByName(name, "ui")
if _G[name] and debug then
table.remove(tab, i)
end
end
end
elseif index == "Tooltips" then
for i, name in pairs(tab) do
DarkMode:FindTexturesByName(name, "tt")
if _G[name] and debug then
table.remove(tab, i)
end
end
elseif type(tab) == "string" then
DarkMode:FindTexturesByName(tab, "ui")
elseif index == "UnitFrames" then
for i, name in pairs(tab) do
DarkMode:FindTexturesByName(name, "uf")
if _G[name] and debug then
table.remove(tab, i)
end
end
else
print("Missing Ui index:", index, tab)
Expand Down Expand Up @@ -794,7 +776,10 @@ function DarkMode:SearchUi(from)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\mmicon_border")
border:SetPoint("TOPLEFT", 0, 1)
border:SetDrawLayer("OVERLAY", 3)
border:SetScale(0.86)
if border.SetScale then
border:SetScale(0.86)
end

DarkMode:UpdateColor(border, "ui")
end

Expand All @@ -804,7 +789,10 @@ function DarkMode:SearchUi(from)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\mmicon_border")
border:SetPoint("TOPLEFT", 0, 1)
border:SetDrawLayer("OVERLAY", 3)
border:SetScale(0.8)
if border.SetScale then
border:SetScale(0.8)
end

DarkMode:UpdateColor(border, "ui")
end

Expand All @@ -813,7 +801,10 @@ function DarkMode:SearchUi(from)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\mmicon_border")
border:SetPoint("TOPLEFT", 0, 1)
border:SetDrawLayer("OVERLAY", 3)
border:SetScale(0.8)
if border.SetScale then
border:SetScale(0.8)
end

DarkMode:UpdateColor(border, "ui")
end

Expand All @@ -822,7 +813,9 @@ function DarkMode:SearchUi(from)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\gt_border")
if DarkMode:GetWoWBuild() == "WRATH" then
border:SetPoint("TOPLEFT", -1, 1)
border:SetScale(0.82)
if border.SetScale then
border:SetScale(0.82)
end
else
border:SetPoint("TOPLEFT")
end
Expand All @@ -843,7 +836,10 @@ function DarkMode:SearchUi(from)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\mmicon_border")
border:SetPoint("TOPLEFT", 0, 1)
border:SetParent(btn)
border:SetScale(0.84)
if border.SetScale then
border:SetScale(0.84)
end

border:SetDrawLayer("OVERLAY", 3)
DarkMode:UpdateColor(border, "ui")
end
Expand Down Expand Up @@ -874,7 +870,10 @@ function DarkMode:SearchUi(from)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\mmicon_border")
border:SetPoint("TOPLEFT", 0, 1)
border:SetParent(btwQ)
border:SetScale(0.9)
if border.SetScale then
border:SetScale(0.9)
end

border:SetDrawLayer("OVERLAY", 3)
DarkMode:UpdateColor(border, "ui")
end
Expand Down Expand Up @@ -1014,8 +1013,13 @@ function DarkMode:InitSlash()
D4:AddSlash("dm", DarkMode.ToggleSettings)
D4:AddSlash("dark", DarkMode.ToggleSettings)
D4:AddSlash("darkmode", DarkMode.ToggleSettings)
D4:AddSlash("rl", C_UI.Reload)
D4:AddSlash("rel", C_UI.Reload)
if C_UI then
D4:AddSlash("rl", C_UI.Reload)
D4:AddSlash("rel", C_UI.Reload)
else
D4:AddSlash("rl", ReloadUI)
D4:AddSlash("rel", ReloadUI)
end
end

local BAGS = {"MainMenuBarBackpackButton", "CharacterBag0Slot", "CharacterBag1Slot", "CharacterBag2Slot", "CharacterBag3Slot"}
Expand Down
2 changes: 1 addition & 1 deletion data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function DarkMode:GetUiAddonsTable()
return DMUiAddons
end

local DMFrames = {"MailItem1", "MailItem2", "MailItem3", "MailItem4", "MailItem5", "MailItem6", "MailItem7", "MailFrame", "InboxFrame", "GuildMemberDetailFrame", "TabardFrame", "TradeFrame", "TradeFrame.RecipientOverlay", "DressUpFrame", "LootFrame", "StaticPopup1", "StaticPopup2", "ItemTextFrame", "WorldStateScoreFrame", "WorldStateScoreFrameTab1", "WorldStateScoreFrameTab2", "WorldStateScoreFrameTab3", "SettingsPanel", "InspectPaperDollFrame", "PaperDollFrame", "CharacterFrame", "CharacterStatsPane", "CharacterFrameTab1", "CharacterFrameTab2", "CharacterFrameTab3", "CharacterFrameTab4", "CharacterFrameTab5", "nwtab5", "nwtab6", "ReputationFrame", "ReputationListScrollFrame", "SkillFrame", "SkillListScrollFrame", "SkillDetailScrollFrame", "HonorFrame", "PetPaperDollFrame", "PetPaperDollFrameTab1", "PetPaperDollFrameTab2", "PetPaperDollFrameTab3", "PetPaperDollFrameExpBar", "TokenFrame", "SpellBookFrame", "SpellBookSkillLineTab1", "SpellBookSkillLineTab2", "SpellBookSkillLineTab3", "SpellBookSkillLineTab4", "SpellBookSkillLineTab5", "SpellBookSkillLineTab6", "SpellBookSkillLineTab7", "WhatsTrainingFrame", "SpellBookFrameTabButton1", "SpellBookFrameTabButton2", "QuestLogFrame", "QuestLogCollapseAllButton", "QuestScrollFrame.ScrollBar", "FriendsFrame", "FriendsFrameFriendsScrollFrame", "FriendsFrameTab1", "FriendsFrameTab2", "FriendsFrameTab3", "FriendsFrameTab4", "WhoFrameList", "WorldMapFrame", "WorldMapFrame.BorderFrame", "WorldMapFrame.MiniBorderFrame", "LFGParentFrame", "LFGParentFrameTab1", "LFGParentFrameTab2", "LFMFrame", "LFGBrowseFrame", "LFGListingFrame", "PVEFrame", "PVEFrameTab1", "PVEFrameTab2", "PVEFrameTab3", "PVEFrameTab4", "PVPFrame", "ChallengesFrame", "GameMenuFrame", "GameMenuFrame.Border", "GameMenuFrame.Header", "QuestFrame", "QuestFrameDetailPanel", "QuestDetailScrollFrame", "QuestDetailScrollChildFrame", "GossipFrameGreetingPanel", "GossipGreetingScrollFrame", "QuestFrameGreetingPanel", "QuestGreetingScrollFrame", "QuestFrameProgressPanel", "QuestProgressScrollFrame", "QuestRewardScrollFrame", "QuestFrameRewardPanel", "QuestInfoRewardsFrame", "GossipFrame", "GossipFrame.GreetingPanel", "GossipFrame.GreetingPanel.ScrollBox", "GossipFrame.GreetingPanel.ScrollBar.Background", "MerchantFrame", "MerchantBuyBackItem", "MerchantFrameTab1", "MerchantFrameTab2", "MerchantItem1", "MerchantItem2", "MerchantItem3", "MerchantItem4", "MerchantItem5", "MerchantItem6", "MerchantItem7", "MerchantItem8", "MerchantItem9", "MerchantItem10", "MerchantItem11", "MerchantItem12", "MerchantMoney", "MerchantMoneyBg", "PetStableFrame", "AddonList", "AddonListDisableAllButton_RightSeparator", "AddonListEnableAllButton_RightSeparator", "AddonListOkayButton_LeftSeparator", "AddonListOkayButton_RightSeparator", "AddonListCancelButton_LeftSeparator", "HelpFrame", "VideoOptionsFrame", "InterfaceOptionsFrame", "TimeManagerFrame", "OpenMailFrame", "OpenMailScrollFrame", "MailFrameTab1", "MailFrameTab2", "SendMailFrame", "SendMailMoney", "SendMailMoneyBg", "SendMailMoneyFrame", "SendMail", "MailEditBoxScrollBar", "BankFrame", "BankFrameTab1", "BankFrameTab2", "BankFrameMoneyFrame", "BankFrameMoneyFrameBorder", "BackpackTokenFrame", "ContainerFrame1", "ContainerFrame2", "ContainerFrame3", "ContainerFrame4", "ContainerFrame5", "ContainerFrame6", "ContainerFrame7", "ContainerFrame8", "ContainerFrame9", "ContainerFrame10", "ContainerFrame11", "ContainerFrame12", "ContainerFrameCombinedBags", "PVPFrame", "PVPParentFrame", "PVPParentFrameTab1", "PVPParentFrameTab2", "BattlefieldFrame", "BattlefieldListScrollFrame", "BattlefieldFrameType", "TaxiFrame", "YourFrameName", "QuestMapFrame", "QuestMapFrame.DetailsFrame"}
local DMFrames = {"MailItem1", "MailItem2", "MailItem3", "MailItem4", "MailItem5", "MailItem6", "MailItem7", "MailFrame", "InboxFrame", "GuildMemberDetailFrame", "TabardFrame", "TradeFrame", "TradeFrame.RecipientOverlay", "DressUpFrame", "LootFrame", "StaticPopup1", "StaticPopup2", "ItemTextFrame", "WorldStateScoreFrame", "WorldStateScoreFrameTab1", "WorldStateScoreFrameTab2", "WorldStateScoreFrameTab3", "SettingsPanel", "InspectPaperDollFrame", "PaperDollFrame", "CharacterFrame", "CharacterStatsPane", "CharacterFrameTab1", "CharacterFrameTab2", "CharacterFrameTab3", "CharacterFrameTab4", "CharacterFrameTab5", "nwtab5", "nwtab6", "ReputationFrame", "ReputationListScrollFrame", "SkillFrame", "SkillListScrollFrame", "SkillDetailScrollFrame", "HonorFrame", "PetPaperDollFrame", "PetPaperDollFrameTab1", "PetPaperDollFrameTab2", "PetPaperDollFrameTab3", "PetPaperDollFrameExpBar", "TokenFrame", "SpellBookFrame", "SpellBookSkillLineTab1", "SpellBookSkillLineTab2", "SpellBookSkillLineTab3", "SpellBookSkillLineTab4", "SpellBookSkillLineTab5", "SpellBookSkillLineTab6", "SpellBookSkillLineTab7", "WhatsTrainingFrame", "SpellBookFrameTabButton1", "SpellBookFrameTabButton2", "QuestLogFrame", "QuestLogCollapseAllButton", "QuestScrollFrame.ScrollBar", "FriendsFrame", "FriendsFrameFriendsScrollFrame", "FriendsFrameTab1", "FriendsFrameTab2", "FriendsFrameTab3", "FriendsFrameTab4", "FriendsFrameTab5", "WhoFrameList", "WorldMapFrame", "WorldMapFrame.BorderFrame", "WorldMapFrame.MiniBorderFrame", "LFGParentFrame", "LFGParentFrameTab1", "LFGParentFrameTab2", "LFMFrame", "LFGBrowseFrame", "LFGListingFrame", "PVEFrame", "PVEFrameTab1", "PVEFrameTab2", "PVEFrameTab3", "PVEFrameTab4", "PVPFrame", "ChallengesFrame", "GameMenuFrame", "GameMenuFrame.Border", "GameMenuFrame.Header", "QuestFrame", "QuestFrameDetailPanel", "QuestDetailScrollFrame", "QuestDetailScrollChildFrame", "GossipFrameGreetingPanel", "GossipGreetingScrollFrame", "QuestFrameGreetingPanel", "QuestGreetingScrollFrame", "QuestFrameProgressPanel", "QuestProgressScrollFrame", "QuestRewardScrollFrame", "QuestFrameRewardPanel", "QuestInfoRewardsFrame", "GossipFrame", "GossipFrame.GreetingPanel", "GossipFrame.GreetingPanel.ScrollBox", "GossipFrame.GreetingPanel.ScrollBar.Background", "MerchantFrame", "MerchantBuyBackItem", "MerchantFrameTab1", "MerchantFrameTab2", "MerchantItem1", "MerchantItem2", "MerchantItem3", "MerchantItem4", "MerchantItem5", "MerchantItem6", "MerchantItem7", "MerchantItem8", "MerchantItem9", "MerchantItem10", "MerchantItem11", "MerchantItem12", "MerchantMoney", "MerchantMoneyBg", "PetStableFrame", "AddonList", "AddonListDisableAllButton_RightSeparator", "AddonListEnableAllButton_RightSeparator", "AddonListOkayButton_LeftSeparator", "AddonListOkayButton_RightSeparator", "AddonListCancelButton_LeftSeparator", "HelpFrame", "VideoOptionsFrame", "InterfaceOptionsFrame", "TimeManagerFrame", "OpenMailFrame", "OpenMailScrollFrame", "MailFrameTab1", "MailFrameTab2", "SendMailFrame", "SendMailMoney", "SendMailMoneyBg", "SendMailMoneyFrame", "SendMail", "MailEditBoxScrollBar", "BankFrame", "BankFrameTab1", "BankFrameTab2", "BankFrameMoneyFrame", "BankFrameMoneyFrameBorder", "BackpackTokenFrame", "ContainerFrame1", "ContainerFrame2", "ContainerFrame3", "ContainerFrame4", "ContainerFrame5", "ContainerFrame6", "ContainerFrame7", "ContainerFrame8", "ContainerFrame9", "ContainerFrame10", "ContainerFrame11", "ContainerFrame12", "ContainerFrameCombinedBags", "PVPFrame", "PVPParentFrame", "PVPParentFrameTab1", "PVPParentFrameTab2", "BattlefieldFrame", "BattlefieldListScrollFrame", "BattlefieldFrameType", "TaxiFrame", "YourFrameName", "QuestMapFrame", "QuestMapFrame.DetailsFrame"}
function DarkMode:GetFrameTable()
return DMFrames
end
Expand Down
42 changes: 42 additions & 0 deletions libs/D4Lib/D4Lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,48 @@ function D4:GetWoWBuild()
return Build
end

local oldWow = false
if C_Timer == nil then
print("[D4] ADD C_Timer")
C_Timer = {}
local f = CreateFrame("Frame")
f.tab = {}
f:HookScript(
"OnUpdate",
function()
for i, v in pairs(f.tab) do
if v[1] < GetTime() then
local func = v[2]
func()
tremove(f.tab, i)
end
end
end
)

C_Timer.After = function(duration, callback)
tinsert(f.tab, {GetTime() + duration, callback})
end

oldWow = true
end

if GetClassColor == nil then
print("[D4] ADD GetClassColor")
GetClassColor = function(classFilename)
local color = RAID_CLASS_COLORS[classFilename]
if color then return color.r, color.g, color.b, color.colorStr end

return 1, 1, 1, "ffffffff"
end

oldWow = true
end

function D4:IsOldWow()
return oldWow
end

--[[ QOL ]]
local ICON_TAG_LIST_EN = {
["star"] = 1,
Expand Down
7 changes: 5 additions & 2 deletions libs/D4Lib/D4Versions.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
local AddonName, _ = ...
D4.VersionTab = D4.VersionTab or {}
local pre = "D4PREFIX"
C_ChatInfo.RegisterAddonMessagePrefix(pre)
if C_ChatInfo then
C_ChatInfo.RegisterAddonMessagePrefix(pre)
end

function D4:SetVersion(name, icon, ver)
if name == nil then
D4:msg("|cffff0000MISSING NAME AT SetVersion", ver)
Expand Down Expand Up @@ -118,7 +121,7 @@ f:SetScript(
D4:MSG(AddonName, 0, "|cffff0000MISSING VERSION", AddonName)
end

if isInitialLogin and ver and pre then
if isInitialLogin and ver and pre and C_ChatInfo then
C_ChatInfo.SendAddonMessage(pre, format("A;%s;V;%s", AddonName, ver))
end
end
Expand Down
5 changes: 0 additions & 5 deletions libs/db.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
local _, DarkMode = ...
local BuildNr = select(4, GetBuildInfo())
local Build = "CLASSIC"

if BuildNr >= 100000 then
Build = "RETAIL"
elseif BuildNr > 29999 then
Expand All @@ -20,7 +19,6 @@ end

local COL_R = "|cFFFF0000"
local COL_Y = "|cFFFFFF00"

function DarkMode:MSG(msg)
print("|cff3FC7EB" .. "[DarkMode |T136122:16:16:0:0|t]|r " .. COL_Y .. msg)
end
Expand Down Expand Up @@ -85,7 +83,6 @@ function DarkMode:IsEnabled(element, value)
end

DarkMode:GetTab()["ELES"]["OPTIONS"][element] = DarkMode:GetTab()["ELES"]["OPTIONS"][element] or {}

if DarkMode:GetTab()["ELES"]["OPTIONS"][element]["ENABLED"] == nil then
DarkMode:GetTab()["ELES"]["OPTIONS"][element]["ENABLED"] = value
end
Expand All @@ -111,7 +108,6 @@ function DarkMode:SetElePoint(key, p1, p2, p3, p4, p5)
DarkMode:GetTab()["ELES"]["POINTS"][key]["PX"] = p4
DarkMode:GetTab()["ELES"]["POINTS"][key]["PY"] = p5
local frame = _G[key]

if frame then
frame:ClearAllPoints()
frame:SetPoint(p1, UIParent, p3, p4, p5)
Expand All @@ -127,7 +123,6 @@ end
function DarkMode:GV(name, value)
DMTAB = DMTAB or {}
DMTAB["VALUES"] = DMTAB["VALUES"] or {}

if DMTAB["VALUES"][name] == nil then
DarkMode:SV(name, value)
end
Expand Down
3 changes: 0 additions & 3 deletions libs/lang.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
local _, DarkMode = ...
local ialang = {}

function DarkMode:GetLangTab()
return ialang
end

function DarkMode:GT(str)
local tab = DarkMode:GetLangTab()
local result = tab[str]

if result ~= nil then
return result
else
Expand All @@ -20,7 +18,6 @@ end

function DarkMode:UpdateLanguage()
DarkMode:Lang_enUS()

if GetLocale() == "deDE" then
DarkMode:Lang_deDE()
elseif GetLocale() == "zhCN" then
Expand Down
4 changes: 0 additions & 4 deletions libs/math.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
local _, DarkMode = ...

function DarkMode:MathC(val, vmin, vmax)
if val == nil then return 0 end
if vmin == nil then return 0 end
if vmax == nil then return 1 end

if val < vmin then
return vmin
elseif val > vmax then
Expand All @@ -23,7 +21,6 @@ end

function DarkMode:FormatValue(val, dec)
dec = dec or 1

if val < 1000 then
return ("%." .. 0 .. "f"):format(val)
elseif val < 1000000 then
Expand All @@ -44,7 +41,6 @@ end
function DarkMode:ReplaceStr(text, old, new)
if text == nil then return "" end
local b, e = text:find(old, 1, true)

if b == nil then
return text
else
Expand Down
Loading

0 comments on commit 406010a

Please sign in to comment.