Advertisement
Zylakitty

COR

Jan 11th, 2019
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 48.10 KB | None | 0 0
  1. -- Original: Motenten / Modified: Arislan
  2.  
  3. -------------------------------------------------------------------------------------------------------------------
  4. --  Keybinds
  5. -------------------------------------------------------------------------------------------------------------------
  6.  
  7. --  Modes:      [ F9 ]              Cycle Offense Modes
  8. --              [ CTRL+F9 ]         Cycle Hybrid Modes
  9. --              [ ALT+F9 ]          Cycle Ranged Modes
  10. --              [ WIN+F9 ]          Cycle Weapon Skill Modes
  11. --              [ F10 ]             Emergency -PDT Mode
  12. --              [ ALT+F10 ]         Toggle Kiting Mode
  13. --              [ F11 ]             Emergency -MDT Mode
  14. --              [ F12 ]             Update Current Gear / Report Current Status
  15. --              [ CTRL+F12 ]        Cycle Idle Modes
  16. --              [ ALT+F12 ]         Cancel Emergency -PDT/-MDT Mode
  17. --              [ WIN+C ]           Toggle Capacity Points Mode
  18. --              [ WIN+` ]           Toggle use of Luzaf Ring.
  19. --              [ WIN+Q ]           Quick Draw shot mode selector.
  20. --
  21. --  Abilities:  [ CTRL+] ]          Quick Draw primary shot element cycle forward.
  22. --              [ CTRL+[ ]          Quick Draw primary shot element cycle backward.
  23. --              [ ALT+] ]           Quick Draw secondary shot element cycle forward.
  24. --              [ ALT+[ ]           Quick Draw secondary shot element cycle backward.
  25. --              [ WIN+[ ]          Quick Draw toggle target type.
  26. --              [ WIN+] ]          Quick Draw toggle use secondary shot.
  27. --
  28. --              [ CTRL+= ]          Crooked Cards
  29. --              [ CTRL+` ]          Double-Up
  30. --              [ ALT+- ]           Fold
  31. --              [ CTRL+- ]          Snake Eye
  32. --              [ CTRL+NumLock ]    Triple Shot
  33. --              [ CTRL+Numpad/ ]    Berserk
  34. --              [ CTRL+Numpad* ]    Warcry
  35. --              [ CTRL+Numpad- ]    Aggressor
  36. --
  37. --  Spells:     [ ALT+numpad+ ]           Utsusemi: Ichi
  38. --              [ CTRL+numpad+ ]           Utsusemi: Ni
  39. --
  40. --  Weapons:    [ CTRL+G ]          Cycles between available ranged weapons
  41. --              [ CTRL+W ]          Toggle Ranged Weapon Lock
  42. --
  43. --  WS:         [ CTRL+Numpad7 ]    Savage Blade
  44. --              [ CTRL+Numpad8 ]    Last Stand
  45. --              [ CTRL+Numpad9 ]    Leaden Salute
  46. --              [ CTRL+Numpad6 ]    Wildfire
  47. --              [ CTRL+Numpad4 ]    Requiescat
  48. --
  49. --  RA:         [ Numpad1 ]         Ranged Attack
  50.  
  51. -------------------------------------------------------------------------------------------------------------------
  52. --  Custom Commands (preface with /console to use these in macros)
  53. -------------------------------------------------------------------------------------------------------------------
  54.    
  55. --  gs c qd                         Uses the currently configured shot on the target, with either <t> or
  56. --                                  <stnpc> depending on setting.
  57. --  gs c altqd                      Uses the currently configured
  58. --
  59. --  gs c qd t                       Uses the currently configured shot on the target, but forces use of <t>.
  60. --
  61. --  gs c cycle mainqd               Cycles through the available steps to use as the primary shot when using
  62. --                                  one of the above commands.
  63. --  gs c cycle altqd                Cycles through the available steps to use for alternating with the
  64. --                                  configured main shot.
  65. --  gs c toggle usealtqd            Toggles whether or not to use an alternate shot.
  66. --  gs c toggle selectqdtarget      Toggles whether or not to use <stnpc> (as opposed to <t>) when using a shot.
  67. --
  68. --  gs c toggle LuzafRing           Toggles use of Luzaf Ring on and off
  69.  
  70.  
  71. -------------------------------------------------------------------------------------------------------------------
  72. -- Setup functions for this job.  Generally should not be modified.
  73. -------------------------------------------------------------------------------------------------------------------
  74.  
  75. -- Initialization function for this job file.
  76. function get_sets()
  77.     mote_include_version = 2
  78.    
  79.     -- Load and initialize the include file.
  80.     include('Mote-Include.lua')
  81. end
  82.  
  83. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  84. function job_setup()
  85.     -- QuickDraw Selector
  86.     state.Mainqd = M{['description']='Primary Shot', 'Fire Shot', 'Ice Shot', 'Wind Shot', 'Earth Shot', 'Thunder Shot', 'Water Shot', 'Dark Shot', 'Light Shot'}
  87.     state.Altqd = M{['description']='Secondary Shot', 'Fire Shot', 'Ice Shot', 'Wind Shot', 'Earth Shot', 'Thunder Shot', 'Water Shot', 'Dark Shot', 'Light Shot'}
  88.     state.UseAltqd = M(false, 'Use Secondary Shot')
  89.     state.SelectqdTarget = M(false, 'Select Quick Draw Target')
  90. state.IgnoreTargetting = M(false, 'Ignore Targetting')
  91.    
  92.     state.DualWield = M(false, 'Dual Wield III')
  93.     state.QDMode = M{['description']='Quick Draw Mode', 'STP', 'Magic Enhance', 'Magic Attack', 'Resistant'}
  94.  
  95.     state.Currentqd = M{['description']='Current Quick Draw', 'Main', 'Alt'}
  96.    
  97.     -- Whether to use Luzaf's Ring
  98.     state.LuzafRing = M(false, "Luzaf's Ring")
  99.     -- Whether a warning has been given for low ammo
  100.     state.warned = M(false)
  101.  
  102.     define_roll_values()
  103.  
  104.     lockstyleset = 3
  105.  
  106.     update_offense_mode()    
  107.     determine_haste_group()
  108. end
  109.  
  110. -------------------------------------------------------------------------------------------------------------------
  111. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  112. -------------------------------------------------------------------------------------------------------------------
  113.  
  114. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  115. function user_setup()
  116.     state.OffenseMode:options('STP', 'Normal', 'HighAcc')
  117.     state.HybridMode:options('Normal', 'DT')
  118.     state.RangedMode:options('STP', 'Normal', 'HighAcc')
  119.     state.WeaponskillMode:options('Normal', 'Acc')
  120.     state.CastingMode:options('Normal', 'Resistant')
  121.     state.IdleMode:options('Normal', 'DT', 'Refresh')
  122.  
  123.     state.WeaponLock = M(false, 'Weapon Lock')    
  124.     state.Gun = M{['description']='Current Gun', 'Fomalhaut', 'Anarchy +2'}
  125.     state.CP = M(false, "Capacity Points Mode")
  126.  
  127.     gear.RAbullet = "Chrono Bullet"
  128.     gear.WSbullet = "Chrono Bullet"
  129.     gear.MAbullet = "Orichalcum Bullet"
  130.     gear.QDbullet = "Animikii Bullet"
  131.     options.ammo_warning_limit = 10
  132.  
  133.     -- Additional local binds
  134.     send_command('bind ^` input /ja "Double-up" <me>')
  135.     send_command('bind ^= input /ja "Crooked Cards" <me>')
  136.     send_command('bind ^- input /ja "Snake Eye" <me>')
  137.     send_command('bind != input /ja "Random Deal" <me>')
  138.     send_command('bind !- input /ja "Fold" <me>')
  139.     send_command('bind !` input /ja "Bolter\'s Roll" <me>')
  140.     send_command ('bind @` gs c toggle LuzafRing')
  141.  
  142.     send_command('bind numpad. gs c qd')
  143.     send_command('bind ^] gs c cycleback mainqd')
  144.     send_command('bind ^[ gs c cycle mainqd')
  145.     send_command('bind ![ gs c cycle altqd')
  146.     send_command('bind !] gs c cycleback altqd')
  147.     send_command('bind @[ gs c toggle selectqdtarget')
  148.     send_command('bind @] gs c toggle usealtqd')   
  149.    
  150.  
  151.     send_command('bind @c gs c toggle CP')
  152.     send_command('bind @q gs c cycle QDMode')
  153.     send_command('bind @g gs c cycle Gun')
  154.     send_command('bind @w gs c toggle WeaponLock')
  155.    
  156.     send_command('bind ^z input /item "Echo Drops" <me>')  
  157.     send_command('bind ^x input /item "Remedy" <me>')
  158.     send_command('bind ^c input /item "Holy Water" <me>')  
  159.  
  160.     send_command('bind ^numlock input /ja "Triple Shot" <me>')
  161.  
  162.     if player.sub_job == "DNC" then
  163.         send_command('bind !. input /ja "Spectral Jig" <me>')
  164.     elseif player.sub_job == "NIN" then
  165.         send_command('bind !. input /ma "Monomi: Ichi" <me>')
  166.         send_command('bind !, input /ma "Tonko: Ni" <me>')
  167.         send_command('bind !numpad+ input /ma "Utsusemi: Ichi" <me>')
  168.         send_command('bind ^numpad+ input /ma "Utsusemi: Ni" <me>')
  169.     elseif player.sub_job == 'WAR' then
  170.         send_command('bind ^numpad/ input /ja "Berserk" <me>')
  171.         send_command('bind ^numpad* input /ja "Warcry" <me>')
  172.         send_command('bind ^numpad- input /ja "Aggressor" <me>')
  173.         send_command('bind !. input /item "Silent Oil" <me>')
  174.         send_command('bind !, input /item "Prism Powder" <me>')
  175.     else
  176.         send_command('bind !. input /item "Silent Oil" <me>')
  177.         send_command('bind !, input /item "Prism Powder" <me>')
  178.     end
  179.  
  180.     send_command('bind ^numpad7 input /ws "Savage Blade" <t>')
  181.     send_command('bind ^numpad8 input /ws "Last Stand" <t>')
  182.     send_command('bind ^numpad9 input /ws "Leaden Salute" <t>')
  183.     send_command('bind ^numpad6 input /ws "Wildfire" <t>')
  184.     send_command('bind ^numpad4 input /ws "Requiescat" <t>')
  185.     send_command('bind ^numpad2 input /ws "Burning Blade" <t>')
  186.     send_command('bind ^numpad3 input /ws "Flat Blade" <t>')
  187.  
  188.     send_command('bind numpad1 input /ra <t>')
  189.  
  190.     select_default_macro_book()
  191.     set_lockstyle()
  192. end
  193.  
  194.  
  195. -- Called when this job file is unloaded (eg: job change)
  196. function user_unload()
  197.     send_command('unbind ^`')
  198.     send_command('unbind !`')
  199.     send_command('unbind @`')
  200.     send_command('unbind ^-')
  201.     send_command('unbind ^=')
  202.     send_command('unbind !-')
  203.     send_command('unbind !=')
  204.     send_command('unbind ^[')
  205.     send_command('unbind ^]')
  206.     send_command('unbind ![')
  207.     send_command('unbind !]')  
  208.     send_command('unbind @[')
  209.     send_command('unbind @]')  
  210.     send_command('unbind @c')
  211.     send_command('unbind @q')
  212.     send_command('unbind @g')
  213.     send_command('unbind @w')
  214.     send_command('unbind ^numlock')
  215.     send_command('unbind ^numpad/')
  216.     send_command('unbind ^numpad*')
  217.     send_command('unbind ^numpad-')
  218.     send_command('unbind ^numpad8')
  219.     send_command('unbind ^numpad4')
  220.     send_command('unbind ^numpad6')
  221.     send_command('unbind ^numpad1')
  222.     send_command('unbind ^numpad2')
  223.     send_command('unbind ^numpad3')
  224.     send_command('unbind numpad1')
  225.     send_command('unbind numpad.')
  226.     send_command('unbind ^numpad.')
  227.     send_command('unbind !,')
  228.     send_command('unbind !.')
  229.     send_command('unbind ^numpad+')
  230.     send_command('unbind !numpad+')
  231.     send_command('unbind ^z')
  232.     send_command('unbind ^x')
  233.     send_command('unbind ^c')  
  234.  
  235.     send_command('unbind #`')
  236.     send_command('unbind #1')
  237.     send_command('unbind #2')
  238.     send_command('unbind #3')
  239.     send_command('unbind #4')
  240.     send_command('unbind #5')
  241.     send_command('unbind #6')
  242.     send_command('unbind #7')
  243.     send_command('unbind #8')
  244.     send_command('unbind #9')
  245.     send_command('unbind #0')
  246. end
  247.  
  248. -- Define sets and vars used by this job file.
  249. function init_gear_sets()
  250.  
  251.     ------------------------------------------------------------------------------------------------
  252.     ---------------------------------------- Precast Sets ------------------------------------------
  253.     ------------------------------------------------------------------------------------------------
  254.  
  255.     sets.precast.JA['Snake Eye'] = {legs="Lanun Trews +1"}
  256.     sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +3"}
  257.     sets.precast.JA['Random Deal'] = {body="Lanun Frac +1"}
  258.  
  259.     sets.precast.CorsairRoll = {
  260.         head={ name="Lanun Tricorne +1", augments={'Enhances "Winning Streak" effect',}},
  261.         body="Meg. Cuirie +2",
  262.         hands="Umuthi Gloves",
  263.         legs={ name="Desultor Tassets", augments={'"Sic" and "Ready" ability delay -5','"Phantom Roll" ability delay -5',}},
  264.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  265.         neck="Regal Necklace",
  266.         waist="Flume Belt",
  267.         left_ear="Ethereal Earring",
  268.         right_ear="Etiolation Earring",
  269.         left_ring="Dark Ring",
  270.         right_ring="Defending Ring",
  271.         back="Camulus's Mantle",
  272.         }
  273.  
  274.     sets.precast.CorsairRoll.Gun = set_combine(sets.precast.CorsairRoll.Engaged, {range="Compensator"})
  275.     sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chas. Culottes +1"})
  276.     sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chass. Bottes +1"})
  277.     sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chass. Tricorne +1"})
  278.     sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac +1"})
  279.     sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants +1"})
  280.    
  281.     sets.precast.LuzafRing = set_combine(sets.precast.CorsairRoll, {ring2="Luzaf's Ring"})
  282.     sets.precast.FoldDoubleBust = {hands="Lanun Gants +1"}
  283.  
  284.     sets.precast.Waltz = {
  285.         body="Passion Jacket",
  286.         neck="Phalaina Locket",
  287.         ring1="Asklepian Ring",
  288.         waist="Gishdubar Sash",
  289.         }
  290.  
  291.     sets.precast.Waltz['Healing Waltz'] = {}
  292.    
  293.     sets.precast.FC = {
  294.         head={ name="Carmine Mask", augments={'Accuracy+15','Mag. Acc.+10','"Fast Cast"+3',}},
  295.         body={ name="Taeon Tabard", augments={'Accuracy+19 Attack+19','"Fast Cast"+5','Phalanx +3',}},
  296.         hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
  297.         legs={ name="Rawhide Trousers", augments={'MP+50','"Fast Cast"+5','"Refresh"+1',}},
  298.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  299.         neck="Orunmila's Torque",
  300.         waist="Flume Belt",
  301.         left_ear="Loquac. Earring",
  302.         right_ear="Etiolation Earring",
  303.         left_ring="Prolix Ring",
  304.         right_ring="Kishar Ring",
  305.         back="Camulus's Mantle",
  306.         }
  307.  
  308.     sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {
  309.         body="Passion Jacket",
  310.         neck="Magoraga Beads",
  311.         ring1="Lebeche Ring",
  312.         })
  313.  
  314.     -- (10% Snapshot from JP Gifts)
  315.     sets.precast.RA = {
  316.         ammo=gear.RAbullet,
  317.         head={ name="Taeon Chapeau", augments={'"Snapshot"+5','"Snapshot"+5',}},
  318.         body="Oshosi Vest",
  319.         hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  320.         legs={ name="Adhemar Kecks +1", augments={'AGI+12','Rng.Acc.+20','Rng.Atk.+20',}},
  321.         feet="Meg. Jam. +2",
  322.         waist="Impulse Belt",
  323.         back="Navarch's Mantle",
  324.         } --59/26
  325.  
  326.     sets.precast.RA.Flurry1 = set_combine(sets.precast.RA, {
  327.         }) --47/46
  328.  
  329.     sets.precast.RA.Flurry2 = set_combine(sets.precast.RA.Flurry1, {
  330.         }) --30/65
  331.  
  332.  
  333.     ------------------------------------------------------------------------------------------------
  334.     ------------------------------------- Weapon Skill Sets ----------------------------------------
  335.     ------------------------------------------------------------------------------------------------
  336.  
  337.     sets.precast.WS = {
  338.         ammo=gear.WSbullet,
  339.         head={ name="Herculean Helm", augments={'Weapon skill damage +4%','STR+9','Accuracy+15','Attack+11',}},
  340.         body="Laksa. Frac +3",
  341.         hands="Meg. Gloves +2",
  342.         legs={ name="Herculean Trousers", augments={'Weapon skill damage +4%','STR+15','Accuracy+5','Attack+10',}},
  343.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  344.         neck="Fotia Gorget",
  345.         waist="Fotia Belt",
  346.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  347.         right_ear="Ishvara Earring",
  348.         left_ring="Ifrit Ring +1",
  349.         right_ring="Ifrit Ring +1",
  350.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','Weapon skill damage +10%',}},
  351.         }
  352.  
  353.     sets.precast.WS.Acc = set_combine(sets.precast.WS, {
  354.         ammo=gear.WSbullet,
  355.         head="Meghanada Visor +2",
  356.         body="Meg. Cuirie +2",
  357.         hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  358.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  359.         feet="Meg. Jam. +2",
  360.         neck="Sanctity Necklace",
  361.         waist="Kentarch Belt +1",
  362.         left_ear="Mache Earring",
  363.         right_ear="Mache Earring",
  364.         left_ring="Ramuh Ring +1",
  365.         right_ring="Cacoethic Ring",
  366.         back="Lupine Cape",
  367.         })
  368.  
  369.     sets.precast.WS['Last Stand'] = {
  370.         ammo=gear.WSbullet,
  371.         head={ name="Herculean Helm", augments={'Rng.Acc.+30','Weapon skill damage +4%','STR+6','Rng.Atk.+15',}},
  372.         body="Laksa. Frac +3",
  373.         hands="Meg. Gloves +2",
  374.         legs={ name="Herculean Trousers", augments={'Rng.Acc.+22 Rng.Atk.+22','Weapon skill damage +4%','DEX+6','Rng.Acc.+2','Rng.Atk.+4',}},
  375.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  376.         neck="Fotia Gorget",
  377.         waist="Fotia Belt",
  378.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  379.         right_ear="Ishvara Earring",
  380.         left_ring="Ilabrat Ring",
  381.         right_ring="Dingir Ring",
  382.         back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  383.         }
  384.        
  385.     sets.precast.WS['Last Stand'].Acc = set_combine(sets.precast.WS['Last Stand'], {
  386.         neck="Sanctity Necklace",
  387.         waist="K. Kachina Belt +1",
  388.         left_ear="Clearview Earring",
  389.         right_ear="Enervating Earring",
  390.         left_ring="Longshot Ring",
  391.         right_ring="Cacoethic Ring",
  392.         })
  393.  
  394.     sets.precast.WS['Wildfire'] = {
  395.         ammo=gear.MAbullet,
  396.         head={ name="Herculean Helm", augments={'"Mag.Atk.Bns."+22','Weapon skill damage +4%','Rng.Acc.+2','Rng.Atk.+10',}},
  397.         body="Laksa. Frac +3",
  398.         hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  399.         legs={ name="Herculean Trousers", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','"Store TP"+5','INT+6','Mag. Acc.+15','"Mag.Atk.Bns."+10',}},
  400.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  401.         neck="Sanctity Necklace",
  402.         waist="Eschan Stone",
  403.         left_ear="Friomisi Earring",
  404.         right_ear="Hecate's Earring",
  405.         left_ring="Arvina Ringlet +1",
  406.         right_ring="Dingir Ring",
  407.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},
  408.         }
  409.  
  410.     sets.precast.WS['Leaden Salute'] = set_combine(sets.precast.WS['Wildfire'], {
  411.         head="Pixie Hairpin +1",
  412.         ear2="Moonshade Earring",
  413.         ring1="Archon Ring",
  414.         })
  415.  
  416.     sets.precast.WS['Leaden Salute'].FullTP = {ear2="Hecate's Earring"}
  417.  
  418.     sets.precast.WS['Detonator'] = set_combine(sets.precast.WS['Last Stand'], {
  419.         })
  420.     sets.precast.WS['Evisceration'] = {
  421.         }
  422.  
  423.     sets.precast.WS['Evisceration'].Acc = set_combine(sets.precast.WS['Evisceration'], {
  424.         })
  425.  
  426.     sets.precast.WS['Savage Blade'] = {
  427.         head={ name="Herculean Helm", augments={'Weapon skill damage +4%','STR+9','Accuracy+15','Attack+11',}},
  428.         body="Laksa. Frac +3",
  429.         hands="Meg. Gloves +2",
  430.         legs={ name="Herculean Trousers", augments={'Weapon skill damage +4%','STR+15','Accuracy+5','Attack+10',}},
  431.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  432.         neck="Caro Necklace",
  433.         waist="Prosilio Belt +1",
  434.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  435.         right_ear="Ishvara Earring",
  436.         left_ring="Ifrit Ring +1",
  437.         right_ring="Ifrit Ring +1",
  438.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','Weapon skill damage +10%',}},
  439.         }
  440.        
  441.     sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'], {
  442.         })
  443.    
  444.     sets.precast.WS['Requiescat'] = {
  445.         head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  446.         body={ name="Adhemar Jacket", augments={'DEX+10','AGI+10','Accuracy+15',}},
  447.         hands="Meg. Gloves +2",
  448.         legs="Meg. Chausses +2",
  449.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  450.         neck="Fotia Gorget",
  451.         waist="Fotia Belt",
  452.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +25',}},
  453.         right_ear="Ishvara Earring",
  454.         left_ring="Ifrit Ring +1",
  455.         right_ring="Epona's Ring",
  456.         back={ name="Gunslinger's Cape", augments={'Enmity-3','"Mag.Atk.Bns."+4','"Phantom Roll" ability delay -1','Weapon skill damage +3%',}},
  457.         } --MND
  458.  
  459.     sets.precast.WS['Requiescat'].Acc = set_combine(sets.precast.WS['Requiescat'], {
  460.         })
  461.  
  462.     ------------------------------------------------------------------------------------------------
  463.     ---------------------------------------- Midcast Sets ------------------------------------------
  464.     ------------------------------------------------------------------------------------------------
  465.  
  466.     sets.midcast.FastRecast = sets.precast.FC
  467.  
  468.     sets.midcast.SpellInterrupt = {
  469.         legs="Carmine Cuisses +1", --20
  470.         ring1="Evanescence Ring", --5
  471.         }
  472.  
  473.     sets.midcast.Cure = {
  474.         head={ name="Carmine Mask", augments={'Accuracy+15','Mag. Acc.+10','"Fast Cast"+3',}},
  475.         body="Meg. Cuirie +2",
  476.         hands="Rawhide Gloves",
  477.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  478.         feet="Meg. Jam. +2",
  479.         neck="Phalaina Locket",
  480.         waist="Chuq'aba Belt",
  481.         left_ear="Gwati Earring",
  482.         right_ear="Etiolation Earring",
  483.         left_ring="Levia. Ring",
  484.         right_ring="Kunaji Ring",
  485.         back="Solemnity Cape",
  486.         }    
  487.  
  488.     sets.midcast.Utsusemi = sets.midcast.SpellInterrupt
  489.  
  490.     sets.midcast.CorsairShot = {
  491.         ammo=gear.QDbullet,
  492.         head="Laksa. Tricorne +2",
  493.         body="Mummu Jacket +2",
  494.         hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
  495.         legs="Mummu Kecks +2",
  496.         feet="Laksa. Boots +2",
  497.         neck="Sanctity Necklace",
  498.         waist="Eschan Stone",
  499.         left_ear="Friomisi Earring",
  500.         right_ear="Hecate's Earring",
  501.         left_ring="Shiva Ring +1",
  502.         right_ring="Shiva Ring +1",
  503.         back={ name="Gunslinger's Cape", augments={'Enmity-3','"Mag.Atk.Bns."+4','"Phantom Roll" ability delay -1','Weapon skill damage +3%',}},
  504.         }
  505.  
  506.     sets.midcast.CorsairShot.STP = set_combine(sets.midcast.CorsairShot, {
  507.         neck="Ocachi Gorget",
  508.         waist="Yemaya Belt",
  509.         left_ear="Cessance Earring",
  510.         right_ear="Digni. Earring",
  511.         left_ring="Ilabrat Ring",
  512.         right_ring="Apate Ring",
  513.         back="Lupine Cape",
  514.         })
  515.  
  516.     sets.midcast.CorsairShot.Resistant = set_combine(sets.midcast.CorsairShot, {
  517.         head={ name="Carmine Mask", augments={'Accuracy+15','Mag. Acc.+10','"Fast Cast"+3',}},
  518.         feet={ name="Herculean Boots", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','STR+3','"Mag.Atk.Bns."+13',}},
  519.         left_ear="Gwati Earring",
  520.         right_ear="Digni. Earring",
  521.         left_ring="Perception Ring",
  522.         right_ring="Kishar Ring",
  523.         })
  524.  
  525.     sets.midcast.CorsairShot['Light Shot'] = sets.midcast.CorsairShot.Resistant
  526.     sets.midcast.CorsairShot['Dark Shot'] = sets.midcast.CorsairShot.Resistant
  527.     sets.midcast.CorsairShot.Enhance = {body="Mirke Wardecors", feet="Chass. Bottes +1"}
  528.  
  529.     -- Ranged gear
  530.     sets.midcast.RA = {
  531.         ammo=gear.RAbullet,    
  532.         head="Meghanada Visor +2",
  533.         body="Laksa. Frac +3",
  534.         hands="Meg. Gloves +2",
  535.         legs={ name="Adhemar Kecks +1", augments={'AGI+12','Rng.Acc.+20','Rng.Atk.+20',}},
  536.         feet="Meg. Jam. +2",
  537.         neck="Iskur Gorget",
  538.         waist="K. Kachina Belt +1",
  539.         left_ear="Telos Earring",
  540.         right_ear="Enervating Earring",
  541.         left_ring="Longshot Ring",
  542.         right_ring="Cacoethic Ring",
  543.         back={ name="Gunslinger's Cape", augments={'Enmity-3','"Mag.Atk.Bns."+4','"Phantom Roll" ability delay -1','Weapon skill damage +3%',}},
  544.         }
  545.  
  546.     sets.midcast.RA.HighAcc = set_combine(sets.midcast.RA.Acc, {
  547.         })
  548.  
  549.     sets.midcast.RA.STP = set_combine(sets.midcast.RA, {
  550.         })
  551.  
  552.     sets.TripleShot = {
  553.         head="Oshosi Mask", --4
  554.         body="Chasseur's Frac +1", --12
  555.         hands="Oshosi Gloves", -- 3
  556.         legs="Oshosi Trousers", --5
  557.         feet="Oshosi Leggings", --2
  558.         } --27
  559.  
  560.  
  561.  
  562.     ------------------------------------------------------------------------------------------------
  563.     ----------------------------------------- Idle Sets --------------------------------------------
  564.     ------------------------------------------------------------------------------------------------
  565.  
  566.     sets.resting = {}
  567.  
  568.     sets.idle = {
  569.         head="Meghanada Visor +2",
  570.         body="Meg. Cuirie +2",
  571.         hands="Meg. Gloves +2",
  572.         legs="Meg. Chausses +2",
  573.         feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}},
  574.         neck="Sanctity Necklace",
  575.         waist="Flume Belt",
  576.         left_ear="Ethereal Earring",
  577.         right_ear="Etiolation Earring",
  578.         left_ring={ name="Dark Ring", augments={'Magic dmg. taken -3%','Phys. dmg. taken -6%',}},
  579.         right_ring="Defending Ring",
  580.         back="Solemnity Cape",
  581.         }
  582.  
  583.     sets.idle.DT = set_combine(sets.idle, {
  584.         head={ name="Dampening Tam", augments={'DEX+10','Accuracy+15','Mag. Acc.+15','Quadruple Attack +3',}},
  585.         body="Meg. Cuirie +2",
  586.         hands="Meg. Gloves +2",
  587.         legs={ name="Herculean Trousers", augments={'Phys. dmg. taken -2%','Pet: "Subtle Blow"+5','Damage taken-2%',}},
  588.         feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}},
  589.         neck="Loricate Torque +1",
  590.         waist="Flume Belt",
  591.         left_ear="Genmei Earring",
  592.         right_ear="Etiolation Earring",
  593.         left_ring={ name="Dark Ring", augments={'Magic dmg. taken -3%','Phys. dmg. taken -6%',}},
  594.         right_ring="Defending Ring",
  595.         back="Solemnity Cape",
  596.         })
  597.  
  598.     sets.idle.Refresh = set_combine(sets.idle, {
  599.         legs="Rawhide Trousers",
  600.         })
  601.  
  602.     ------------------------------------------------------------------------------------------------
  603.     ---------------------------------------- Defense Sets ------------------------------------------
  604.     ------------------------------------------------------------------------------------------------
  605.  
  606.     sets.defense.PDT = sets.idle.DT
  607.     sets.defense.MDT = sets.idle.DT
  608.  
  609.     sets.Kiting = {legs="Carmine Cuisses +1"}
  610.  
  611.  
  612.     ------------------------------------------------------------------------------------------------
  613.     ---------------------------------------- Engaged Sets ------------------------------------------
  614.     ------------------------------------------------------------------------------------------------
  615.  
  616.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  617.     -- sets if more refined versions aren't defined.
  618.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  619.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  620.  
  621.     sets.engaged = {
  622.         head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  623.         body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  624.         hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  625.         legs={ name="Herculean Trousers", augments={'Accuracy+25','"Triple Atk."+3','DEX+4',}},
  626.         feet={ name="Herculean Boots", augments={'Accuracy+28','"Triple Atk."+3','DEX+1',}},
  627.         neck="Lissome Necklace",
  628.         waist="Windbuffet Belt +1",
  629.         left_ear="Cessance Earring",
  630.         right_ear="Brutal Earring",
  631.         left_ring="Ilabrat Ring",
  632.         right_ring="Epona's Ring",
  633.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','Weapon skill damage +10%',}},
  634.         }
  635.  
  636.     sets.engaged.HighAcc = set_combine(sets.engaged, {
  637.         head={ name="Dampening Tam", augments={'DEX+10','Accuracy+15','Mag. Acc.+15','Quadruple Attack +3',}},
  638.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  639.         feet="Meg. Jam. +2",
  640.         neck="Iqabi Necklace",
  641.         waist="Kentarch Belt +1",
  642.         left_ear="Telos Earring",
  643.         right_ear="Mache Earring",
  644.         left_ring="Ramuh Ring +1",
  645.         right_ring="Cacoethic Ring",
  646.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','Weapon skill damage +10%',}},
  647.         })
  648.  
  649.     sets.engaged.STP = set_combine(sets.engaged, {
  650.         feet="Carmine Greaves +1",
  651.         ring1="Chirich Ring",
  652.         })
  653.  
  654.     ------------------------------------------------------------------------------------------------
  655.     ---------------------------------------- Hybrid Sets -------------------------------------------
  656.     ------------------------------------------------------------------------------------------------
  657.  
  658.     sets.engaged.Hybrid = {
  659.         neck="Loricate Torque +1", --6/6
  660.         ring2="Defending Ring", --10/10
  661.         }
  662.    
  663.     ------------------------------------------------------------------------------------------------
  664.     ---------------------------------------- Special Sets ------------------------------------------
  665.     ------------------------------------------------------------------------------------------------
  666.  
  667.     sets.buff.Doom = {ring1="Eshmun's Ring", ring2="Eshmun's Ring", waist="Gishdubar Sash"}
  668.  
  669.     sets.Obi = {waist="Hachirin-no-Obi"}
  670.     sets.CP = {back="Mecisto. Mantle"}
  671.     sets.Reive = {neck="Ygnas's Resolve +1"}
  672.  
  673. end
  674.  
  675.  
  676. -------------------------------------------------------------------------------------------------------------------
  677. -- Job-specific hooks for standard casting events.
  678. -------------------------------------------------------------------------------------------------------------------
  679.  
  680. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  681. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  682. function job_precast(spell, action, spellMap, eventArgs)
  683.     -- Check that proper ammo is available if we're using ranged attacks or similar.
  684.     if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  685.         do_bullet_checks(spell, spellMap, eventArgs)
  686.     end
  687.  
  688.     -- Gear
  689.     if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") then
  690.         if player.status ~= 'Engaged' then
  691.             equip(sets.precast.CorsairRoll.Gun)
  692.         end
  693.         if state.LuzafRing.value then
  694.             equip(sets.precast.LuzafRing)
  695.         end
  696.     elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
  697.         classes.CustomClass = 'Acc'
  698.     end
  699.    
  700.     if spell.english == 'Fold' and buffactive['Bust'] == 2 then
  701.         if sets.precast.FoldDoubleBust then
  702.             equip(sets.precast.FoldDoubleBust)
  703.             eventArgs.handled = true
  704.         end
  705.     end
  706.     if spellMap == 'Utsusemi' then
  707.         if buffactive['Copy Image (3)'] or buffactive['Copy Image (4+)'] then
  708.             cancel_spell()
  709.             add_to_chat(123, '**!! '..spell.english..' Canceled: [3+ IMAGES] !!**')
  710.             eventArgs.handled = true
  711.             return
  712.         elseif buffactive['Copy Image'] or buffactive['Copy Image (2)'] then
  713.             send_command('cancel 66; cancel 444; cancel Copy Image; cancel Copy Image (2)')
  714.         end
  715.     end
  716. end
  717.  
  718. function job_post_precast(spell, action, spellMap, eventArgs)
  719.     if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") then
  720.         if player.status ~= 'Engaged' then
  721.             equip(sets.precast.CorsairRoll.Gun)
  722.         end
  723.     elseif spell.action_type == 'Ranged Attack' then
  724.         if flurry == 2 then
  725.             equip(sets.precast.RA.Flurry2)
  726.         elseif flurry == 1 then
  727.             equip(sets.precast.RA.Flurry1)
  728.         end
  729.     -- Equip obi if weather/day matches for WS.
  730.     elseif spell.type == 'WeaponSkill' then
  731.         if spell.english == 'Leaden Salute' then
  732.             if world.weather_element == 'Dark' or world.day_element == 'Dark' then
  733.                 equip(sets.Obi)
  734.             end
  735.             if player.tp > 2900 then
  736.                 equip(sets.precast.WS['Leaden Salute'].FullTP)
  737.             end    
  738.         elseif spell.english == 'Wildfire' and (world.weather_element == 'Fire' or world.day_element == 'Fire') then
  739.             equip(sets.Obi)
  740.         end
  741.     end
  742. end
  743.  
  744. function job_post_midcast(spell, action, spellMap, eventArgs)
  745.     -- Equip obi if weather/day matches for Quick Draw.
  746.     if spell.type == 'CorsairShot' then
  747.         if (spell.element == world.day_element or spell.element == world.weather_element) and
  748.         (spell.english ~= 'Light Shot' and spell.english ~= 'Dark Shot') then
  749.             equip(sets.Obi)
  750.         end
  751.         if state.QDMode.value == 'Magic Enhance' then
  752.             equip(sets.midcast.CorsairShot.Enhance)
  753.         elseif state.QDMode.value == 'STP' then
  754.             equip(sets.midcast.CorsairShot.STP)
  755.         end
  756.     elseif spell.action_type == 'Ranged Attack' and buffactive['Triple Shot'] then
  757.         equip(sets.TripleShot)
  758.     end
  759. end
  760.  
  761. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  762. function job_aftercast(spell, action, spellMap, eventArgs)
  763.     if spell.type == 'CorsairRoll' and not spell.interrupted then
  764.         display_roll_info(spell)
  765.     end
  766.     if spell.english == "Light Shot" then
  767.         send_command('@timers c "Light Shot ['..spell.target.name..']" 60 down abilities/00195.png')
  768.     end
  769. end
  770.  
  771. function job_buff_change(buff,gain)
  772.     -- If we gain or lose any haste buffs, adjust gear.
  773.     if S{'haste', 'march', 'mighty guard', 'embrava', 'haste samba', 'geo-haste', 'indi-haste'}:contains(buff:lower()) then
  774.         determine_haste_group()
  775.         customize_melee_set()
  776.         if not gain then
  777.             haste = nil
  778.             --add_to_chat(122, "Haste Status: Cleared")
  779.         end
  780.         if not midaction() then
  781.             handle_equipping_gear(player.status)
  782.         end
  783.     end
  784.  
  785. -- If we gain or lose any flurry buffs, adjust gear.
  786.     if S{'flurry'}:contains(buff:lower()) then
  787.         if not gain then
  788.             flurry = nil
  789.             --add_to_chat(122, "Flurry status cleared.")
  790.         end
  791.         if not midaction() then
  792.             handle_equipping_gear(player.status)
  793.         end
  794.     end
  795.  
  796. --    if buffactive['Reive Mark'] then
  797. --        if gain then          
  798. --            equip(sets.Reive)
  799. --            disable('neck')
  800. --        else
  801. --            enable('neck')
  802. --        end
  803. --    end
  804.  
  805.     if buff == "doom" then
  806.         if gain then          
  807.             equip(sets.buff.Doom)
  808.             send_command('@input /p Doomed.')
  809.             disable('ring1','ring2','waist')
  810.         else
  811.             enable('ring1','ring2','waist')
  812.             handle_equipping_gear(player.status)
  813.         end
  814.     end
  815.  
  816. end
  817.  
  818. -- Handle notifications of general user state change.
  819. function job_state_change(stateField, newValue, oldValue)
  820.     if state.WeaponLock.value == true then
  821.         disable('ranged')
  822.     else
  823.         enable('ranged')
  824.     end
  825. end
  826.  
  827. -------------------------------------------------------------------------------------------------------------------
  828. -- User code that supplements standard library decisions.
  829. -------------------------------------------------------------------------------------------------------------------
  830.  
  831. -- Called by the 'update' self-command, for common needs.
  832. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  833. function job_update(cmdParams, eventArgs)
  834.     update_offense_mode()
  835.     determine_haste_group()
  836. end
  837.  
  838. -- Modify the default idle set after it was constructed.
  839. function customize_idle_set(idleSet)
  840.     if state.Gun.current == 'Fomalhaut' then
  841.         equip({ranged="Fomalhaut"})
  842.     elseif state.Gun.current == 'Anarchy +2' then
  843.         equip({ranged="Anarchy +2"})
  844.     end
  845. end
  846.  
  847. -- Modify the default idle set after it was constructed.
  848. function customize_idle_set(idleSet)
  849.     if state.CP.current == 'on' then
  850.         equip(sets.CP)
  851.         disable('back')
  852.     else
  853.         enable('back')
  854.     end
  855.     return idleSet
  856. end
  857.  
  858. -- Modify the default melee set after it was constructed.
  859. function customize_melee_set(meleeSet)
  860.     if state.DualWield.value == true and player.sub_job == 'NIN' then
  861.         meleeSet = set_combine(meleeSet, sets.LessDualWield)
  862.     end
  863.  
  864.     return meleeSet
  865. end
  866.  
  867. -- Handle auto-targetting based on local setup.
  868. function job_auto_change_target(spell, action, spellMap, eventArgs)
  869.     if spell.type == 'CorsairShot' then
  870.         if state.IgnoreTargetting.value == true then
  871.             state.IgnoreTargetting:reset()
  872.             eventArgs.handled = true
  873.         end
  874.        
  875.         eventArgs.SelectNPCTargets = state.SelectqdTarget.value
  876.     end
  877. end
  878.  
  879. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  880. function display_current_job_state(eventArgs)
  881.     local msg = ''
  882.    
  883.     msg = msg .. '[ Offense/Ranged: '..state.OffenseMode.current
  884.    
  885.     if state.HybridMode.value ~= 'Normal' then
  886.         msg = msg .. '/' .. state.HybridMode.value
  887.     end
  888.    
  889.     msg = msg .. '/' ..state.RangedMode.current .. ' ]'
  890.  
  891.     if state.WeaponskillMode.value ~= 'Normal' then
  892.         msg = msg .. '[ WS: '..state.WeaponskillMode.current .. ' ]'
  893.     end
  894.  
  895.     if state.DefenseMode.value ~= 'None' then
  896.         msg = msg .. '[ Defense: ' .. state.DefenseMode.value .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ' ]'
  897.     end
  898.    
  899.     if state.Kiting.value then
  900.         msg = msg .. '[ Kiting Mode: ON ]'
  901.     end
  902.  
  903.     msg = msg .. '[ *'..state.Mainqd.current
  904.  
  905.     if state.UseAltqd.value == true then
  906.         msg = msg .. '/'..state.Altqd.current
  907.     end
  908.    
  909.     msg = msg .. ' ('
  910.  
  911.     if state.QDMode.value then
  912.         msg = msg .. state.QDMode.current .. ') '
  913.     end    
  914.  
  915.     msg = msg .. ']'
  916.    
  917.     add_to_chat(060, msg)
  918.  
  919.     eventArgs.handled = true
  920. end
  921.  
  922. -------------------------------------------------------------------------------------------------------------------
  923. -- User self-commands.
  924. -------------------------------------------------------------------------------------------------------------------
  925.  
  926. -- Called for custom player commands.
  927. function job_self_command(cmdParams, eventArgs)
  928.     if cmdParams[1] == 'qd' then
  929.         if cmdParams[2] == 't' then
  930.             state.IgnoreTargetting:set()
  931.         end
  932.  
  933.         local doqd = ''
  934.         if state.UseAltqd.value == true then
  935.             doqd = state[state.Currentqd.current..'qd'].current
  936.             state.Currentqd:cycle()
  937.         else
  938.             doqd = state.Mainqd.current
  939.         end        
  940.        
  941.         send_command('@input /ja "'..doqd..'" <t>')
  942.     end
  943. end
  944.  
  945.  
  946. -------------------------------------------------------------------------------------------------------------------
  947. -- Utility functions specific to this job.
  948. -------------------------------------------------------------------------------------------------------------------
  949.  
  950. --Read incoming packet to differentiate between Haste/Flurry I and II
  951. windower.register_event('action',
  952.     function(act)
  953.         --check if you are a target of spell
  954.         local actionTargets = act.targets
  955.         playerId = windower.ffxi.get_player().id
  956.         isTarget = false
  957.         for _, target in ipairs(actionTargets) do
  958.             if playerId == target.id then
  959.                 isTarget = true
  960.             end
  961.         end
  962.         if isTarget == true then
  963.             if act.category == 4 then
  964.                 local param = act.param
  965.                 if param == 845 and flurry ~= 2 then
  966.                     --add_to_chat(122, 'Flurry Status: Flurry I')
  967.                     flurry = 1
  968.                 elseif param == 846 then
  969.                     --add_to_chat(122, 'Flurry Status: Flurry II')
  970.                     flurry = 2             
  971.                 elseif param == 57 and haste ~=2 then
  972.                     --add_to_chat(122, 'Haste Status: Haste I (Haste)')
  973.                     haste = 1
  974.                 elseif param == 511 then
  975.                     --add_to_chat(122, 'Haste Status: Haste II (Haste II)')
  976.                     haste = 2
  977.                 end
  978.             elseif act.category == 5 then
  979.                 if act.param == 5389 then
  980.                     --add_to_chat(122, 'Haste Status: Haste II (Spy Drink)')
  981.                     haste = 2
  982.                 end
  983.             elseif act.category == 13 then
  984.                 local param = act.param
  985.                 --595 haste 1 -602 hastega 2
  986.                 if param == 595 and haste ~=2 then
  987.                     --add_to_chat(122, 'Haste Status: Haste I (Hastega)')
  988.                     haste = 1
  989.                 elseif param == 602 then
  990.                     --add_to_chat(122, 'Haste Status: Haste II (Hastega2)')
  991.                     haste = 2
  992.                 end
  993.             end
  994.         end
  995.     end)
  996.  
  997. function determine_haste_group()
  998.  
  999.     -- Assuming the following values:
  1000.  
  1001.     -- Haste - 15%
  1002.     -- Haste II - 30%
  1003.     -- Haste Samba - 5%
  1004.     -- Honor March - 15%
  1005.     -- Victory March - 25%
  1006.     -- Advancing March - 15%
  1007.     -- Embrava - 25%
  1008.     -- Mighty Guard (buffactive[604]) - 15%
  1009.     -- Geo-Haste (buffactive[580]) - 30%
  1010.  
  1011.     classes.CustomMeleeGroups:clear()
  1012.  
  1013.     if state.CombatForm.value == 'DW' then
  1014.  
  1015.         if (haste == 2 and (buffactive[580] or buffactive.march or buffactive.embrava or buffactive[604])) or
  1016.             (haste == 1 and (buffactive[580] or buffactive.march == 2 or (buffactive.embrava and buffactive['haste samba']) or (buffactive.march and buffactive[604]))) or
  1017.             (buffactive[580] and (buffactive.march or buffactive.embrava or buffactive[604])) or
  1018.             (buffactive.march == 2 and (buffactive.embrava or buffactive[604])) or
  1019.             (buffactive.march and (buffactive.embrava and buffactive['haste samba'])) then
  1020.             --add_to_chat(122, 'Magic Haste Level: 43%')
  1021.             classes.CustomMeleeGroups:append('MaxHaste')
  1022.             state.DualWield:set()
  1023.         elseif ((haste == 2 or buffactive[580] or buffactive.march == 2) and buffactive['haste samba']) or
  1024.             (haste == 1 and buffactive['haste samba'] and (buffactive.march or buffactive[604])) or
  1025.             (buffactive.march and buffactive['haste samba'] and buffactive[604]) then
  1026.             --add_to_chat(122, 'Magic Haste Level: 35%')
  1027.             classes.CustomMeleeGroups:append('HighHaste')
  1028.             state.DualWield:set()
  1029.         elseif (haste == 2 or buffactive[580] or buffactive.march == 2 or (buffactive.embrava and buffactive['haste samba']) or
  1030.             (haste == 1 and (buffactive.march or buffactive[604])) or (buffactive.march and buffactive[604])) then
  1031.             --add_to_chat(122, 'Magic Haste Level: 30%')
  1032.             classes.CustomMeleeGroups:append('MidHaste')
  1033.             state.DualWield:set()
  1034.         elseif (haste == 1 or buffactive.march or buffactive[604] or buffactive.embrava) then
  1035.             --add_to_chat(122, 'Magic Haste Level: 15%')
  1036.             classes.CustomMeleeGroups:append('LowHaste')
  1037.             state.DualWield:set()
  1038.         else
  1039.             state.DualWield:set(false)
  1040.         end
  1041.     end
  1042. end
  1043.  
  1044.  
  1045. function define_roll_values()
  1046.     rolls = {
  1047.         ["Corsair's Roll"] =    {lucky=5, unlucky=9, bonus="Experience Points"},
  1048.         ["Ninja Roll"] =        {lucky=4, unlucky=8, bonus="Evasion"},
  1049.         ["Hunter's Roll"] =     {lucky=4, unlucky=8, bonus="Accuracy"},
  1050.         ["Chaos Roll"] =        {lucky=4, unlucky=8, bonus="Attack"},
  1051.         ["Magus's Roll"] =      {lucky=2, unlucky=6, bonus="Magic Defense"},
  1052.         ["Healer's Roll"] =     {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  1053.         ["Drachen Roll"] =      {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  1054.         ["Choral Roll"] =       {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  1055.         ["Monk's Roll"] =       {lucky=3, unlucky=7, bonus="Subtle Blow"},
  1056.         ["Beast Roll"] =        {lucky=4, unlucky=8, bonus="Pet Attack"},
  1057.         ["Samurai Roll"] =      {lucky=2, unlucky=6, bonus="Store TP"},
  1058.         ["Evoker's Roll"] =     {lucky=5, unlucky=9, bonus="Refresh"},
  1059.         ["Rogue's Roll"] =      {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  1060.         ["Warlock's Roll"] =    {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  1061.         ["Fighter's Roll"] =    {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  1062.         ["Puppet Roll"] =       {lucky=3, unlucky=7, bonus="Pet Magic Attack/Accuracy"},
  1063.         ["Gallant's Roll"] =    {lucky=3, unlucky=7, bonus="Defense"},
  1064.         ["Wizard's Roll"] =     {lucky=5, unlucky=9, bonus="Magic Attack"},
  1065.         ["Dancer's Roll"] =     {lucky=3, unlucky=7, bonus="Regen"},
  1066.         ["Scholar's Roll"] =    {lucky=2, unlucky=6, bonus="Conserve MP"},
  1067.         ["Naturalist's Roll"] = {lucky=3, unlucky=7, bonus="Enh. Magic Duration"},
  1068.         ["Runeist's Roll"] =    {lucky=4, unlucky=8, bonus="Magic Evasion"},
  1069.         ["Bolter's Roll"] =     {lucky=3, unlucky=9, bonus="Movement Speed"},
  1070.         ["Caster's Roll"] =     {lucky=2, unlucky=7, bonus="Fast Cast"},
  1071.         ["Courser's Roll"] =    {lucky=3, unlucky=9, bonus="Snapshot"},
  1072.         ["Blitzer's Roll"] =    {lucky=4, unlucky=9, bonus="Attack Delay"},
  1073.         ["Tactician's Roll"] =  {lucky=5, unlucky=8, bonus="Regain"},
  1074.         ["Allies' Roll"] =      {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  1075.         ["Miser's Roll"] =      {lucky=5, unlucky=7, bonus="Save TP"},
  1076.         ["Companion's Roll"] =  {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  1077.         ["Avenger's Roll"] =    {lucky=4, unlucky=8, bonus="Counter Rate"},
  1078.     }
  1079. end
  1080.  
  1081. function display_roll_info(spell)
  1082.     rollinfo = rolls[spell.english]
  1083.     local rollsize = (state.LuzafRing.value and 'Large') or 'Small'
  1084.  
  1085.     if rollinfo then
  1086.         add_to_chat(104, '[ Lucky: '..tostring(rollinfo.lucky)..' / Unlucky: '..tostring(rollinfo.unlucky)..' ] '..spell.english..': '..rollinfo.bonus..' ('..rollsize..') ')
  1087.     end
  1088. end
  1089.  
  1090.  
  1091. -- Determine whether we have sufficient ammo for the action being attempted.
  1092. function do_bullet_checks(spell, spellMap, eventArgs)
  1093.     local bullet_name
  1094.     local bullet_min_count = 1
  1095.    
  1096.     if spell.type == 'WeaponSkill' then
  1097.         if spell.skill == "Marksmanship" then
  1098.             if spell.english == 'Wildfire' or spell.english == 'Leaden Salute' then
  1099.                 -- magical weaponskills
  1100.                 bullet_name = gear.MAbullet
  1101.             else
  1102.                 -- physical weaponskills
  1103.                 bullet_name = gear.WSbullet
  1104.             end
  1105.         else
  1106.             -- Ignore non-ranged weaponskills
  1107.             return
  1108.         end
  1109.     elseif spell.type == 'CorsairShot' then
  1110.         bullet_name = gear.QDbullet
  1111.     elseif spell.action_type == 'Ranged Attack' then
  1112.         bullet_name = gear.RAbullet
  1113.         if buffactive['Triple Shot'] then
  1114.             bullet_min_count = 3
  1115.         end
  1116.     end
  1117.    
  1118.     local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  1119.    
  1120.     -- If no ammo is available, give appropriate warning and end.
  1121.     if not available_bullets then
  1122.         if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  1123.             add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
  1124.             return
  1125.         elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  1126.             add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  1127.             return
  1128.         else
  1129.             add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  1130.             eventArgs.cancel = true
  1131.             return
  1132.         end
  1133.     end
  1134.    
  1135.     -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  1136.     if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  1137.         add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
  1138.         eventArgs.cancel = true
  1139.         return
  1140.     end
  1141.    
  1142.     -- Low ammo warning.
  1143.     if spell.type ~= 'CorsairShot' and state.warned.value == false
  1144.         and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  1145.         local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
  1146.         --local border = string.repeat("*", #msg)
  1147.         local border = ""
  1148.         for i = 1, #msg do
  1149.             border = border .. "*"
  1150.         end
  1151.        
  1152.         add_to_chat(104, border)
  1153.         add_to_chat(104, msg)
  1154.         add_to_chat(104, border)
  1155.  
  1156.         state.warned:set()
  1157.     elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  1158.         state.warned:reset()
  1159.     end
  1160. end
  1161.  
  1162. function update_offense_mode()  
  1163.     if player.sub_job == 'NIN' or player.sub_job == 'DNC' then
  1164.         state.CombatForm:set('DW')
  1165.     else
  1166.         state.CombatForm:reset()
  1167.     end
  1168. end
  1169.  
  1170. -- Select default macro book on initial load or subjob change.
  1171. function select_default_macro_book()
  1172.     if player.sub_job == 'DNC' then
  1173.         set_macro_page(1, 5)
  1174.     else
  1175.         set_macro_page(1, 5)
  1176.     end
  1177. end
  1178.  
  1179. function set_lockstyle()
  1180.     send_command('wait 2; input /lockstyleset ' .. lockstyleset)
  1181. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement