mirror of
https://github.com/TheRealFayz/SHPlates.git
synced 2026-11-16 12:30:34 +00:00
Settings window - New layout with tabs down the side, the portrait, and a resize grip (right-click the grip to reset the size) - Tabs: General, one tab for each template (Grey Tank, Grey DPS, Neon Tank, Neon DPS), Casts/Tanks/Notes, and Share - Each template tab has the Designer pinned at the top and its settings scrolling underneath - Clicking a piece in the Designer scrolls to that piece's settings and briefly highlights the section Per-template settings - Every setting is now saved per template, so tank and DPS plates can look and behave completely differently - Existing settings are copied into all four templates on first load, so nothing is lost - Old share strings still import and apply to every template Designer - Drag pieces on a sample plate: name, level, health text, spell name, cast bar, spell icon, raid icon, elite star, debuffs, class icon, mob note, threat line, aggro holder name, threat wheel, and tanked icon - Arrow buttons nudge the selected piece, and right-click puts a piece back where it started - The threat line and the aggro holder name now move separately - The sample shows the full threat line so it's easier to center - Boxes hide when their piece is turned off or has no text Size and Style - Width, height, and text size for enemy plates, friendly plates, and cast bars - Debuff icon size, font, health text alignment, aggro holder name size - Custom colors for health text, names, cast bars, and the target box - Back to Theme Sizes button Cast bars - Cast bars work without SuperWoW, read from the combat log with cast times for over 1,200 spells (table from ShaguTweaks, MIT License) - Unknown spells learn their cast time once they land - Option to hide cast bars - Neon's spell icon backing is now its own piece Debuffs - Your own debuffs are always shown first - Hide debuffs option and a debuff timers toggle Plates - Option to hide unit levels - "Show critters" is now "Hide critters", and without SuperWoW critters are learned by name - The elite star can be moved Other addons - ShaguTweaks nameplate tweaks are switched off while SHPlates runs (can be turned off on the General tab) Removed - Separate Threat line section and its setting - Short Debuffs and Debuff Tracker checkboxes (replaced by Hide debuffs) README rewritten with an Installation section and a client mod comparison table
159 lines
5.8 KiB
Lua
159 lines
5.8 KiB
Lua
-------------------------------------------------------------------------------
|
|
-- SHPlates: Conflicts
|
|
-- pfUI ships its own nameplates. Two nameplate addons on the same plates fight
|
|
-- (double bars, stolen clicks), so while SHPlates is running, pfUI's nameplate
|
|
-- module is switched off for the session. Nothing is written to pfUI's
|
|
-- settings: disable SHPlates and pfUI's plates are back after a reload.
|
|
--
|
|
-- This mirrors pfUI's own logout teardown: its nameplate frame stops all
|
|
-- events and updates, and every overlay it already built is hidden for good.
|
|
-------------------------------------------------------------------------------
|
|
local C = SHPlates.Compat
|
|
local Cf = {}
|
|
SHPlates.Conflicts = Cf
|
|
|
|
local function Noop() end
|
|
|
|
local function KillFrame(f)
|
|
if not f then return end
|
|
if f.UnregisterAllEvents then f:UnregisterAllEvents() end
|
|
f:SetScript("OnEvent", nil)
|
|
f:SetScript("OnUpdate", nil)
|
|
end
|
|
|
|
local function Enabled()
|
|
return not (SHPlatesDB and SHPlatesDB.hidePfUIPlates == false)
|
|
end
|
|
|
|
-- Hide one pfUI overlay and stop it from ever showing again
|
|
function Cf.ReleasePlate(plate)
|
|
local pf = plate and plate.nameplate
|
|
if not pf or pf.shplatesReleased or not Enabled() then return end
|
|
pf.shplatesReleased = true
|
|
if pf.UnregisterAllEvents then pf:UnregisterAllEvents() end
|
|
pf:SetScript("OnEvent", nil)
|
|
pf:SetScript("OnUpdate", nil)
|
|
pf:SetScript("OnShow", nil)
|
|
pf:EnableMouse(false)
|
|
pf:SetAlpha(0)
|
|
pf:Hide()
|
|
pf.Show = Noop -- pfUI calls plate:Show() when its data changes
|
|
end
|
|
|
|
local announced = false
|
|
function Cf.KillPfUIPlates()
|
|
if not Enabled() then return true end
|
|
local core = getglobal("pfNameplates")
|
|
if not core then return false end
|
|
if core.shplatesKilled then return true end
|
|
core.shplatesKilled = true
|
|
|
|
KillFrame(core)
|
|
KillFrame(core.castbarFrame)
|
|
if core.mouselook then core.mouselook:SetScript("OnUpdate", nil) end
|
|
|
|
-- overlays pfUI already built
|
|
local children = { WorldFrame:GetChildren() }
|
|
for i = 1, table.getn(children) do
|
|
local frame = children[i]
|
|
if frame.nameplate and frame.nameplate.original then Cf.ReleasePlate(frame) end
|
|
end
|
|
|
|
if not announced then
|
|
announced = true
|
|
C.print("pfUI's nameplates are switched off while SHPlates is running.")
|
|
end
|
|
return true
|
|
end
|
|
|
|
-------------------------------------------------------------------------------
|
|
-- ShaguTweaks: its nameplate tweaks (class colors, scale, castbar, dark UI)
|
|
-- all run through one shared scanner, ShaguTweaks.libnameplate. Stopping that
|
|
-- scanner and emptying its callback lists switches every one of them off for
|
|
-- the session, the same way GudaPlates does it. Nothing is saved to
|
|
-- ShaguTweaks' settings.
|
|
-------------------------------------------------------------------------------
|
|
local function ShaguEnabled()
|
|
return not (SHPlatesDB and SHPlatesDB.hideShaguPlates == false)
|
|
end
|
|
|
|
-- "Nameplate Scale" moves the plate's health bar and text into a frame of
|
|
-- its own (plate.new), and "Nameplate Castbar" adds plate.castbar. Put the
|
|
-- plate back the way the client built it so SHPlates can read it.
|
|
function Cf.ReleaseShaguPlate(plate)
|
|
if not plate or plate.shplatesShaguReleased or not ShaguEnabled() then return end
|
|
if not (ShaguTweaks and ShaguTweaks.libnameplate) then return end
|
|
plate.shplatesShaguReleased = true
|
|
local new = plate.new
|
|
if new and new.plate == plate then
|
|
if plate.healthbar and plate.healthbar.SetParent then plate.healthbar:SetParent(plate) end
|
|
local regions = { new:GetRegions() }
|
|
for i = 1, table.getn(regions) do regions[i]:SetParent(plate) end
|
|
new:SetScript("OnShow", nil)
|
|
new:Hide()
|
|
end
|
|
local cb = plate.castbar
|
|
if cb and cb.texture and cb.texture.icon then
|
|
cb:Hide()
|
|
cb.Show = Noop
|
|
end
|
|
end
|
|
|
|
local shaguAnnounced = false
|
|
function Cf.KillShaguPlates()
|
|
if not ShaguEnabled() then return true end
|
|
local lib = ShaguTweaks and ShaguTweaks.libnameplate
|
|
if not lib then return false end
|
|
if lib.shplatesKilled then return true end
|
|
lib.shplatesKilled = true
|
|
lib:SetScript("OnUpdate", nil)
|
|
-- plates it already hooked call these lists every frame: empty them
|
|
if lib.OnInit then C.wipe(lib.OnInit) end
|
|
if lib.OnShow then C.wipe(lib.OnShow) end
|
|
if lib.OnUpdate then C.wipe(lib.OnUpdate) end
|
|
local children = { WorldFrame:GetChildren() }
|
|
for i = 1, table.getn(children) do Cf.ReleaseShaguPlate(children[i]) end
|
|
if not shaguAnnounced then
|
|
shaguAnnounced = true
|
|
C.print("ShaguTweaks' nameplate tweaks are switched off while SHPlates is running.")
|
|
end
|
|
return true
|
|
end
|
|
|
|
local shaguWatch = CreateFrame("Frame")
|
|
shaguWatch:RegisterEvent("ADDON_LOADED")
|
|
shaguWatch:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
shaguWatch:SetScript("OnEvent", function()
|
|
if SHPlates.disabled then return end
|
|
if event == "ADDON_LOADED" and arg1 ~= SHPlates.ADDON and arg1 ~= "ShaguTweaks" then return end
|
|
Cf.KillShaguPlates()
|
|
end)
|
|
|
|
-- pfUI creates its nameplate module when pfUI loads, which can be before or
|
|
-- after SHPlates. Keep looking until it exists (or clearly never will).
|
|
local watcher = CreateFrame("Frame")
|
|
local active, timer, giveUpAt = false, 0, nil
|
|
watcher:RegisterEvent("ADDON_LOADED")
|
|
watcher:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
watcher:SetScript("OnEvent", function()
|
|
if SHPlates.disabled then return end
|
|
if event == "ADDON_LOADED" then
|
|
if arg1 == SHPlates.ADDON or arg1 == "pfUI" then active = true end
|
|
elseif event == "PLAYER_ENTERING_WORLD" then
|
|
active = true
|
|
giveUpAt = GetTime() + 30
|
|
end
|
|
if active and Cf.KillPfUIPlates() then active = false end
|
|
end)
|
|
watcher:SetScript("OnUpdate", function()
|
|
if not active or SHPlates.disabled then return end
|
|
timer = timer + (arg1 or 0)
|
|
if timer < .25 then return end
|
|
timer = 0
|
|
if Cf.KillPfUIPlates() then active = false; return end
|
|
local pfOff = pfUI_config and pfUI_config.disabled and pfUI_config.disabled.nameplates == "1"
|
|
if giveUpAt and GetTime() > giveUpAt and (pfOff or not (IsAddOnLoaded and IsAddOnLoaded("pfUI"))) then
|
|
active = false
|
|
end
|
|
end)
|