Guest User

Arislan - COR

a guest
Mar 5th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.23 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="Wiglen Gorget",
  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.         body="Samnuha Coat",
  161.         hands="Leyline Gloves",
  162.         neck="Orunmila's Torque",
  163.         ear2="Loquacious Earring",
  164.         ring1="Prolix Ring", --2
  165.         ring2="Weather. Ring", --5
  166.         }
  167.  
  168.     sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {
  169.         neck="Magoraga Beads",
  170.         ring1="Lebeche Ring",
  171.         })
  172.  
  173.     sets.precast.RA = {
  174.         ammo=gear.RAbullet,
  175.         head="Chass. Tricorne",
  176.         body="Lak. Frac +1",
  177.         hands="Carmine Fin. Ga.",
  178.         legs="Adhemar Kecks",
  179.         ring1="Lebeche Ring",
  180.         back="Navarch's Mantle",
  181.         waist="Impulse Belt",
  182.         }
  183.  
  184.        
  185.     -- Weaponskill sets
  186.     -- Default set for any weaponskill that isn't any more specifically defined
  187.     sets.precast.WS = {
  188.         ammo=gear.WSbullet,
  189.         head="Pursuer's Beret",
  190.         body="Chasseur's Frac +1",
  191.         hands="Pursuer's Cuffs",
  192.         legs="Pursuer's Pants",
  193.         feet="Adhemar Gamashes",       
  194.         neck=gear.ElementalGorget,
  195.         ear1="Enervating Earring",
  196.         ear2="Moonshade Earring",
  197.         ring1="Petrov Ring",
  198.         ring2="Arvina Ringlet +1",
  199.         back="Gunslinger's Cape",
  200.         waist=gear.ElementalBelt,
  201.         }
  202.  
  203.  
  204.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  205.  
  206.     sets.precast.WS["Last Stand"] = sets.precast.WS
  207.  
  208.     sets.precast.WS['Last Stand'].Acc = set_combine(sets.precast.WS['Last Stand'], {
  209.         ammo=gear.WSbullet,
  210.         head=gear.Taeon_RA_head,
  211.         hands="Floral Gauntlets",
  212.         feet=gear.Taeon_RA_feet,       
  213.         })
  214.  
  215.     sets.precast.WS['Wildfire'] = {
  216.         ammo=gear.MAbullet,
  217.         head="Pursuer's Beret",
  218.         body="Samnuha Coat",
  219.         hands="Carmine Fin. Ga.",
  220.         legs="Lak. Trews +1",
  221.         feet="Adhemar Gamashes",
  222.         neck="Deviant Necklace",
  223.         ear1="Hecate's Earring",
  224.         ear2="Friomisi Earring",
  225.         ring1="Garuda Ring",
  226.         ring2="Arvina Ringlet +1",
  227.         back="Gunslinger's Cape",
  228.         waist="Aquiline Belt",
  229.         }
  230.    
  231.     sets.precast.WS['Leaden Salute'] =  {
  232.         ammo=gear.MAbullet,
  233.         head="Pixie Hairpin +1",
  234.         body="Samnuha Coat",
  235.         hands="Pursuer's Cuffs",
  236.         legs="Lak. Trews +1",
  237.         feet="Adhemar Gamashes",
  238.         neck="Deviant Necklace",
  239.         ear1="Moonshade Earring",
  240.         ear2="Friomisi Earring",
  241.         ring1="Archon Ring",
  242.         ring2="Arvina Ringlet +1",
  243.         back="Gunslinger's Cape",
  244.         waist="Aquiline Belt",
  245.         }
  246.        
  247.     sets.precast.WS['Evisceration'] = {
  248.         head="Adhemar Bonnet",
  249.         body="Abnoba Kaftan",
  250.         hands="Adhemar Wristbands",
  251.         legs="Carmine Cuisses",
  252.         feet=gear.Taeon_DW_feet,
  253.         neck=gear.ElementalGorget,
  254.         ear1="Brutal Earring",
  255.         ear2="Moonshade Earring",
  256.         ring1="Petrov Ring",
  257.         ring2="Ramuh Ring +1",
  258.         back="Bleating Mantle",
  259.         waist=gear.ElementalBelt,
  260.         }
  261.  
  262.     sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS['Evisceration'], {
  263.         ring2="Garuda Ring",
  264.         })
  265.    
  266.     sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS['Evisceration'], {
  267.         head="Lilitu Headpiece",
  268.         ring1="Ifrit Ring",
  269.         ring2="Rufescent Ring",
  270.         })
  271.  
  272.     sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS['Savage Blade'], {
  273.         head="Adhemar Bonnet",
  274.         })
  275.    
  276.     -- Midcast Sets
  277.     sets.midcast.FastRecast = {
  278.         ear1="Loquacious Earring",
  279.         }
  280.  
  281.     sets.midcast.Cure = {
  282.         neck="Incanter's Torque",
  283.         ear1="Roundel Earring",
  284.         ear2="Mendi. Earring",
  285.         ring1="Haoma's Ring",
  286.         ring2="Sirona's Ring",
  287.         waist="Bishop's Sash",
  288.         }  
  289.  
  290.     sets.midcast.Utsusemi = {
  291.         waist="Ninurta's Sash",
  292.         }
  293.  
  294.     sets.midcast.CorsairShot = {
  295.         ammo=gear.QDbullet,
  296.         head="Lak. Hat +1",
  297.         body="Samnuha Coat",
  298.         hands="Leyline Gloves",
  299.         legs="Lak. Trews +1",
  300. --      feet="Adhemar Gamashes",
  301.         feet="Chass. Bottes +1",
  302.         neck="Deviant Necklace",
  303.         ear1="Hecate's Earring",
  304.         ear2="Friomisi Earring",
  305.         ring1="Fenrir Ring +1",
  306.         ring2="Fenrir Ring +1",
  307.         back="Gunslinger's Cape",
  308.         waist="Aquiline Belt",
  309.         }
  310.  
  311.     sets.midcast.CorsairShot.Acc = set_combine(sets.midcast.CorsairShot, {
  312.         ammo=gear.QDbullet,
  313.         ear1="Hermetic Earring",
  314.         ear2="Friomisi Earring",
  315.         back="Navarch's Mantle",
  316.         })
  317.  
  318.     sets.midcast.CorsairShot['Light Shot'] = sets.midcast.CorsairShot.Acc
  319.  
  320.     sets.midcast.CorsairShot['Dark Shot'] = sets.midcast.CorsairShot.Acc
  321.  
  322.  
  323.     -- Ranged gear
  324.     sets.midcast.RA = {
  325.         ammo=gear.RAbullet,
  326.         head="Pursuer's Beret",
  327.         body="Chasseur's Frac +1",
  328.         hands="Pursuer's Cuffs",
  329.         legs="Pursuer's Pants",
  330.         feet="Adhemar Gamashes",
  331.         neck="Marked Gorget",
  332.         ear1="Enervating Earring",
  333.         ear2="Neritic Earring",
  334.         ring1="Petrov Ring",
  335.         ring2="Arvina Ringlet +1",
  336.         back="Gunslinger's Cape",
  337.         waist="Yemaya Belt",
  338.         }
  339.  
  340.     sets.midcast.RA.Acc = set_combine(sets.midcast.RA, {
  341.         ammo=gear.RAbullet,
  342.         head=gear.Taeon_RA_head,
  343.         hands="Floral Gauntlets",
  344.         legs="Adhemar Kecks",
  345.         feet=gear.Taeon_RA_feet,
  346.         ring2="Arvina Ringlet +1",
  347.         })
  348.  
  349.     sets.midcast.RA.Fodder = set_combine(sets.midcast.RA, {
  350.         ammo=gear.RAbullet,
  351.         body="Lak. Frac +1",
  352.         neck="Ocachi Gorget",
  353.         waist="Ponente Belt",
  354.         })
  355.  
  356.     -- Sets to return to when not performing an action.
  357.    
  358.     -- Resting sets
  359.     sets.resting = {}
  360.    
  361.     -- Idle sets
  362.     sets.idle = {
  363.         ammo=gear.RAbullet,
  364.         head="Lanun Tricorne +1",
  365.         body="Chasseur's Frac +1",
  366.         hands="Carmine Fin. Ga.",
  367.         legs="Carmine Cuisses",
  368.         feet="Chass. Bottes +1",
  369.         neck="Wiglen Gorget",
  370.         ear1="Enervating Earring",
  371.         ear2="Infused Earring",
  372.         ring1="Paguroidea Ring",
  373.         ring2="Sheltered Ring",
  374.         back="Gunslinger's Cape",
  375.         waist="Yemaya Belt",
  376.         }
  377.  
  378.     sets.idle.Town = set_combine(sets.idle, {
  379.         head="Pixie Hairpin +1",
  380.         neck="Marked Gorget",
  381.         ring1="Petrov Ring",
  382.         ring2="Arvina Ringlet +1",
  383.         })
  384.  
  385.    
  386.     -- Defense sets
  387.     sets.defense.PDT = {
  388.         ring2=gear.DarkRing,
  389.         waist="Flume Belt",
  390.         }
  391.  
  392.     sets.defense.MDT = {
  393.         ring2=gear.DarkRing,
  394.         }
  395.    
  396.  
  397.     sets.Kiting = {legs="Carmine Cuisses"}
  398.  
  399.     -- Engaged sets
  400.  
  401.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  402.     -- sets if more refined versions aren't defined.
  403.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  404.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  405.    
  406.     -- Normal melee group
  407.     sets.engaged = {
  408.         ammo=gear.RAbullet,
  409.         head=gear.Taeon_TA_head,
  410.         body="Rawhide Vest",
  411.         hands="Adhemar Wristbands",
  412.         legs="Samnuha Tights",
  413.         feet=gear.Taeon_DW_feet,
  414.         neck="Lissome Necklace",
  415.         ear1="Brutal Earring",
  416.         ear2="Suppanomimi",
  417.         ring1="Petrov Ring",
  418.         ring2="Epona's Ring",
  419.         back="Bleating Mantle",
  420.         waist="Windbuffet Belt +1",
  421.         }
  422.  
  423.     sets.engaged.Acc = set_combine(sets.engaged, {
  424.         body="Abnoba Kaftan",
  425.         hands="Floral Gauntlets",
  426.         legs="Carmine Cuisses",
  427.         neck="Lissome Necklace",
  428.         ear1="Zennaroi Earring",
  429.         ring2="Ramuh Ring +1",
  430.         back="Sokolski Mantle",
  431.         waist="Anguinus Belt",
  432.         })
  433.  
  434.     sets.engaged.HighHaste = {
  435.         ammo=gear.RAbullet,
  436.         head=gear.Taeon_TA_head,
  437.         body="Rawhide Vest",
  438.         hands="Adhemar Wristbands",
  439.         legs="Samnuha Tights",
  440.         feet=gear.Taeon_DW_feet,
  441.         neck="Lissome Necklace",
  442.         ear1="Brutal Earring",
  443.         ear2="Suppanomimi",
  444.         ring1="Petrov Ring",
  445.         ring2="Epona's Ring",
  446.         back="Bleating Mantle",
  447.         waist="Windbuffet Belt +1",
  448.         }
  449.  
  450.     sets.engaged.HighHaste.Acc = set_combine(sets.engaged.HighHaste, {
  451.         body="Abnoba Kaftan",
  452.         hands="Floral Gauntlets",
  453.         legs="Carmine Cuisses",
  454.         neck="Lissome Necklace",
  455.         ear2="Zennaroi Earring",
  456.         ring2="Ramuh Ring +1",
  457.         back="Sokolski Mantle",
  458.         waist="Anguinus Belt",
  459.         })
  460.  
  461.     sets.engaged.MaxHaste = {
  462.         ammo=gear.RAbullet,
  463.         head=gear.Taeon_TA_head,
  464.         body="Rawhide Vest",
  465.         hands="Adhemar Wristbands",
  466.         legs="Samnuha Tights",
  467.         feet=gear.Taeon_DW_feet,
  468.         neck="Lissome Necklace",
  469.         ear1="Brutal Earring",
  470.         ear2="Suppanomimi",
  471.         ring1="Petrov Ring",
  472.         ring2="Epona's Ring",
  473.         back="Bleating Mantle",
  474.         waist="Windbuffet Belt +1",
  475.         }
  476.  
  477.     sets.engaged.MaxHaste.Acc = set_combine(sets.engaged.HighHaste, {
  478.         body="Abnoba Kaftan",
  479.         hands="Floral Gauntlets",
  480.         legs="Carmine Cuisses",
  481.         neck="Lissome Necklace",
  482.         ear2="Zennaroi Earring",
  483.         ring2="Ramuh Ring +1",
  484.         back="Sokolski Mantle",
  485.         waist="Anguinus Belt",
  486.         })
  487.  
  488. end
  489.  
  490.  
  491. -------------------------------------------------------------------------------------------------------------------
  492. -- Job-specific hooks for standard casting events.
  493. -------------------------------------------------------------------------------------------------------------------
  494.  
  495. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  496. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  497. function job_precast(spell, action, spellMap, eventArgs)
  498.     -- Check that proper ammo is available if we're using ranged attacks or similar.
  499.     if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  500.         do_bullet_checks(spell, spellMap, eventArgs)
  501.     end
  502.  
  503.     -- gear sets
  504.     if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing.value then
  505.         equip(sets.precast.LuzafRing)
  506.     elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
  507.         classes.CustomClass = 'Acc'
  508.     elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
  509.         if sets.precast.FoldDoubleBust then
  510.             equip(sets.precast.FoldDoubleBust)
  511.             eventArgs.handled = true
  512.         end
  513.     end
  514. end
  515.  
  516.  
  517. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  518. function job_aftercast(spell, action, spellMap, eventArgs)
  519.     if spell.type == 'CorsairRoll' and not spell.interrupted then
  520.         display_roll_info(spell)
  521.     end
  522. end
  523.  
  524. function job_status_change(new_status, old_status)
  525.     if new_status == 'Engaged' then
  526.         determine_haste_group()
  527.     end
  528. end
  529.  
  530. -------------------------------------------------------------------------------------------------------------------
  531. -- User code that supplements standard library decisions.
  532. -------------------------------------------------------------------------------------------------------------------
  533.  
  534. -- Return a customized weaponskill mode to use for weaponskill sets.
  535. -- Don't return anything if you're not overriding the default value.
  536.  
  537. function job_update(cmdParams, eventArgs)
  538.     determine_haste_group()
  539. end
  540.  
  541. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  542.  
  543. function job_update(cmdParams, eventArgs)
  544.     determine_haste_group()
  545. end
  546.  
  547. function display_current_job_state(eventArgs)
  548.  
  549. end
  550.  
  551. function get_custom_wsmode(spell, spellMap, default_wsmode)
  552.     if buffactive['Transcendancy'] then
  553.         return 'Brew'
  554.     end
  555. end
  556.  
  557.  
  558. -- Called by the 'update' self-command, for common needs.
  559. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  560. function job_update(cmdParams, eventArgs)
  561.     if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  562.         state.OffenseMode:set('Ranged')
  563.     end
  564. end
  565.  
  566. -- Handle auto-targetting based on local setup.
  567. function job_auto_change_target(spell, action, spellMap, eventArgs)
  568.     if spell.type == 'CorsairShot' then
  569.         if state.IgnoreTargetting.value == true then
  570.             state.IgnoreTargetting:reset()
  571.             eventArgs.handled = true
  572.         end
  573.        
  574.         eventArgs.SelectNPCTargets = state.SelectQDTarget.value
  575.     end
  576. end
  577.  
  578. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  579. function display_current_job_state(eventArgs)
  580.     local msg = ''
  581.    
  582.     msg = msg .. 'Offense/Ranged: ['..state.OffenseMode.current..'/'..state.RangedMode.current
  583.     msg = msg .. '], WS: ['..state.WeaponskillMode.current..']'
  584.  
  585.     if state.DefenseMode.value ~= 'None' then
  586.         local defMode = state[state.DefenseMode.value ..'DefenseMode'].current
  587.         msg = msg .. ', Defense: ('..state.DefenseMode.value..' '..defMode..')'
  588.     end
  589.    
  590.     if state.Kiting.value then
  591.         msg = msg .. ', Kiting'
  592.     end
  593.  
  594.     msg = msg .. ', ['..state.MainQD.current
  595.  
  596.     if state.UseAltQD.value == true then
  597.         msg = msg .. '/'..state.AltQD.current
  598.     end
  599.    
  600.     msg = msg .. ']'
  601.    
  602.     add_to_chat(122, msg)
  603.  
  604.     eventArgs.handled = true
  605. end
  606.  
  607. -------------------------------------------------------------------------------------------------------------------
  608. -- User self-commands.
  609. -------------------------------------------------------------------------------------------------------------------
  610.  
  611. -- Called for custom player commands.
  612. function job_self_command(cmdParams, eventArgs)
  613.     if cmdParams[1] == 'qd' then
  614.         if cmdParams[2] == 't' then
  615.             state.IgnoreTargetting:set()
  616.         end
  617.  
  618.         local doQD = ''
  619.         if state.UseAltQD.value == true then
  620.             doQD = state[state.CurrentQD.current..'QD'].current
  621.             state.CurrentQD:cycle()
  622.         else
  623.             doQD = state.MainQD.current
  624.         end    
  625.        
  626.         send_command('@input /ja "'..doQD..'" <t>')
  627.     end
  628. end
  629.  
  630.  
  631. -------------------------------------------------------------------------------------------------------------------
  632. -- Utility functions specific to this job.
  633. -------------------------------------------------------------------------------------------------------------------
  634.  
  635. function determine_haste_group()
  636.     -- We have three groups of DW in gear: Charis body, Charis neck + DW earrings, and Patentia Sash.
  637.  
  638.     -- For high haste, we want to be able to drop one of the 10% groups (body, preferably).
  639.     -- High haste buffs:
  640.     -- 2x Marches + Haste
  641.     -- 2x Marches + Haste Samba
  642.     -- 1x March + Haste + Haste Samba
  643.     -- Embrava + any other haste buff
  644.    
  645.     -- For max haste, we probably need to consider dropping all DW gear.
  646.     -- Max haste buffs:
  647.     -- Embrava + Haste/March + Haste Samba
  648.     -- 2x March + Haste + Haste Samba
  649.  
  650.     classes.CustomMeleeGroups:clear()
  651.    
  652.     if buffactive.embrava and (buffactive.haste or buffactive.march) then
  653.         classes.CustomMeleeGroups:append('MaxHaste')
  654.     elseif buffactive.march == 2 and buffactive.haste then
  655.         classes.CustomMeleeGroups:append('MaxHaste')
  656.     elseif buffactive.embrava and (buffactive.haste or buffactive.march) then
  657.         classes.CustomMeleeGroups:append('HighHaste')
  658.     elseif buffactive.march == 1 and buffactive.haste then
  659.         classes.CustomMeleeGroups:append('HighHaste')
  660.     elseif buffactive.march == 2 and buffactive.haste then
  661.         classes.CustomMeleeGroups:append('HighHaste')
  662.     end
  663. end
  664.  
  665. function define_roll_values()
  666.     rolls = {
  667.         ["Corsair's Roll"]   = {lucky=5, unlucky=9, bonus="Experience Points"},
  668.         ["Ninja Roll"]     = {lucky=4, unlucky=8, bonus="Evasion"},
  669.         ["Hunter's Roll"]   = {lucky=4, unlucky=8, bonus="Accuracy"},
  670.         ["Chaos Roll"]     = {lucky=4, unlucky=8, bonus="Attack"},
  671.         ["Magus's Roll"]     = {lucky=2, unlucky=6, bonus="Magic Defense"},
  672.         ["Healer's Roll"]   = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  673.         ["Puppet Roll"]   = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  674.         ["Choral Roll"]   = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  675.         ["Monk's Roll"]   = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  676.         ["Beast Roll"]     = {lucky=4, unlucky=8, bonus="Pet Attack"},
  677.         ["Samurai Roll"]     = {lucky=2, unlucky=6, bonus="Store TP"},
  678.         ["Evoker's Roll"]   = {lucky=5, unlucky=9, bonus="Refresh"},
  679.         ["Rogue's Roll"]     = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  680.         ["Warlock's Roll"]   = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  681.         ["Fighter's Roll"]   = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  682.         ["Drachen Roll"]     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  683.         ["Gallant's Roll"]   = {lucky=3, unlucky=7, bonus="Defense"},
  684.         ["Wizard's Roll"]   = {lucky=5, unlucky=9, bonus="Magic Attack"},
  685.         ["Dancer's Roll"]   = {lucky=3, unlucky=7, bonus="Regen"},
  686.         ["Scholar's Roll"]   = {lucky=2, unlucky=6, bonus="Conserve MP"},
  687.         ["Bolter's Roll"]   = {lucky=3, unlucky=9, bonus="Movement Speed"},
  688.         ["Caster's Roll"]   = {lucky=2, unlucky=7, bonus="Fast Cast"},
  689.         ["Courser's Roll"]   = {lucky=3, unlucky=9, bonus="Snapshot"},
  690.         ["Blitzer's Roll"]   = {lucky=4, unlucky=9, bonus="Attack Delay"},
  691.         ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  692.         ["Allies's Roll"]   = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  693.         ["Miser's Roll"]     = {lucky=5, unlucky=7, bonus="Save TP"},
  694.         ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  695.         ["Avenger's Roll"]   = {lucky=4, unlucky=8, bonus="Counter Rate"},
  696.     }
  697. end
  698.  
  699. function display_roll_info(spell)
  700.     rollinfo = rolls[spell.english]
  701.     local rollsize = (state.LuzafRing.value and 'Large') or 'Small'
  702.  
  703.     if rollinfo then
  704.         add_to_chat(104, '[ Lucky: '..tostring(rollinfo.lucky)..' / Unlucky: '..tostring(rollinfo.unlucky)..' ] '..spell.english..': '..rollinfo.bonus..' ('..rollsize..') ')
  705.     end
  706. end
  707.  
  708.  
  709. -- Determine whether we have sufficient ammo for the action being attempted.
  710. function do_bullet_checks(spell, spellMap, eventArgs)
  711.     local bullet_name
  712.     local bullet_min_count = 1
  713.    
  714.     if spell.type == 'WeaponSkill' then
  715.         if spell.skill == "Marksmanship" then
  716.             if spell.element == 'None' then
  717.                 -- physical weaponskills
  718.                 bullet_name = gear.WSbullet
  719.             else
  720.                 -- magical weaponskills
  721.                 bullet_name = gear.MAbullet
  722.             end
  723.         else
  724.             -- Ignore non-ranged weaponskills
  725.             return
  726.         end
  727.     elseif spell.type == 'CorsairShot' then
  728.         bullet_name = gear.QDbullet
  729.     elseif spell.action_type == 'Ranged Attack' then
  730.         bullet_name = gear.RAbullet
  731.         if buffactive['Triple Shot'] then
  732.             bullet_min_count = 3
  733.         end
  734.     end
  735.    
  736.     local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  737.    
  738.     -- If no ammo is available, give appropriate warning and end.
  739.     if not available_bullets then
  740.         if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  741.             add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
  742.             return
  743.         elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  744. --          add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  745.             return
  746.         else
  747.             add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  748.             eventArgs.cancel = true
  749.             return
  750.         end
  751.     end
  752.    
  753.     -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  754.     if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  755.         add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
  756.         eventArgs.cancel = true
  757.         return
  758.     end
  759.    
  760.     -- Low ammo warning.
  761.     if spell.type ~= 'CorsairShot' and state.warned.value == false
  762.         and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  763.         local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
  764.         --local border = string.repeat("*", #msg)
  765.         local border = ""
  766.         for i = 1, #msg do
  767.             border = border .. "*"
  768.         end
  769.        
  770.         add_to_chat(104, border)
  771.         add_to_chat(104, msg)
  772.         add_to_chat(104, border)
  773.  
  774.         state.warned:set()
  775.     elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  776.         state.warned:reset()
  777.     end
  778. end
  779.  
  780. -- Select default macro book on initial load or subjob change.
  781. function select_default_macro_book()
  782.     if player.sub_job == 'DNC' then
  783.         set_macro_page(1, 7)
  784.     else
  785.         set_macro_page(2, 7)
  786.     end
  787. end
Advertisement
Add Comment
Please, Sign In to add comment