Advertisement
suteru

COR Lua

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