W.CanLead (Core.lua) decides who speaks for a raid: the raid leader and assistants. Outside a raid, anyone may. - W:Send, the one place WhoDidIt posts from, sends anyone else's posts to their own chat and says why once per session. - W:ConfirmSend checks before showing the "Post?" box. - Claims for automatic posts (banter, rival watch) only count leaders. - Another marker's hound-skull message only counts from someone who can mark. - The loaders wrap DopingControl's "Send to raid chat" and its whispers, and RollFor's raid announcements (the master looter may still use those), without changing their files. - RollForML's "Post how to roll" follows the same rule. The master feed is only taken from the maintainer's built-in master characters. /wdi master add can only re-trust one of those after a remove; nobody else can be added any more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.7 KiB
Lua
62 lines
2.7 KiB
Lua
--[[--------------------------------------------------------------------
|
|
WhoDidIt - built-in DopingControl
|
|
|
|
WhoDidIt carries its own copy of DopingControl, the raid consumables,
|
|
class buffs, debuffs, resistances, hit and enchant checker by ShempError
|
|
(MIT licence). It lives in the DopingControl\ folder and ships with
|
|
WhoDidIt, at the commit in DopingControl\wdi_version.lua (from
|
|
github.com/ShempError/DopingControl, its LICENSE kept). Its window opens
|
|
from the Consumes tab ("Open DopingControl") or with /dc.
|
|
|
|
tools\EmbedUpdate.ps1 (maintainer) makes small changes so it runs from inside WhoDidIt: its
|
|
version comes from DopingControl\wdi_version.lua, its images are found
|
|
in this folder, it starts on WhoDidIt's ADDON_LOADED, and each file
|
|
starts with "if WDI_DOPING_SKIP then return end".
|
|
|
|
If the separate DopingControl addon is switched on, it has already loaded
|
|
by now (it's an optional dependency), so the built-in copy stands down
|
|
and WhoDidIt asks once whether to switch the separate one off.
|
|
----------------------------------------------------------------------]]
|
|
|
|
WDI_DOPING_SKIP = IsAddOnLoaded("DopingControl") and true or nil
|
|
|
|
-- the version its options window shows
|
|
function WDI_DopingVersion()
|
|
return WDI_DOPING_VERSION or ""
|
|
end
|
|
|
|
-- Both declare DopingControlDB (that's how settings move to the built-in
|
|
-- copy), so WhoDidIt's saved copy would replace the separate addon's table
|
|
-- while it's running. Give it its own table back once WhoDidIt has loaded.
|
|
local standaloneDB = WDI_DOPING_SKIP and DopingControlDB
|
|
local f = CreateFrame("Frame")
|
|
f:RegisterEvent("ADDON_LOADED")
|
|
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
f:SetScript("OnEvent", function()
|
|
if event == "ADDON_LOADED" then
|
|
if arg1 ~= "WhoDidIt" then return end
|
|
if standaloneDB then DopingControlDB = standaloneDB end
|
|
return
|
|
end
|
|
this:UnregisterAllEvents()
|
|
-- in a raid its "Send to raid chat" and its whispers are for the raid leader
|
|
-- and assistants (WhoDidIt.CanLead), like everything WhoDidIt posts
|
|
if not WDI_DOPING_SKIP and WhoDidIt.CanLead then
|
|
if DC_Report and DC_Report.SendDisabled then
|
|
local sendOff = DC_Report.SendDisabled
|
|
DC_Report.SendDisabled = function(source) return sendOff(source) or not WhoDidIt.CanLead() end
|
|
end
|
|
if DC_Matrix and DC_Matrix.CanWhisper then
|
|
local canWhisper = DC_Matrix.CanWhisper
|
|
DC_Matrix.CanWhisper = function(row, now, last)
|
|
if not WhoDidIt.CanLead() then WhoDidIt.LeadOnly(); return false, nil end
|
|
return canWhisper(row, now, last)
|
|
end
|
|
end
|
|
end
|
|
-- only offer to switch it off when the built-in copy is really there
|
|
if WDI_DOPING_SKIP and WDI_DOPING_VERSION and WhoDidIt.AskHandover then
|
|
WhoDidIt:AskHandover("DopingControl", "DopingControl (Full check on the Consumes tab)")
|
|
end
|
|
end)
|