Loire

Song Duration

Mar 31st, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.98 KB | None | 0 0
  1. function aftercast(spell)
  2.     if not spell.interrupted then
  3.     if spell.type and spell.type == 'BardSong' and spell.target and spell.target.type:upper() == 'SELF' then
  4.         local t = os.time()
  5.        
  6.         -- Eliminate songs that have already expired
  7.         local tempreg = {}
  8.         for i,v in pairs(timer_reg) do
  9.             if v < t then tempreg[i] = true end
  10.         end
  11.         for i,v in pairs(tempreg) do
  12.             timer_reg[i] = nil
  13.         end
  14.        
  15.         local dur = calculate_duration(spell.name)
  16.         if timer_reg[spell.name] then
  17.             if (timer_reg[spell.name] - t) <= 120 then
  18.                 send_command('timers delete "'..spell.name..'"')
  19.                 timer_reg[spell.name] = t + dur
  20.                 send_command('timers create "'..spell.name..'" '..dur..' down')
  21.             end
  22.         else
  23.             local maxsongs = 2
  24.             if player.equipment.range == 'Daurdabla' then
  25.                 maxsongs = maxsongs+2
  26.             end
  27.             if buffactive['Clarion Call'] then
  28.                 maxsongs = maxsongs+1
  29.             end
  30.             if maxsongs < table.length(timer_reg) then
  31.                 maxsongs = table.length(timer_reg)
  32.             end
  33.            
  34.             if table.length(timer_reg) < maxsongs then
  35.                 timer_reg[spell.name] = t+dur
  36.                 send_command('timers create "'..spell.name..'" '..dur..' down')
  37.             else
  38.                 local rep,repsong
  39.                 for i,v in pairs(timer_reg) do
  40.                     if t+dur > v then
  41.                         if not rep or rep > v then
  42.                             rep = v
  43.                             repsong = i
  44.                         end
  45.                     end
  46.                 end
  47.                 if repsong then
  48.                     timer_reg[repsong] = nil
  49.                     send_command('timers delete "'..repsong..'"')
  50.                     timer_reg[spell.name] = t+dur
  51.                     send_command('timers create "'..spell.name..'" '..dur..' down')
  52.                 end
  53.             end
  54.         end
  55.     end
  56.     end
  57.     if player.status == 'Engaged' then
  58.         equip(sets.aftercast.Engaged)
  59.     else
  60.         equip(sets.aftercast.Idle)
  61.     end
  62. end
  63.  
  64. function status_change(new,old)
  65.     if new == 'Engaged' then
  66.         equip(sets.aftercast.Engaged)
  67.     elseif T{'Idle','Resting'}:contains(new) then
  68.         equip(sets.aftercast.Idle)
  69.     end
  70. end
  71.  
  72.  
  73. function equip_song_gear(spell)
  74.     if DaurdSongs:contains(spell.english) then
  75.         equip(sets.midcast.Base,sets.midcast.DBuff)
  76.     else
  77.         if spell.target.type == 'MONSTER' then
  78.             equip(sets.midcast.Base,sets.midcast.Debuff,sets.midcast.GBuff)
  79.             if buffactive.troubadour or buffactive['elemental seal'] then
  80.                 equip(sets.midcast.Duration)
  81.             end
  82.             if string.find(spell.english,'Foe Lullaby') then equip (sets.midcast.Lullaby) end
  83.             if string.find(spell.english,'Horde Lullaby') then equip (sets.midcast.Lullaby,sets.midcast.DBuff,sets.midcast.Horde) end
  84.         else
  85.             equip(sets.midcast.Base,sets.midcast.Buff,sets.midcast.GBuff)
  86.             if string.find(spell.english,'Ballad') then equip(sets.midcast.Ballad) end
  87.             if string.find(spell.english,'Scherzo') then equip(sets.midcast.Scherzo) end
  88.         end
  89.     end
  90. end
  91.  
  92. function calculate_duration(name)
  93.     local mult = 1
  94.     if player.equipment.range == "Daurdabla" then mult = mult + 0.3 end
  95.     if player.equipment.range == "Gjallarhorn" then mult = mult + 0.4 end
  96.    
  97.     if player.equipment.neck == "Aoidos' Matinee" then mult = mult + 0.1 end
  98.     if player.equipment.feet == "Brioso Slippers +1" then mult = mult + 0.11 end
  99.     if player.equipment.body == "Fili Hongreline" then mult = mult + 0.11 end
  100.     if player.equipment.legs == "Mdk. Shalwar +1" then mult = mult + 0.1 end
  101.     if player.equipment.main == "Legato Dagger" then mult = mult + 0.05 end
  102.     if player.equipment.sub == "Legato Dagger" then mult = mult + 0.05 end
  103.     if player.equipment.main == "Carnwenhan" then mult = mult + 0.5 end
  104.    
  105.     if string.find(name,'March') and player.equipment.hands == "Fili Manchettes" then mult = mult + 0.1 end
  106.     if string.find(name,'Minuet') and player.equipment.body == "Fili Hongreline" then mult = mult + 0.1 end
  107.     if string.find(name,'Madrigal') and player.equipment.head == "Fili Calot +1" then mult = mult + 0.1 end
  108.     if string.find(name,'Ballad') and player.equipment.legs == "Fili Rhingrave" then mult = mult + 0.1 end
  109.     if string.find(name,'Paeon') and player.equipment.head == "Brioso Roundlet +1" then mult = mult + 0.1 end
  110.     if string.find(name,'Scherzo') and player.equipment.feet == "Fili Cothurnes" then mult = mult + 0.1 end
  111.    
  112.     if buffactive.Troubadour then
  113.         mult = mult*2
  114.     end
  115.     if string.find(name,'Scherzo') and buffactive['Soul Voice'] then
  116.         mult = mult*2
  117.     elseif string.find(name,'Scherzo') and buffactive.marcato then
  118.         mult = mult*1.5
  119.     end
  120.    
  121.     return mult*120
  122. end
Advertisement
Add Comment
Please, Sign In to add comment