Advertisement
gabestah

torment final update

Aug 24th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.96 KB | None | 0 0
  1. -- === CONFIG SETTINGS BEGIN ===    
  2. local config = {};
  3. -- id: Unique identifier to distinguish between other timers.
  4. local id = "torment";
  5. -- time: Time remaining at which to trigger (in seconds), can be
  6. --  decimal. If checkTimeElapsed = true, this is time elapsed at
  7. --  which to trigger instead.
  8. config.time = 0;
  9. -- checkTimeElapsed: Default checks against time remaining before the
  10. --  timer ends. If you want to check against time elapsed instead,
  11. --  change to "true".
  12. config.checkTimeElapsed = true;    
  13. -- duration: Duration the trigger should remain active before
  14. --  untrigger, can be decimal. If set to default of 0 (zero), trigger
  15. --  expires when timer expires. If set to a positive value of say 5,
  16. --  trigger will expire 5 seconds after trigger started, as specified
  17. --  by "time" above.
  18. config.duration = 34;
  19. -- frequency: How often the event should trigger this display.  If
  20. --  set to default "1", trigger will occur for every matching event.
  21. --  If set to "2", trigger will occur every other event, "3" will
  22. --  trigger every third event, and so on.
  23. config.frequency = 1;
  24. -- ignoreCount: Ignore the first X occurrences without triggering
  25. --  display. Once the specified occurrences have passed, display
  26. --  will trigger as normal, as if the next occurrence was the first
  27. --  instance of the event.
  28. config.ignoreCount = 0;
  29. -- cooldown: Estimated delay (in seconds) between cooldowns of this
  30. --  event.  This value is used to display approximate timings for the
  31. --  next event occurrence.  If left as the default of "0" or "false",
  32. --  the trigger will approximate the cooldown by detecting the
  33. --  shortest cooldown between events.
  34. config.cooldown = 35;
  35. -- messages: Custom messages to be displayed for specified event
  36. --  firings. Useful to create ordered lists such as cooldown rotations.
  37. --  If no custom messages are desired, change to false or delete line:
  38. -- config.messages = false;
  39. config.messages = {
  40.     { -- 1
  41.         {
  42.             recipient = "dougall",
  43.             message = "Shard@|cffff0066".."Now".."|r, Trink@".."|cffff0066".."17".."|r, Disp@|cffff0066".."8".."|r",
  44.         },
  45.         {
  46.             recipient = "kulldon,kainhighwind",
  47.             message = "Spam Heal Torment!",
  48.         },
  49.     },
  50.     { -- 2
  51.         {
  52.             recipient = "chukasi",
  53.             message = "Shard@|cffff0066".."Now".."|r, Trink@".."|cffff0066".."17".."|r, Disp@|cffff0066".."8".."|r",
  54.         },
  55.         {
  56.             recipient = "kainhighwind",
  57.             message = "Solo Heal Torment!",
  58.         },
  59.     },
  60.     { -- 3
  61.         {
  62.             recipient = "ansum",
  63.             message = "Shard@|cffff0066".."Now to 14".."|r sec",
  64.         },
  65.         {
  66.             recipient = "bauser",
  67.             message = "Shard@|cffff0066".."14".."|r sec",
  68.         },
  69.         {
  70.             recipient = "kulldon",
  71.             message = "Solo Heal Torment!",
  72.         },
  73.     },
  74.     { -- 4
  75.         {
  76.             recipient = "dougall",
  77.             message = "Shard@|cffff0066".."Now".."|r, Trink@".."|cffff0066".."17".."|r, Disp@|cffff0066".."8".."|r",
  78.         },
  79.         {
  80.             recipient = "kulldon",
  81.             message = "Spam Heal Torment!",
  82.         },
  83.         {
  84.             recipient = "kainhighwind",
  85.             message = "Beacon Heal Torment!",
  86.         },
  87.     },
  88.     { -- 5
  89.         {
  90.             recipient = "ansum",
  91.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  92.         },
  93.         {
  94.             recipient = "bauser",
  95.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  96.         },
  97.         {
  98.             recipient = "takaoni",
  99.             message = "Shard@|cffff0066".."10".."|r sec",
  100.         },
  101.     },
  102.     { -- 6
  103.         {
  104.             recipient = "dougall",
  105.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  106.         },
  107.         {
  108.             recipient = "harkle",
  109.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  110.         },
  111.         {
  112.             recipient = "chukasi",
  113.             message = "Shard@|cffff0066".."10".."|r sec",
  114.         },
  115.     },
  116.     { -- 7
  117.         {
  118.             recipient = "ansum",
  119.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  120.         },
  121.         {
  122.             recipient = "bauser",
  123.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  124.         },
  125.         {
  126.             recipient = "takaoni",
  127.             message = "Shard@|cffff0066".."10".."|r sec",
  128.         },
  129.     },
  130.     { -- 8
  131.         {
  132.             recipient = "dougall",
  133.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  134.         },
  135.         {
  136.             recipient = "harkle",
  137.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  138.         },
  139.         {
  140.             recipient = "chukasi",
  141.             message = "Shard@|cffff0066".."10".."|r sec",
  142.         },
  143.     },
  144.     { -- 9
  145.         {
  146.             recipient = "ansum",
  147.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  148.         },
  149.         {
  150.             recipient = "bauser",
  151.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  152.         },
  153.         {
  154.             recipient = "takaoni",
  155.             message = "Shard@|cffff0066".."10".."|r sec",
  156.         },
  157.     },
  158.     { -- 10
  159.         {
  160.             recipient = "dougall",
  161.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  162.         },
  163.         {
  164.             recipient = "harkle",
  165.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  166.         },
  167.         {
  168.             recipient = "chukasi",
  169.             message = "Shard@|cffff0066".."10".."|r sec",
  170.         },
  171.     },
  172.     { -- 11
  173.         {
  174.             recipient = "ansum",
  175.             message = "Shard@|cffff0066".."Now to 18".."|r sec",
  176.         },
  177.         {
  178.             recipient = "bauser",
  179.             message = "Shard@|cffff0066".."18 - 10".."|r sec",
  180.         },
  181.         {
  182.             recipient = "takaoni",
  183.             message = "Shard@|cffff0066".."10".."|r sec",
  184.         },
  185.     },
  186. };
  187. -- messageRepeat: Boolean setting that specifies if custom messages will
  188. --  be repeated at the end of the list.  If false, trigger will display
  189. --  default name after list has been exhausted.
  190. config.messageRepeat = true;
  191. -- === CONFIG SETTINGS END ===
  192.  
  193. -- Check combat
  194. if not InCombatLockdown() then return end
  195. if not WeakAuras.CustomValues then WeakAuras.CustomValues = {}; end
  196. if not WeakAuras.CustomValues.CustomTimers then WeakAuras.CustomValues.CustomTimers = {}; end
  197. if not WeakAuras.CustomValues.CustomTimers[id] then WeakAuras.CustomValues.CustomTimers[id] = {}; end
  198. local kIndex = kAuction:WeakAuras_GetConfigIndexById(id)
  199. WeakAuras.CustomValues.CustomTimers[id].config = kAuction and kAuction.db.profile.weakauras.configs[kIndex] and assert(loadstring(kAuction.db.profile.weakauras.configs[kIndex].value))() or config;
  200. if not type(WeakAuras.CustomValues.CustomTimers[id].config) == "table" then return end
  201.  
  202. -- Bump count
  203. if not WeakAuras.CustomValues.CustomTimers[id].count then
  204.     WeakAuras.CustomValues.CustomTimers[id].count = 1;
  205. else
  206.     WeakAuras.CustomValues.CustomTimers[id].count = WeakAuras.CustomValues.CustomTimers[id].count + 1;
  207. end
  208. -- Set validEvent false
  209. WeakAuras.CustomValues.CustomTimers[id].validEvent = false;
  210. -- Set fired false
  211. WeakAuras.CustomValues.CustomTimers[id].fired = false;
  212. -- Check if count > ignoredCount
  213. if WeakAuras.CustomValues.CustomTimers[id].count <= config.ignoreCount then return false; end
  214. -- Check if (count - ignoreCount)%frequency > 0
  215. if ((WeakAuras.CustomValues.CustomTimers[id].count - config.ignoreCount) + config.frequency - 1) % config.frequency > 0 then return false; end
  216. -- Set the shortest cooldown time
  217. if WeakAuras.CustomValues.CustomTimers[id].previousEventTime and not WeakAuras.CustomValues.CustomTimers[id].shortestCooldown then
  218.     WeakAuras.CustomValues.CustomTimers[id].shortestCooldown = (GetTime() - WeakAuras.CustomValues.CustomTimers[id].previousEventTime);
  219. 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
  220.     WeakAuras.CustomValues.CustomTimers[id].shortestCooldown = (GetTime() - WeakAuras.CustomValues.CustomTimers[id].previousEventTime);
  221. end
  222. -- Set previous event time
  223. WeakAuras.CustomValues.CustomTimers[id].previousEventTime = GetTime();    
  224. -- Cooldown or shortestCooldown must exist for valid event
  225. if (config.cooldown and config.cooldown > 0) or (WeakAuras.CustomValues.CustomTimers[id].shortestCooldown and WeakAuras.CustomValues.CustomTimers[id].shortestCooldown > 0) then
  226.     -- Set valid event
  227.     WeakAuras.CustomValues.CustomTimers[id].validEvent = true;
  228.     -- Set fired count
  229.     if not WeakAuras.CustomValues.CustomTimers[id].firedCount then
  230.         WeakAuras.CustomValues.CustomTimers[id].firedCount = 1;
  231.     else
  232.         WeakAuras.CustomValues.CustomTimers[id].firedCount = WeakAuras.CustomValues.CustomTimers[id].firedCount + 1;
  233.     end
  234. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement