Guest User

Untitled

a guest
Apr 4th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.77 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. --[[
  6.  
  7.     Custom commands:
  8.    
  9.     gs c qd
  10.         Uses the currently configured step on the target, with either <t> or <stnpc> depending on setting.
  11.  
  12.     gs c qd t
  13.         Uses the currently configured step on the target, but forces use of <t>.
  14.    
  15.    
  16.     Configuration commands:
  17.    
  18.     gs c cycle mainqd
  19.         Cycles through the available steps to use as the primary step when using one of the above commands.
  20.        
  21.     gs c cycle altqd
  22.         Cycles through the available steps to use for alternating with the configured main step.
  23.        
  24.     gs c toggle usealtqd
  25.         Toggles whether or not to use an alternate step.
  26.        
  27.     gs c toggle selectqdtarget
  28.         Toggles whether or not to use <stnpc> (as opposed to <t>) when using a step.
  29.        
  30.        
  31.     gs c toggle LuzafRing -- Toggles use of Luzaf Ring on and off
  32.    
  33.     Offense mode is melee or ranged.  Used ranged offense mode if you are engaged
  34.     for ranged weaponskills, but not actually meleeing.
  35.    
  36.     Weaponskill mode, if set to 'Normal', is handled separately for melee and ranged weaponskills.
  37. --]]
  38.  
  39.  
  40. -- Initialization function for this job file.
  41. function get_sets()
  42.     mote_include_version = 2
  43.    
  44.     -- Load and initialize the include file.
  45.     include('Mote-Include.lua')
  46. end
  47.  
  48. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  49. function job_setup()
  50.     -- QuickDraw Selector
  51.     state.MainQD = M{['description']='Primary Shot', 'Dark Shot', 'Earth Shot', 'Water Shot', 'Wind Shot', 'Fire Shot', 'Ice Shot', 'Thunder Shot'}
  52.     state.AltQD = M{['description']='Secondary Shot', 'Earth Shot', 'Water Shot', 'Wind Shot', 'Fire Shot', 'Ice Shot', 'Thunder Shot', 'Dark Shot'}
  53.     state.UseAltQD = M(false, 'Use Secondary Shot')
  54.     state.SelectQDTarget = M(false, 'Select Quick Draw Target')
  55.     state.IgnoreTargetting = M(false, 'Ignore Targetting')
  56.  
  57.     state.CurrentQD = M{['description']='Current Quick Draw', 'Main', 'Alt'}
  58.    
  59.     -- Whether to use Luzaf's Ring
  60.     state.LuzafRing = M(false, "Luzaf's Ring")
  61.     -- Whether a warning has been given for low ammo
  62.     state.warned = M(false)
  63.  
  64.     define_roll_values()
  65.     determine_haste_group()
  66.  
  67. end
  68.  
  69. -------------------------------------------------------------------------------------------------------------------
  70. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  71. -------------------------------------------------------------------------------------------------------------------
  72.  
  73. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  74. function user_setup()
  75.     state.OffenseMode:options('Normal', 'Acc')
  76.     state.RangedMode:options('Normal', 'Acc', 'Fodder')
  77.     state.WeaponskillMode:options('Normal', 'Acc')
  78.     state.CastingMode:options('Normal', 'Resistant')
  79.     state.IdleMode:options('Normal', 'PDT', 'Refresh')
  80.  
  81.     gear.RAbullet = "Adlivun Bullet"
  82.     gear.WSbullet = "Adlivun Bullet"
  83.     gear.MAbullet = "Orichalc. Bullet"
  84.     gear.QDbullet = "Animikii Bullet"
  85.     options.ammo_warning_limit = 5
  86.  
  87.     -- Additional local binds
  88.     send_command('bind ^` input /ja "Double-up" <me>')
  89.     send_command('bind !` input /ja "Bolter\'s Roll" <me>')
  90.     send_command ('bind @` gs c toggle LuzafRing')
  91.    
  92.     send_command('bind ^= gs c cycle mainqd')
  93.     send_command('bind != gs c cycle altqd')
  94.     send_command('bind ^- gs c toggle selectqdtarget')
  95.     send_command('bind !- gs c toggle usealtqd')
  96.     send_command('bind ^, input /ja "Spectral Jig" <me>')
  97.  
  98.     select_default_macro_book()
  99. end
  100.  
  101.  
  102. -- Called when this job file is unloaded (eg: job change)
  103. function user_unload()
  104.     send_command('unbind ^`')
  105.     send_command('unbind !`')
  106.     send_command('unbind @`')
  107.     send_command('unbind ^=')
  108.     send_command('unbind !=')
  109.     send_command('unbind ^-')
  110.     send_command('unbind !-')
  111.     send_command('unbind ^,')
  112. end
  113.  
  114. -- Define sets and vars used by this job file.
  115. function init_gear_sets()
  116.     --------------------------------------
  117.     -- Start defining the sets
  118.     --------------------------------------
  119.    
  120.     -- Precast Sets
  121.    
  122.     sets.precast.JA['Triple Shot'] = {body="Chasseur's Frac +1"}
  123.     sets.precast.JA['Snake Eye'] = {legs="Comm. Culottes +2"}
  124.     sets.precast.JA['Wild Card'] = {feet="Comm. Bottes +2"}
  125.     sets.precast.JA['Random Deal'] = {body="Lanun Frac +1"}
  126.  
  127.    
  128.     sets.precast.CorsairRoll = {
  129. --      range="Compensator",
  130.         head="Lanun Tricorne +1",
  131.         body="Lanun Frac +1",
  132.         hands="Chasseur's Gants",
  133.         legs="Desultor Tassets",
  134.         neck="Loricate Torque +1",
  135.         ring1="Barataria Ring",
  136.         back="Gunslinger's Cape",
  137.         waist="Flume Belt",
  138.         }
  139.    
  140.     sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chas. Culottes"})
  141.     sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chass. Bottes +1"})
  142.     sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chass. Tricorne"})
  143.     sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac +1"})
  144.     sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants"})
  145.    
  146.     sets.precast.LuzafRing = {ring2="Luzaf's Ring"}
  147.     sets.precast.FoldDoubleBust = {hands="Comm. Gants +2"}
  148.    
  149.     sets.precast.CorsairShot = {}
  150.  
  151.     sets.precast.Waltz = {
  152.         hands="Slither Gloves +1",
  153.         ring1="Asklepian Ring",
  154.         ring2="Valseur's Ring",
  155.         } -- CHR and VIT
  156.  
  157.     sets.precast.Waltz['Healing Waltz'] = {}
  158.    
  159.     sets.precast.FC = {
  160.         head=gear.Herc_MAB_head,
  161.         body="Samnuha Coat",
  162.         hands="Leyline Gloves",
  163.         neck="Orunmila's Torque",
  164.         ear2="Loquacious Earring",
  165.         ring1="Prolix Ring",
  166.         ring2="Weather. Ring",
  167.         }
  168.  
  169.     sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {
  170.         neck="Magoraga Beads",
  171.         ring1="Lebeche Ring",
  172.         })
  173.  
  174.     sets.precast.RA = {
  175.         ammo=gear.RAbullet,
  176.         head="Aurore Beret +1", --5
  177.         body="Lak. Frac +1",
  178.         hands="Carmine Fin. Ga.", --7
  179.         legs="Adhemar Kecks", --9
  180.         feet="Wurrukatte Boots", --6
  181.         back="Navarch's Mantle", --6.5
  182.         waist="Impulse Belt", --3
  183.         }
  184.  
  185.        
  186.     -- Weaponskill sets
  187.     -- Default set for any weaponskill that isn't any more specifically defined
  188.     sets.precast.WS = {
  189.         ammo=gear.WSbullet,
  190.         head="Pursuer's Beret",
  191.         body="Chasseur's Frac +1",
  192.         hands="Pursuer's Cuffs",
  193.         legs="Pursuer's Pants",
  194.         feet="Adhemar Gamashes",       
  195.         neck=gear.ElementalGorget,
  196.         ear1="Enervating Earring",
  197.         ear2="Moonshade Earring",
  198.         ring1="Petrov Ring",
  199.         ring2="Arvina Ringlet +1",
  200.         back="Gunslinger's Cape",
  201.         waist=gear.ElementalBelt,
  202.         }
  203.  
  204.  
  205.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  206.  
  207.     sets.precast.WS["Last Stand"] = sets.precast.WS
  208.  
  209.     sets.precast.WS['Last Stand'].Acc = set_combine(sets.precast.WS['Last Stand'], {
  210.         ammo=gear.WSbullet,
  211.         head=gear.Taeon_RA_head,
  212.         hands="Adhemar Wristbands",
  213.         feet=gear.Taeon_RA_feet,       
  214.         })
  215.  
  216.     sets.precast.WS['Wildfire'] = {
  217.         ammo=gear.MAbullet,
  218.         head=gear.Herc_MAB_head,
  219.         body="Samnuha Coat",
  220.         hands="Carmine Fin. Ga.",
  221.         legs=gear.Herc_MAB_legs,
  222.         feet=gear.Herc_MAB_feet,
  223.         neck="Deviant Necklace",
  224.         ear1="Hecate's Earring",
  225.         ear2="Friomisi Earring",
  226.         ring1="Garuda Ring",
  227.         ring2="Arvina Ringlet +1",
  228.         back="Gunslinger's Cape",
  229.         waist="Eschan Stone",
  230.         }
  231.    
  232.     sets.precast.WS['Leaden Salute'] =  {
  233.         ammo=gear.MAbullet,
  234.         head="Pixie Hairpin +1",
  235.         body="Samnuha Coat",
  236.         hands="Pursuer's Cuffs",
  237.         legs=gear.Herc_MAB_legs,
  238.         feet=gear.Herc_MAB_feet,
  239.         neck="Deviant Necklace",
  240.         ear1="Moonshade Earring",
  241.         ear2="Friomisi Earring",
  242.         ring1="Archon Ring",
  243.         ring2="Arvina Ringlet +1",
  244.         back="Gunslinger's Cape",
  245.         waist="Eschan Stone",
  246.         }
  247.        
  248.     sets.precast.WS['Evisceration'] = {
  249.         head="Lilitu Headpiece",
  250.         body="Adhemar Jacket",
  251.         hands=gear.Herc_TA_hands,
  252.         legs=gear.Herc_TA_legs,
  253.         feet=gear.Herc_TA_feet,
  254.         neck=gear.ElementalGorget,
  255.         ear1="Brutal Earring",
  256.         ear2="Moonshade Earring",
  257.         ring1="Apate Ring",
  258.         ring2="Ramuh Ring +1",
  259.         back="Bleating Mantle",
  260.         waist=gear.ElementalBelt,
  261.         }
  262.  
  263.     sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS['Evisceration'], {
  264.         ring1="Apate Ring",
  265.         ring2="Garuda Ring",
  266.         })
  267.    
  268.     sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS['Evisceration'], {
  269.         neck="Caro Necklace",
  270.         ring1="Rufescent Ring",
  271.         ring2="Ifrit Ring",
  272.         })
  273.  
  274.     sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS['Savage Blade'], {
  275.         head="Adhemar Bonnet",
  276.         ring1="Rufescent Ring",
  277.         ring2="Levia. Ring +1",
  278.         }) --MND
  279.    
  280.     -- Midcast Sets
  281.     sets.midcast.FastRecast = {
  282.         ear1="Loquacious Earring",
  283.         }
  284.  
  285.     sets.midcast.Cure = {
  286.         neck="Incanter's Torque",
  287.         ear1="Roundel Earring",
  288.         ear2="Mendi. Earring",
  289.         ring1="Haoma's Ring",
  290.         ring2="Sirona's Ring",
  291.         waist="Bishop's Sash",
  292.         }  
  293.  
  294.     sets.midcast.Utsusemi = {
  295.         waist="Ninurta's Sash",
  296.         }
  297.  
  298.     sets.midcast.CorsairShot = {
  299.         ammo=gear.QDbullet,
  300.         head=gear.Herc_MAB_head,
  301.         body="Samnuha Coat",
  302.         hands="Leyline Gloves",
  303.         legs=gear.Herc_MAB_legs,
  304. --      feet=gear.Herc_MAB_feet,
  305.         feet="Chass. Bottes +1",
  306.         neck="Deviant Necklace",
  307.         ear1="Hecate's Earring",
  308.         ear2="Friomisi Earring",
  309.         ring1="Fenrir Ring +1",
  310.         ring2="Fenrir Ring +1",
  311.         back="Gunslinger's Cape",
  312.         waist="Eschan Stone",
  313.         }
  314.  
  315.     sets.midcast.CorsairShot.Acc = set_combine(sets.midcast.CorsairShot, {
  316.         ammo=gear.QDbullet,
  317.         ear1="Hermetic Earring",
  318.         ear2="Friomisi Earring",
  319.         back="Navarch's Mantle",
  320.         })
  321.  
  322.     sets.midcast.CorsairShot['Light Shot'] = set_combine(sets.midcast.CorsairShot, {
  323.         ring2="Weather. Ring",
  324.         })
  325.  
  326.     sets.midcast.CorsairShot['Dark Shot'] = set_combine(sets.midcast.CorsairShot, {
  327.         head="Pixie Hairpin +1",
  328.         ring2="Archon Ring",
  329.         })
  330.  
  331.  
  332.     -- Ranged gear
  333.     sets.midcast.RA = {
  334.         ammo=gear.RAbullet,
  335.         head="Pursuer's Beret",
  336.         body="Chasseur's Frac +1",
  337.         hands="Adhemar Wristbands",
  338.         legs="Pursuer's Pants",
  339.         feet="Adhemar Gamashes",
  340.         neck="Marked Gorget",
  341.         ear1="Enervating Earring",
  342.         ear2="Neritic Earring",
  343.         ring1="Apate Ring",
  344.         ring2="Arvina Ringlet +1",
  345.         back="Gunslinger's Cape",
  346.         waist="Yemaya Belt",
  347.         }
  348.  
  349.     sets.midcast.RA.Acc = set_combine(sets.midcast.RA, {
  350.         ammo=gear.RAbullet,
  351.         head=gear.Taeon_RA_head,
  352.         legs="Adhemar Kecks",
  353.         feet=gear.Taeon_RA_feet,
  354.         waist="Eschan Stone",
  355.         })
  356.  
  357.     sets.midcast.RA.Fodder = set_combine(sets.midcast.RA, {
  358.         ammo=gear.RAbullet,
  359.         body="Chasseur's Frac +1",
  360.         neck="Ocachi Gorget",
  361.         waist="Ponente Belt",
  362.         })
  363.  
  364.     -- Sets to return to when not performing an action.
  365.    
  366.     -- Resting sets
  367.     sets.resting = {}
  368.    
  369.     -- Idle sets
  370.     sets.idle = {
  371.         ammo=gear.RAbullet,
  372.         head=gear.Herc_MAB_head,
  373.         body=gear.Herc_TA_body,
  374.         hands=gear.Herc_TA_hands,
  375.         legs="Carmine Cuisses",
  376.         feet=gear.Herc_TA_feet,
  377.         neck="Loricate Torque +1",
  378.         ear1="Enervating Earring",
  379.         ear2="Infused Earring",
  380.         ring1="Paguroidea Ring",
  381.         ring2="Sheltered Ring",
  382.         back="Gunslinger's Cape",
  383.         waist="Flume Belt",
  384.         }
  385.  
  386.     sets.idle.Town = set_combine(sets.idle, {
  387.         head="Pixie Hairpin +1",
  388.         body="Chasseur's Frac +1",
  389.         feet="Chass. Bottes +1",
  390.         neck="Marked Gorget",
  391.         ear2="Neritic Earring",
  392.         ring1="Apate Ring",
  393.         ring2="Arvina Ringlet +1",
  394.         waist="Eschan Stone",
  395.         })
  396.  
  397.    
  398.     -- Defense sets
  399.     sets.defense.PDT = {
  400.         neck="Loricate Torque +1",
  401.         ring2=gear.DarkRing,
  402.         back="Agema Cape",
  403.         waist="Flume Belt",
  404.         }
  405.  
  406.     sets.defense.MDT = {
  407.         neck="Loricate Torque +1",
  408.         ring2=gear.DarkRing,
  409.         back="Agema Cape",
  410.         }
  411.    
  412.  
  413.     sets.Kiting = {legs="Carmine Cuisses"}
  414.  
  415.     -- Engaged sets
  416.  
  417.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  418.     -- sets if more refined versions aren't defined.
  419.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  420.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  421.    
  422.     -- Normal melee group
  423.     sets.engaged = {
  424.         ammo=gear.RAbullet,
  425.         head="Adhemar Bonnet",
  426.         body="Adhemar Jacket",
  427.         hands=gear.Herc_TA_hands,
  428.         legs="Samnuha Tights",
  429.         feet=gear.Taeon_DW_feet,
  430.         neck="Lissome Necklace",
  431.         ear1="Brutal Earring",
  432.         ear2="Suppanomimi",
  433.         ring1="Petrov Ring",
  434.         ring2="Epona's Ring",
  435.         back="Bleating Mantle",
  436.         waist="Windbuffet Belt +1",
  437.         }
  438.  
  439.     sets.engaged.Acc = set_combine(sets.engaged, {
  440.         head=gear.Herc_TA_head,
  441.         body=gear.Herc_TA_body,
  442.         legs="Carmine Cuisses",
  443.         feet=gear.Herc_TA_feet,
  444.         neck="Lissome Necklace",
  445.         ear1="Digni. Earring",
  446.         ear2="Zennaroi Earring",
  447.         ring2="Ramuh Ring +1",
  448.         back="Letalis Mantle",
  449.         waist="Kentarch Belt +1",
  450.         })
  451.  
  452.     sets.engaged.HighHaste = {
  453.         ammo=gear.RAbullet,
  454.         head="Adhemar Bonnet",
  455.         body="Adhemar Jacket",
  456.         hands=gear.Herc_TA_hands,
  457.         legs="Samnuha Tights",
  458.         feet=gear.Herc_TA_feet,
  459.         neck="Lissome Necklace",
  460.         ear1="Brutal Earring",
  461.         ear2="Suppanomimi",
  462.         ring1="Petrov Ring",
  463.         ring2="Epona's Ring",
  464.         back="Bleating Mantle",
  465.         waist="Windbuffet Belt +1",
  466.         }
  467.  
  468.     sets.engaged.HighHaste.Acc = set_combine(sets.engaged.HighHaste, {
  469.         head=gear.Herc_TA_head,
  470.         body=gear.Herc_TA_body,
  471.         legs="Carmine Cuisses",
  472.         neck="Lissome Necklace",
  473.         ear1="Digni. Earring",
  474.         ear2="Zennaroi Earring",
  475.         ring2="Ramuh Ring +1",
  476.         back="Letalis Mantle",
  477.         waist="Kentarch Belt +1",
  478.         })
  479.  
  480.     sets.engaged.MaxHaste = {
  481.         ammo=gear.RAbullet,
  482.         head="Adhemar Bonnet",
  483.         body="Adhemar Jacket",
  484.         hands=gear.Herc_TA_hands,
  485.         legs="Samnuha Tights",
  486.         feet=gear.Herc_TA_feet,
  487.         neck="Lissome Necklace",
  488.         ear1="Brutal Earring",
  489.         ear2="Suppanomimi",
  490.         ring1="Petrov Ring",
  491.         ring2="Epona's Ring",
  492.         back="Bleating Mantle",
  493.         waist="Windbuffet Belt +1",
  494.         }
  495.  
  496.     sets.engaged.MaxHaste.Acc = set_combine(sets.engaged.HighHaste, {
  497.         head=gear.Herc_TA_head,
  498.         body=gear.Herc_TA_body,
  499.         legs="Carmine Cuisses",
  500.         neck="Lissome Necklace",
  501.         ear1="Digni. Earring",
  502.         ear2="Zennaroi Earring",
  503.         ring2="Ramuh Ring +1",
  504.         back="Letalis Mantle",
  505.         waist="Kentarch Belt +1",
  506.         })
  507.  
  508. end
  509.  
  510.  
  511. -------------------------------------------------------------------------------------------------------------------
  512. -- Job-specific hooks for standard casting events.
  513. -------------------------------------------------------------------------------------------------------------------
  514.  
  515. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  516. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  517. function job_precast(spell, action, spellMap, eventArgs)
  518.     -- Check that proper ammo is available if we're using ranged attacks or similar.
  519.     if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  520.         do_bullet_checks(spell, spellMap, eventArgs)
  521.     end
  522.  
  523.     -- gear sets
  524.     if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing.value then
  525.         equip(sets.precast.LuzafRing)
  526.     elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
  527.         classes.CustomClass = 'Acc'
  528.     elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
  529.         if sets.precast.FoldDoubleBust then
  530.             equip(sets.precast.FoldDoubleBust)
  531.             eventArgs.handled = true
  532.         end
  533.     end
  534. end
  535.  
  536.  
  537. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  538. function job_aftercast(spell, action, spellMap, eventArgs)
  539.     if spell.type == 'CorsairRoll' and not spell.interrupted then
  540.         display_roll_info(spell)
  541.     end
  542. end
  543.  
  544. function job_status_change(new_status, old_status)
  545.     if new_status == 'Engaged' then
  546.         determine_haste_group()
  547.     end
  548. end
  549.  
  550. -------------------------------------------------------------------------------------------------------------------
  551. -- User code that supplements standard library decisions.
  552. -------------------------------------------------------------------------------------------------------------------
  553.  
  554. -- Return a customized weaponskill mode to use for weaponskill sets.
  555. -- Don't return anything if you're not overriding the default value.
  556.  
  557. function job_update(cmdParams, eventArgs)
  558.     determine_haste_group()
  559. end
  560.  
  561. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  562.  
  563. function job_update(cmdParams, eventArgs)
  564.     determine_haste_group()
  565. end
  566.  
  567. function display_current_job_state(eventArgs)
  568.  
  569. end
  570.  
  571. function get_custom_wsmode(spell, spellMap, default_wsmode)
  572.     if buffactive['Transcendancy'] then
  573.         return 'Brew'
  574.     end
  575. end
  576.  
  577.  
  578. -- Called by the 'update' self-command, for common needs.
  579. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  580. function job_update(cmdParams, eventArgs)
  581.     if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  582.         state.OffenseMode:set('Ranged')
  583.     end
  584. end
  585.  
  586. -- Handle auto-targetting based on local setup.
  587. function job_auto_change_target(spell, action, spellMap, eventArgs)
  588.     if spell.type == 'CorsairShot' then
  589.         if state.IgnoreTargetting.value == true then
  590.             state.IgnoreTargetting:reset()
  591.             eventArgs.handled = true
  592.         end
  593.        
  594.         eventArgs.SelectNPCTargets = state.SelectQDTarget.value
  595.     end
  596. end
  597.  
  598. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  599. function display_current_job_state(eventArgs)
  600.     local msg = ''
  601.    
  602.     msg = msg .. 'Offense/Ranged: ['..state.OffenseMode.current..'/'..state.RangedMode.current
  603.     msg = msg .. '], WS: ['..state.WeaponskillMode.current..']'
  604.  
  605.     if state.DefenseMode.value ~= 'None' then
  606.         local defMode = state[state.DefenseMode.value ..'DefenseMode'].current
  607.         msg = msg .. ', Defense: ('..state.DefenseMode.value..' '..defMode..')'
  608.     end
  609.    
  610.     if state.Kiting.value then
  611.         msg = msg .. ', Kiting'
  612.     end
  613.  
  614.     msg = msg .. ', ['..state.MainQD.current
  615.  
  616.     if state.UseAltQD.value == true then
  617.         msg = msg .. '/'..state.AltQD.current
  618.     end
  619.    
  620.     msg = msg .. ']'
  621.    
  622.     add_to_chat(122, msg)
  623.  
  624.     eventArgs.handled = true
  625. end
  626.  
  627. -------------------------------------------------------------------------------------------------------------------
  628. -- User self-commands.
  629. -------------------------------------------------------------------------------------------------------------------
  630.  
  631. -- Called for custom player commands.
  632. function job_self_command(cmdParams, eventArgs)
  633.     if cmdParams[1] == 'qd' then
  634.         if cmdParams[2] == 't' then
  635.             state.IgnoreTargetting:set()
  636.         end
  637.  
  638.         local doQD = ''
  639.         if state.UseAltQD.value == true then
  640.             doQD = state[state.CurrentQD.current..'QD'].current
  641.             state.CurrentQD:cycle()
  642.         else
  643.             doQD = state.MainQD.current
  644.         end    
  645.        
  646.         send_command('@input /ja "'..doQD..'" <t>')
  647.     end
  648. end
  649.  
  650.  
  651. -------------------------------------------------------------------------------------------------------------------
  652. -- Utility functions specific to this job.
  653. -------------------------------------------------------------------------------------------------------------------
  654.  
  655. function determine_haste_group()
  656.     -- We have three groups of DW in gear: Charis body, Charis neck + DW earrings, and Patentia Sash.
  657.  
  658.     -- For high haste, we want to be able to drop one of the 10% groups (body, preferably).
  659.     -- High haste buffs:
  660.     -- 2x Marches + Haste
  661.     -- 2x Marches + Haste Samba
  662.     -- 1x March + Haste + Haste Samba
  663.     -- Embrava + any other haste buff
  664.    
  665.     -- For max haste, we probably need to consider dropping all DW gear.
  666.     -- Max haste buffs:
  667.     -- Embrava + Haste/March + Haste Samba
  668.     -- 2x March + Haste + Haste Samba
  669.  
  670.     classes.CustomMeleeGroups:clear()
  671.    
  672.     if buffactive.embrava and (buffactive.haste or buffactive.march) then
  673.         classes.CustomMeleeGroups:append('MaxHaste')
  674.     elseif buffactive.march == 2 and buffactive.haste then
  675.         classes.CustomMeleeGroups:append('MaxHaste')
  676.     elseif buffactive.embrava and (buffactive.haste or buffactive.march) then
  677.         classes.CustomMeleeGroups:append('HighHaste')
  678.     elseif buffactive.march == 1 and buffactive.haste then
  679.         classes.CustomMeleeGroups:append('HighHaste')
  680.     elseif buffactive.march == 2 and buffactive.haste then
  681.         classes.CustomMeleeGroups:append('HighHaste')
  682.     end
  683. end
  684.  
  685. function define_roll_values()
  686.     rolls = {
  687.         ["Corsair's Roll"]   = {lucky=5, unlucky=9, bonus="Experience Points"},
  688.         ["Ninja Roll"]     = {lucky=4, unlucky=8, bonus="Evasion"},
  689.         ["Hunter's Roll"]   = {lucky=4, unlucky=8, bonus="Accuracy"},
  690.         ["Chaos Roll"]     = {lucky=4, unlucky=8, bonus="Attack"},
  691.         ["Magus's Roll"]     = {lucky=2, unlucky=6, bonus="Magic Defense"},
  692.         ["Healer's Roll"]   = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  693.         ["Puppet Roll"]   = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  694.         ["Choral Roll"]   = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  695.         ["Monk's Roll"]   = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  696.         ["Beast Roll"]     = {lucky=4, unlucky=8, bonus="Pet Attack"},
  697.         ["Samurai Roll"]     = {lucky=2, unlucky=6, bonus="Store TP"},
  698.         ["Evoker's Roll"]   = {lucky=5, unlucky=9, bonus="Refresh"},
  699.         ["Rogue's Roll"]     = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  700.         ["Warlock's Roll"]   = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  701.         ["Fighter's Roll"]   = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  702.         ["Drachen Roll"]     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  703.         ["Gallant's Roll"]   = {lucky=3, unlucky=7, bonus="Defense"},
  704.         ["Wizard's Roll"]   = {lucky=5, unlucky=9, bonus="Magic Attack"},
  705.         ["Dancer's Roll"]   = {lucky=3, unlucky=7, bonus="Regen"},
  706.         ["Scholar's Roll"]   = {lucky=2, unlucky=6, bonus="Conserve MP"},
  707.         ["Bolter's Roll"]   = {lucky=3, unlucky=9, bonus="Movement Speed"},
  708.         ["Caster's Roll"]   = {lucky=2, unlucky=7, bonus="Fast Cast"},
  709.         ["Courser's Roll"]   = {lucky=3, unlucky=9, bonus="Snapshot"},
  710.         ["Blitzer's Roll"]   = {lucky=4, unlucky=9, bonus="Attack Delay"},
  711.         ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  712.         ["Allies's Roll"]   = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  713.         ["Miser's Roll"]     = {lucky=5, unlucky=7, bonus="Save TP"},
  714.         ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  715.         ["Avenger's Roll"]   = {lucky=4, unlucky=8, bonus="Counter Rate"},
  716.     }
  717. end
  718.  
  719. function display_roll_info(spell)
  720.     rollinfo = rolls[spell.english]
  721.     local rollsize = (state.LuzafRing.value and 'Large') or 'Small'
  722.  
  723.     if rollinfo then
  724.         add_to_chat(104, '[ Lucky: '..tostring(rollinfo.lucky)..' / Unlucky: '..tostring(rollinfo.unlucky)..' ] '..spell.english..': '..rollinfo.bonus..' ('..rollsize..') ')
  725.     end
  726. end
  727.  
  728.  
  729. -- Determine whether we have sufficient ammo for the action being attempted.
  730. function do_bullet_checks(spell, spellMap, eventArgs)
  731.     local bullet_name
  732.     local bullet_min_count = 1
  733.    
  734.     if spell.type == 'WeaponSkill' then
  735.         if spell.skill == "Marksmanship" then
  736.             if spell.element == 'None' then
  737.                 -- physical weaponskills
  738.                 bullet_name = gear.WSbullet
  739.             else
  740.                 -- magical weaponskills
  741.                 bullet_name = gear.MAbullet
  742.             end
  743.         else
  744.             -- Ignore non-ranged weaponskills
  745.             return
  746.         end
  747.     elseif spell.type == 'CorsairShot' then
  748.         bullet_name = gear.QDbullet
  749.     elseif spell.action_type == 'Ranged Attack' then
  750.         bullet_name = gear.RAbullet
  751.         if buffactive['Triple Shot'] then
  752.             bullet_min_count = 3
  753.         end
  754.     end
  755.    
  756.     local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  757.    
  758.     -- If no ammo is available, give appropriate warning and end.
  759.     if not available_bullets then
  760.         if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  761.             add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
  762.             return
  763.         elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  764. --          add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  765.             return
  766.         else
  767.             add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  768.             eventArgs.cancel = true
  769.             return
  770.         end
  771.     end
  772.    
  773.     -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  774.     if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  775.         add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
  776.         eventArgs.cancel = true
  777.         return
  778.     end
  779.    
  780.     -- Low ammo warning.
  781.     if spell.type ~= 'CorsairShot' and state.warned.value == false
  782.         and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  783.         local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
  784.         --local border = string.repeat("*", #msg)
  785.         local border = ""
  786.         for i = 1, #msg do
  787.             border = border .. "*"
  788.         end
  789.        
  790.         add_to_chat(104, border)
  791.         add_to_chat(104, msg)
  792.         add_to_chat(104, border)
  793.  
  794.         state.warned:set()
  795.     elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  796.         state.warned:reset()
  797.     end
  798. end
  799.  
  800. -- Select default macro book on initial load or subjob change.
  801. function select_default_macro_book()
  802.     if player.sub_job == 'DNC' then
  803.         set_macro_page(1, 7)
  804.     else
  805.         set_macro_page(2, 7)
  806.     end
  807. end
Advertisement
Add Comment
Please, Sign In to add comment