Advertisement
Guest User

Untitled

a guest
Nov 12th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.43 KB | None | 0 0
  1. local mod   = DBM:NewMod(737, "DBM-HeartofFear", nil, 330)
  2. local L     = mod:GetLocalizedStrings()
  3.  
  4. mod:SetRevision(("$Revision: 8099 $"):sub(12, -3))
  5. mod:SetCreatureID(62511)
  6. mod:SetModelID(43126)
  7. mod:SetZone()
  8. mod:SetMinSyncRevision(8052)
  9.  
  10. mod:RegisterCombat("combat")
  11.  
  12. mod:RegisterEventsInCombat(
  13.     "SPELL_AURA_APPLIED",
  14.     "SPELL_AURA_APPLIED_DOSE",
  15.     "SPELL_AURA_REMOVED",
  16.     "SPELL_CAST_START",
  17.     "SPELL_CAST_SUCCESS",
  18.     "SPELL_DAMAGE",
  19.     "SPELL_MISSED",
  20.     "UNIT_POWER"
  21. )
  22.  
  23. --[[WoL Reg Expression
  24. (spellid = 45477 or spellid = 122540 or spellid = 122532 or spellid = 122348) and fulltype = SPELL_CAST_SUCCESS or (spellid =122784 or spellid =121949 or spellid = 122395 or spellid = 121994) and fulltype = SPELL_AURA_APPLIED or (spellid =122370 or spellid = 122540 or spellid = 122395 or spellid = 121994) and fulltype = SPELL_AURA_REMOVED or (spellid = 122408 or spellid = 122413 or spellid = 122398 or spellid = 122540 or spellid = 122402) and fulltype = SPELL_CAST_START or fulltype = UNIT_DIED and (targetname = "Omegal" or targetname = "Shiramune")
  25. (spellid = 45477 or spellid = 122540) and fulltype = SPELL_CAST_SUCCESS or (spellid =122784 or spellid =121949 or spellid = 122395 or spellid = 121994) and fulltype = SPELL_AURA_APPLIED or (spellid =122370 or spellid = 122540 or spellid = 122395 or spellid = 121994) and fulltype = SPELL_AURA_REMOVED or (spellid = 122408 or spellid = 122413 or spellid = 122398 or spellid = 122540 or spellid = 122402) and fulltype = SPELL_CAST_START or fulltype = UNIT_DIED and (targetname = "Omegal" or targetname = "Shiramune")
  26. --]]
  27. --Boss
  28. local warnReshapeLifeTutor      = mod:NewAnnounce("warnReshapeLifeTutor", 1, 122784)--Another LFR focused warning really.
  29. local warnReshapeLife           = mod:NewTargetAnnounce(122784, 4)
  30. local warnAmberScalpel          = mod:NewTargetAnnounce(121994, 3)
  31. local warnParasiticGrowth       = mod:NewTargetAnnounce(121949, 4, nil, mod:IsHealer())
  32. --Construct
  33. local warnAmberExplosion        = mod:NewAnnounce("warnAmberExplosion", 3, 122398, false)--In case you want to get warned for all of them, but could be spammy later fight so off by default. This announce includes source of cast.
  34. local warnStruggleForControl    = mod:NewTargetAnnounce(122395, 2)--Disabled in phase 3 as at that point it's just a burn.
  35. local warnDestabalize           = mod:NewStackAnnounce(123059, 1, nil, false)--This can be super spammy so off by default.
  36. --Living Amber
  37. local warnLivingAmber           = mod:NewSpellAnnounce("ej6261", 2, nil, false)--122348 is what you check spawns with. ALso spamming and off by default
  38. local warnBurningAmber          = mod:NewCountAnnounce("ej6567", 2, nil, false)--Keep track of Burning Amber Puddles. Spammy, but nessesary for heroic for someone managing them.
  39. --Amber Monstrosity
  40. local warnAmberCarapace         = mod:NewTargetAnnounce(122540, 4)--Monstrosity Shielding Boss (phase 2 start)
  41. local warnMassiveStomp          = mod:NewCastAnnounce(122408, 3)
  42. local warnAmberExplosionSoon    = mod:NewPreWarnAnnounce(122402, 10, 3)
  43. local warnFling                 = mod:NewSpellAnnounce(122413, 3)--think this always does his aggro target but not sure. If it does random targets it will need target scanning.
  44. local warnInterruptsAvailable   = mod:NewAnnounce("warnInterruptsAvailable", 1, 122398)
  45.  
  46. --Boss
  47. local specwarnAmberScalpel          = mod:NewSpecialWarningYou(121994)
  48. local yellAmberScalpel              = mod:NewYell(121994)
  49. local specwarnAmberScalpelNear      = mod:NewSpecialWarningClose(121994)
  50. local specwarnReshape               = mod:NewSpecialWarningYou(122784)
  51. local specwarnParasiticGrowth       = mod:NewSpecialWarningTarget(121949, mod:IsHealer())
  52. local specwarnParasiticGrowthYou    = mod:NewSpecialWarningYou(121949) -- This warn will be needed at player is clustered together. Especially on Phase 3.
  53. --Construct
  54. local specwarnAmberExplosionYou     = mod:NewSpecialWarning("specwarnAmberExplosionYou")--Only interruptable by the player controling construct casting, so only that person gets warning. non generic used to make this one more specific.
  55. local specwarnAmberExplosionAM      = mod:NewSpecialWarning("specwarnAmberExplosionAM")--Must be on by default. Amber montrosity's MUST be interrupted on heroic or it's an auto wipe. it hits for over 500k.
  56. local specwarnAmberExplosionOther   = mod:NewSpecialWarning("specwarnAmberExplosionOther", false)--A compromise. loose non player controled constructs now off by default but should still be an option as they are still perfectly interruptable (and should be)
  57. local specwarnAmberExplosion        = mod:NewSpecialWarningTarget(122398, nil, nil, nil, true)--One you can't interrupt it
  58. local specwarnWillPower             = mod:NewSpecialWarning("specwarnWillPower")--Special warning for when your will power is low (construct)
  59. --local specwarnBossDebuff          = mod:NewSpecialWarning("specwarnBossDebuff")--Some special warning that says "get your ass to boss and refresh debuff NOW" (Debuff stacks up to 255 with 10% damage taken increase every stack, keeping buff up and stacking is paramount to dps check on heroic)
  60. --Living Amber
  61. local specwarnBurningAmber      = mod:NewSpecialWarningMove(122504)--Standing in a puddle
  62. --Amber Monstrosity
  63. local specwarnAmberMonstrosity  = mod:NewSpecialWarningSwitch("ej6254", not mod:IsHealer())
  64. local specwarnFling             = mod:NewSpecialWarningSpell(122413, mod:IsTank())
  65. local specwarnMassiveStomp      = mod:NewSpecialWarningSpell(122408, nil, nil, nil, true)
  66.  
  67. --Boss
  68. local timerReshapeLifeCD        = mod:NewNextTimer(50, 122784)--50 second cd in phase 1-2, 15 second in phase 3. if no construct is up, cd is ignored and boss casts it anyways to make sure 1 is always up.
  69. local timerAmberScalpelCD       = mod:NewCDTimer(40, 121994)--40 seconds after last one ENDED
  70. local timerAmberScalpel         = mod:NewBuffActiveTimer(10, 121994)
  71. local timerParasiticGrowthCD    = mod:NewCDTimer(35, 121949, nil, mod:IsHealer())--35-50 variation (most of the time 50, rare pulls he decides to use 35 sec cd instead)
  72. local timerParasiticGrowth      = mod:NewTargetTimer(30, 121949, nil, mod:IsHealer())
  73. --Construct
  74. local timerAmberExplosionCD     = mod:NewNextSourceTimer(13, 122398)--13 second cd on player controled units, 18 seconds on non player controlled constructs
  75. local timerDestabalize          = mod:NewTargetTimer(10, 123059)
  76. local timerStruggleForControl   = mod:NewTargetTimer(5, 122395)
  77. --Amber Monstrosity
  78. local timerMassiveStompCD       = mod:NewCDTimer(18, 122408)--18-25 seconds variation
  79. local timerFlingCD              = mod:NewCDTimer(25, 122413)--25-40sec variation.
  80. local timerAmberExplosionAMCD   = mod:NewTimer(46, "timerAmberExplosionAMCD", 122402)--Special timer just for amber monstrosity. easier to cancel, easier to tell apart. His bar is the MOST important and needs to be seperate from any other bar option.
  81.  
  82. local countdownAmberExplosion   = mod:NewCountdown(49, 122398)
  83.  
  84. mod:AddBoolOption("InfoFrame", true)
  85. mod:AddBoolOption("FixNameplates", false)--Because having 215937495273598637205175t9 hostile nameplates on screen when you enter a construct is not cool.
  86.  
  87. local Phase = 1
  88. local Puddles = 0
  89. local Constructs = 0
  90. local playerIsConstruct = false
  91. local warnedWill = false
  92. local lastStrike = 0
  93. local scansDone = 0
  94. local Totems = nil
  95. local Guardians = nil
  96. local Pets = nil
  97. local TPTPNormal = nil
  98. local amberExplosion = GetSpellInfo(122402)
  99. local Monstrosity = EJ_GetSectionInfo(6254)
  100. local MutatedConstruct = EJ_GetSectionInfo(6249)
  101. local canInterrupt = {}
  102. local guids = {}
  103. local guidTableBuilt = false--Entirely for DCs, so we don't need to reset between pulls cause it doesn't effect building table on combat start and after a DC then it will be reset to false always
  104. local function buildGuidTable()
  105.     table.wipe(guids)
  106.     for i = 1, DBM:GetGroupMembers() do
  107.         guids[UnitGUID("raid"..i) or "none"] = GetRaidRosterInfo(i)
  108.     end
  109. end
  110.  
  111. function mod:ScalpelTarget()
  112.     scansDone = scansDone + 1
  113.     local targetname = DBM:GetUnitFullName("boss1targettarget")--Not a mistake, just clever use of available api to get the target of an invisible mob the boss is targeting ;)
  114.     if UnitExists("boss1targettarget") and not UnitIsUnit("boss1", "boss1targettarget") then
  115.         warnAmberScalpel:Show(targetname)
  116.         if targetname == UnitName("player") then
  117.             specwarnAmberScalpel:Show()
  118.             yellAmberScalpel:Yell()
  119.         else
  120.             local uId = DBM:GetRaidUnitId(targetname)
  121.             if uId then
  122.                 local x, y = GetPlayerMapPosition(uId)
  123.                 if x == 0 and y == 0 then
  124.                     SetMapToCurrentZone()
  125.                     x, y = GetPlayerMapPosition(uId)
  126.                 end
  127.                 local inRange = DBM.RangeCheck:GetDistance("player", x, y)
  128.                 if inRange and inRange < 5 then--Guessed range
  129.                     specwarnAmberScalpelNear:Show(targetname)
  130.                 end
  131.             end
  132.         end
  133.     else--He failed sanity check (ie boss1targettarget was himself, so he was obviously still targeting tank, reschedule check)
  134.         if scansDone < 6 then
  135.             self:ScheduleMethod(0.2, "ScalpelTarget")
  136.         end
  137.     end
  138. end
  139.  
  140. function mod:OnCombatStart(delay)
  141.     warnedWill = true--avoid wierd bug on pull
  142.     buildGuidTable()
  143.     Phase = 1
  144.     Puddles = 0
  145.     Constructs = 0
  146.     lastStrike = 0
  147.     table.wipe(canInterrupt)
  148.     playerIsConstruct = false
  149.     timerAmberScalpelCD:Start(9-delay)
  150.     timerReshapeLifeCD:Start(20-delay)
  151.     timerParasiticGrowthCD:Start(23.5-delay)
  152.     if self.Options.InfoFrame then
  153.         DBM.InfoFrame:SetHeader(L.WillPower)--This is a work in progress
  154.         DBM.InfoFrame:Show(5, "playerpower", 1, ALTERNATE_POWER_INDEX, nil, nil, true)--At a point i need to add an arg that lets info frame show the 5 LOWEST not the 5 highest, instead of just showing 10
  155.     end
  156.     if self.Options.FixNameplates then
  157.         --Blizz settings either return 1 or nil, we pull users original settings first, then change em if appropriate after.
  158.         Totems = GetCVarBool("nameplateShowEnemyTotems")
  159.         Guardians = GetCVarBool("nameplateShowEnemyGuardians")
  160.         Pets = GetCVarBool("nameplateShowEnemyPets")
  161.         --Now change all settings to make the nameplates while in constructs not terrible.
  162.         if Totems then
  163.             SetCVar("nameplateShowEnemyTotems", 0)
  164.         elseif Guardians then
  165.             SetCVar("nameplateShowEnemyGuardians", 0)
  166.         elseif Pets then
  167.             SetCVar("nameplateShowEnemyPets", 0)
  168.         end
  169.         --Check for Tidy plates threat plates (it has additional options to even further hide worthless nameplates on unsok.
  170.         if IsAddOnLoaded("TidyPlates_ThreatPlates") then
  171.             TidyPlatesNormal = TidyPlatesThreat.db.profile.nameplate.toggle["Normal"]--Returns true or false, use TidyPlatesNormal to save that value on pull
  172.             if TPTPNormal == true then
  173.                 TidyPlatesThreat.db.profile.nameplate.toggle["Normal"] = false
  174.                 TidyPlates:ReloadTheme()--Call the Tidy plates update methods
  175.                 TidyPlates:ForceUpdate()
  176.             end
  177.         end
  178.     end
  179. end
  180.  
  181. function mod:OnCombatEnd()
  182.     if self.Options.InfoFrame then
  183.         DBM.InfoFrame:Hide()
  184.     end
  185.     if self.Options.FixNameplates then
  186.         --if any of settings were on before pull, we put them back to way they were.
  187.         if Totems then
  188.             SetCVar("nameplateShowEnemyTotems", 1)
  189.         elseif Guardians then
  190.             SetCVar("nameplateShowEnemyGuardians", 1)
  191.         elseif Pets then
  192.             SetCVar("nameplateShowEnemyPets", 1)
  193.         end
  194.         if IsAddOnLoaded("TidyPlates_ThreatPlates") then
  195.             if TPTPNormal == true and not TidyPlatesThreat.db.profile.nameplate.toggle["Normal"] then--Normal plates were on when we pulled but aren't on now.
  196.                 TidyPlatesThreat.db.profile.nameplate.toggle["Normal"] = true--Turn them back on
  197.                 TidyPlates:ReloadTheme()--Call the Tidy plates update methods
  198.                 TidyPlates:ForceUpdate()
  199.             end
  200.         end
  201.     end
  202. end
  203.  
  204. function mod:SPELL_AURA_APPLIED(args)
  205.     if args:IsSpellID(123059) and not args:GetDestCreatureID() == 62691 then--Only track debuffs on boss, constructs, or monstrosity, ignore oozes.
  206.         warnDestabalize:Show(args.destName, args.amount or 1)
  207.         timerDestabalize:Start(args.destName)
  208.     elseif args:IsSpellID(121949) then
  209.         warnParasiticGrowth:Show(args.destName)
  210.         specwarnParasiticGrowth:Show(args.destName)
  211.         if args:IsPlayer() then
  212.             specwarnParasiticGrowthYou:Show()
  213.         end
  214.         timerParasiticGrowth:Start(args.destName)
  215.         timerParasiticGrowthCD:Start()
  216.     elseif args:IsSpellID(122540) then
  217.         Phase = 2
  218.         warnAmberCarapace:Show(args.destName)
  219.         specwarnAmberMonstrosity:Show()
  220.         timerMassiveStompCD:Start(20)
  221.         timerFlingCD:Start(33)
  222.         warnAmberExplosionSoon:Schedule(45.5)
  223.         timerAmberExplosionAMCD:Start(55.5, amberExplosion, Monstrosity)
  224.     elseif args:IsSpellID(122395) and Phase < 3 then
  225.         warnStruggleForControl:Show(args.destName)
  226.         timerStruggleForControl:Start(args.destName)
  227.     elseif args:IsSpellID(122784) then
  228.         Constructs = Constructs + 1
  229.         warnReshapeLife:Show(args.destName)
  230.         if args:IsPlayer() then
  231.             playerIsConstruct = true
  232.             warnedWill = true -- fix bad low will special warning on entering Construct. After entering vehicle, this will be return to false. (on alt.power changes)
  233.             specwarnReshape:Show()
  234.             warnReshapeLifeTutor:Show()
  235.         end
  236.         if Phase < 3 then
  237.             timerReshapeLifeCD:Start()
  238.         else
  239.             timerReshapeLifeCD:Start(15)--More often in phase 3
  240.         end
  241.     end
  242. end
  243. mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
  244.  
  245. function mod:SPELL_AURA_REMOVED(args)
  246.     if args:IsSpellID(122754) then
  247.         timerDestabalize:Cancel(args.destName)
  248.     elseif args:IsSpellID(122784) then
  249.         Constructs = Constructs - 1
  250.         if args:IsPlayer() then
  251.             countdownAmberExplosion:Cancel()
  252.             playerIsConstruct = false
  253.         end
  254.         timerAmberExplosionCD:Cancel(args.destName)
  255.     elseif args:IsSpellID(121994) then
  256.         timerAmberScalpelCD:Start()
  257.     elseif args:IsSpellID(121949) then
  258.         timerParasiticGrowth:Cancel(args.destName)
  259.     elseif args:IsSpellID(122540) then--Phase 3
  260.         Phase = 3
  261.         timerMassiveStompCD:Cancel()
  262.         timerFlingCD:Cancel()
  263.         timerAmberExplosionAMCD:Cancel()
  264.         warnAmberExplosionSoon:Cancel()
  265.         --He does NOT reset reshape live cd here, he finishes out last CD first, THEN starts using new one.
  266.     end
  267. end
  268.  
  269. function mod:SPELL_CAST_START(args)
  270.     if args:IsSpellID(122398) then
  271.         warnAmberExplosion:Show(args.sourceName, args.spellName)
  272.         if args:GetSrcCreatureID() == 62701 then--Cast by a wild construct not controlled by player
  273.             if Constructs == 0 then--No constructs, thus no interrupt. Give a beware warning.
  274.                 specwarnAmberExplosion:Show(args.sourceName)
  275.             end
  276.             if playerIsConstruct then--Player is construct
  277.                 if GetTime() - lastStrike >= 4 then--Check if Amber Strike will be available before cast ends.
  278.                     specwarnAmberExplosionOther:Show(args.spellName, args.sourceName)
  279.                     if self:LatencyCheck() then--if you're too laggy we don't want you telling us you can interrupt it 2-3 seconds from now. we only care if you can interrupt it NOW
  280.                         self:SendSync("InterruptAvailable", UnitGUID("player")..":122398")
  281.                     end
  282.                 end
  283.             end
  284.             timerAmberExplosionCD:Start(18, args.sourceName, args.sourceGUID)--Longer CD if it's a non player controlled construct. Everyone needs to see this bar because there is no way to interrupt these.
  285.         elseif args.sourceGUID == UnitGUID("player") then--Cast by YOU
  286.             specwarnAmberExplosionYou:Show(args.spellName)
  287.             timerAmberExplosionCD:Start(13, args.sourceName)--Only player needs to see this, they are only person who can do anything about it.
  288.             countdownAmberExplosion:Start(13)
  289.         end
  290.     elseif args:IsSpellID(122402) then--Amber Monstrosity
  291.         warnAmberExplosion:Show(args.sourceName, args.spellName)
  292.         if Constructs == 0 then--No constructs, thus no interrupt. Give a beware warning.
  293.             specwarnAmberExplosion:Show(args.sourceName)
  294.         end
  295.         if playerIsConstruct then--Player is construct
  296.             if GetTime() - lastStrike >= 4 then--Check if Amber Strike will be available before cast ends.
  297.                 specwarnAmberExplosionAM:Show(args.spellName, args.sourceName)--On heroic, not interrupting amber montrosity is an auto wipe. this is single handedly the most important special warning of all!!!!!!
  298.                 if self:LatencyCheck() then--if you're too laggy we don't want you telling us you can interrupt it 2-3 seconds from now. we only care if you can interrupt it NOW
  299.                     self:SendSync("InterruptAvailable", UnitGUID("player")..":122402")
  300.                 end
  301.             end
  302.         end
  303.         warnAmberExplosionSoon:Cancel()
  304.         warnAmberExplosionSoon:Schedule(39)
  305.         timerAmberExplosionAMCD:Start(46, args.spellName, args.sourceName)
  306.     elseif args:IsSpellID(122408) then
  307.         warnMassiveStomp:Show()
  308.         specwarnMassiveStomp:Show()
  309.         timerMassiveStompCD:Start()
  310.     elseif args:IsSpellID(122413) then
  311.         warnFling:Show()
  312.         specwarnFling:Show()
  313.         timerFlingCD:Start()
  314.     end
  315. end
  316.  
  317. function mod:SPELL_CAST_SUCCESS(args)
  318.     if args:IsSpellID(122348) then
  319.         warnLivingAmber:Show()
  320.     elseif args:IsSpellID(121994) then
  321.         scansDone = 0
  322.         self:ScheduleMethod(0.2, "ScalpelTarget")
  323.     elseif args:IsSpellID(122532) then
  324.         Puddles = Puddles + 1
  325.         warnBurningAmber:Show(Puddles)
  326.     elseif args:IsSpellID(123156) then
  327.         Puddles = Puddles - 1
  328.         warnBurningAmber:Show(Puddles)
  329.     elseif args:IsSpellID(122389) and args.sourceGUID == UnitGUID("player") then--Amber Strike
  330.         lastStrike = GetTime()
  331.     end
  332. end
  333.  
  334. function mod:SPELL_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
  335.     if spellId == 122504 and destGUID == UnitGUID("player") and self:AntiSpam(3) then
  336.         specwarnBurningAmber:Show()
  337.     end
  338. end
  339. mod.SPELL_MISSED = mod.SPELL_DAMAGE
  340.  
  341. function mod:UNIT_POWER(uId)
  342.     if uId ~= "player" then return end
  343.     if UnitPower(uId, ALTERNATE_POWER_INDEX) < 28 and not warnedWill then
  344.         warnedWill = true
  345.         specwarnWillPower:Show()
  346.     elseif UnitPower(uId, ALTERNATE_POWER_INDEX) >= 32 and warnedWill then
  347.         warnedWill = false
  348.     end
  349. end
  350.  
  351. local function warnAmberExplosionCast(spellId)
  352.     if #canInterrupt == 0 then--No interupts, warn the raid to prep for aoe damage with beware! alert.
  353.         specwarnAmberExplosion:Show(spellId == 122402 and Monstrosity or MutatedConstruct)
  354.     else--Interrupts available, lets call em out as a great tool to give raid leader split second decisions on who to allocate to the task (so they don't all waste it on same target and not have for next one).
  355.         print("Debug: Interrupts Available")
  356.         warnInterruptsAvailable:Show(spellId == 122402 and Monstrosity or MutatedConstruct, table.concat(canInterrupt, "<, >"))
  357.     end
  358.     table.wipe(canInterrupt)
  359. end
  360.  
  361. function mod:OnSync(msg, str, sender)
  362.     print(msg, str, sender)--This could generate a decent amount of spam in phase 3 if there is a loose construct casting away and multiple player constructs up. None the less, that would be the greatest debug if a user complains about spam (and thus, shares it).
  363.     if not guidTableBuilt then
  364.         buildGuidTable()
  365.         guidTableBuilt = true
  366.     end
  367.     local guid, spellId
  368.     if sender and str then
  369.         guid, spellId = string.split(":", str)
  370.         spellId = tonumber(spellId or "")
  371.         print(guid, spellId)
  372.     end
  373.     if msg == "InterruptAvailable" and guids[guid] and spellId then
  374.         canInterrupt[#canInterrupt + 1] = guids[guid]
  375.         self:Unschedule(warnAmberExplosionCast)
  376.         self:Schedule(0.5, warnAmberExplosionCast, spellId)
  377.     end
  378. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement