Advertisement
Arnan

COR (mule) Lua October 2017

Oct 4th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.02 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Some of Motenten's Functions ** --
  3.  
  4. function get_sets()
  5.     AccIndex = 1
  6.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For Shooting/QD/TP/WS. Default ACC Set Is LowACC. The First TP Set Of Your Main Weapon Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  7.     IdleIndex = 1
  8.     IdleArray = {'Movement', 'Regen'} -- Default Idle Set Is Movement --
  9.     Armor = 'None'
  10.     define_roll_values()
  11.     warning = false
  12.     Lock_Main = 'OFF' -- Set Default Lock Main Weapon ON or OFF Here --
  13.     AutoGunWS = "Last Stand" -- Set Auto Gun WS Here --
  14.     AutoMode = 'OFF' -- Set Default Auto RA/WS ON or OFF Here --
  15.     Obi = 'ON' -- Turn Default Obi ON or OFF Here --
  16.     ammo_warning_limit = 10 -- Set Ammo Limit Check Here --
  17.     target_distance = 6 -- Set Default Distance Here --
  18.     select_default_macro_book() -- Change Default Macro Book At The End --
  19.  
  20.     ACC_Shots = S{"Light Shot","Dark Shot"}
  21.  
  22.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  23.     Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  24.     sc_map = {SC1="CoursersRoll", SC2="DiaII", SC3="LightShot"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  25.  
  26.     -- Idle/Town Sets --
  27.     sets.Idle = {}
  28.     sets.Idle.Regen = {
  29.             ammo="Eminent Bullet",
  30.             head="Meghanada Visor +1",
  31.             neck="Bathy Choker +1",
  32.             ear1="Ethereal Earring",
  33.             ear2="Hearty Earring",
  34.             body="Meg. Cuirie +1",
  35.             hands="Meg. Gloves +2",
  36.             ring1="Defending Ring",
  37.             ring2="Meghanada Ring",
  38.             back="Moonbeam Cape",
  39.             waist="Flume Belt",
  40.             legs="Carmine Cuisses +1",
  41.             feet="Meg. Jam. +1"}
  42.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{})
  43.  
  44.     -- QD Sets --
  45.     sets.QD = {feet="Chass. Bottes +1"}
  46.     sets.QD.MidACC = set_combine(sets.QD,{})
  47.     sets.QD.HighACC = set_combine(sets.QD.MidACC,{})
  48.  
  49.     -- PDT/MDT Sets --
  50.     sets.PDT = {
  51.             ammo="Eminent Bullet",
  52.             head="Meghanada Visor +1",
  53.             neck="Twilight Torque",
  54.             ear1="Ethereal Earring",
  55.             ear2="Hearty Earring",
  56.             body="Meg. Cuirie +1",
  57.             hands="Meg. Gloves +2",
  58.             ring1="Defending Ring",
  59.             ring2="Gelatinous Ring +1",
  60.             back="Moonbeam Cape",
  61.             waist="Flume Belt",
  62.             legs="Meg. Chausses +1",
  63.             feet="Meg. Jam. +1"}
  64.  
  65.     sets.MDT = set_combine(sets.PDT,{})
  66.  
  67.     -- Roll Set --
  68.     sets.Rolls = {
  69.             head="Lanun Tricorne",
  70.             neck="Regal Necklace",
  71.             hands="Chasseur's Gants +1",
  72.             ring2="Luzaf's Ring"}
  73.  
  74.     -- Preshot --
  75.     sets.Preshot = {
  76.             ammo="Eminent Bullet",
  77.             body="Laksa. Frac +3",
  78.             hands="Iuitl Wristbands",
  79.             legs="Lanun Culottes",
  80.             feet="Meg. Jam. +1"}
  81.  
  82.     -- Shooting Base Set --
  83.     sets.Midshot = {
  84.             ammo="Eminent Bullet",
  85.             head="Meghanada Visor +1",
  86.             neck="Sanctity Necklace",
  87.             body="Laksa. Frac +3",
  88.             hands="Meg. Gloves +2",
  89.             ring1="Paqichikaji Ring",
  90.             ring2="Arewe Ring",
  91.             back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  92.             waist="Kwahu Kachina Belt",
  93.             legs="Meg. Chausses +1",
  94.             feet="Meg. Jam. +1"}
  95.  
  96.     -- Death Penalty Sets --
  97.     sets.Midshot['Death Penalty'] = {}
  98.     sets.Midshot['Death Penalty'].MidACC = set_combine(sets.Midshot['Death Penalty'],{})
  99.     sets.Midshot['Death Penalty'].HighACC = set_combine(sets.Midshot['Death Penalty'].MidACC,{})
  100.  
  101.     -- Armageddon Sets --
  102.     sets.Midshot.Armageddon = {}
  103.     sets.Midshot.Armageddon.MidACC = set_combine(sets.Midshot.Armageddon,{})
  104.     sets.Midshot.Armageddon.HighACC = set_combine(sets.Midshot.Armageddon.MidACC,{})
  105.  
  106.     -- Vanir Gun Sets --
  107.     sets.Midshot['Vanir Gun'] = {}
  108.     sets.Midshot['Vanir Gun'].MidACC = set_combine(sets.Midshot['Vanir Gun'],{})
  109.     sets.Midshot['Vanir Gun'].HighACC = set_combine(sets.Midshot['Vanir Gun'].MidACC,{})
  110.  
  111.     -- Melee Sets --
  112.     sets.Melee = {
  113.             ammo="Eminent Bullet",
  114.             head="Dampening Tam",
  115.             neck="Lissome Necklace",
  116.             ear1="Cessance Earring",
  117.             ear2="Brutal Earring",
  118.             body="Adhemar Jacket",
  119.             hands="Adhemar Wristbands",
  120.             ring1="Petrov Ring",
  121.             ring2="Epona's Ring",
  122.             back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','"Dual Wield"+10',}},
  123.             waist="Windbuffet Belt +1",
  124.             legs="Carmine Cuisses +1",
  125.             feet={ name="Herculean Boots", augments={'Accuracy+26','"Store TP"+4','DEX+2','Attack+13',}}}
  126.     sets.Melee.MidACC = set_combine(sets.Melee,{})
  127.     sets.Melee.HighACC = set_combine(sets.Melee.MidACC,{})
  128.  
  129.     -- WS Base Set (multi-attack) --
  130.     sets.WS = {
  131.             ammo="Eminent Bullet",
  132.             head="Dampening Tam",
  133.             neck="Fotia Gorget",
  134.             ear1="Cessance Earring",
  135.             ear2="Brutal Earring",
  136.             body="Adhemar Jacket",
  137.             hands="Adhemar Wristbands",
  138.             ring1="Ifrit Ring",
  139.             ring2="Epona's Ring",
  140.             back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','HP+4','Weapon skill damage +10%',}},
  141.             waist="Fotia Belt",
  142.             legs="Carmine Cuisses +1",
  143.             feet={ name="Herculean Boots", augments={'Accuracy+26','"Store TP"+4','DEX+2','Attack+13',}}}
  144.     sets.WS.MidACC = set_combine(sets.WS,{})
  145.     sets.WS.HighACC = set_combine(sets.WS.MidACC,{})
  146.    
  147.     -- MAB WS Set --
  148.     sets.WS.MABWS = {
  149.             ammo="Eminent Bullet",
  150.             head="Dampening Tam",
  151.             neck="Sanctity Necklace",
  152.             ear1="Friomisi Earring",
  153.             ear2="Hecate's Earring",
  154.             body="Samnuha Coat",
  155.             hands={ name="Herculean Gloves", augments={'Mag. Acc.+11 "Mag.Atk.Bns."+11','Weapon skill damage +4%','Mag. Acc.+7','"Mag.Atk.Bns."+14',}},
  156.             ring1="Acumen Ring",
  157.             ring2="Arvina Ringlet +1",
  158.             back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  159.             waist="Hachirin-no-Obi",
  160.             legs={ name="Herculean Trousers", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','Magic burst dmg.+1%','Mag. Acc.+11','"Mag.Atk.Bns."+15',}},
  161.             feet={ name="Herculean Boots", augments={'DEX+5','INT+14','Weapon skill damage +7%','Accuracy+17 Attack+17','Mag. Acc.+13 "Mag.Atk.Bns."+13',}}}
  162.    
  163.     -- One-Hit WS Base Set --
  164.     sets.WS.OneHit = {
  165.             ammo="Eminent Bullet",
  166.             head="Meghanada Visor +1",
  167.             neck="Fotia Gorget",
  168.             ear1="Flame Pearl",
  169.             ear2="Ishvara Earring",
  170.             body="Laksa. Frac +3",
  171.             hands="Meg. Gloves +2",
  172.             ring1="Ifrit Ring",
  173.             ring2="Ifrit Ring",
  174.             back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','HP+4','Weapon skill damage +10%',}},
  175.             waist="Prosilio Belt",
  176.             legs={ name="Herculean Trousers", augments={'Accuracy+25','Weapon skill damage +3%','AGI+7',}},
  177.             feet={ name="Herculean Boots", augments={'DEX+5','INT+14','Weapon skill damage +7%','Accuracy+17 Attack+17','Mag. Acc.+13 "Mag.Atk.Bns."+13',}}}
  178.     sets.WS.OneHit.MidACC = set_combine(sets.WS.OneHit,{})
  179.     sets.WS.OneHit.HighACC = set_combine(sets.WS.OneHit.MidACC,{})
  180.  
  181.     -- Ranged WS Base Set --
  182.     sets.WS.Ranged = {
  183.             ammo="Eminent Bullet",
  184.             head="Meghanada Visor +1",
  185.             neck="Fotia Gorget",
  186.             ear1="Auster's Pearl",
  187.             ear2="Ishvara Earring",
  188.             body="Laksa. Frac +3",
  189.             hands="Meg. Gloves +2",
  190.             ring1="Garuda Ring",
  191.             ring2="Garuda Ring",
  192.             back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  193.             waist="Fotia Belt",
  194.             legs="Meg. Chausses +1",
  195.             feet="Meg. Jam. +1"}
  196.     sets.WS.Ranged.MidACC = set_combine(sets.WS.Ranged,{})
  197.     sets.WS.Ranged.HighACC = set_combine(sets.WS.Ranged.MidACC,{})
  198.  
  199.     -- Sword WS Sets --
  200.    
  201.     -- Savage Blade Set --
  202.     sets.WS["Savage Blade"] = set_combine(sets.WS.OneHit,{})
  203.     sets.WS["Savage Blade"].MidACC = set_combine(sets.WS.OneHit.MidACC,{})
  204.     sets.WS["Savage Blade"].HighACC = set_combine(sets.WS.OneHit.HighACC,{})
  205.    
  206.     -- Requiescat Set --
  207.     sets.WS.Requiescat = set_combine(sets.WS,{})
  208.     sets.WS.Requiescat.MidACC = set_combine(sets.WS.MidACC,{})
  209.     sets.WS.Requiescat.HighACC = set_combine(sets.WS.HighACC,{})
  210.    
  211.     -- Dagger WS Sets --
  212.    
  213.     -- Evisceration Set --
  214.     sets.WS.Evisceration = set_combine(sets.WS,{})
  215.     sets.WS.Evisceration.MidACC = set_combine(sets.WS.MidACC,{})
  216.     sets.WS.Evisceration.HighACC = set_combine(sets.WS.HighACC,{})
  217.    
  218.     -- Exenterator Set --
  219.     sets.WS.Exenterator = set_combine(sets.WS,{})
  220.     sets.WS.Exenterator.MidACC = set_combine(sets.WS.MidACC,{})
  221.     sets.WS.Exenterator.HighACC = set_combine(sets.WS.HighACC,{})
  222.    
  223.     -- Marksmanship WS Sets --
  224.    
  225.     -- Hot Shot Sets --
  226.     sets.WS["Hot Shot"] = set_combine(sets.WS.Ranged,{})
  227.     sets.WS["Hot Shot"].MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  228.     sets.WS["Hot Shot"].HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  229.    
  230.     -- Split Shot Sets --
  231.     sets.WS["Split Shot"] = set_combine(sets.WS.Ranged,{})
  232.     sets.WS["Split Shot"].MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  233.     sets.WS["Split Shot"].HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  234.    
  235.     -- Sniper Shot Sets --
  236.     sets.WS["Sniper Shot"] = set_combine(sets.WS.Ranged,{})
  237.     sets.WS["Sniper Shot"].MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  238.     sets.WS["Sniper Shot"].HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  239.    
  240.     -- Slug Shot Sets --
  241.     sets.WS["Slug Shot"] = set_combine(sets.WS.Ranged,{})
  242.     sets.WS["Slug Shot"].MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  243.     sets.WS["Slug Shot"].HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  244.    
  245.     -- Detonator Sets --
  246.     sets.WS.Detonator = set_combine(sets.WS.Ranged,{})
  247.     sets.WS.Detonator.MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  248.     sets.WS.Detonator.HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  249.    
  250.     -- Numbing Shot Sets --
  251.     sets.WS["Numbing Shot"] = set_combine(sets.WS.Ranged,{})
  252.     sets.WS["Numbing Shot"].MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  253.     sets.WS["Numbing Shot"].HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  254.  
  255.     -- Last Stand Sets --
  256.     sets.WS["Last Stand"] = set_combine(sets.WS.Ranged,{})
  257.     sets.WS["Last Stand"].MidACC = set_combine(sets.WS.Ranged.MidACC,{})
  258.     sets.WS["Last Stand"].HighACC = set_combine(sets.WS.Ranged.HighACC,{})
  259.  
  260.     -- Wildfire Sets --
  261.     sets.WS.Wildfire = set_combine(sets.WS.MABWS,{})
  262.     sets.WS.Wildfire.MidACC = set_combine(sets.WS.MABWS,{})
  263.     sets.WS.Wildfire.HighACC = set_combine(sets.WS.MABWS,{})
  264.  
  265.     -- Leaden Salute Sets --
  266.     sets.WS['Leaden Salute'] = set_combine(sets.WS.MABWS,{
  267.             head="Pixie Hairpin +1"})
  268.     sets.WS['Leaden Salute'].MidACC = set_combine(sets.WS.MABWS,{
  269.             head="Pixie Hairpin +1"})
  270.     sets.WS['Leaden Salute'].HighAC = set_combine(sets.WS.MABWS,{
  271.             head="Pixie Hairpin +1"})
  272.  
  273.     -- Elemental Obi --
  274.     sets.Obi = {}
  275.     sets.Obi.Lightning = {}
  276.     sets.Obi.Water = {}
  277.     sets.Obi.Fire = {}
  278.     sets.Obi.Ice = {}
  279.     sets.Obi.Wind = {}
  280.     sets.Obi.Earth = {}
  281.     sets.Obi.Light = {}
  282.     sets.Obi.Dark = {}
  283.  
  284.     -- JA Sets --
  285.     sets.JA = {}
  286.     sets.JA["Random Deal"] = {body="Lanun Frac"}
  287.     sets.JA.Fold = {}
  288.     sets.JA["Snake Eye"] = {legs="Lanun Culottes"}
  289.     sets.JA["Wild Card"] = {feet="Lanun Bottes"}
  290.     sets.JA["Double-Up"] = {
  291.             head="Lanun Tricorne",
  292.             neck="Regal Necklace",
  293.             hands="Chasseur's Gants +1",
  294.             ring2="Luzaf's Ring"}
  295.  
  296.     -- Waltz Set --
  297.     sets.Waltz = {}
  298.  
  299.     sets.Precast = {}
  300.     --Fastcast Set --
  301.     sets.Precast.FastCast = {}
  302.  
  303.     sets.Midcast = {}
  304.     -- Magic Haste Set --
  305.     sets.Midcast.Haste = set_combine(sets.PDT,{})
  306.  
  307.     -- Cure Set --
  308.     sets.Midcast.Cure = {}
  309. end
  310.  
  311. function pretarget(spell,action)    if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  312.         cancel_spell()
  313.         send_command('input /item "Echo Drops" <me>')
  314.     elseif spell.type == "CorsairRoll" and buffactive[spell.english] then -- Change Any Rolls To Double-Up When You Have A Roll Up --
  315.         cancel_spell()
  316.         send_command('doubleup')
  317.     elseif spell.english == "Seigan" and buffactive.Seigan then -- Change Seigan To Third Eye If Seigan Is On --
  318.         cancel_spell()
  319.         send_command('ThirdEye')
  320.     elseif spell.english == "Meditate" and player.tp > 2900 then -- Cancel Meditate If TP Is Above 2900 --
  321.         cancel_spell()
  322.         add_to_chat(123, spell.name .. ' Canceled: ' .. player.tp)
  323.     elseif spell.action_type == 'Ranged Attack' then
  324.         if spell.target.distance > 24.9 then -- Cancel Ranged Attack If You Are Out Of Range --
  325.             cancel_spell()
  326.             add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  327.             return
  328.         else
  329.             if AutoMode == 'ON' and not buffactive.amnesia then -- Auto WS/Triple Shot --
  330.                 if player.tp >= 1000 then
  331.                     cancel_spell()
  332.                     autoWS()
  333.                 elseif windower.ffxi.get_ability_recasts()[84] < 1 then
  334.                     cancel_spell()
  335.                     send_command('TripleShot')
  336.                 end
  337.             end
  338.         end
  339.     elseif spell.type == 'WeaponSkill' and player.status == 'Engaged' then
  340.         if spell.skill == 'Marksmanship' then
  341.             if spell.target.distance > 16+target_distance then
  342.                 cancel_spell()
  343.                 add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  344.                 return
  345.             end
  346.         else
  347.             if spell.target.distance > target_distance then
  348.                 cancel_spell()
  349.                 add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  350.                 return
  351.             end
  352.         end
  353.     end
  354. end
  355.  
  356. function precast(spell,action)
  357.     if spell.action_type == 'Ranged Attack' or spell.type == "WeaponSkill" then
  358.         if player.equipment.ammo == "Animikii Bullet" then -- Cancel Ranged Attack or WS If You Have Animikii Bullet Equipped --
  359.             cancel_spell()
  360.             add_to_chat(123, spell.name .. ' Canceled: [Animikii Bullet Equipped!]')
  361.             return
  362.         else
  363.             local check_ammo
  364.             local check_ammo_count = 1
  365.             if spell.action_type == 'Ranged Attack' then
  366.                 check_ammo = player.equipment.ammo
  367.                 if player.equipment.ammo == 'empty' or player.inventory[check_ammo].count <= check_ammo_count then
  368.                     add_to_chat(123, spell.name..' Canceled: [Out of Ammo]')
  369.                     cancel_spell()
  370.                     return
  371.                 else
  372.                     equip(sets.Preshot,(buffactive["Triple Shot"] and {body="Chasseur's Frac +1"} or {}))
  373.                     if player.inventory[check_ammo].count <= ammo_warning_limit and player.inventory[check_ammo].count > 1 and not warning then
  374.                         add_to_chat(8, '***** [Low Ammo Warning!] *****')
  375.                         warning = true
  376.                     elseif player.inventory[check_ammo].count > ammo_warning_limit and warning then
  377.                         warning = false
  378.                     end
  379.                 end
  380.             elseif spell.type == "WeaponSkill" then
  381.                 if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  382.                     cancel_spell()
  383.                     add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  384.                     return
  385.                 else
  386.                     equipSet = sets.WS
  387.                     if equipSet[spell.english] then
  388.                         equipSet = equipSet[spell.english]
  389.                     end
  390.                     if equipSet[AccArray[AccIndex]] then
  391.                         equipSet = equipSet[AccArray[AccIndex]]
  392.                     end
  393.                     if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  394.                         equipSet = set_combine(equipSet,{})
  395.                     end
  396.                     if spell.english == "Last Stand" and (player.tp > 2990 or buffactive.Sekkanoki) then -- Equip Altdorf's Earring and Wilhelm's Earring When You Have 3000 TP or Sekkanoki For Last Stand --
  397.                         equipSet = set_combine(equipSet,{})
  398.                     end
  399.                     equip(equipSet)
  400.                 end
  401.             end
  402.         end
  403.     elseif spell.type == "JobAbility" then
  404.         if sets.JA[spell.english] then
  405.             equip(sets.JA[spell.english])
  406.             if spell.english == "Snake Eye" then -- Auto Double-Up After You Use Snake Eye --
  407.                 send_command('@wait 1;input /ja Double-Up <me>')
  408.             end
  409.         end
  410.     elseif spell.type == "CorsairRoll" or spell.english == "Double-Up" then
  411.         equip(sets.Rolls)
  412.         if spell.english == "Tactician's Roll" then -- Change Tactician's Roll Equipment Here --
  413.             equip({body="Chasseur's Frac +1"})
  414.         elseif spell.english == "Caster's Roll" then -- Change Caster's Roll Equipment Here --
  415.             equip({legs="Chas. Culottes +1"})
  416.         elseif spell.english == "Courser's Roll" then -- Change Courser's Roll Equipment Here --
  417.             equip({feet="Chass. Bottes +1"})
  418.         elseif spell.english == "Blitzer's Roll" then -- Change Blitzer's Roll Equipment Here --
  419.             equip({})
  420.         elseif spell.english == "Allies' Roll" then -- Change Allies' Roll Equipment Here --
  421.             equip({hands="Chasseur's Gants +1"})
  422.         end
  423.     elseif spell.type == "CorsairShot" then
  424.         equipSet = sets.QD
  425.         if ACC_Shots:contains(spell.english) then
  426.             equipSet = sets.QD.HighACC
  427.         else
  428.             if equipSet[AccArray[AccIndex]] then
  429.                 equipSet = equipSet[AccArray[AccIndex]]
  430.             end
  431.             if not ACC_Shots:contains(spell.english) and (world.day_element == spell.element or world.weather_element == spell.element) and sets.Obi[spell.element] and Obi == 'ON' then -- Use Obi Toggle To Unlock Elemental Obi --
  432.                 equipSet = set_combine(equipSet,sets.Obi[spell.element])
  433.             end
  434.         end
  435.         equip(equipSet)
  436.     elseif spell.action_type == 'Magic' then
  437.         if spell.english == 'Utsusemi: Ni' then
  438.             if buffactive['Copy Image (3)'] then
  439.                 cancel_spell()
  440.                 add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  441.                 return
  442.             else
  443.                 equip(sets.Precast.FastCast)
  444.             end
  445.         else
  446.             equip(sets.Precast.FastCast)
  447.         end
  448.     elseif spell.type == "Waltz" then
  449.         refine_waltz(spell,action)
  450.         equip(sets.Waltz)
  451.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  452.         cast_delay(0.2)
  453.         send_command('cancel Sneak')
  454.     end
  455. end
  456.  
  457. function midcast(spell,action)
  458.     if spell.action_type == 'Ranged Attack' then
  459.         equipSet = sets.Midshot
  460.         if equipSet[player.equipment.range] then
  461.             equipSet = equipSet[player.equipment.range]
  462.         end
  463.         if equipSet[AccArray[AccIndex]] then
  464.             equipSet = equipSet[AccArray[AccIndex]]
  465.         end
  466.         if buffactive['Triple Shot'] then
  467.             equipSet = set_combine(equipSet,{})
  468.         end
  469.         equip(equipSet)
  470.     elseif spell.action_type == 'Magic' then
  471.         if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  472.             equip(sets.Midcast.Cure)
  473.         elseif spell.english == "Stoneskin" then
  474.             if buffactive.Stoneskin then
  475.                 send_command('@wait 2.8;cancel stoneskin')
  476.             end
  477.             equip(sets.Midcast.Stoneskin)
  478.         elseif spell.english == "Sneak" then
  479.             if spell.target.name == player.name and buffactive['Sneak'] then
  480.                 send_command('cancel sneak')
  481.             end
  482.             equip(sets.Midcast.Haste)
  483.         elseif spell.english:startswith('Utsusemi') then
  484.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
  485.                 send_command('@wait 1.7;cancel Copy Image*')
  486.             end
  487.             equip(sets.Midcast.Haste)
  488.         elseif spell.english == 'Monomi: Ichi' then
  489.             if buffactive['Sneak'] then
  490.                 send_command('@wait 1.7;cancel sneak')
  491.             end
  492.             equip(sets.Midcast.Haste)
  493.         else
  494.             equip(sets.Midcast.Haste)
  495.         end
  496.     end
  497. end
  498.  
  499. function aftercast(spell,action)
  500.     if spell.action_type == 'Ranged Attack' and AutoMode == 'ON' then
  501.         autoRA()
  502.     else
  503.         status_change(player.status)
  504.     end
  505.     if not spell.interrupted then
  506.         if spell.type == "WeaponSkill" then
  507.             send_command('wait 0.2;gs c TP')
  508.         elseif spell.type == 'CorsairRoll' then
  509.             display_roll_info(spell)
  510.         elseif spell.english == 'Light Shot' then -- Sleep Countdown --
  511.             send_command('wait 50;input /echo '..spell.name..' Effect: [WEARING OFF IN 10 SEC.];wait 10;input /echo '..spell.name..' Effect: [OFF]')
  512.         end
  513.     end
  514. end
  515.  
  516. function status_change(new,old)
  517.     if Armor == 'PDT' then
  518.         equip(sets.PDT)
  519.     elseif Armor == 'MDT' then
  520.         equip(sets.MDT)
  521.     elseif new == 'Engaged' then
  522.         equipSet = sets.Melee
  523.         if equipSet[AccArray[AccIndex]] then
  524.             equipSet = equipSet[AccArray[AccIndex]]
  525.         end
  526.         if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  527.             equipSet = set_combine(equipSet,{})
  528.         end
  529.         if world.area:endswith('Adoulin') then
  530.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  531.         end
  532.         equip(equipSet)
  533.     elseif new == 'Idle' then
  534.         equip(sets.Idle[IdleArray[IdleIndex]])
  535.     elseif new == 'Resting' then
  536.         equip(sets.Resting)
  537.     end
  538. end
  539.  
  540. function buff_change(buff,gain)
  541.     buff = string.lower(buff)
  542.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  543.         if gain then
  544.             send_command('timers create "Aftermath: Lv.3" 180 down;wait 150;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 15;input /echo Aftermath: Lv.3 [WEARING OFF IN 15 SEC.];wait 5;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
  545.         else
  546.             send_command('timers delete "Aftermath: Lv.3"')
  547.             add_to_chat(123,'AM3: [OFF]')
  548.         end
  549.     elseif buff == 'weakness' then -- Weakness Timer --
  550.         if gain then
  551.             send_command('timers create "Weakness" 300 up')
  552.         else            send_command('timers delete "Weakness"')
  553.         end
  554.     end
  555.     if not midaction() then
  556.         status_change(player.status)
  557.     end
  558. end
  559.  
  560. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  561. function self_command(command)
  562.     if command == 'C1' then -- Accuracy Level Toggle --
  563.         AccIndex = (AccIndex % #AccArray) + 1
  564.         status_change(player.status)
  565.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  566.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  567.         status_change(player.status)
  568.         add_to_chat(158,'Auto Update Gear')
  569.     elseif command == 'C3' then -- Obi Toggle --
  570.         if Obi == 'ON' then
  571.             Obi = 'OFF'
  572.             add_to_chat(123,'Obi: [OFF]')
  573.         else
  574.             Obi = 'ON'
  575.             add_to_chat(158,'Obi: [ON]')
  576.         end
  577.         status_change(player.status)
  578.     elseif command == 'pdt' then -- PDT Toggle --
  579.         if Armor == 'PDT' then
  580.             Armor = 'None'
  581.             add_to_chat(123,'PDT Set: [Unlocked]')
  582.         else
  583.             Armor = 'PDT'
  584.             add_to_chat(158,'PDT Set: [Locked]')
  585.         end
  586.         status_change(player.status)
  587.     elseif command == 'C15' then -- MDT Toggle --
  588.         if Armor == 'MDT' then
  589.             Armor = 'None'
  590.             add_to_chat(123,'MDT Set: [Unlocked]')
  591.         else
  592.             Armor = 'MDT'
  593.             add_to_chat(158,'MDT Set: [Locked]')
  594.         end
  595.         status_change(player.status)
  596.     elseif command == 'C17' then -- Lock Main Weapon Toggle --
  597.         if Lock_Main == 'ON' then
  598.             Lock_Main = 'OFF'
  599.             add_to_chat(123,'Main Weapon: [Unlocked]')
  600.         else
  601.             Lock_Main = 'ON'
  602.             add_to_chat(158,'Main Weapon: [Locked]')
  603.         end
  604.         status_change(player.status)
  605.     elseif command == 'C8' then -- Distance Toggle --
  606.         if player.target.distance then
  607.             target_distance = math.floor(player.target.distance*10)/10
  608.             add_to_chat(158,'Distance: '..target_distance)
  609.         else
  610.             add_to_chat(123,'No Target Selected')
  611.         end
  612.     elseif command == 'C6' then -- Idle Toggle --
  613.         IdleIndex = (IdleIndex % #IdleArray) + 1
  614.         status_change(player.status)
  615.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  616.     elseif command == 'C2' then -- Auto RA/WS Toggle. *Don't Rely On This. It Isn't As Fast As Shooting Manually. It Is Mainly For AFK or When You Dualbox* --
  617.         if AutoMode == 'ON' then
  618.             AutoMode = 'OFF'
  619.             add_to_chat(123,'Auto Mode: [OFF]')
  620.         else
  621.             AutoMode = 'ON'
  622.             add_to_chat(158,'Auto Mode: [ON]')
  623.         end
  624.     elseif command == 'TP' then
  625.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  626.     elseif command:match('^SC%d$') then
  627.         send_command('//' .. sc_map[command])
  628.     end
  629. end
  630.  
  631. function autoRA() -- Make Auto RA Delay Adjustment Here --
  632.     local delay = '2.2'
  633.     if spell.type == "WeaponSkill" then
  634.         delay = '2.25'
  635.     else
  636.         if buffactive["Courser's Roll"] then
  637.             delay = '0.7'
  638.         elseif buffactive[581] then -- Flurry II --
  639.             delay = '0.5'
  640.         else
  641.             delay = '1.05'
  642.         end
  643.     end
  644.     send_command('@wait '..delay..'; input /ra <t>')
  645. end
  646.  
  647. function autoWS()
  648.     send_command('input /ws "'..AutoGunWS..'" <t>')
  649. end
  650.  
  651. function define_roll_values()
  652.     rolls = {
  653.         CorsairsRoll    = {lucky=5, unlucky=9, bonus="Experience Points"},
  654.         NinjaRoll       = {lucky=4, unlucky=8, bonus="Evasion"},
  655.         HuntersRoll     = {lucky=4, unlucky=8, bonus="Accuracy"},
  656.         ChaosRoll       = {lucky=4, unlucky=8, bonus="Attack"},
  657.         MagussRoll      = {lucky=2, unlucky=6, bonus="Magic Defense"},
  658.         HealersRoll     = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  659.         PuppetRoll      = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  660.         ChoralRoll      = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  661.         MonksRoll       = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  662.         BeastRoll       = {lucky=4, unlucky=8, bonus="Pet Attack"},
  663.         SamuraiRoll     = {lucky=2, unlucky=6, bonus="Store TP"},
  664.         EvokersRoll     = {lucky=5, unlucky=9, bonus="Refresh"},
  665.         RoguesRoll      = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  666.         WarlocksRoll    = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  667.         FightersRoll    = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  668.         DrachenRoll     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  669.         GallantsRoll    = {lucky=3, unlucky=7, bonus="Defense"},
  670.         WizardsRoll     = {lucky=5, unlucky=9, bonus="Magic Attack"},
  671.         DancersRoll     = {lucky=3, unlucky=7, bonus="Regen"},
  672.         ScholarsRoll    = {lucky=2, unlucky=6, bonus="Conserve MP"},
  673.         BoltersRoll     = {lucky=3, unlucky=9, bonus="Movement Speed"},
  674.         CastersRoll     = {lucky=2, unlucky=7, bonus="Fast Cast"},
  675.         CoursersRoll    = {lucky=3, unlucky=9, bonus="Snapshot"},
  676.         BlitzersRoll    = {lucky=4, unlucky=9, bonus="Attack Delay"},
  677.         TacticiansRoll  = {lucky=5, unlucky=8, bonus="Regain"},
  678.         AlliessRoll     = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  679.         MisersRoll      = {lucky=5, unlucky=7, bonus="Save TP"},
  680.         CompanionsRoll  = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  681.         AvengersRoll    = {lucky=4, unlucky=8, bonus="Counter Rate"}
  682.         }
  683. end
  684.  
  685. function display_roll_info(spell)
  686.     rollinfo = rolls[(string.gsub((string.gsub(spell.english, "%'+", "")), "%s+", ""))]
  687.     if rollinfo then
  688.         add_to_chat(158, spell.english..' = '..rollinfo.bonus..'. Lucky Roll is '..
  689.         tostring(rollinfo.lucky)..', Unlucky Roll is '..tostring(rollinfo.unlucky)..'.')
  690.     end
  691. end
  692.  
  693. function refine_waltz(spell,action)
  694.     if spell.type ~= 'Waltz' then
  695.         return
  696.     end
  697.  
  698.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  699.         return
  700.     end
  701.  
  702.     local newWaltz = spell.english
  703.            
  704.     local missingHP = 0
  705.     local targ
  706.  
  707.     if spell.target.type == "SELF" then
  708.         targ = alliance[1][1]
  709.         missingHP = player.max_hp - player.hp
  710.     elseif spell.target.isallymember then
  711.         targ = find_player_in_alliance(spell.target.name)
  712.         local est_max_hp = targ.hp / (targ.hpp/100)
  713.         missingHP = math.floor(est_max_hp - targ.hp)
  714.     end
  715.  
  716.     if targ then
  717.         if player.sub_job == 'DNC' then
  718.             if missingHP < 40 then
  719.                 add_to_chat(123,'Full HP!')
  720.                 cancel_spell()
  721.                 return
  722.             elseif missingHP < 150 then
  723.                 newWaltz = 'Curing Waltz'
  724.             elseif missingHP < 300 then
  725.                 newWaltz = 'Curing Waltz II'
  726.             else
  727.                 newWaltz = 'Curing Waltz III'
  728.             end
  729.         else
  730.             return
  731.         end
  732.     end
  733.  
  734.     local waltzTPCost = {['Curing Waltz'] = 20,['Curing Waltz II'] = 35,['Curing Waltz III'] = 50,['Curing Waltz IV'] = 65,['Curing Waltz V'] = 80}
  735.     local tpCost = waltzTPCost[newWaltz]
  736.     local downgrade
  737.  
  738.     if player.tp < tpCost and not buffactive.trance then       
  739.         if player.tp < 20 then
  740.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  741.             cancel_spell()
  742.             return
  743.         elseif player.tp < 35 then
  744.             newWaltz = 'Curing Waltz'
  745.         elseif player.tp < 50 then
  746.             newWaltz = 'Curing Waltz II'
  747.         elseif player.tp < 65 then
  748.             newWaltz = 'Curing Waltz III'
  749.         elseif player.tp < 80 then
  750.             newWaltz = 'Curing Waltz IV'
  751.         end
  752.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  753.     end
  754.  
  755.     if newWaltz ~= spell.english then
  756.         send_command('wait 0.03;input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  757.         if downgrade then
  758.             add_to_chat(8, downgrade)
  759.         end
  760.         cancel_spell()
  761.         return
  762.     end
  763.  
  764.     if missingHP > 0 then
  765.         add_to_chat(8,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  766.     end
  767. end
  768.  
  769. function find_player_in_alliance(name)
  770.     for i,v in ipairs(alliance) do
  771.         for k,p in ipairs(v) do
  772.             if p.name == name then
  773.                 return p
  774.             end
  775.         end
  776.     end
  777. end
  778.  
  779. function actualCost(originalCost)
  780.     if buffactive["Penury"] then
  781.         return originalCost*.5
  782.     elseif buffactive["Light Arts"] then
  783.         return originalCost*.9
  784.     else
  785.         return originalCost
  786.     end
  787. end
  788.  
  789. function degrade_spell(spell,degrade_array)
  790.     spell_index = table.find(degrade_array,spell.name)
  791.     if spell_index>1 then
  792.         new_spell = degrade_array[spell_index - 1]
  793.         change_spell(new_spell,spell.target.raw)
  794.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  795.     end
  796. end
  797.  
  798. function change_spell(spell_name,target)
  799.     cancel_spell()
  800.     send_command('//'..spell_name..' '..target)
  801. end
  802.  
  803. function sub_job_change(newSubjob, oldSubjob)
  804.     select_default_macro_book()
  805. end
  806.  
  807. function set_macro_page(set,book)
  808.     if not tonumber(set) then
  809.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  810.         return
  811.     end
  812.     if set < 1 or set > 10 then
  813.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  814.         return
  815.     end
  816.  
  817.     if book then
  818.         if not tonumber(book) then
  819.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  820.             return
  821.         end
  822.         if book < 1 or book > 20 then
  823.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  824.             return
  825.         end
  826.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  827.     else
  828.         send_command('@input /macro set '..tostring(set))
  829.     end
  830. end
  831.  
  832. function select_default_macro_book()
  833.     -- Default macro set/book
  834.     if player.sub_job == 'SAM' then
  835.         set_macro_page(2, 1)
  836.     elseif player.sub_job == 'WHM' then
  837.         set_macro_page(2, 1)
  838.     elseif player.sub_job == 'DNC' then
  839.         set_macro_page(2, 1)
  840.     elseif player.sub_job == 'NIN' then
  841.         set_macro_page(2, 1)
  842.     elseif player.sub_job == 'RDM' then
  843.         set_macro_page(2, 1)
  844.     elseif player.sub_job == 'WAR' then
  845.         set_macro_page(2, 1)
  846.     elseif player.sub_job == 'DRG' then
  847.         set_macro_page(2, 1)
  848.     else
  849.         set_macro_page(2, 1)
  850.     end
  851. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement