-- RealNibba's Raid Tools - Queue.lua
-- Sends queued raid messages with a gap to avoid spam filter.
-- Modelled on working BiSRaid queue.

BiSRaidQueue = {}
local qTimer = 0

local f = CreateFrame("Frame")
function BiSRaid_AddQueue(m)
    table.insert(BiSRaidQueue, m)
end

f:SetScript("OnUpdate", function(_, elapsed)
    qTimer = qTimer + elapsed
    if qTimer < 0.6 then return end
    qTimer = 0
    if table.getn(BiSRaidQueue) > 0 then
        local msg = table.remove(BiSRaidQueue, 1)
        if GetNumRaidMembers() > 0 then
            SendChatMessage(msg, "RAID")
        else
            -- Solo testing: print to chat instead
            DEFAULT_CHAT_FRAME:AddMessage("|cffFFD100[RNTools Test]|r " .. msg)
        end
    end
end)
