Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --The base code used was taken from Byrth's BRD.Lua - Custom Timers
- function get_sets()
- timer_reg = {}
- runecounter = 0
- end
- function precast(spell)
- rune_custome_timer_pc(spell)
- end
- function midcast(spell)
- end
- function buff_change(status,gain)
- if gain then
- --add_to_chat(100,'> > > Gain > '..status)
- else
- if runes:contains(status) then -- Need to work on this...
- runecounter = runecounter -1
- if runecounter < 0 then
- runecounter = 0
- end
- end
- --add_to_chat(100,'> > Lost> '..status)
- end
- end
- function aftercast(spell,action)
- rune_custome_timer_af(spell)
- end
- function rune_custome_timer_pc(spell)
- runes = S{ 'Ignis', 'Gelus', 'Flabra', 'Tellus', 'Sulpor', 'Unda', 'Lux', 'Tenebrae' }
- if spell.type and spell.type == 'Rune' and not spell.interrupted then
- runecounter = runecounter + 1
- if runecounter > 3 then
- runecounter = 1
- end
- end
- runename = 'Rune: '..tostring(runecounter)
- if spell.name == "Swipe" and not spell.interrupted then
- send_command('timers delete "Rune: 1"')
- runecounter = 0
- end
- if spell.name == "Lunge" or spell.name == "Gambit" and not spell.interrupted then
- reset_timers()
- end
- end
- function rune_custome_timer_af(spell)
- if spell.type and spell.type == 'Rune' and spell.target and spell.target.type:upper() == 'SELF' and not spell.interrupted then
- local t = os.time()
- local tempreg = {}
- for i,v in pairs(timer_reg) do
- if v < t then tempreg[i] = true end
- end
- for i,v in pairs(tempreg) do
- timer_reg[i] = nil
- end
- local dur = 300
- add_to_chat(100,'> > > '..runename)
- if timer_reg[runename] then
- send_command('timers delete "'..runename..'"')
- timer_reg[runename] = t + dur
- send_command('timers create "'..runename..'" '..dur..' down')
- else
- local maxrunes = 3
- if maxrunes < table.length(timer_reg) then
- maxrunes = table.length(timer_reg)
- end
- if table.length(timer_reg) < maxrunes then
- timer_reg[runename] = t+dur
- send_command('timers create "'..runename..'" '..dur..' down')
- else
- local rep,reprune
- for i,v in pairs(timer_reg) do
- if t+dur > v then
- if not rep or rep > v then
- rep = v
- reprune = i
- end
- end
- end
- if reprune then
- timer_reg[reprune] = nil
- send_command('timers delete "'..reprune..'"')
- timer_reg[runename] = t+dur
- send_command('timers create "'..runename..'" '..dur..' down')
- end
- end
- end
- end
- end
- function reset_timers()
- send_command('timers delete "Rune: 1"')
- send_command('timers delete "Rune: 2"')
- send_command('timers delete "Rune: 3"')
- runecounter = 0
- end
- function self_command(cmd)
- end
Advertisement
Add Comment
Please, Sign In to add comment