zendil

Agatha WA

Apr 3rd, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.19 KB | None | 0 0
  1. function(allstates,e,...)
  2.     --Get the current timestamp
  3.     local timestamp = GetTime()
  4.    
  5.     --note: shield is every 50 seconds
  6.    
  7.     --First spawns 12 sec in, then every 46 sec
  8.     --These can be modified if better data is found
  9.     --Also you can change the boss emote string to search for
  10.     local first,interval,search
  11.     first = 12
  12.     interval = 46
  13.     search = "d"
  14.     --Initialize a state table
  15.     local state = {}
  16.     --Set some default state values
  17.     state.changed = true
  18.     state.show = true
  19.     state.name = "Healing Imps"
  20.     state.icon = nil
  21.     state.stacks = 1
  22.     state.progressType = "timed"
  23.     state.autoHide = false
  24.     if e == "PLAYER_REGEN_DISABLED" then
  25.         --We just entered combat
  26.         if UnitName("boss1") == "Agatha" then
  27.             --If we entered combat and the boss is agatha, trigger
  28.             --Reset the table, and add one entry for the timer
  29.             --this entry is set to the first set
  30.             state.duration = first
  31.             state.expirationTime = timestamp + first
  32.         end
  33.     elseif e == "CHAT_MSG_SAY" then
  34.         --There was a chat message, we might need to reset
  35.         local msg = ...
  36.         if msg then
  37.             --make sure we actually got a message
  38.             if string.match(msg, search) then
  39.                 --Imps just spawned, reset timer to new interval
  40.                 --Reset the table, and add one entry for the timer
  41.                 --this entry is set to the new interval
  42.                 state.duration = interval
  43.                 state.expirationTime = timestamp + interval
  44.             end
  45.         end
  46.     elseif e == "PLAYER_REGEN_ENABLED" or e == "PLAYER_DEAD" then
  47.         --Left combat or died, reset the whole thing
  48.     end
  49.     --Place the new state in the allstates table, overwriting the old data
  50.     allstates = {state}
  51.     --Test Output
  52.     print("here-localstate")
  53.     for k,v in pairs(state) do
  54.         print(k.." : "..tostring(v))
  55.     end
  56.     print("here-allstates")
  57.     for k,v in pairs(allstates) do
  58.         print(k.." : -----------------")
  59.         for k,v in pairs(v) do
  60.             print(k.." : "..tostring(v))
  61.         end
  62.     end
  63.     --End Test
  64.     return true
  65. end
Advertisement
Add Comment
Please, Sign In to add comment