mirror of
https://github.com/TheRealFayz/SHPlates.git
synced 2026-11-16 04:20:34 +00:00
GudaPlates and SHPlates both take over the same nameplates, so they can't run together. - If GudaPlates is loaded, SHPlates stays fully off: no plate changes, no threat queries, no pfUI changes - A warning banner across the middle of the screen explains why, with buttons to disable GudaPlates and reload, or dismiss - The warning comes back on every login and reload, and when using /shp or a mark key, until GudaPlates is disabled - An installed but disabled GudaPlates is ignored - Added a note about GudaPlates to the README
52 lines
2.0 KiB
Lua
52 lines
2.0 KiB
Lua
-------------------------------------------------------------------------------
|
|
-- SHPlates: Raid marks with keybinds, also when solo
|
|
-- In a group this is a normal raid mark. Solo, SuperWoW's "local" mark is
|
|
-- used (only you see it) and SHPlates also remembers it by GUID, so the plate
|
|
-- shows it either way. Bind keys under Key Bindings > SHPlates.
|
|
-------------------------------------------------------------------------------
|
|
local C = SHPlates.Compat
|
|
local Marks = {}
|
|
SHPlates.Marks = Marks
|
|
Marks.local_ = {} -- guid -> index (solo marks)
|
|
|
|
BINDING_HEADER_SHPLATES = "SHPlates"
|
|
local NAMES = { "Star", "Circle", "Diamond", "Triangle", "Moon", "Square", "Cross", "Skull" }
|
|
for i = 1, 8 do setglobal("BINDING_NAME_SHPLATES_MARK_" .. i, "Mark target: " .. NAMES[i]) end
|
|
BINDING_NAME_SHPLATES_MARK_0 = "Clear target mark"
|
|
|
|
local function InGroup()
|
|
return UnitInRaid("player") or GetNumPartyMembers() > 0
|
|
end
|
|
|
|
function Marks.Get(guid)
|
|
return guid and Marks.local_[guid]
|
|
end
|
|
|
|
function SHPlates_Mark(index)
|
|
if SHPlates.disabled then if SHPlates.ShowConflictWarning then SHPlates.ShowConflictWarning() end return end
|
|
if not UnitExists("target") then return end
|
|
local guid = C.GUID("target")
|
|
local current = (GetRaidTargetIndex and GetRaidTargetIndex("target")) or Marks.Get(guid) or 0
|
|
if index ~= 0 and current == index then index = 0 end -- pressing it again clears it
|
|
|
|
if InGroup() then
|
|
SetRaidTarget("target", index)
|
|
else
|
|
if C.HasSuperWoW then pcall(SetRaidTarget, "target", index, "local") end
|
|
if guid then
|
|
-- one mark per icon, like real raid marks
|
|
for g, i in pairs(Marks.local_) do if i == index then Marks.local_[g] = nil end end
|
|
if index == 0 then Marks.local_[guid] = nil else Marks.local_[guid] = index end
|
|
end
|
|
end
|
|
SHPlates:Update()
|
|
end
|
|
|
|
local f = CreateFrame("Frame")
|
|
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
pcall(f.RegisterEvent, f, "UNIT_DIED")
|
|
f:SetScript("OnEvent", function()
|
|
if event == "PLAYER_ENTERING_WORLD" then C.wipe(Marks.local_)
|
|
elseif arg1 then Marks.local_[arg1] = nil end
|
|
end)
|