All pastes #2101994 Raw Edit

forbury

public lua v1 · immutable
#2101994 ·published 2012-01-10 20:57 UTC
rendered paste body
local mod	= DBM:NewMod(318, "DBM-DragonSoul", nil, 187)local L		= mod:GetLocalizedStrings()mod:SetRevision(("$Revision: 7018 $"):sub(12, -3))mod:SetCreatureID(53879)mod:SetModelID(35268)mod:SetZone()mod:SetUsedIcons(6, 5, 4, 3, 2, 1)mod:RegisterCombat("yell", L.Pull)--Engage trigger comes 30 seconds after encounter starts, because of this, the mod can miss the first round of ability casts such as first grip targets. have to use yellmod:RegisterEventsInCombat(	"SPELL_CAST_START",	"SPELL_AURA_APPLIED",	"SPELL_AURA_APPLIED_DOSE",	"SPELL_AURA_REMOVED",	"SPELL_HEAL",	"SPELL_PERIODIC_HEAL",	"RAID_BOSS_EMOTE",	"UNIT_DIED")local warnAbsorbedBlood		= mod:NewStackAnnounce(105248, 2)local warnGrip				= mod:NewTargetAnnounce(109459, 4)local warnNuclearBlast		= mod:NewCastAnnounce(105845, 4)local warnSealArmor			= mod:NewCastAnnounce(105847, 4)--Cast by Burning Tendons when they spawn after you break a platelocal specWarnTendril		= mod:NewSpecialWarning("SpecWarnTendril")local specWarnGrip			= mod:NewSpecialWarningSpell(109459, mod:IsDps())local specWarnNuclearBlast	= mod:NewSpecialWarningRun(105845, mod:IsMelee())local specWarnSealArmor		= mod:NewSpecialWarningSpell(105847, mod:IsDps())local timerSealArmor		= mod:NewCastTimer(23, 105847)local timerBarrelRoll		= mod:NewCastTimer(5, "ej4050")local timerGripCD			= mod:NewCDTimer(32, 109457)local soundNuclearBlast		= mod:NewSound(105845, nil, mod:IsMelee())mod:AddBoolOption("InfoFrame", true)mod:AddBoolOption("SetIconOnGrip", true)mod:AddBoolOption("ShowShieldInfo", true)local gripTargets = {}local gripIcon = 6local corruptionActive = {}local function checkTendrils()	if not UnitDebuff("player", GetSpellInfo(109454)) and not UnitIsDeadOrGhost("player") then		specWarnTendril:Show()	end	if mod.Options.InfoFrame and not DBM.InfoFrame:IsShown() then		DBM.InfoFrame:SetHeader(L.NoDebuff:format(GetSpellInfo(109454)))		DBM.InfoFrame:Show(5, "playergooddebuff", 109454)	endendlocal function clearTendrils()	if mod.Options.InfoFrame then		DBM.InfoFrame:Hide()	endendlocal function showGripWarning()	warnGrip:Show(table.concat(gripTargets, "<, >"))	specWarnGrip:Show()	table.wipe(gripTargets)end--This wasn't working right on 25 man at all, i think more then one went out at a time, and it spam changed name, it didn't want to add more then 1 name to frame at a time so instead it kept replacing the frame, alli saw was about 6 names flash by within 1 second.local clearPlasmaTarget, setPlasmaTargetdo	local plasmaTargets = {}	local healed = {}		function mod:SPELL_HEAL(args)		if plasmaTargets[args.destGUID] then			healed[args.destGUID] = healed[args.destGUID] + (args.absorbed or 0)		end	end	mod.SPELL_PERIODIC_HEAL = mod.SPELL_HEAL	local function updatePlasmaTargets()		local maxAbsorb =	mod:IsDifficulty("heroic25") and 420000 or							mod:IsDifficulty("heroic10") and 280000 or							mod:IsDifficulty("normal25") and 300000 or							mod:IsDifficulty("normal10") and 200000 or 1		DBM.BossHealth:Clear()		if not DBM.BossHealth:IsShown() then			DBM.BossHealth:Show(L.name)		end		for i,v in pairs(plasmaTargets) do			DBM.BossHealth:AddBoss(function() return math.max(1, math.floor((healed[i] or 0) / maxAbsorb * 100))	end, L.PlasmaTarget:format(v))		end	end	function setPlasmaTarget(guid, name)		plasmaTargets[guid] = name		healed[guid] = 0		updatePlasmaTargets()	end	function clearPlasmaTarget(guid, name)		plasmaTargets[guid] = nil		healed[guid] = nil		updatePlasmaTargets()	endendfunction mod:OnCombatStart(delay)	if self:IsDifficulty("lfr25") then		warnSealArmor = mod:NewCastAnnounce(105847, 4, 34.5)	else		warnSealArmor = mod:NewCastAnnounce(105847, 4)	end	table.wipe(gripTargets)	table.wipe(corruptionActive)	gripIcon = 6endfunction mod:OnCombatEnd()	if self.Options.InfoFrame then		DBM.InfoFrame:Hide()	endendfunction mod:SPELL_CAST_START(args)	if args:IsSpellID(105845) and args.sourceGUID == UnitGUID("target") then--Only warn if it's your target, if it isn't you're probably not by the one exploding.		warnNuclearBlast:Show()		specWarnNuclearBlast:Show()		soundNuclearBlast:Play()	elseif args:IsSpellID(105847, 105848) then -- sometimes spellid 105848, maybe related to positions?		warnSealArmor:Show()		specWarnSealArmor:Show()		if self:IsDifficulty("lfr25") then			timerSealArmor:Start(34.5)		else			timerSealArmor:Start()		end	elseif args:IsSpellID(109379) then -- plasma spell cast start id. may be same all difficulties?		if not corruptionActive[args.sourceGUID] then			corruptionActive[args.sourceGUID] = true			if self:IsDifficulty("normal25", "heroic25") then -- confirmed by kin raiders. always use grip after 2 times of plasma cast (8 sec x 2).				timerGripCD:Start(16, args.sourceGUID)			else -- for my 10 man log. after 4 times of plasma cast (8 sec x 4).				timerGripCD:Start(nil, args.sourceGUID)			end		end	end	elseif args:IsSpellID(105219, 109371, 109372, 109373) then		blooddead = blooddead+1		BloodWarning:Show(blooddead)		SendChatMessage("Corrupted Blood killed: ("..blooddead..")","RAID",nil) --just posted 		end		if blooddead == 9 then			blooddead = 0		end	end	  endfunction mod:SPELL_AURA_APPLIED(args)	if args:IsSpellID(105248) then		warnAbsorbedBlood:Show(args.destName, args.amount or 1)	elseif args:IsSpellID(105490, 109457, 109458, 109459) then--This ability is not used in LFR, so if you add a CD bar for this, make sure you exclude LFR.		gripTargets[#gripTargets + 1] = args.destName		timerGripCD:Cancel(args.sourceGUID)		if corruptionActive[args.sourceGUID] then			corruptionActive[args.sourceGUID] = nil		end		if self.Options.SetIconOnGrip then			if gripIcon == 0 then				gripIcon = 6			end			self:SetIcon(args.destName, gripIcon)			gripIcon = gripIcon - 1		end		self:Unschedule(showGripWarning)		self:Schedule(0.3, showGripWarning)	elseif args:IsSpellID(105479, 109362, 109363, 109364) then -- 105479 in 10 man. otherid is drycoded.		if self.Options.ShowShieldInfo then			setPlasmaTarget(args.destGUID, args.destName)		end	endend		mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIEDfunction mod:SPELL_AURA_REMOVED(args)	if args:IsSpellID(105490, 109457, 109458, 109459) then		if self.Options.SetIconOnGrip then			self:SetIcon(args.destName, 0)		end	elseif args:IsSpellID(105479, 109362, 109363, 109364) then -- 105479 in 10 man. otherid is drycoded.		if self.Options.ShowShieldInfo then			clearPlasmaTarget(args.destGUID, args.destName)		end	endend	function mod:RAID_BOSS_EMOTE(msg)	if msg == L.DRoll or msg:find(L.DRoll) then		self:Unschedule(checkTendrils)--In case you manage to spam spin him, we don't want to get a bunch of extra stuff scheduled.		self:Unschedule(clearTendrils)--^		checkTendrils()--Warn you right away.		self:Schedule(3, checkTendrils)--Check a second time 3 seconds into 5 second cast to remind player		self:Schedule(8, clearTendrils)--Clearing 3 seconds after the roll should be sufficent		timerBarrelRoll:Start()	elseif msg == L.DLevels or msg:find(L.DLevels) then		self:Unschedule(checkTendrils)		self:Unschedule(clearTendrils)		clearTendrils()		timerBarrelRoll:Cancel()	endendfunction mod:UNIT_DIED(args)	local cid = self:GetCIDFromGUID(args.destGUID)	if cid == 53891 or cid == 56162 or cid == 56161 then		timerGripCD:Cancel(args.sourceGUID)	elseif cid == 56341 or cid == 56575 then		timerSealArmor:Cancel()	endend