Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function mod:StartCooldown(sender, spellId, cooldown)
- if self.db.profile.hideSelf and sender == playerName then return end
- if not self.db.profile.spells[spellId] then return end -- Only show a bar for this spell if the user enabled it
- -- Because we now scan all spells whenever a Spell Cooldown event is fired,
- -- a sync might be sent multiple times for the same spell. This block prevents
- -- the bar from constantly updating its max time, making it look like the
- -- cooldown is being used again.
- local bar = barGroup:GetBar(sender .. "_" .. spellId)
- if bar == nil then
- bar = barGroup:NewTimerBar((sender .. "_" .. spellId), sender, cooldown, cooldown, spellId)
- bar.caster = sender
- bar.spellId = spellId
- -- begin ithilyn
- bar.spellName = GetSpellInfo(spellId)
- bar:SetScript("OnEnter", function(bar, ...)
- GameTooltip:SetOwner(bar, "ANCHOR_TOPLEFT")
- GameTooltip:SetText(bar.spellName)
- GameTooltip:Show()
- end)
- bar:SetScript("OnLeave", function(frame, ...)
- GameTooltip:Hide()
- end)
- bar:EnableMouse(true)
- -- end ithilyn
- else
- bar:SetTimer(cooldown, bar.maxValue)
- end
- local _, c = UnitClass(sender)
- if not c then
- -- Get the class name from our cooldown table; this is used exclusively for testing
- for k, v in pairs(RaidCooldowns.cooldowns) do
- for k2, v2 in pairs(v) do
- if v2.id == spellId then
- c = k
- end
- end
- end
- end
- local color = RAID_CLASS_COLORS[c]
- if type(color) == "table" then
- bar:SetColorAt(1.00, color.r, color.g, color.b, 1)
- bar:SetColorAt(0.00, color.r, color.g, color.b, 1)
- end
- end
- function mod:StopCooldown(sender, spellId)
- local bar = barGroup:GetBar(sender .. "_" .. spellId)
- if bar ~= nil then
- barGroup:RemoveBar(bar)
- self:UpdateDisplay() -- Removes a gap that appears in edge cases
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement