64 lines
3.0 KiB
Lua
64 lines
3.0 KiB
Lua
-- Renataki (Octo BigWigs Raids/ZG/Renataki.lua), native server events.
|
|
-- boss_renataki.cpp: vanish = server visibility off (every client loses the unit at once), Ambush 24337 on return,
|
|
-- Enrage 8269, Gouge 12540/24698. Vanish is read from this client's own raid targets, not synced.
|
|
local RENATAKI = 15084
|
|
local L = {msg_vanish = "Renataki has Vanished!", bar_nextReturn = "Return", msg_vanishFade = "Renataki Appears!",
|
|
bar_nextVanish = "Vanish", msg_enrage = "Enrage!", bar_gouge = "Gouge CD"}
|
|
local timer = {nextVanish = 28, nextReturn = 20, gouge = 9}
|
|
local icon = {nextVanish = "ability_vanish", nextReturn = "ability_rogue_ambush", enrage = "spell_shadow_unholyfrenzy", gouge = "ability_gouge"}
|
|
local m = OctoBossMods:NewModule("Renataki", {npcs = {RENATAKI}, displayName = "Renataki", zone = "Zul'Gurub"})
|
|
|
|
local function visible()
|
|
for _, unit in ipairs({"target", "focus", "mouseover", "targettarget"}) do
|
|
if OctoBossMods.NpcId(UnitGUID(unit)) == RENATAKI then return true end
|
|
end
|
|
local n = IsInRaid() and GetNumGroupMembers() or 0
|
|
for i = 1, n do if OctoBossMods.NpcId(UnitGUID("raid" .. i .. "target")) == RENATAKI then return true end end
|
|
return false
|
|
end
|
|
function m:OnEngage()
|
|
self.vanished, self.wasSeen, self.gougeTime = false, visible(), GetTime()
|
|
self:Bar(L.bar_nextVanish, timer.nextVanish, icon.nextVanish, true, "White")
|
|
self:Bar(L.bar_gouge, timer.gouge, icon.gouge, true, "Red")
|
|
self:ScheduleRepeatingEvent("vanish", function() self:Watch() end, 0.5)
|
|
end
|
|
function m:Watch()
|
|
local v = visible()
|
|
if v then self.wasSeen = true end
|
|
if self.wasSeen and not v and not self.vanished then
|
|
self.vanished, self.vanishTime = true, GetTime()
|
|
self:RemoveBar(L.bar_nextVanish)
|
|
self:RemoveBar(L.bar_gouge)
|
|
self:Bar(L.bar_nextReturn, timer.nextReturn, icon.nextReturn, true, "White")
|
|
self:Message(L.msg_vanish, "Attention")
|
|
elseif v and self.vanished then
|
|
self:Appear()
|
|
end
|
|
end
|
|
function m:Appear()
|
|
if not self.vanished then return end
|
|
self.vanished = false
|
|
self:RemoveBar(L.bar_nextReturn)
|
|
self:Message(L.msg_vanishFade, "Attention")
|
|
self:Bar(L.bar_nextVanish, timer.nextVanish, icon.nextVanish, true, "White")
|
|
local left = timer.gouge - ((self.vanishTime or GetTime()) - (self.gougeTime or 0))
|
|
if left > 0 then self:Bar(L.bar_gouge, left, icon.gouge, true, "Red") end
|
|
end
|
|
function m:Ambush() self:Appear() end
|
|
function m:Enrage(_, _, dstGUID)
|
|
if OctoBossMods.NpcId(dstGUID) ~= RENATAKI or not self:Throttle("enrage", 10) then return end
|
|
self:WarningSign(icon.enrage, 1)
|
|
self:Message(L.msg_enrage, "Urgent", false, "Beware")
|
|
end
|
|
function m:Gouge()
|
|
if not self:Throttle("gouge", 3) then return end
|
|
self.gougeTime = GetTime()
|
|
self:Sound("Info")
|
|
self:Bar(L.bar_gouge, timer.gouge, icon.gouge, true, "Red")
|
|
end
|
|
m.events = {
|
|
SPELL_CAST_SUCCESS = {[24337] = "Ambush", [12540] = "Gouge", [24698] = "Gouge"},
|
|
SPELL_DAMAGE = {[24337] = "Ambush"},
|
|
SPELL_AURA_APPLIED = {[8269] = "Enrage"},
|
|
}
|