Advertisement
Vamperica

COR

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