Advertisement
Guest User

Untitled

a guest
May 27th, 2018
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 49.00 KB | None | 0 0
  1. ----- Credit: Krystela of Asura | Last Update: 27 november 2016 ---->
  2. ---- .:: This was entirely created by me, it's not based off anyone's file ::. ---->
  3. ---- Always visit http://pastebin.com/u/KrystelaRose to look for possible updates ---->
  4. ---- .:: Please leave credit where it's due ::. ---->
  5. ---- .:: If you have any problem contact me via ffxiah: http://www.ffxiah.com/player/Asura/Krystela ::. ---->
  6.  
  7. function get_sets()
  8.         mote_include_version = 2
  9.  
  10.         -- Load and initialize the include file.
  11.         include('Mote-Include.lua')
  12. end
  13.  
  14. function user_setup()  
  15.                 define_nuke_downgrades()
  16. end
  17.  
  18. function define_nuke_downgrades()
  19.         t1              =       S{      'Stone',                'Water',                'Aero',                 'Fire',                 'Blizzard',             'Thunder'}
  20.         t2              =       S{      'Stone II',             'Water II',             'Aero II',              'Fire II',              'Blizzard II',  'Thunder II'}
  21.         t3              =       S{      'Stone III',    'Water III',    'Aero III',             'Fire III',             'Blizzard III', 'Thunder III'}
  22.         t4              =       S{      'Stone IV',             'Water IV',             'Aero IV',              'Fire IV',              'Blizzard IV',  'Thunder IV'}
  23.         t5              =       S{      'Stone V',              'Water V',              'Aero V',               'Fire V',               'Blizzard V',   'Thunder V'}
  24.         t6              =       S{      'Stone VI',             'Water VI',             'Aero VI',              'Fire VI',              'Blizzard VI',  'Thunder VI'}
  25.         ra1             =       S{      'Stonera',              'Watera',               'Aera',               'Fira',                 'Blizzara',             'Thundara'}
  26.         ra2             =       S{      'Stonera II',   'Watera II',    'Aera II',    'Fira II',              'Blizzara II',  'Thundara II'}
  27.         ra3             =       S{      'Stonera III',  'Watera III',   'Aera III',   'Fira III',             'Blizzara III', 'Thundara III'}
  28.         no_down =       S{      'Quake',                'Flood',                'Tornado',              'Flare',                'Freeze',               'Burst',
  29.                                         'Quake II',             'Flood II',             'Tornado II',   'Flare II',             'Freeze II',    'Burst II',
  30.                                         'Stonega',              'Waterga',              'Aeroga',               'Firaga',               'Blizzaga',             'Thundaga',
  31.                                         'Stonega II',   'Waterga II',   'Aeroga II',    'Firaga II',    'Blizzaga II',  'Thundaga II',
  32.                                         'Stonega III',  'Waterga III',  'Aeroga III',   'Firaga III',   'Blizzaga III', 'Thundaga III',
  33.                                         'Stoneja',              'Waterja',              'Aeroja',               'Firaja',               'Blizzaja',             'Thundaja',
  34.                                         'Rasp',                 'Drown',                'Choke',                'Burn',                 'Frost',                'Shock',
  35.                                         'Geohelix',             'Hydrohelix',   'Anemohelix',   'Pyrohelix',    'Cryohelix',    'Ionohelix',
  36.                                         'Luminohelix',  'Noctohelix',   'Comet',                'Meteor',               'Impact'}
  37.         aras    =       S{      'Stonera',              'Watera',               'Aera',               'Fira',                 'Blizzara',             'Thundara',
  38.                                         'Stonera II',   'Watera II',    'Aera II',    'Fira II',              'Blizzara II',  'Thundara II',
  39.                                         'Stonera III',  'Watera III',   'Aera III',   'Fira III',             'Blizzara III', 'Thundara III'}
  40. end
  41.  
  42. function job_unload()
  43.     send_command('unbind ^f1')
  44.     send_command('unbind ^f2')
  45.     send_command('unbind ^f3') 
  46.     send_command('unbind ^f9')     
  47.     send_command('unbind ^f10')
  48.     send_command('unbind ^f11')    
  49.     send_command('unbind `')
  50.     send_command('unbind !`')
  51. end
  52. function get_sets()
  53. -- Binds for modes
  54.     send_command('bind ^f1 gs c C1')
  55.     send_command('bind ^f9 gs c C9')       
  56.     send_command('bind ^f10 gs c C10')
  57.     send_command('bind ^f11 gs c C11')
  58. -- Binds for Mana wall and Enmity Douse -- 
  59.     send_command('bind ^f2 input /ja Mana wall <me>')
  60.     send_command('bind ^f3 input /ja Enmity Douse <t>')
  61.     send_command('bind ` input /ma Stun <t>; wait 0.5; input /p Casting STUN → «¶«<t>«¶«.')
  62.     send_command('bind !` input /ja "Sublimation" <me>')
  63.     send_command('bind !q input /ja "Klimaform" <me>')
  64.     send_command('bind !e input /ja "Alacrity" <me>')
  65.     send_command('@wait 5;input /lockstyleset 20')
  66. -- Auto Functions --
  67.     AutoRemedy = 'OFF' -- Set to ON if you want to auto use remedies if silenced or Paralyzed, otherwise set to OFF -- 
  68. -- Modes --
  69.     MagicIndex = 1
  70.     MagicArray = {"Normal","Death","Magic Burst"} -- Press ctrl + F1 to circle through Magic modes --
  71.     Defense = 'OFF' -- Press CTRL + F9 for Idle being set as Defense full time instead of refresh --   
  72.     WeaponLock = 'OFF' -- Press ctrl + F10 for Weapon/sub/Range Lock--
  73.     Capacity = 'OFF' -- Press Ctrl +F11 to have Capacity cape locked on while Idle, Change the cape at line 26 --
  74. -- Gears --
  75.     gear = {} -- Fill these --
  76.     gear.Capacity_Cape = {name="Mecisto. Mantle"} -- The cape you use for capacity --
  77.     gear.Manawall_Back = {name="Taranus's Cape"} -- Add Ambuscade Cape if you want to use it in idle/refresh when you have manawall on, it not leave {} empty --
  78.     gear.Manawall_Feet = {} -- Add Empy Feet if you want to use it in Idle/refresh when you have manawall on, it not leave {} empty -- 
  79.     gear.Refresh_Head = {name="Amalric Hood"} -- Add refresh effect + head if you want to use it, it not leave {} empty --
  80.     gear.ElementalConvert_Body = {name="Spae. Coat +1"} -- Add AF Body if you want to nuke in it under 50% MP, it not leave {} empty --
  81.     FC_Head = { name="Merlinic Hood", augments={'Mag. Acc.+11','"Fast Cast"+7','INT+9','"Mag.Atk.Bns."+13',}}
  82.     FC_Hands = {name="Merlinic Dastanas", augments={'"Fast Cast"+6','VIT+4','Mag. Acc.+2',}}
  83.     FC_Body= { name="Merlinic Jubbah", augments={'Accuracy+7','"Fast Cast"+7','"Mag.Atk.Bns."+12',}}
  84.     FC_Feet= { name="Merlinic Crackows", augments={'"Mag.Atk.Bns."+17','"Fast Cast"+5','INT+4','Mag. Acc.+14',}}
  85.     MBHead = { name="Merlinic Hood", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','Magic burst dmg.+8%','INT+6','Mag. Acc.+9','"Mag.Atk.Bns."+4',}}
  86.     MBFeet= { name="Merlinic Crackows", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','Magic burst dmg.+5%','INT+6','Mag. Acc.+5','"Mag.Atk.Bns."+15',}}
  87.     MBBody= { name="Merlinic Jubbah", augments={'Mag. Acc.+25 "Mag.Atk.Bns."+25','Magic burst dmg.+5%','INT+8','Mag. Acc.+15',}}
  88.     MBLegs= { name="Merlinic Shalwar", augments={'Mag. Acc.+24 "Mag.Atk.Bns."+24','Magic burst dmg.+9%',}}
  89.     MBHands= { name="Amalric Gages +1", augments={'INT+12','Mag. Acc.+20','"Mag.Atk.Bns."+20',}}
  90. -- Set macro book/set --
  91.     send_command('input /macro book 4;wait .1;input /macro set 1') -- set macro book/set here --   
  92.     -- Area mapping -- 
  93.     Town = S{"Ru'Lude Gardens","Upper Jeuno","Lower Jeuno","Port Jeuno","Port Windurst","Windurst Waters","Windurst Woods","Windurst Walls","Heavens Tower",
  94.              "Port San d'Oria","Northern San d'Oria","Southern San d'Oria","Port Bastok","Bastok Markets","Bastok Mines","Metalworks","Aht Urhgan Whitegate",
  95.              "Tavnazian Safehold","Nashmau","Selbina","Mhaura","Norg","Eastern Adoulin","Western Adoulin","Kazham","Heavens Tower"}
  96. ---- Precast ----
  97.     sets.precast = {}
  98.     -- Base Set --
  99.     sets.precast.FC = {
  100.         ammo="Sapience Orb",
  101.         head=FC_Head,
  102.         neck="Baetyl Pendant",
  103.         ear1="Loquac. Earring",
  104.         ear2="Enchntr. Earring +1",
  105.         body=FC_Body,
  106.         hands=FC_Hands,
  107.         ring1="Weatherspoon Ring",
  108.         ring2="Kishar ring",
  109.         back="Perimede Cape",
  110.         waist="Witful Belt",
  111.         legs="Psycloth Lappas",
  112.         feet=FC_Feet}
  113.     -- Healing Magic --
  114.     sets.precast.Cure = set_combine(sets.precast.FC, {})   
  115.     -- Enhancing Magic --  
  116.     sets.precast.Enhancing = set_combine(sets.precast.FC, {})
  117.     sets.precast['Stoneskin'] = set_combine(sets.precast.FC, {})
  118.     -- Elemental Magic --
  119.     sets.precast.Elemental = set_combine(sets.precast.FC, {})
  120.     sets.precast['Impact'] = set_combine(sets.precast.FC, { -- Make sure to leave the head empty --
  121.         head=empty,
  122.         body="Twilight Cloak"})
  123.     -- Death Toggle -- 
  124.     sets.precast.FC.Toggle = { -- Keep your mp the same or higher than the midcast death set --
  125.         ammo="Psilomene",
  126.         head=FC_Head,
  127.         neck="Baetyl Pendane",
  128.         ear1="Loquac. Earring",
  129.         ear2="Enchntr. Earring +1",
  130.         body=FC_Body,
  131.         hands=FC_Hands,
  132.         ring1="Mephitas's Ring +1",
  133.         ring2="Mephitas's Ring",
  134.         back="Bane Cape",
  135.         waist="Witful Sash",
  136.         legs="Psycloth Lappas",
  137.         feet=FC_Feet}  
  138.     -- Job Abilities --
  139.     sets.JA = {}
  140.     sets.JA['Manafont'] = {}
  141.     -- Weaponskills --
  142.     sets.WS = {}
  143.     sets.WS['Myrkr'] = {
  144.         ammo="Psilomene",
  145.         head="Pixie Hairpin +1",
  146.         neck="Dualism Collar +1",
  147.         ear1="Gifted Earring",
  148.         ear2="Etiolation Earring",
  149.         body="Weather. Robe +1",
  150.         hands="Otomi Gloves",
  151.         ring1="Mephitas's Ring +1",
  152.         ring2="Mephitas's Ring",
  153.         back="Bane Cape",
  154.         waist="Shinjutsu-no-Obi +1",
  155.         legs="Amalric Slops",
  156.         feet="Psycloth Boots"}
  157. ---- Midcast ----      
  158.     sets.midcast = {}
  159.     -- Base Set --
  160.     sets.midcast.Recast = {
  161.         ammo="Sapience Orb",
  162.         head="Amalric Coif",
  163.         neck="Baetyl Pendan",
  164.         ear1="Loquac. Earring",
  165.         ear2="Enchntr. Earring +1",
  166.         body={ name="Merlinic Jubbah", augments={'"Fast Cast"+6',}},
  167.         hands={ name="Merlinic Dastanas", augments={'"Fast Cast"+6','DEX+10','Accuracy+19 Attack+19','Mag. Acc.+11 "Mag.Atk.Bns."+11',}},
  168.         ring1="Weatherspoon Ring",
  169.         back="Bane Cape",
  170.         waist="Witful Belt",
  171.         legs="Psycloth Lappas",
  172.         feet="Merlinic crackows"}
  173.     -- Healing Magic --
  174.     sets.midcast.Cure = {  
  175.         head="Vanya Hood",
  176.         neck="Incanter's Torque",  
  177.         ear1="Healing Earring",
  178.         ear2="Beatific Earring",
  179.         body="Heka's Kalasiris",
  180.         hands="Vanya Cuffs",
  181.         ring1="Sirona's Ring",
  182.         ring2="Haoma's Ring",
  183.         back="Tempered Cape +1",
  184.         waist="Luminary Sash",
  185.         legs="Vanya Slops",
  186.         feet="Vanya Clogs"}
  187.     sets.midcast.Cure.WeaponLock = set_combine(sets.midcast.Cure, {})  
  188.     -- Enhancing Magic --      
  189.     sets.midcast.Duration = set_combine(sets.midcast.Recast, {  -- Duration for haste/Refresh --
  190.         head="Telchine Cap",
  191.         body="Telchine Chas.",
  192.         hands="Telchine Gloves",       
  193.         legs="Telchine Braconi",
  194.         feet="Telchine Pigaches"})     
  195.     sets.midcast['Phalanx'] = set_combine(sets.midcast.Duration, { -- As much skill as possible for Phalanx --
  196.         head="Befouled Crown", 
  197.         neck="Incanter's Torque",  
  198.         ear1="Andoaa Earring",
  199.         ear2="Augmenting Earring",
  200.         body="Telchine Chasuble",
  201.         ring1="Stikini Ring +1",
  202.         ring2="Stikini Ring +1",       
  203.         back="Perimede Cape",      
  204.         feet="Regal Pumps +1"})    
  205.     sets.midcast['Stoneskin'] = set_combine(sets.midcast.Duration, {}) 
  206.     sets.midcast['Aquaveil'] = set_combine(sets.midcast.Duration, {head="Amalric Coif"})   
  207.     -- Death Toggle -- 
  208.     sets.midcast.Duration.Toggle = set_combine(sets.midcast.Recast, { -- Duration for Haste/Refresh in Death mode, so keep your MP High --
  209.         ammo="Psilomene",
  210.         head="Telchine Cap",
  211.         ear2="Enchntr. Earring +1",
  212.         body="Telchine Chasuble",
  213.         hands="Telchine Gloves",
  214.         ring1="Mephitas's Ring +1",
  215.         ring2="Mephitas's Ring",
  216.         back="Bane Cape",
  217.         waist="Shinjutsu-no-Obi",
  218.         legs="Telchine Braconi",
  219.         feet="Telchine Pigaches"}) 
  220. -- Enfeebling Magic -- 
  221.     sets.midcast.Enfeebling = { -- Full skill set for frazzle/distract/Poison --
  222.         main="Grioavolr",
  223.         --main={ name="Grioavolr", augments={'"Conserve MP"+1','INT+2','Mag. Acc.+30',}},
  224.         sub="Clerisy Strap +1",
  225.         ammo="Pemphredo Tathlum",
  226.         head="Amalric Coif",       
  227.         neck="Incanter's Torque",          
  228.         ear1="Dignitary's Earring",
  229.         ear2="Gwati Earring",
  230.         body={ name="Merlinic Jubbah", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','Mag. Acc.+15',}},
  231.         hands="Jhakri Cuffs +1",
  232.         ring1="Stikini Ring +1",
  233.         ring2="Stikini Ring +1",
  234.         back="Nantosuelta's Cape",
  235.         waist="Luminary Sash",
  236.         legs="Psycloth Lappas",
  237.         feet="Skaoi Boots"}
  238.     sets.midcast.Enfeebling.Macc = set_combine(sets.midcast.Enfeebling, {}) -- For Silence/Dispel/Sleep/Break/Gravity that arent affect by full enfeeb set or effect + gears --
  239.     sets.midcast.Enfeebling.MND = set_combine(sets.midcast.Enfeebling, {}) -- For Paralyze/Slow who's potency/macc is enhanced by MND --
  240.     sets.midcast.Enfeebling.INT = set_combine(sets.midcast.Enfeebling, {})  -- For Blind/Bind who's Macc is enhanced by INT --
  241.     -- Dark Magic --
  242.     sets.midcast.Bio = set_combine(sets.midcast.Recast, { -- For Bio, you want a full Dark magic skill set for potency --
  243.         neck="Incanter's Torque",
  244.         body="Vanya Robe",
  245.         ring1="Stikini Ring +1",
  246.         ring2="Stikini Ring +1",
  247.         back="Bane Cape"})
  248.     sets.midcast.Dark = set_combine(sets.midcast.Recast, { -- For Aspir/Drain --
  249.         head="Pixie Hairpin +1",
  250.         neck="Incanter's Torque",
  251.         body="Vanya Robe",
  252.         ring1="Evanescence Ring",
  253.         ring2="Stikini Ring +1",
  254.         waist="Fucho-no-obi",
  255.         back="Bane Cape",
  256.         legs="Merlinic Shalwar",
  257.         feet="Merlinic Crackows"})
  258.     sets.midcast['Stun'] = set_combine(sets.midcast.Recast, {
  259.         neck="Erra pendant",
  260.         ring1="Stikini Ring +1",
  261.         ring2="Stikini Ring +1"})
  262.     sets.midcast.Death = { -- Normal Nuke --
  263.         ammo="Psilomene",
  264.         head="Pixie Hairpin +1",
  265.         neck="Mizukage-no-kubikazari",
  266.         ear1="Barkarole Earring",
  267.         ear2="Static Earring",
  268.         body="Amalric Doublet",    
  269.         hands=MBHands,
  270.         ring1="Mephitas's Ring +1",
  271.         ring2="Archon Ring",
  272.         back={ name="Taranus's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','"Mag.Atk.Bns."+10',}},
  273.         waist="Refoccilation Stone",
  274.         legs="Amalric Slops",
  275.         feet="Amalric Nails"}
  276.     sets.midcast.Death.MB = set_combine(sets.midcast.Death, { -- For when MB mode is turned on --
  277.         ear2="Static Earring",
  278.         ring1="Mujin Band"})   
  279.     sets.midcast.Death.Weather = set_combine(sets.midcast.Death, { -- For when weather/day is on, normal mode --
  280.         --back="Twilight Cape",
  281.         waist="Hachirin-no-Obi"})  
  282.     sets.midcast.Death.MB.Weather = set_combine(sets.midcast.Death.MB, { -- For when MB mode is turned on and weather/day is on --
  283.         ring1="Locus Ring",
  284.         waist="Hachirin-no-Obi"})
  285.         --back="Twilight Cape",
  286.            
  287.     -- Death Toggle -- 
  288.     sets.midcast.Dark.Toggle = {
  289.         ammo="psilomene",
  290.         head="Amalric Coif",
  291.         neck="Baetyl Pendan",
  292.         ear1="Loquac. Earring",
  293.         ear2="Etiolation Earring",
  294.         body="Vanya Robe",
  295.         hands=MBHands,
  296.         ring1="Stikini Ring +1",
  297.         ring2="Mephitas's Ring +1",
  298.         back="Bane Cape",
  299.         waist="Shinjutsu-no-Obi",
  300.         legs="Merlinic Shalwar",
  301.         feet="Merlinic Crackows"}  
  302.     sets.midcast.Death.Toggle = { -- Put MB% gears in here --
  303.         ammo="Psilomene",
  304.         head="Pixie Hairpin +1",
  305.         neck="Mizukage-no-kubikazari",
  306.         ear1="Barkarole Earring",
  307.         ear2="Friomisi Earring",
  308.         body="Amalric Doublet",    
  309.         hands=MBHands,
  310.         ring1="Mephitas's Ring +1",
  311.         ring2="Archon Ring",
  312.         back="Bane Cape",
  313.         waist="Refoccilation Stone",
  314.         legs="Amalric Slops",
  315.         feet="Amalric Nails"}          
  316.     sets.midcast.Death.Weather.Toggle = set_combine(sets.midcast.Death.Toggle, { -- For when weather is on --  
  317.         waist="Hachirin-no-Obi"})  
  318.     -- Elemental Magic --
  319.     sets.midcast.Elemental = { -- Normal Nukes --
  320.         main="Lathi",
  321.         ammo="Pemphredo Tathlum",      
  322.         sub="Enki Strap",
  323.         ammo="Pemphredo Tathlum",
  324.         head=MBHead,
  325.         body=MBBody,
  326.         legs=MBLegs,
  327.         hands=MBHands,
  328.         feet=MBFeet,
  329.         neck="Mizu. Kubikazari",
  330.         waist="Yamabuki-no-Obi",
  331.         left_ear="Barkarole Earring",
  332.         right_ear="Friomisi Earring",
  333.         ring1="Stikini ring +1",
  334.         ring2="Shiva Ring +1",
  335.         back={ name="Taranus's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','"Mag.Atk.Bns."+10',}}}
  336.     sets.midcast.Elemental.MB = set_combine(sets.midcast.Elemental, { -- For when MB mode is turned on --
  337.         --ring1="Locus Ring",
  338.         ring1="Mujin Band"})       
  339.     sets.midcast.Elemental.Weather = set_combine(sets.midcast.Elemental, { -- For normal nukes with weather on/appropriate day --
  340.         back="Twilight Cape",
  341.         waist="Hachirin-no-Obi"})  
  342.     sets.midcast.Elemental.MB.Weather = set_combine(sets.midcast.Elemental.MB, { -- For MB nukes with weather on/appropriate day --
  343.         ear2="Static Earring",
  344.         back="Twilight Cape",
  345.         waist="Hachirin-no-Obi"})          
  346.     sets.midcast['Impact'] = set_combine(sets.midcast.Elemental, {  -- Make sure to leave the head empty --
  347.         head=empty,
  348.         body="Twilight Cloak"})    
  349.     sets.midcast.Comet =  { -- This is normal Comet -- 
  350.         ammo="Pemphredro Tatlhum",
  351.         head="Pixie Hairpin +1",
  352.         neck="Mizukage-no-Kubikazari",
  353.         ear1="Barkarole Earring",
  354.         ear2="Friomisi Earring",
  355.         body={ name="Merlinic Jubbah", augments={'"Mag.Atk.Bns."+29','Magic burst mdg.+11%','INT+7',}},
  356.         hands=MBHands,
  357.         ring1="Stikini Ring +1",
  358.         ring2="Archon Ring",
  359.         back={ name="Taranus's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','"Mag.Atk.Bns."+10',}},
  360.         waist="Refoccilation",
  361.         legs="Merlinic Shalwar",
  362.         feet={ name="Merlinic Crackows", augments={'"Mag.Atk.Bns."+27','Magic burst mdg.+9%',}}}
  363.     sets.midcast.Comet.MB = set_combine(sets.midcast.Comet, {
  364.         ear2="Static Earring",
  365.         ring1="Mujin Band"})           
  366.     sets.midcast.Comet.Weather = set_combine(sets.midcast.Comet, {
  367.         back="Twilight Cape",
  368.         waist="Hachirin-no-Obi"})  
  369.     sets.midcast.Comet.MB.Weather = set_combine(sets.midcast.Comet.MB, {
  370.         ring1="Locus Ring",
  371.         back="Twilight Cape",
  372.         waist="Hachirin-no-Obi"})      
  373.     -- Death Toggle --
  374.     sets.midcast.Comet.Toggle =  { -- This is death toggle Comet, keep the MP high --  
  375.         ammo="Psilomene",
  376.         head="Pixie Hairpin +1",
  377.         neck="Mizukage-no-kubikazari",
  378.         ear1="Barkarole Earring",
  379.         ear2="Static Earring",
  380.         body=MBBody,   
  381.         hands=MBHands,
  382.         ring1="Mephitas's Ring +1",
  383.         ring2="Archon Ring",
  384.         back={ name="Taranus's Cape", augments={'MP+60','Mag. Acc+20 /Mag. Dmg.+20','MP+12','"Mag.Atk.Bns."+10',}},
  385.         waist="Refoccilation Stone",
  386.         legs="Amalric Slops",
  387.         feet="Amalric Nails"}
  388.     sets.midcast.Comet.Weather.Toggle = set_combine(sets.midcast.Comet.Toggle, { -- This is death toggle Comet when weather/day is on , keep the MP high --
  389.         waist="Hachirin-no-Obi"})  
  390.        
  391.     sets.midcast['Apururu (UC)'] = set_combine(sets.midcast.FastRecast, {body="Apururu Unity Shirt"})
  392. ---- Aftercast ----
  393.     sets.aftercast = {}
  394.     sets.aftercast.Idle = { -- Your movement speed goes here, mix of PDT/Refresh --
  395.         ammo="Staunch Tathlum +1", 
  396.         head="Befouled Crown",         
  397.         neck="Loricate Torque +1",
  398.         ear1="Etiolation Earring",
  399.         ear2="Genmei Earring",
  400.         body="Jhakri Robe +2",
  401.         hands=MBHands,
  402.         left_ring="Defending Ring",
  403.         right_ring="Mephitas's ring +1",       
  404.         back={ name="Taranus's Cape", augments={'MP+60','Mag. Acc+20 /Mag. Dmg.+20','MP+12','"Mag.Atk.Bns."+10',}},
  405.         waist="Slipor Sash",
  406.         legs="Assid. Pants +1",
  407.         feet="Herald's Gaiters"}
  408.     sets.aftercast.Refresh = set_combine(sets.aftercast.Idle, { -- Refresh gears goes here --
  409.         ear1="Moonshade Earring",
  410.         ring1="Stikini Ring +1",
  411.         ring2="Stikini Ring +1",
  412.         feet="Serpentes Sabots"})      
  413.     sets.aftercast.Latent = {waist="Fucho-no-obi"}
  414.     sets.aftercast.Defense = set_combine(sets.aftercast.Idle, { -- For when you want you idle as full time PDT --
  415.         ear1="Etiolation Earring",
  416.         feet="Merlinic Crackows"})     
  417.     sets.aftercast.Town = {
  418.         main={ name="Lathi", augments={'MP+80','INT+20','"Mag.Atk.Bns."+20',}},
  419.         sub="Enki Strap",
  420.         ammo="Psilomene",
  421.         head={ name="Merlinic Hood", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','Magic burst dmg.+8%','INT+6','Mag. Acc.+9','"Mag.Atk.Bns."+4',}},
  422.         body={ name="Merlinic Jubbah", augments={'Mag. Acc.+25 "Mag.Atk.Bns."+25','Magic burst dmg.+5%','INT+8','Mag. Acc.+15',}},
  423.         hands={ name="Amalric Gages +1", augments={'INT+12','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
  424.         legs={ name="Merlinic Shalwar", augments={'Mag. Acc.+24 "Mag.Atk.Bns."+24','Magic burst dmg.+9%',}},
  425.         feet="Herald's Gaiters",
  426.         neck="Mizu. Kubikazari",
  427.         waist="Yamabuki-no-Obi",
  428.         left_ear="Barkaro. Earring",
  429.         right_ear="Static Earring",
  430.         left_ring="Shiva Ring +1",
  431.         right_ring="Mujin Band",
  432.         back={ name="Taranus's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','"Mag.Atk.Bns."+10',}}}
  433.     -- Death Toggle -- 
  434.     sets.aftercast.Idle.Death = { -- Same MP as your death set with refresh/pdt gears --
  435.         ammo="Psilomene",
  436.         head="Befouled Crown",         
  437.         neck="Dualism Collar +1",
  438.         ear1="Moonshade Earring",
  439.         ear2="Etiolation Earring",
  440.         body="Jhakri Robe +2",
  441.         hands=MBHands,
  442.         ring1="Mephitas's Ring +1",
  443.         ring2="Mephitas's Ring",       
  444.         back="Bane Cape",
  445.         waist="Fucho-no-obi",
  446.         legs="Assid. Pants +1",
  447.         feet="Amalric Nails"}  
  448.     sets.resting = set_combine(sets.aftercast.Refresh, {})
  449. ---- Melee ----
  450.     sets.engaged = {}  
  451. end    
  452. ---- .::Pretarget Functions::. ---->
  453. function pretarget(spell,action)
  454.     -- Auto Remedy --
  455.     if AutoRemedy == 'ON' then
  456.         if buffactive['Silence'] or buffactive['Paralysis'] then
  457.             if spell.action_type == 'Magic' or spell.type == 'JobAbility' then  
  458.                 cancel_spell()
  459.                 send_command('input /item "Remedy" <me>')
  460.             end            
  461.         end
  462.     end
  463. end
  464. ---- .::Precast Functions::. ---->
  465. function precast(spell)
  466.     if spell.action_type == 'Magic' then
  467.         -- Death Toggle -- 
  468.         if MagicArray[MagicIndex] == 'Death' then
  469.             equip(sets.precast.FC.Toggle)  
  470.         -- Healing Magic --
  471.         elseif string.find(spell.english, 'Cure') or string.find(spell.english, 'Cura') then
  472.             equip(sets.precast.Cure)
  473.         -- Enhancing Magic --  
  474.         elseif spell.skill == 'Enhancing Magic' then
  475.             equip(sets.precast.Enhancing)
  476.         -- Elemental Magic --  
  477.         elseif spell.skill == 'Elemental Magic' then
  478.             if spell.english == 'Impact' then
  479.                 equip(sets.precast[spell.english])
  480.             else   
  481.                 equip(sets.precast.Elemental)
  482.             end
  483.         -- Everything that have a specific name set -- 
  484.         elseif sets.precast[spell.english] then
  485.             equip(sets.precast[spell.english])             
  486.         -- Everything else that doesn't have a specific set for it --          
  487.         else
  488.             equip(sets.precast.FC)
  489.         end
  490.     -- Job Abilities --
  491.     elseif spell.type == 'JobAbility' then
  492.         equip(sets.JA[spell.english])  
  493.     -- Weaponskills --
  494.     elseif spell.type == 'WeaponSkill' then
  495.         if sets.WS[spell.english] then 
  496.             equip(sets.WS[spell.english])
  497.         else
  498.             equip(sets.WS)
  499.         end
  500.     end    
  501. end
  502.  
  503. function job_precast(spell, action, spellMap, eventArgs)
  504.         refine_nukes(spell, action, spellMap, eventArgs)
  505.         refine_various_spells(spell, action, spellMap, eventArgs)
  506.  
  507. end
  508.  
  509. function refine_various_spells(spell, action, spellMap, eventArgs)
  510.         aspirs = S{'Aspir','Aspir II','Aspir III'}
  511.         sleeps = S{'Sleep','Sleep II'}
  512.         sleepgas = S{'Sleepga','Sleepga II'}
  513.  
  514.         if not sleepgas:contains(spell.english) and not sleeps:contains(spell.english) and not aspirs:contains(spell.english) then
  515.                 return
  516.         end
  517.  
  518.         local newSpell = spell.english
  519.         local spell_recasts = windower.ffxi.get_spell_recasts()
  520.         local cancelling = 'All '..spell.english..' spells are on cooldown. Cancelling spell casting.'
  521.  
  522.         if spell_recasts[spell.recast_id] > 0 then
  523.                 if aspirs:contains(spell.english) then
  524.                         if spell.english == 'Aspir' then
  525.                                 add_to_chat(122,cancelling)
  526.                                 eventArgs.cancel = true
  527.                                 return
  528.                         elseif spell.english == 'Aspir II' then newSpell = 'Aspir'
  529.                         elseif spell.english == 'Aspir III' then newSpell = 'Aspir II'
  530.                         end                    
  531.                 elseif sleeps:contains(spell.english) then
  532.                         if spell.english == 'Sleep' then
  533.                                 add_to_chat(122,cancelling)
  534.                                 eventArgs.cancel = true
  535.                                 return
  536.                         elseif spell.english == 'Sleep II' then newSpell = 'Sleep'
  537.                         end
  538.                 elseif sleepgas:contains(spell.english) then
  539.                         if spell.english == 'Sleepga' then
  540.                                 add_to_chat(122,cancelling)
  541.                                 eventArgs.cancel = true
  542.                                 return
  543.                         elseif spell.english == 'Sleepga II' then newSpell = 'Sleepga'
  544.                         end
  545.                 end
  546.         end
  547.  
  548.         if newSpell ~= spell.english then
  549.                 send_command('@input /ma "'..newSpell..'" '..tostring(spell.target.raw))
  550.                 eventArgs.cancel = true
  551.                 return
  552.         end
  553. end
  554.  
  555. ---- .::Midcast Functions::. ---->
  556. function midcast(spell)
  557.     if spell.action_type == 'Magic' then   
  558.         -- Healing Magic --
  559.         if string.find(spell.english, 'Cure') or string.find(spell.english, 'Cura') then
  560.             if WeaponLock == 'ON' then
  561.                 equip(sets.midcast.Cure.WeaponLock)        
  562.             else
  563.                 equip(sets.midcast.Cure)
  564.             end            
  565.         -- Enhancing Magic --      
  566.         elseif string.find(spell.english, 'Haste') then
  567.             if MagicArray[MagicIndex] == 'Death' then
  568.                 equip(sets.midcast.Duration.Toggle)
  569.             else
  570.                 equip(sets.midcast.Duration)           
  571.             end
  572.         elseif string.find(spell.english, 'Refresh') then
  573.             if MagicArray[MagicIndex] == 'Death' then
  574.                 equip(sets.midcast.Duration.Toggle)
  575.             else
  576.                 equip(sets.midcast.Duration, {head=gear.Refresh_Head})         
  577.             end
  578.         -- Enfeebling Magic --         
  579.         elseif string.find(spell.english, 'Frazzle') or string.find(spell.english, 'Distract') or string.find(spell.english, 'Poison') then            
  580.             equip(sets.midcast.Enfeebling)         
  581.         elseif string.find(spell.english, 'Dispel') or string.find(spell.english, 'Silence') or string.find(spell.english, 'Sleep') or string.find(spell.english, 'Break') or string.find(spell.english, 'Gravity')  then
  582.             equip(sets.midcast.Enfeebling.Macc)
  583.         elseif string.find(spell.english, 'Paralyze') or string.find(spell.english, 'Slow') or string.find(spell.english, 'Addle') then
  584.             equip(sets.midcast.Enfeebling.MND)         
  585.         elseif string.find(spell.english, 'Blind') or spell.english == 'Bind' then
  586.             equip(sets.midcast.Enfeebling.INT)             
  587.         -- Dark Magic --
  588.         elseif string.find(spell.english, 'Bio') then
  589.             equip(sets.midcast.Bio)            
  590.         elseif string.find(spell.english, 'Aspir') or string.find(spell.english, 'Drain') then
  591.             if MagicArray[MagicIndex] == 'Death' then
  592.                 equip(sets.midcast.Dark.Toggle)
  593.             else   
  594.                 equip(sets.midcast.Dark)
  595.             end            
  596.         elseif spell.english == 'Death' then   
  597.             if MagicArray[MagicIndex] == 'Death' then
  598.                 if spell.english == 'Death' then
  599.                     if world.weather_element == "Dark" or world.day_element == "Darksday" then                 
  600.                         equip(sets.midcast.Death.Weather.Toggle)
  601.                     else
  602.                         equip(sets.midcast.Death.Toggle)
  603.                     end
  604.                 end                
  605.             elseif MagicArray[MagicIndex] == 'Magic Burst' then
  606.                 if spell.english == 'Death' then
  607.                     if world.weather_element == "Dark" or world.day_element == "Darksday" then
  608.                         equip(sets.midcast.Death.MB.Weather)   
  609.                     else
  610.                         equip(sets.midcast.Death.MB)                   
  611.                     end
  612.                 end            
  613.             elseif world.weather_element == "Dark" or world.day_element == "Darksday" then
  614.                 equip(sets.midcast.Death.Weather)
  615.             else   
  616.                 equip(sets.midcast.Death)              
  617.             end                                
  618. -- Elemental Magic --      
  619.         elseif spell.skill == 'Elemental Magic' then
  620.             if spell.english == 'Impact' then
  621.                 equip(sets.midcast['Impact'])  
  622.             elseif MagicArray[MagicIndex] == 'Death' then
  623.                 if spell.english == 'Comet' then
  624.                     if spell.element == world.weather_element or spell.element == world.day_element then
  625.                         if player.mpp <50 then                 
  626.                             equip(sets.midcast.Comet.Weather.Toggle, {body=gear.ElementalConvert_Body})
  627.                         else
  628.                             equip(sets.midcast.Comet.Weather.Toggle)
  629.                         end
  630.                     else
  631.                         equip(sets.midcast.Comet.Toggle)
  632.                     end
  633.                 elseif spell.element == world.weather_element or spell.element == world.day_element then
  634.                     if player.mpp <50 then                 
  635.                         equip(sets.midcast.Elemental.MB.Weather, {body=gear.ElementalConvert_Body})
  636.                     else
  637.                         equip(sets.midcast.Elemental.MB.Weather)
  638.                     end
  639.                 else
  640.                     equip(sets.midcast.Elemental.MB)
  641.                 end                                                
  642.             elseif MagicArray[MagicIndex] == 'Magic Burst' then
  643.                 if spell.english == 'Comet' then           
  644.                     if spell.element == world.weather_element or spell.element == world.day_element then
  645.                         if player.mpp <50 then 
  646.                             equip(sets.midcast.Comet.MB.Weather, {body=gear.ElementalConvert_Body})
  647.                         else
  648.                             equip(sets.midcast.Comet.MB.Weather)                       
  649.                         end
  650.                     else
  651.                         equip(sets.midcast.Comet.MB)
  652.                     end
  653.                 elseif spell.element == world.weather_element or spell.element == world.day_element then    
  654.                     if player.mpp <50 then                 
  655.                         equip(sets.midcast.Elemental.MB.Weather, {body=gear.ElementalConvert_Body})
  656.                     else
  657.                         equip(sets.midcast.Elemental.MB.Weather)
  658.                     end
  659.                 else
  660.                     equip(sets.midcast.Elemental.MB)
  661.                 end
  662.             elseif spell.english == 'Comet' then           
  663.                 if spell.element == world.weather_element or spell.element == world.day_element then
  664.                     if player.mpp <50 then 
  665.                         equip(sets.midcast.Comet.Weather, {body=gear.ElementalConvert_Body})
  666.                     else
  667.                         equip(sets.midcast.Comet.Weather)                      
  668.                     end
  669.                 else
  670.                     equip(sets.midcast.Comet)
  671.                 end                
  672.             elseif spell.element == world.weather_element or spell.element == world.day_element then  
  673.                 if player.mpp <50 then
  674.                     equip(sets.midcast.Elemental.Weather, {body=gear.ElementalConvert_Body})
  675.                 else   
  676.                     equip(sets.midcast.Elemental.Weather)
  677.                 end
  678.             else
  679.                 equip(sets.midcast.Elemental)
  680.             end
  681.         -- Everything that have a specific name set -- 
  682.         elseif sets.midcast[spell.english] then
  683.             equip(sets.midcast[spell.english])             
  684.         -- Everything else that doesn't have a specific set for it --
  685.         else
  686.             equip(sets.midcast.Recast)     
  687.         end
  688.     end
  689. end    
  690.  
  691. function job_aftercast(spell, action, spellMap, eventArgs)
  692.         if not spell.interrupted then
  693.                 if spell.english:startswith('Indi') then
  694.                         if not classes.CustomIdleGroups:contains('Indi') then
  695.                                 classes.CustomIdleGroups:append('Indi')
  696.                         end
  697.                         send_command('@timers d "'..indi_timer..'"')
  698.                         indi_timer = spell.english
  699.                         send_command('@timers c "'..indi_timer..'" '..indi_duration..' down spells/00136.png')
  700.                 elseif spell.english == 'Sleep' or spell.english == 'Sleepga' then
  701.                         send_command('@timers c "'..spell.english..' ['..spell.target.name..']" 60 down spells/00220.png')
  702.                 elseif spell.english == 'Sleep II' or spell.english == 'Sleepga II' then
  703.                         send_command('@timers c "'..spell.english..' ['..spell.target.name..']" 90 down spells/00220.png')
  704.                 end
  705.         elseif not player.indi then
  706.                 classes.CustomIdleGroups:clear()
  707.         end
  708. end
  709. ---- .::Aftercast Functions::. ---->
  710. function aftercast(spell,action)
  711.     status_change(player.status)   
  712. end
  713. ---- .::Status Changes Functions::. ---->
  714. function status_change(new,tab,old)
  715.     -- Idle --
  716.     if new == 'Idle' then
  717.         if MagicArray[MagicIndex] == 'Death' then
  718.             equip(sets.aftercast.Idle.Death)
  719.         elseif buffactive[437] then
  720.             equip(sets.aftercast.Refresh, {back=gear.Manawall_Back, feet=gear.Manawall_Feet})      
  721.         elseif Defense == 'ON' then
  722.             equip(sets.aftercast.Defense)
  723.         elseif Town:contains(world.zone) then  
  724.             equip(sets.aftercast.Town)
  725.         elseif player.mpp <70 then
  726.             equip(sets.aftercast.Refresh)
  727.         elseif player.mpp < 51 then
  728.             equip(sets.aftercast.Latent)
  729.         else
  730.             equip(sets.aftercast.Idle)
  731.         end
  732.     -- Resting --  
  733.     elseif new == 'Resting' then
  734.         equip(sets.Resting)
  735.     -- Engaged --      
  736.     elseif new == 'Engaged' then   
  737.         equip(sets.engaged)
  738.     end    
  739. end
  740. --- ..:: Modes functions ::.. --->
  741. function self_command(command) 
  742.     status_change(player.status)
  743.     -- Magic --
  744.     if command == 'C1' then        
  745.         MagicIndex = (MagicIndex % #MagicArray) + 1
  746.         add_to_chat(158,'Magic Set: ' .. MagicArray[MagicIndex])
  747.     -- Defense --  
  748.     elseif command == 'C9' then
  749.         if Defense == 'ON' then
  750.             Defense = 'OFF'            
  751.             add_to_chat(123,'Defense Idle Set: [OFF]')
  752.         else
  753.             Defense = 'ON' 
  754.             equip(sets.aftercast.Defense)          
  755.             add_to_chat(158,'Defense Idle Set: [ON]')
  756.         end
  757.     -- Weapon Lock --      
  758.     elseif command == 'C10' then
  759.         if WeaponLock == 'ON' then
  760.             WeaponLock = 'OFF'
  761.             enable('main', 'sub' ,'range')             
  762.             add_to_chat(123,'Weapon Lock Set: [OFF]')
  763.         else
  764.             WeaponLock = 'ON'
  765.             disable('main', 'sub' ,'range')        
  766.             add_to_chat(158,'Weapon Lock Set: [ON]')
  767.         end
  768.     -- Capacity --     
  769.     elseif command == 'C11' then
  770.         if Capacity == 'ON' then
  771.             Capacity = 'OFF'
  772.             enable('back')             
  773.             add_to_chat(123,'Capacity Cape Set: [OFF]')
  774.         else
  775.             Capacity = 'ON'
  776.             equip({back=gear.Capacity_Cape})
  777.             disable('back')
  778.             add_to_chat(158,'Capacity Cape Set: [ON]')
  779.         end
  780.     end
  781. end
  782. -- Automatically changes Idle gears if you zone in or out of town --
  783. windower.register_event('zone change', function()
  784.     status_change(player.status)
  785.     if Town:contains(world.zone) then  
  786.         equip(sets.aftercast.Town)
  787.     else
  788.         equip(sets.aftercast.Idle)     
  789.     end
  790. end)
  791. -- Will make gears change the seconds you use Manawall --
  792. function buff_change(buff,gain)
  793.     if midaction() then
  794.         return
  795.     else   
  796.         status_change(player.status)
  797.     end    
  798. end
  799.  
  800. function refine_nukes(spell, action, spellMap, eventArgs)
  801.         local nuke_mp_cost = {  ['Stone'] = 4, ['Stone II'] = 16, ['Stone III'] = 46, ['Stone IV'] = 88,                          ['Stone V'] = 135,                      ['Stone VI'] = 237,
  802.                                                         ['Water'] = 5, ['Water II'] = 19, ['Water III'] = 46, ['Water IV'] = 99,                          ['Water V'] = 175,                      ['Water VI'] = 266,
  803.                                                         ['Aero'] = 6, ['Aero II'] = 22, ['Aero III'] = 54, ['Aero IV'] = 115,                     ['Aero V'] = 198,                        ['Aero VI'] = 299,
  804.                                                         ['Fire'] = 7, ['Fire II'] = 26, ['Fire III'] = 63, ['Fire IV'] = 135,                     ['Fire V'] = 228,                        ['Fire VI'] = 339,
  805.                                                         ['Blizzard'] = 8, ['Blizzard II'] = 31, ['Blizzard III'] = 75, ['Blizzard IV'] = 162,  ['Blizzard V'] = 267,   ['Blizzard VI'] = 386,
  806.                                                         ['Thunder'] = 9, ['Thunder II'] = 37, ['Thunder III'] = 91, ['Thunder IV'] = 195,   ['Thunder V'] = 306,        ['Thunder VI'] = 437,
  807.                                                         ['Stonera'] = 54, ['Stonera II'] = 143, ['Stonera III'] = 276,
  808.                                                         ['Watera'] = 66, ['Watera II'] = 163, ['Watera III'] = 312,
  809.                                                         ['Aera'] = 79, ['Aera II'] = 184, ['Aera III'] = 350,
  810.                                                         ['Fira'] = 93, ['Fira II'] = 206, ['Fira III'] = 390,
  811.                                                         ['Blizzara'] = 108, ['Blizzara II'] = 229, ['Blizzara III'] = 432,
  812.                                                         ['Thundara'] = 123, ['Thundara II'] = 253, ['Thundara III'] = 476,}
  813.  
  814.         if spell.skill ~= 'Elemental Magic' or no_down:contains(spell.english) then
  815.                 return
  816.         end
  817.  
  818.         local elementType
  819.  
  820.         if spell.element == 'Earth' then elementType = 'Stone'
  821.         elseif spell.element == 'Water' then elementType = 'Water'
  822.         elseif spell.element == 'Wind' then elementType = 'Aero'
  823.         elseif spell.element == 'Fire' then elementType = 'Fire'
  824.         elseif spell.element == 'Ice' then elementType = 'Blizzard'
  825.         elseif spell.element == 'Lightning' then elementType = 'Thunder'
  826.         end
  827.  
  828.         local newAra
  829.  
  830.         if aras:contains(spell.english)then
  831.                 if elementType == 'Stone' then newAra = 'Stonera'
  832.                 elseif elementType == 'Water' then newAra = 'Watera'
  833.                 elseif elementType == 'Aero' then newAra = 'Aera'
  834.                 elseif elementType == 'Fire' then newAra = 'Fira'
  835.                 elseif elementType == 'Blizzard' then newAra = 'Blizzara'
  836.                 elseif elementType == 'Thunder' then newAra = 'Thundara'
  837.                 end
  838.         end
  839.  
  840.         local newNuke = spell.english
  841.  
  842.         local nukeMpCost = nuke_mp_cost[newNuke]
  843.  
  844.         if buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  845.                 nukeMpCost = math.floor(nukeMpCost * 0.9)
  846.         elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
  847.                 nukeMpCost = math.ceil(nukeMpCost * 1.2)
  848.         end
  849.  
  850.         local downgrade
  851.  
  852.         -- Downgrade the spell to what we can actually afford
  853.         if player.mp < nukeMpCost and not buffactive['Mana Well'] then
  854.                 if spell.element == 'Earth' then
  855.                         if aras:contains(spell.english) then
  856.                                 if player.mp < 54 then
  857.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  858.                                         eventArgs.cancel = true
  859.                                         return
  860.                                 elseif player.mp < 143 then newNuke = ''..newAra..''
  861.                                 elseif player.mp < 276 then newNuke = ''..newAra..' II'
  862.                                 end
  863.                         elseif not aras:contains(spell.english) then
  864.                                 if player.mp < 4 then
  865.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  866.                                         eventArgs.cancel = true
  867.                                         return
  868.                                 elseif player.mp < 16 then newNuke = 'Stone'
  869.                                 elseif player.mp < 40 then newNuke = 'Stone II'
  870.                                 elseif player.mp < 88 then newNuke = 'Stone III'
  871.                                 elseif player.mp < 156 then newNuke = 'Stone IV'
  872.                                 elseif player.mp < 237 then newNuke = 'Stone V'
  873.                                 end
  874.                         end
  875.                 elseif spell.element == 'Water' then
  876.                         if aras:contains(spell.english) then
  877.                                 if player.mp < 66 then
  878.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  879.                                         eventArgs.cancel = true
  880.                                         return
  881.                                 elseif player.mp < 163 then newNuke = ''..newAra..''
  882.                                 elseif player.mp < 312 then newNuke = ''..newAra..' II'
  883.                                 end
  884.                         elseif not aras:contains(spell.english) then
  885.                                 if player.mp < 5 then
  886.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  887.                                         eventArgs.cancel = true
  888.                                         return
  889.                                 elseif player.mp < 19 then newNuke = 'Water'
  890.                                 elseif player.mp < 46 then newNuke = 'Water II'
  891.                                 elseif player.mp < 99 then newNuke = 'Water III'
  892.                                 elseif player.mp < 175 then newNuke = 'Water IV'
  893.                                 elseif player.mp < 266 then newNuke = 'Water V'
  894.                                 end
  895.                         end
  896.                 elseif spell.element == 'Wind' then
  897.                         if aras:contains(spell.english) then
  898.                                 if player.mp < 79 then
  899.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  900.                                         eventArgs.cancel = true
  901.                                         return
  902.                                 elseif player.mp < 184 then newNuke = ''..newAra..''
  903.                                 elseif player.mp < 350 then newNuke = ''..newAra..' II'
  904.                                 end
  905.                         elseif not aras:contains(spell.english) then
  906.                                 if player.mp < 6 then
  907.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  908.                                         eventArgs.cancel = true
  909.                                         return
  910.                                 elseif player.mp < 22 then newNuke = 'Aero'
  911.                                 elseif player.mp < 54 then newNuke = 'Aero II'
  912.                                 elseif player.mp < 115 then newNuke = 'Aero III'
  913.                                 elseif player.mp < 198 then newNuke = 'Aero IV'
  914.                                 elseif player.mp < 299 then newNuke = 'Aero V'
  915.                                 end
  916.                         end
  917.                 elseif spell.element == 'Fire' then
  918.                         if aras:contains(spell.english) then
  919.                                 if player.mp < 93 then
  920.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  921.                                         eventArgs.cancel = true
  922.                                         return
  923.                                 elseif player.mp < 206 then newNuke = ''..newAra..''
  924.                                 elseif player.mp < 390 then newNuke = ''..newAra..' II'
  925.                                 end
  926.                         elseif not aras:contains(spell.english) then
  927.                                 if player.mp < 7 then
  928.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  929.                                         eventArgs.cancel = true
  930.                                         return
  931.                                 elseif player.mp < 26 then newNuke = 'Fire'
  932.                                 elseif player.mp < 63 then newNuke = 'Fire II'
  933.                                 elseif player.mp < 135 then newNuke = 'Fire III'
  934.                                 elseif player.mp < 228 then newNuke = 'Fire IV'
  935.                                 elseif player.mp < 339 then newNuke = 'Fire V'
  936.                                 end
  937.                         end
  938.                 elseif spell.element == 'Ice' then
  939.                         if aras:contains(spell.english) then
  940.                                 if player.mp < 108 then
  941.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  942.                                         eventArgs.cancel = true
  943.                                         return
  944.                                 elseif player.mp < 229 then newNuke = ''..newAra..''
  945.                                 elseif player.mp < 432 then newNuke = ''..newAra..' II'
  946.                                 end
  947.                         elseif not aras:contains(spell.english) then
  948.                                 if player.mp < 8 then
  949.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  950.                                         eventArgs.cancel = true
  951.                                         return
  952.                                 elseif player.mp < 31 then newNuke = 'Blizzard'
  953.                                 elseif player.mp < 75 then newNuke = 'Blizzard II'
  954.                                 elseif player.mp < 162 then newNuke = 'Blizzard III'
  955.                                 elseif player.mp < 267 then newNuke = 'Blizzard IV'
  956.                                 elseif player.mp < 386 then newNuke = 'Blizzard V'
  957.                                 end
  958.                         end
  959.                 elseif spell.element == 'Lightning' then
  960.                         if aras:contains(spell.english) then
  961.                                 if player.mp < 123 then
  962.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  963.                                         eventArgs.cancel = true
  964.                                         return
  965.                                 elseif player.mp < 253 then newNuke = ''..newAra..''
  966.                                 elseif player.mp < 476 then newNuke = ''..newAra..' II'
  967.                                 end
  968.                         elseif not aras:contains(spell.english) then
  969.                                 if player.mp < 9 then
  970.                                         add_to_chat(122, 'Insufficient MP ['..tostring(player.mp)..']. Cancelling.')
  971.                                         eventArgs.cancel = true
  972.                                         return
  973.                                 elseif player.mp < 37 then newNuke = 'Thunder'
  974.                                 elseif player.mp < 91 then newNuke = 'Thunder II'
  975.                                 elseif player.mp < 195 then newNuke = 'Thunder III'
  976.                                 elseif player.mp < 306 then newNuke = 'Thunder IV'
  977.                                 elseif player.mp < 437 then newNuke = 'Thunder V'
  978.                                 end
  979.                         end
  980.                 end
  981.  
  982.                 downgrade = 'Insufficient MP ['..tostring(player.mp)..'] to cast '..spell.english..'. Changing spell to '..newNuke..'.'
  983.         end
  984.  
  985.         -- Downgrade the spell to what we can actually cast
  986.         local spell_recasts = windower.ffxi.get_spell_recasts()
  987.         if spell_recasts[spell.recast_id] > 0 then
  988.                 if t1:contains(spell.english) then
  989.                         add_to_chat(122, ''..spell.english..' is on cooldown. Cancelling.')
  990.                         eventArgs.cancel = true
  991.                         return
  992.                 elseif t2:contains(spell.english) then newNuke = ''..elementType..''
  993.                 elseif t3:contains(spell.english) then newNuke = ''..elementType..' II'
  994.                 elseif t4:contains(spell.english) then newNuke = ''..elementType..' III'
  995.                 elseif t5:contains(spell.english) then newNuke = ''..elementType..' IV'
  996.                 elseif t6:contains(spell.english) then newNuke = ''..elementType..' V'
  997.                 elseif ra2:contains(spell.english) then newNuke = ''..newAra..''
  998.                 elseif ra3:contains(spell.english) then newNuke = ''..newAra..' II'
  999.                 end
  1000.  
  1001.                 downgrade = '***'..spell.english..'*** is on cooldown. Downgrading spell to ***'..newNuke..'***.'
  1002.         end
  1003.  
  1004.         if newNuke ~= spell.english then
  1005.                 send_command('@input /ma "'..newNuke..'" '..tostring(spell.target.raw))
  1006.                 if downgrade then
  1007.                         add_to_chat(122, downgrade)
  1008.                 end
  1009.                 eventArgs.cancel = true
  1010.                 return
  1011.         end
  1012. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement