Compare commits

..

No commits in common. "development" and "main" have entirely different histories.

6 changed files with 15 additions and 178 deletions

View File

@ -1,26 +1,16 @@
local _, DX = ... local addonName, DX = ...
DX.Modules = {} _G[addonName] = DX
function DX:AddModule(name, desc, func) local f = CreateFrame("Frame")
DX.Modules[name] = { f:RegisterEvent("ADDON_LOADED")
Init = func,
Enabled = true,
Description = desc
}
end
local coreFrame = CreateFrame("Frame") f:SetScript("OnEvent", function(self, event, ...)
coreFrame:RegisterEvent("PLAYER_LOGIN") if event == "ADDON_LOADED" and ... == addonName then
self:UnregisterEvent("ADDON_LOADED")
coreFrame:SetScript("OnEvent", function(self, event) DX:Initialize()
if event == "PLAYER_LOGIN" then
print("|cffFF4500DX Tweaks:|r Loading modules...")
for name, module in pairs(DX.Modules) do
if module.Enabled then
module.Init()
print("|cffFF4500DX Tweaks:|r " .. name .. " loaded")
end
end
self:UnregisterEvent("PLAYER_LOGIN")
end end
end) end)
function DX:Initialize()
print("|cffFF4500DX Tweaks|r geladen!")
end

View File

@ -27,6 +27,4 @@ libs\LibSharedMedia-3.0\LibSharedMedia-3.0.lua
Media.lua Media.lua
Core.lua Core.lua
# Modules # Modules
modules\talentbackground\TalentBackground.lua
modules\movementtracker\MovementTracker.lua

View File

@ -3,9 +3,4 @@ local LSM = LibStub("LibSharedMedia-3.0")
-- ----- -- -----
-- FONT -- FONT
-- ----- -- -----
LSM:Register('font', 'DX Narrow', [[Interface\Addons\DX_Tweaks\media\fonts\DX_Narrow.ttf]]) LSM:Register('font', 'DX Narrow', [[Interface\Addons\DX_Tweaks\media\fonts\DX_Narrow.ttf]])
-- -----
-- BACKGROUND
-- -----
LSM:Register('background', 'DX TalentBG', [[Interface\AddOns\DX_Tweaks\media\textures\talent_bg.tga]])

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 MiB

View File

@ -1,92 +0,0 @@
local _, DX = ...
local LSM = LibStub("LibSharedMedia-3.0")
local moduleName = "MovementTracker"
local moduleDesc = "Tracks different movement cooldowns like Blink, Shimmer or Shift"
local moduleTicker
local movementCooldowns = {
Blink = 1953,
Shimmer = 212653,
Shift = 123
}
local movementConfig = {
[movementCooldowns.Blink] = {
text = "No Blink: "
},
[movementCooldowns.Shimmer] = {
text = "No Shimmer: "
},
[movementCooldowns.Shift] = {
text = "No Shift: "
}
}
local function LoadMovementTracker()
local eventFrame = CreateFrame("Frame")
-- Create the frame
local trackerFrame = CreateFrame("Frame", "DX_MovementTracker", UIParent)
trackerFrame:SetSize(400, 50)
trackerFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 18)
trackerFrame:SetFrameStrata("LOW")
trackerFrame:Show()
local trackerText = trackerFrame:CreateFontString(nil, "OVERLAY")
local trackerFont = LSM:Fetch("font", "DX Narrow")
trackerText:SetFont(trackerFont, 20, "OUTLINE")
trackerText:SetPoint("CENTER")
trackerText:SetJustifyH("CENTER")
trackerText:SetTextColor(1, 1, 1, 1)
-- Returns the spellId of the learned movement cooldown
local function getRelevantSpellId()
if C_SpellBook.IsSpellKnown(movementCooldowns.Shimmer) then
return movementCooldowns.Shimmer
elseif C_SpellBook.IsSpellKnown(movementCooldowns.Blink) then
return movementCooldowns.Blink
elseif C_SpellBook.IsSpellKnown(movementCooldowns.Shift) then
return movementCooldowns.Shift
else
-- No spell known
return -1
end
end
-- Applies the cooldown to the TextFrame and hide/shows it accordingly
local function applyCooldownText()
local spellId = getRelevantSpellId()
local config = movementConfig[spellId]
local durationObject = C_Spell.GetSpellCooldownDuration(spellId)
local cooldown = durationObject:GetRemainingDuration(1)
-- Ignore spell if only on GCD or not on cooldown
if (C_Spell.GetSpellCooldown(spellId).isOnGCD ~= false) or (not cooldown) or (cooldown == 0) then
trackerFrame:Hide()
if moduleTicker then
moduleTicker:Cancel()
end
return
end
trackerFrame:Show()
trackerText:SetText(string.format("%s%.1f", config.text, cooldown))
end
function eventFrame:SPELL_UPDATE_COOLDOWN()
if getRelevantSpellId() == -1 then
return
end
if moduleTicker then
moduleTicker:Cancel()
end
moduleTicker = C_Timer.NewTicker(0.1, applyCooldownText)
end
eventFrame:SetScript("OnEvent", function(self, event, ...) return self[event](self, ...) end)
eventFrame:RegisterEvent("SPELL_UPDATE_COOLDOWN")
end
DX:AddModule(moduleName, moduleDesc, LoadMovementTracker)

View File

@ -1,54 +0,0 @@
local _, DX = ...
local LSM = LibStub("LibSharedMedia-3.0")
local moduleName = "TalentBackground"
local moduleDesc = "Changes the background of the TalentFrame"
local function LoadTalentBackground()
local eventFrame = CreateFrame("Frame")
local function ApplyBG()
local frame = _G.PlayerSpellsFrame
if not frame or not frame.TalentsFrame then return end
local bg = frame.TalentsFrame.Background
if bg then
local bgPath = LSM:Fetch("background", "DX TalentBG")
bg:SetAtlas(nil)
bg:SetTexture(bgPath)
bg:SetAlpha(1)
bg:SetDesaturated(false)
bg:SetVertexColor(1, 1, 1, 1)
bg:SetDrawLayer("BACKGROUND", -8)
bg:SetHorizTile(false)
bg:SetVertTile(false)
end
end
local function SetupHooks()
local frame = _G.PlayerSpellsFrame
if not frame then return end
hooksecurefunc(frame, "Show", function()
C_Timer.After(0.05, ApplyBG)
end)
if frame:IsVisible() then
ApplyBG()
end
end
if C_AddOns.IsAddOnLoaded("Blizzard_PlayerSpells") then
SetupHooks()
else
eventFrame:SetScript("OnEvent", function(self, event, name)
if name == "Blizzard_PlayerSpells" then
SetupHooks()
self:UnregisterEvent("ADDON_LOADED")
end
end)
eventFrame:RegisterEvent("ADDON_LOADED")
end
end
DX:AddModule(moduleName, moduleDesc, LoadTalentBackground)