Compare commits
3 Commits
main
...
developmen
| Author | SHA1 | Date |
|---|---|---|
|
|
b97f827228 | |
|
|
65b2096222 | |
|
|
6945ad473e |
34
Core.lua
34
Core.lua
|
|
@ -1,16 +1,26 @@
|
||||||
local addonName, DX = ...
|
local _, DX = ...
|
||||||
_G[addonName] = DX
|
DX.Modules = {}
|
||||||
|
|
||||||
local f = CreateFrame("Frame")
|
function DX:AddModule(name, desc, func)
|
||||||
f:RegisterEvent("ADDON_LOADED")
|
DX.Modules[name] = {
|
||||||
|
Init = func,
|
||||||
|
Enabled = true,
|
||||||
|
Description = desc
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
f:SetScript("OnEvent", function(self, event, ...)
|
local coreFrame = CreateFrame("Frame")
|
||||||
if event == "ADDON_LOADED" and ... == addonName then
|
coreFrame:RegisterEvent("PLAYER_LOGIN")
|
||||||
self:UnregisterEvent("ADDON_LOADED")
|
|
||||||
DX:Initialize()
|
coreFrame:SetScript("OnEvent", function(self, event)
|
||||||
|
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
|
|
||||||
|
|
@ -28,3 +28,5 @@ Media.lua
|
||||||
Core.lua
|
Core.lua
|
||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
|
modules\talentbackground\TalentBackground.lua
|
||||||
|
modules\movementtracker\MovementTracker.lua
|
||||||
|
|
@ -4,3 +4,8 @@ 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.
|
After Width: | Height: | Size: 8.0 MiB |
|
|
@ -0,0 +1,92 @@
|
||||||
|
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)
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
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)
|
||||||
Loading…
Reference in New Issue