Advertisement
Guest User

adjust spells

a guest
Apr 14th, 2016
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.15 KB | None | 0 0
  1. --spelladjust
  2. --[[
  3. function job_precast(spell, action, spellMap, eventArgs)
  4.     refine_various_spells(spell, action, spellMap, eventArgs)
  5. end
  6. ]]--
  7.  
  8. --Refine Nuke Spells
  9. function refine_various_spells(spell, action, spellMap, eventArgs)
  10.     aspirs = S{'Aspir','Aspir II','Aspir III'}
  11.     sleeps = S{'Sleep II','Sleep'}
  12.     sleepgas = S{'Sleepga II','Sleepga'}
  13.     nukes = S{'Fire', 'Blizzard', 'Aero', 'Stone', 'Thunder', 'Water',
  14.     'Fire II', 'Blizzard II', 'Aero II', 'Stone II', 'Thunder II', 'Water II',
  15.     'Fire III', 'Blizzard III', 'Aero III', 'Stone III', 'Thunder III', 'Water III',
  16.     'Fire IV', 'Blizzard IV', 'Aero IV', 'Stone IV', 'Thunder IV', 'Water IV',
  17.     'Fire V', 'Blizzard V', 'Aero V', 'Stone V', 'Thunder V', 'Water V',
  18.     'Fire VI', 'Blizzard VI', 'Aero VI', 'Stone VI', 'Thunder VI', 'Water VI',
  19.     'Firaga', 'Blizzaga', 'Aeroga', 'Stonega', 'Thundaga', 'Waterga',
  20.     'Firaga II', 'Blizzaga II', 'Aeroga II', 'Stonega II', 'Thundaga II', 'Waterga II',
  21.     'Firaga III', 'Blizzaga III', 'Aeroga III', 'Stonega III', 'Thundaga III', 'Waterga III',  
  22.     'Firaja', 'Blizzaja', 'Aeroja', 'Stoneja', 'Thundaja', 'Waterja',
  23.     }
  24.     cures = S{'Cure IV','Cure V','Cure IV','Cure III','Curaga III','Curaga II', 'Curaga',}
  25.    
  26.     if spell.skill == 'Healing Magic' then
  27.         if not cures:contains(spell.english) then
  28.             return
  29.         end
  30.        
  31.         local newSpell = spell.english
  32.         local spell_recasts = windower.ffxi.get_spell_recasts()
  33.         local cancelling = 'All '..spell.english..' spells are on cooldown. Cancelling spell casting.'
  34.        
  35.         if spell_recasts[spell.recast_id] > 0 then
  36.             if cures:contains(spell.english) then
  37.                 if spell.english == 'Cure' then
  38.                     add_to_chat(122,cancelling)
  39.                     eventArgs.cancel = true
  40.                 return
  41.                 elseif spell.english == 'Cure IV' then
  42.                     newSpell = 'Cure V'
  43.                 elseif spell.english == 'Cure V' then
  44.                     newSpell = 'Cure IV'
  45.                 elseif spell.english == 'Cure IV' then
  46.                     newSpell = 'Cure III'
  47.                 end
  48.             end
  49.         end
  50.        
  51.         if newSpell ~= spell.english then
  52.             send_command('@input /ma "'..newSpell..'" '..tostring(spell.target.raw))
  53.             eventArgs.cancel = true
  54.             return
  55.         end
  56.     elseif spell.skill == 'Dark Magic' then
  57.         if not aspirs:contains(spell.english) then
  58.             return
  59.         end
  60.        
  61.         local newSpell = spell.english
  62.         local spell_recasts = windower.ffxi.get_spell_recasts()
  63.         local cancelling = 'All '..spell.english..' spells are on cooldown. Cancelling spell casting.'
  64.  
  65.         if spell_recasts[spell.recast_id] > 0 then
  66.             if aspirs:contains(spell.english) then
  67.                 if spell.english == 'Aspir' then
  68.                     add_to_chat(122,cancelling)
  69.                     eventArgs.cancel = true
  70.                 return
  71.                 elseif spell.english == 'Aspir II' then
  72.                     newSpell = 'Aspir'
  73.                 elseif spell.english == 'Aspir III' then
  74.                     newSpell = 'Aspir II'
  75.                 end
  76.             end
  77.         end
  78.        
  79.         if newSpell ~= spell.english then
  80.             send_command('@input /ma "'..newSpell..'" '..tostring(spell.target.raw))
  81.             eventArgs.cancel = true
  82.             return
  83.         end
  84.     elseif spell.skill == 'Elemental Magic' then
  85.         if not sleepgas:contains(spell.english) and not sleeps:contains(spell.english) and not nukes:contains(spell.english) then
  86.             return
  87.         end
  88.  
  89.         local newSpell = spell.english
  90.         local spell_recasts = windower.ffxi.get_spell_recasts()
  91.         local cancelling = 'All '..spell.english..' spells are on cooldown. Cancelling spell casting.'
  92.  
  93.         if spell_recasts[spell.recast_id] > 0 then
  94.             if sleeps:contains(spell.english) then
  95.                 if spell.english == 'Sleep' then
  96.                     add_to_chat(122,cancelling)
  97.                     eventArgs.cancel = true
  98.                 return
  99.                 elseif spell.english == 'Sleep II' then
  100.                     newSpell = 'Sleep'
  101.                 end
  102.             elseif sleepgas:contains(spell.english) then
  103.                 if spell.english == 'Sleepga' then
  104.                     add_to_chat(122,cancelling)
  105.                     eventArgs.cancel = true
  106.                     return
  107.                 elseif spell.english == 'Sleepga II' then
  108.                     newSpell = 'Sleepga'
  109.                 end
  110.             elseif nukes:contains(spell.english) then  
  111.                 if spell.english == 'Fire' then
  112.                     eventArgs.cancel = true
  113.                     return
  114.                 elseif spell.english == 'Fire VI' then
  115.                     newSpell = 'Fire V'
  116.                 elseif spell.english == 'Fire V' then
  117.                     newSpell = 'Fire IV'
  118.                 elseif spell.english == 'Fire IV' then
  119.                     newSpell = 'Fire III'  
  120.                 elseif spell.english == 'Fire II' then
  121.                     newSpell = 'Fire'
  122.                 elseif spell.english == 'Firaja' then
  123.                     newSpell = 'Firaga III'
  124.                 elseif spell.english == 'Firaga II' then
  125.                     newSpell = 'Firaga'
  126.                 end
  127.                 if spell.english == 'Blizzard' then
  128.                     eventArgs.cancel = true
  129.                     return
  130.                 elseif spell.english == 'Blizzard VI' then
  131.                     newSpell = 'Blizzard V'
  132.                 elseif spell.english == 'Blizzard V' then
  133.                     newSpell = 'Blizzard IV'
  134.                 elseif spell.english == 'Blizzard IV' then
  135.                     newSpell = 'Blizzard III'  
  136.                 elseif spell.english == 'Blizzard II' then
  137.                     newSpell = 'Blizzard'
  138.                 elseif spell.english == 'Blizzaja' then
  139.                     newSpell = 'Blizzaga III'
  140.                 elseif spell.english == 'Blizzaga II' then
  141.                     newSpell = 'Blizzaga'  
  142.                 end
  143.                 if spell.english == 'Aero' then
  144.                     eventArgs.cancel = true
  145.                     return
  146.                 elseif spell.english == 'Aero VI' then
  147.                     newSpell = 'Aero V'
  148.                 elseif spell.english == 'Aero V' then
  149.                     newSpell = 'Aero IV'
  150.                 elseif spell.english == 'Aero IV' then
  151.                     newSpell = 'Aero III'  
  152.                 elseif spell.english == 'Aero II' then
  153.                     newSpell = 'Aero'
  154.                 elseif spell.english == 'Aeroja' then
  155.                     newSpell = 'Aeroga III'
  156.                 elseif spell.english == 'Aeroga II' then
  157.                     newSpell = 'Aeroga'
  158.                 end
  159.                 if spell.english == 'Stone' then
  160.                     eventArgs.cancel = true
  161.                     return
  162.                 elseif spell.english == 'Stone VI' then
  163.                     newSpell = 'Stone V'
  164.                 elseif spell.english == 'Stone V' then
  165.                     newSpell = 'Stone IV'
  166.                 elseif spell.english == 'Stone IV' then
  167.                     newSpell = 'Stone III' 
  168.                 elseif spell.english == 'Stone II' then
  169.                     newSpell = 'Stone'
  170.                 elseif spell.english == 'Stoneja' then
  171.                     newSpell = 'Stonega III'
  172.                 elseif spell.english == 'Stonega II' then
  173.                     newSpell = 'Stonega'   
  174.                 end
  175.                 if spell.english == 'Thunder' then
  176.                     eventArgs.cancel = true
  177.                     return
  178.                 elseif spell.english == 'Thunder VI' then
  179.                     newSpell = 'Thunder V'
  180.                 elseif spell.english == 'Thunder V' then
  181.                     newSpell = 'Thunder IV'
  182.                 elseif spell.english == 'Thunder IV' then
  183.                     newSpell = 'Thunder III'   
  184.                 elseif spell.english == 'Thunder II' then
  185.                     newSpell = 'Thunder'
  186.                 elseif spell.english == 'Thundaja' then
  187.                     newSpell = 'Thundaga III'
  188.                 elseif spell.english == 'Thundaga II' then
  189.                     newSpell = 'Thundaga'  
  190.                 end
  191.                 if spell.english == 'Water' then
  192.                     eventArgs.cancel = true
  193.                     return
  194.                 elseif spell.english == 'Water VI' then
  195.                     newSpell = 'Water V'
  196.                 elseif spell.english == 'Water V' then
  197.                     newSpell = 'Water IV'
  198.                 elseif spell.english == 'Water IV' then
  199.                     newSpell = 'Water III' 
  200.                 elseif spell.english == 'Water II' then
  201.                     newSpell = 'Water'
  202.                 elseif spell.english == 'Waterja' then
  203.                     newSpell = 'Waterga III'
  204.                 elseif spell.english == 'Waterga II' then
  205.                     newSpell = 'Waterga'   
  206.                 end
  207.             end
  208.         end
  209.  
  210.         if newSpell ~= spell.english then
  211.             send_command('@input /ma "'..newSpell..'" '..tostring(spell.target.raw))
  212.             eventArgs.cancel = true
  213.             return
  214.         end
  215.     end
  216. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement