local mod	= DBM:NewMod(2129, "DBM-Party-BfA", 10, 1001)
local L		= mod:GetLocalizedStrings()

mod:SetRevision(("$Revision: 17468 $"):sub(12, -3))
mod:SetCreatureID(131864)
mod:SetEncounterID(2117)
mod:SetZone()

mod:RegisterCombat("combat")

mod:RegisterEventsInCombat(
--	"SPELL_AURA_APPLIED",
	"SPELL_CAST_START 266225 266266 266181",
	"CHAT_MSG_MONSTER_YELL"
)

--TODO, re-transcribe fight to see what UNIT events exist so maybe yell isn't needed
--TODO, verify iffy timers from such a short short pull
--TODO, heroic stuff (grim portal, dread lense). Too many spellIds to just guess/drycode
local warnAlchFire					= mod:NewSpellAnnounce(266198, 1)

local specWarnSummonSlaver			= mod:NewSpecialWarningSwitch(266266, "-Healer", nil, nil, 1, 2)
local specWarnDreadEssence			= mod:NewSpecialWarningSpell(266181, nil, nil, nil, 2, 2)
--local yellSwirlingScythe			= mod:NewYell(195254)
--local specWarnGTFO				= mod:NewSpecialWarningGTFO(238028, nil, nil, nil, 1, 2)

local timerDarkenedLightningCD		= mod:NewCDTimer(14.5, 266225, nil, nil, nil, 3)--Has interrupt spell icon but it's not actually interruptable
local timerSummonSlaverCD			= mod:NewCDTimer(29.1, 266266, nil, nil, nil, 1)
local timerDreadEssenceCD			= mod:NewCDTimer(29.1, 266181, nil, nil, nil, 2)

mod:AddRangeFrameOption(6, 266225)--Range guessed, can't find spell data for it

function mod:OnCombatStart(delay)
	timerDarkenedLightningCD:Start(16.5-delay)
	timerSummonSlaverCD:Start(21.4-delay)
	timerDreadEssenceCD:Start(34.7-delay)
	if self.Options.RangeFrame then
		DBM.RangeCheck:Show(6)
	end
end

function mod:OnCombatEnd()
	if self.Options.RangeFrame then
		DBM.RangeCheck:Hide()
	end
end

--[[
function mod:SPELL_AURA_APPLIED(args)
	local spellId = args.spellId
	if spellId == 194966 then
	
	end
end
--mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
--]]

function mod:SPELL_CAST_START(args)
	local spellId = args.spellId
	if spellId == 266225 then
		timerDarkenedLightningCD:Start()
	elseif spellId == 266266 then
		specWarnSummonSlaver:Show()
		specWarnSummonSlaver:Play("killmob")
		timerSummonSlaverCD:Start()
	elseif spellId == 266181 then
		specWarnDreadEssence:Show()
		specWarnDreadEssence:Play("aesoon")
		--timerDreadEssenceCD:Start()
	end
end

function mod:CHAT_MSG_MONSTER_YELL(msg, npc, _, _, target)
	if (msg == L.fireYell or msg:find(L.fireYell)) then
		self:SendSync("FireSpawn")
	end
end

function mod:OnSync(msg, targetname)
	if msg == "FireSpawn" and self:AntiSpam(10, 6) then
		warnAlchFire:Show()
	end
end

--[[
function mod:SPELL_PERIODIC_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
	if spellId == 228007 and destGUID == UnitGUID("player") and self:AntiSpam(2, 4) then
		specWarnGTFO:Show()
		specWarnGTFO:Play("runaway")
	end
end
mod.SPELL_PERIODIC_MISSED = mod.SPELL_PERIODIC_DAMAGE

function mod:UNIT_DIED(args)
	local cid = self:GetCIDFromGUID(args.destGUID)
	if cid == 124396 then
		
	end
end

function mod:UNIT_SPELLCAST_SUCCEEDED(uId, _, spellId)
	if spellId == 257939 then
	end
end
--]]
