Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- === CONFIG SETTINGS BEGIN ===
- local config = {};
- -- id: Unique identifier to distinguish between other timers.
- local id = "torment";
- -- time: Time remaining at which to trigger (in seconds), can be
- -- decimal. If checkTimeElapsed = true, this is time elapsed at
- -- which to trigger instead.
- config.time = 0;
- -- checkTimeElapsed: Default checks against time remaining before the
- -- timer ends. If you want to check against time elapsed instead,
- -- change to "true".
- config.checkTimeElapsed = true;
- -- duration: Duration the trigger should remain active before
- -- untrigger, can be decimal. If set to default of 0 (zero), trigger
- -- expires when timer expires. If set to a positive value of say 5,
- -- trigger will expire 5 seconds after trigger started, as specified
- -- by "time" above.
- config.duration = 34;
- -- frequency: How often the event should trigger this display. If
- -- set to default "1", trigger will occur for every matching event.
- -- If set to "2", trigger will occur every other event, "3" will
- -- trigger every third event, and so on.
- config.frequency = 1;
- -- ignoreCount: Ignore the first X occurrences without triggering
- -- display. Once the specified occurrences have passed, display
- -- will trigger as normal, as if the next occurrence was the first
- -- instance of the event.
- config.ignoreCount = 0;
- -- cooldown: Estimated delay (in seconds) between cooldowns of this
- -- event. This value is used to display approximate timings for the
- -- next event occurrence. If left as the default of "0" or "false",
- -- the trigger will approximate the cooldown by detecting the
- -- shortest cooldown between events.
- config.cooldown = 35;
- -- messages: Custom messages to be displayed for specified event
- -- firings. Useful to create ordered lists such as cooldown rotations.
- -- If no custom messages are desired, change to false or delete line:
- -- config.messages = false;
- config.messages = {
- { -- 1
- {
- recipient = "dougall",
- message = "Shard@|cffff0066".."Now".."|r, Trink@".."|cffff0066".."17".."|r, Disp@|cffff0066".."8".."|r",
- },
- {
- recipient = "kulldon,kainhighwind",
- message = "Spam Heal Torment!",
- },
- },
- { -- 2
- {
- recipient = "chukasi",
- message = "Shard@|cffff0066".."Now".."|r, Trink@".."|cffff0066".."17".."|r, Disp@|cffff0066".."8".."|r",
- },
- {
- recipient = "kainhighwind",
- message = "Solo Heal Torment!",
- },
- },
- { -- 3
- {
- recipient = "bauser",
- message = "Shard@|cffff0066".."Now to 14".."|r sec",
- },
- {
- recipient = "takaoni",
- message = "Shard@|cffff0066".."14".."|r sec",
- },
- {
- recipient = "kulldon",
- message = "Solo Heal Torment!",
- },
- },
- { -- 4
- {
- recipient = "dougall",
- message = "Shard@|cffff0066".."Now".."|r, Trink@".."|cffff0066".."17".."|r, Disp@|cffff0066".."8".."|r",
- },
- {
- recipient = "kulldon",
- message = "Spam Heal Torment!",
- },
- {
- recipient = "kainhighwind",
- message = "Beacon Heal Torment!",
- },
- },
- { -- 5
- {
- recipient = "bauser",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "takaoni",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "akalabreath",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- { -- 6
- {
- recipient = "dougall",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "harkle",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "chukasi",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- { -- 7
- {
- recipient = "bauser",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "takaoni",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "akalabreath",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- { -- 8
- {
- recipient = "dougall",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "harkle",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "chukasi",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- { -- 9
- {
- recipient = "bauser",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "takaoni",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "akalabreath",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- { -- 10
- {
- recipient = "dougall",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "harkle",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "chukasi",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- { -- 11
- {
- recipient = "bauser",
- message = "Shard@|cffff0066".."Now to 18".."|r sec",
- },
- {
- recipient = "takaoni",
- message = "Shard@|cffff0066".."18 - 10".."|r sec",
- },
- {
- recipient = "akalabreath",
- message = "Shard@|cffff0066".."10".."|r sec",
- },
- },
- };
- -- messageRepeat: Boolean setting that specifies if custom messages will
- -- be repeated at the end of the list. If false, trigger will display
- -- default name after list has been exhausted.
- config.messageRepeat = true;
- -- === CONFIG SETTINGS END ===
- -- Check combat
- if not InCombatLockdown() then return end
- if not WeakAuras.CustomValues then WeakAuras.CustomValues = {}; end
- if not WeakAuras.CustomValues.CustomTimers then WeakAuras.CustomValues.CustomTimers = {}; end
- if not WeakAuras.CustomValues.CustomTimers[id] then WeakAuras.CustomValues.CustomTimers[id] = {}; end
- WeakAuras.CustomValues.CustomTimers[id].config = config;
- -- Bump count
- if not WeakAuras.CustomValues.CustomTimers[id].count then
- WeakAuras.CustomValues.CustomTimers[id].count = 1;
- else
- WeakAuras.CustomValues.CustomTimers[id].count = WeakAuras.CustomValues.CustomTimers[id].count + 1;
- end
- -- Set validEvent false
- WeakAuras.CustomValues.CustomTimers[id].validEvent = false;
- -- Set fired false
- WeakAuras.CustomValues.CustomTimers[id].fired = false;
- -- Check if count > ignoredCount
- if WeakAuras.CustomValues.CustomTimers[id].count <= config.ignoreCount then return false; end
- -- Check if (count - ignoreCount)%frequency > 0
- if ((WeakAuras.CustomValues.CustomTimers[id].count - config.ignoreCount) + config.frequency - 1) % config.frequency > 0 then return false; end
- -- Set the shortest cooldown time
- if WeakAuras.CustomValues.CustomTimers[id].previousEventTime and not WeakAuras.CustomValues.CustomTimers[id].shortestCooldown then
- WeakAuras.CustomValues.CustomTimers[id].shortestCooldown = (GetTime() - WeakAuras.CustomValues.CustomTimers[id].previousEventTime);
- elseif WeakAuras.CustomValues.CustomTimers[id].previousEventTime and WeakAuras.CustomValues.CustomTimers[id].shortestCooldown and (GetTime() - WeakAuras.CustomValues.CustomTimers[id].previousEventTime) < WeakAuras.CustomValues.CustomTimers[id].shortestCooldown then
- WeakAuras.CustomValues.CustomTimers[id].shortestCooldown = (GetTime() - WeakAuras.CustomValues.CustomTimers[id].previousEventTime);
- end
- -- Set previous event time
- WeakAuras.CustomValues.CustomTimers[id].previousEventTime = GetTime();
- -- Cooldown or shortestCooldown must exist for valid event
- if (config.cooldown and config.cooldown > 0) or (WeakAuras.CustomValues.CustomTimers[id].shortestCooldown and WeakAuras.CustomValues.CustomTimers[id].shortestCooldown > 0) then
- -- Set valid event
- WeakAuras.CustomValues.CustomTimers[id].validEvent = true;
- -- Set fired count
- if not WeakAuras.CustomValues.CustomTimers[id].firedCount then
- WeakAuras.CustomValues.CustomTimers[id].firedCount = 1;
- else
- WeakAuras.CustomValues.CustomTimers[id].firedCount = WeakAuras.CustomValues.CustomTimers[id].firedCount + 1;
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement