Files
Fayz d6cd5cec9b Settings rebuild, Designer, per-template settings, and casts without SuperWoW
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
2026-10-27 16:25:41 -05:00

125 lines
4.0 KiB
Lua

-------------------------------------------------------------------------------
-- SHPlates: Compat
-- Namespaces, client detection (SuperWoW / Nampower) and small helpers that
-- replace 3.3.5 conveniences missing from the 1.12 client (Lua 5.0).
-------------------------------------------------------------------------------
SHPlates = {}
SHPlatesUtility = {}
SHPlatesWidgets = {}
if not SHPlatesThemeList then SHPlatesThemeList = {} end
SHPlates.ADDON = "SHPlates"
SHPlates.MEDIA = "Interface\\AddOns\\SHPlates\\Media\\"
SHPlates.ART = "Interface\\AddOns\\SHPlates\\Art\\"
local C = {}
SHPlates.Compat = C
-- GudaPlates and SHPlates both take over the same Blizzard nameplates, so
-- only one can run. Addons load alphabetically, so GudaPlates is usually
-- already loaded here; Guard.lua also catches it if it loads later.
SHPlates.disabled = (IsAddOnLoaded and IsAddOnLoaded("GudaPlates")) and true or false
-- SuperWoW: GUIDs on nameplates, GUIDs as unit tokens, UNIT_CASTEVENT, SpellInfo
C.HasSuperWoW = (SUPERWOW_VERSION ~= nil) or (SpellInfo ~= nil)
-- Nampower: aura cast events with durations, spell records
C.HasNampower = (GetNampowerVersion ~= nil)
-- wipe(): empties a table in place
function C.wipe(t)
for k in pairs(t) do t[k] = nil end
return t
end
-- print(): 1.12 has no print
function C.print(msg)
if DEFAULT_CHAT_FRAME then
DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99SHPlates|r: " .. tostring(msg))
end
end
-- InCombat(): stands in for InCombatLockdown(). Deliberately NOT a global,
-- since other addons test for InCombatLockdown to detect the client version.
function C.InCombat()
if UnitAffectingCombat("player") then return true end
return false
end
-- GUID(unit): SuperWoW returns the GUID as the second value of UnitExists
function C.GUID(unitid)
if not C.HasSuperWoW then return nil end
local exists, guid = UnitExists(unitid)
if exists and guid and guid ~= "" then return guid end
return nil
end
-- PlateGUID(frame): SuperWoW returns the GUID of a nameplate with GetName(1)
-- When the client recycles a plate for another unit, GetName(1) can still
-- hand back the previous unit's GUID for a moment. If the GUID's name doesn't
-- match the name on the plate, it's stale: ignore it until it catches up.
function C.PlateGUID(plate, plateName)
if not C.HasSuperWoW then return nil end
-- the designer's sample plate isn't a real one: SuperWoW has no unit for it
if plate.shpPreview then return nil end
local guid = plate:GetName(1)
if not guid or guid == "" or guid == "0x0000000000000000" then return nil end
if plateName then
local name = UnitName(guid)
if not name or name ~= plateName then return nil end
end
return guid
end
-- Safe CVar helpers (unknown CVars throw errors in 1.12)
function C.GetCVarSafe(name)
local ok, value = pcall(GetCVar, name)
if ok then return value end
return nil
end
function C.SetCVarSafe(name, value)
local ok = pcall(SetCVar, name, value)
return ok
end
-- Hook a script without replacing it (no HookScript in 1.12).
-- Handlers in 1.12 read 'this' and 'arg1..' globals, which stay intact here.
function C.HookScript(frame, script, func)
local original = frame:GetScript(script)
frame:SetScript(script, function()
if original then original() end
func()
end)
end
-- Spell name/icon lookup by spell ID
local QUESTION = "Interface\\Icons\\INV_Misc_QuestionMark"
function C.SpellNameIcon(spellId)
if not spellId then return nil, QUESTION end
if SpellInfo then
local name, _, icon = SpellInfo(spellId)
return name, icon or QUESTION
end
if GetSpellNameAndRankForId then
local name = GetSpellNameAndRankForId(spellId)
return name, QUESTION
end
return nil, QUESTION
end
-- Splits text into lines, ignoring blanks
function C.Lines(text)
local t = {}
if not text then return t end
for line in string.gfind(text, "[^\r\n]+") do
line = string.gsub(line, "^%s+", "")
line = string.gsub(line, "%s+$", "")
if line ~= "" then table.insert(t, line) end
end
return t
end
SHPlates.InCombat = C.InCombat
SHPlates.Print = C.print