Boposhopo

COR Lua

Jun 16th, 2025 (edited)
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.80 KB | Gaming | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Initialization function for this job file.
  6. function get_sets()
  7.     mote_include_version = 2
  8.    
  9.     -- Load and initialize the include file.
  10.     include('Mote-Include.lua')
  11. end
  12.  
  13. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  14. function job_setup()
  15.     -- Whether to use Luzaf's Ring
  16.     state.LuzafRing = M(false, "Luzaf's Ring")
  17.     -- Whether a warning has been given for low ammo
  18.     state.warned = M(false)
  19.  
  20.     define_roll_values()
  21.    
  22.     send_command('wait 6;input /lockstyleset 6')
  23. end
  24.  
  25. -------------------------------------------------------------------------------------------------------------------
  26. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  27. -------------------------------------------------------------------------------------------------------------------
  28.  
  29. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  30. function user_setup()
  31.     state.OffenseMode:options('Normal', 'DT')
  32.     state.RangedMode:options('Normal', 'Acc')
  33.     state.WeaponskillMode:options('Normal', 'Att')
  34.     state.CastingMode:options('Normal', 'Resistant')
  35.     state.IdleMode:options('Normal', 'PDT', 'Refresh')
  36.  
  37.     gear.RAbullet = "Chrono Bullet"
  38.     gear.WSbullet = "Chrono Bullet"
  39.     gear.MAbullet = "Living Bullet"
  40.     gear.QDbullet = "Living Bullet"
  41.     options.ammo_warning_limit = 15
  42.  
  43.     select_default_macro_book()
  44. end
  45.  
  46.  
  47. -- Called when this job file is unloaded (eg: job change)
  48. function user_unload()
  49.  
  50. end
  51.  
  52. -- Define sets and vars used by this job file.
  53. function init_gear_sets()
  54.     --------------------------------------
  55.     -- Start defining the sets
  56.     --------------------------------------
  57.    
  58.     -- Precast Sets
  59.  
  60.     -- Precast sets to enhance JAs
  61.    
  62.     sets.precast.JA['Triple Shot'] = {body="Chasseur's Frac +2"}
  63.     sets.precast.JA['Snake Eye'] = {legs="Lanun Trews +1"}
  64.     sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +3"}
  65.     sets.precast.JA['Random Deal'] = {body="Lanun Frac +3"}
  66.  
  67.    
  68.     sets.precast.CorsairRoll = {head="Lanun Tricorne +1",
  69.         hands="Chasseur's Gants +3",
  70.         ring2="Luzaf's Ring",
  71.         neck="Regal Necklace",
  72.         back="Camulus's Mantle",}
  73.    
  74.     sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chasseur's Culottes +1"})
  75.     sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chasseur's Bottes +2"})
  76.     sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chass. Tricorne +1"})
  77.     sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac +2"})
  78.     sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants +3"})
  79.  
  80.     sets.precast.FoldDoubleBust = {hands="Lanun Gants +3"}
  81.    
  82.     sets.precast.CorsairShot = {ammo=gear.QDbullet,
  83.         head="Nyame Helm",
  84.         body={ name="Lanun Frac +3", augments={'Enhances "Loaded Deck" effect',}},
  85.         hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  86.         legs="Nyame Flanchard",
  87.         feet="Chasseur's Bottes +3",
  88.         neck={ name="Comm. Charm +1", augments={'Path: A',}},
  89.         waist="Eschan Stone",
  90.         left_ear="Friomisi Earring",
  91.         right_ear="Enervating Earring",
  92.         left_ring="Dingir Ring",
  93.         right_ring="Regal Ring",
  94.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  95.    
  96.  
  97.     -- Waltz set (chr and vit)
  98.     sets.precast.Waltz = {}
  99.        
  100.     -- Don't need any special gear for Healing Waltz.
  101.     sets.precast.Waltz['Healing Waltz'] = {}
  102.  
  103.     -- Fast cast sets for spells
  104.    
  105.     sets.precast.FC = {head={ name="Carmine Mask +1", augments={'Accuracy+20','Mag. Acc.+12','"Fast Cast"+4',}},
  106.         body={ name="Taeon Tabard", augments={'Spell interruption rate down -9%','Phalanx +3',}},
  107.         hands={ name="Leyline Gloves", augments={'Accuracy+12','Mag. Acc.+14','"Mag.Atk.Bns."+15','"Fast Cast"+2',}},
  108.         feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}},
  109.         left_ear="Etiolation Earring",
  110.         right_ear="Loquac. Earring",
  111.         left_ring="Kishar Ring",}
  112.  
  113.     sets.precast.FC.Utsusemi = {head="Carmine Mask +1",
  114.         hands="Leyline Gloves",
  115.         feet="Carmine Greaves +1",
  116.         left_ring="Kishar Ring",
  117.         right_ear="Loquacious Earring",
  118.         left_ear="Etiolation earring",}
  119.  
  120.  
  121.     sets.precast.RA = {ammo=gear.RAbullet,
  122.         head="Ikenga's Hat", --9
  123.         neck="Commodore Charm +1", --3
  124.         body="Ikenga's Vest", --9
  125.         hands="Carmine Fin. Ga. +1", --8 Rapid 11
  126.         legs="Adhemar Kecks +1", --10 Rapid 13
  127.         waist="Impulse Belt", --3
  128.         feet="Meg. Jam. +2", --10
  129.         back={ name="Camulus's Mantle", augments={'Eva.+20 /Mag. Eva.+20','"Snapshot"+10','Phys. dmg. taken-10%',}},} --10
  130.  
  131.        
  132.     -- Weaponskill sets
  133.     -- Default set for any weaponskill that isn't any more specifically defined
  134.     sets.precast.WS = {head="Nyame Helm",
  135.         body="Nyame Mail",
  136.         hands="Chasseur's Gants +3",
  137.         legs="Nyame Flanchard",
  138.         feet="Nyame Sollerets",
  139.         neck="Fotia Gorget",
  140.         waist="Fotia Belt",
  141.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  142.         right_ear="Ishvara Earring",
  143.         left_ring="Dingir Ring",
  144.         right_ring="Ilabrat Ring",
  145.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  146.  
  147.  
  148.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  149.     sets.precast.WS['Evisceration'] = {head={ name="Blistering Sallet +1", augments={'Path: A',}},
  150.         body="Mummu Jacket +2",
  151.         hands="Adhemar Wrist. +1",
  152.         legs={ name="Samnuha Tights", augments={'STR+8','DEX+9','"Dbl.Atk."+3','"Triple Atk."+2',}},
  153.         feet={ name="Herculean Boots", augments={'Attack+21','"Triple Atk."+3','STR+4','Accuracy+10',}},
  154.         neck="Fotia Gorget",
  155.         waist="Fotia Belt",
  156.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  157.         right_ear="Cessance Earring",
  158.         left_ring="Petrov Ring",
  159.         right_ring="Epona's Ring",
  160.         back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},}
  161.  
  162.     sets.precast.WS['Savage Blade'] = {head={ name="Nyame Helm", augments={'Path: B',}},
  163.         body={ name="Nyame Mail", augments={'Path: B',}},
  164.         hands="Chasseur's Gants +3",
  165.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  166.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  167.         neck="Rep. Plat. Medal",
  168.         waist={ name="Sailfi Belt +1", augments={'Path: A',}},
  169.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  170.         right_ear="Ishvara Earring",
  171.         left_ring="Sroda Ring",
  172.         right_ring="Epaminondas's Ring",
  173.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  174.  
  175.     sets.precast.WS['Requiescat'] = {ammo=gear.MAbullet,
  176.         head="Adhemar Bonnet +1",
  177.         body="Lanun Frac +3",
  178.         hands="Chasseur's Gants +3",
  179.         legs="Nyame Flanchard",
  180.         feet="Lanun Bottes +3",
  181.         neck="Fotia Gorget",
  182.         waist="Fotia Belt",
  183.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  184.         right_ear="Ishvara Earring",
  185.         left_ring="Regal Ring",
  186.         right_ring="Dingir Ring",
  187.         back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  188.  
  189.     sets.precast.WS['Last Stand'] = {ammo=gear.WSbullet,
  190.         head={ name="Nyame Helm", augments={'Path: B',}},
  191.         body={ name="Ikenga's Vest", augments={'Path: A',}},
  192.         hands="Chasseur's Gants +3",
  193.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  194.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  195.         neck="Fotia Gorget",
  196.         waist="Fotia Belt",
  197.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  198.         right_ear="Ishvara Earring",
  199.         left_ring="Dingir Ring",
  200.         right_ring="Regal Ring",
  201.         back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},}
  202.  
  203.     sets.precast.WS['Wildfire'] = {ammo=gear.MAbullet,
  204.         head="Nyame Helm",
  205.         body={ name="Lanun Frac +3", augments={'Enhances "Loaded Deck" effect',}},
  206.         hands="Nyame Gauntlets",
  207.         legs="Nyame Flanchard",
  208.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  209.         neck={ name="Comm. Charm +1", augments={'Path: A',}},
  210.         waist="Eschan Stone",
  211.         Right_ear="Friomisi Earring",
  212.         Left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  213.         left_ring="Dingir Ring",
  214.         right_ring="Ilabrat Ring",
  215.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  216.        
  217.     sets.precast.WS['Hot Shot'] = {ammo=gear.WSbullet,
  218.         head="Ikenga's Hat",
  219.         body="Nyame Mail",
  220.         hands="Chasseur's Gants +3",
  221.         legs="Nyame Flanchard",
  222.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  223.         neck="Fotia Gorget",
  224.         waist="Fotia Belt",
  225.         Right_ear="Friomisi Earring",
  226.         Left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  227.         left_ring="Dingir Ring",
  228.         right_ring="Regal Ring",
  229.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  230.    
  231.     sets.precast.WS['Leaden Salute'] = {ammo=gear.MAbullet,
  232.         head="Pixie Hairpin +1",
  233.         body="Lanun Frac +3",
  234.         hands="Nyame Gauntlets",
  235.         legs="Nyame Flanchard",
  236.         feet="Lanun Bottes +3",
  237.         neck="Commodore Charm +1",
  238.         waist="Eschan Stone",
  239.         Right_ear="Friomisi Earring",
  240.         Left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  241.         left_ring="Dingir Ring",
  242.         right_ring="Archon Ring",
  243.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  244.        
  245.     sets.precast.WS['Aeolian Edge'] = set_combine(sets.precast.WS['Wildfire'], {})
  246.    
  247.     sets.Obi = {waist="Hachirin-no-Obi"}
  248.    
  249.    
  250.     -- Midcast Sets
  251.     sets.midcast.FastRecast = {}
  252.        
  253.     -- Specific spells
  254.     sets.midcast.Utsusemi = {}
  255.  
  256.     sets.midcast.CorsairShot = {ammo=gear.QDbullet,
  257.         head="Nyame Helm",
  258.         body={ name="Lanun Frac +3", augments={'Enhances "Loaded Deck" effect',}},
  259.         hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  260.         legs="Nyame Flanchard",
  261.         feet="Chasseur's Bottes +3",
  262.         neck={ name="Comm. Charm +1", augments={'Path: A',}},
  263.         waist="Eschan Stone",
  264.         left_ear="Friomisi Earring",
  265.         right_ear="Enervating Earring",
  266.         left_ring="Dingir Ring",
  267.         right_ring="Regal Ring",
  268.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  269.  
  270.     sets.midcast.CorsairShot.Acc = {}
  271.  
  272.     sets.midcast.CorsairShot['Light Shot'] = {head={ name="Carmine Mask +1", augments={'Accuracy+20','Mag. Acc.+12','"Fast Cast"+4',}},
  273.         body={ name="Lanun Frac +3", augments={'Enhances "Loaded Deck" effect',}},
  274.         name="Nyame Gauntlets",
  275.         legs="Nyame Flanchard",
  276.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  277.         neck={ name="Comm. Charm +1", augments={'Path: A',}},
  278.         waist="Eschan Stone",
  279.         left_ring="Dingir Ring",
  280.         right_ring="Ilabrat Ring",
  281.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  282.  
  283.     sets.midcast.CorsairShot['Dark Shot'] = sets.midcast.CorsairShot['Light Shot']
  284.    
  285.     sets.midcast['Absorb-TP'] = {head={ name="Carmine Mask +1", augments={'Accuracy+20','Mag. Acc.+12','"Fast Cast"+4',}},
  286.         body={ name="Lanun Frac +3", augments={'Enhances "Loaded Deck" effect',}},
  287.         name="Nyame Gauntlets",
  288.         legs="Nyame Flanchard",
  289.         feet={ name="Lanun Bottes +3", augments={'Enhances "Wild Card" effect',}},
  290.         neck={ name="Comm. Charm +1", augments={'Path: A',}},
  291.         waist="Eschan Stone",
  292.         left_ring="Dingir Ring",
  293.         right_ring="Ilabrat Ring",
  294.         back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},}
  295.  
  296.  
  297.     -- Ranged gear
  298.     sets.midcast.RA = {ammo=gear.RAbullet,
  299.         head="Ikenga's Hat",
  300.         body="Nisroch Jerkin",
  301.         hands="Malignance Gloves",
  302.         legs="Malignance Tights",
  303.         feet="Ikenga's Clogs",
  304.         neck="Iskur Gorget",
  305.         waist="Yemaya Belt",
  306.         left_ear="Crep. Earring",
  307.         right_ear={ name="Chas. Earring +1", augments={'System: 1 ID: 1676 Val: 0','Accuracy+11','Mag. Acc.+11','Crit.hit rate+3',}},
  308.         left_ring="Ilabrat Ring",
  309.         right_ring="Dingir Ring",
  310.         back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10','Phys. dmg. taken-10%',}},}
  311.  
  312.     sets.midcast.RA.Acc = {ammo=gear.RAbullet,
  313.         head="Ikenga's Hat",
  314.         body="Ikenga's Vest",
  315.         hands="Malignance Gloves",
  316.         legs="Malignance Tights",
  317.         feet="Ikenga's Clogs",
  318.         neck="Iskur Gorget",
  319.         waist="Yemaya Belt",
  320.         left_ear="Enervating Earring",
  321.         right_ear="Telos Earring",
  322.         left_ring="Ilabrat Ring",
  323.         right_ring="Dingir Ring",
  324.         back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10','Phys. dmg. taken-10%',}},}
  325.        
  326.     sets.TripleShot = {head="Oshosi Mask", --5
  327.         body="Chasseur's Frac +2", --12
  328.         hands="Lanun Gants +3"}
  329.  
  330.    
  331.     -- Sets to return to when not performing an action.
  332.    
  333.     -- Resting sets
  334.     sets.resting = {}
  335.    
  336.  
  337.     -- Idle sets
  338.     sets.idle = {ammo=gear.RAbullet,
  339.         head="Nyame Helm",
  340.         body="Nyame Mail",
  341.         hands="Nyame Gauntlets",
  342.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  343.         feet="Nyame Sollerets",
  344.         neck="Loricate Torque +1",
  345.         waist="Carrier's Sash",
  346.         left_ear="Etiolation Earring",
  347.         right_ear="Infused Earring",
  348.         left_ring="Warp Ring",
  349.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  350.         back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10','Phys. dmg. taken-10%',}},
  351. }
  352.  
  353.     sets.idle.Town = {ammo=gear.RAbullet,
  354.         head="Nyame Helm",
  355.         body="Nyame Mail",
  356.         hands="Nyame Gauntlets",
  357.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  358.         feet="Nyame Sollerets",
  359.         neck="Loricate Torque +1",
  360.         waist="Carrier's Sash",
  361.         left_ear="Etiolation Earring",
  362.         right_ear="Infused Earring",
  363.         left_ring="Warp Ring",
  364.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  365.         back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10','Phys. dmg. taken-10%',}},
  366. }
  367.  
  368.    
  369.     sets.Kiting = {legs="Carmine Cuisses +1"}
  370.  
  371.     -- Engaged sets
  372.  
  373.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  374.     -- sets if more refined versions aren't defined.
  375.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  376.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  377.    
  378.     -- Normal melee group
  379.     sets.engaged = {ammo=gear.RAbullet,
  380.         head="Adhemar Bonnet +1",
  381.         body="Adhemar Jacket +1",
  382.         hands="Adhemar Wristbands +1",
  383.         legs="Samnuha Tights",
  384.         feet="Malignance Boots",
  385.         neck="Iskur Gorget",
  386.         waist="Sailfi Belt +1",
  387.         left_ear="Cessance Earring",
  388.         right_ear="Telos Earring",
  389.         left_ring="Chirich Ring +1",
  390.         right_ring="Epona's Ring",
  391.         back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},}
  392.    
  393.     sets.engaged.DT = {ammo=gear.RAbullet,
  394.         head="Adhemar Bonnet +1",
  395.         body="Adhemar Jacket +1",
  396.         hands="Malignance Gloves",
  397.         legs="Malignance Tights",
  398.         feet="Malignance Boots",
  399.         neck="Iskur Gorget",
  400.         waist="Sailfi Belt +1",
  401.         left_ear="Cessance Earring",
  402.         right_ear="Telos Earring",
  403.         left_ring="Defending RIng",
  404.         right_ring="Epona's Ring",
  405.         back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Damage taken-5%',}},}
  406.  
  407.     sets.engaged.DW = {}
  408.    
  409.     sets.engaged.DT.DW = {}
  410. end
  411.  
  412. -------------------------------------------------------------------------------------------------------------------
  413. -- Job-specific hooks for standard casting events.
  414. -------------------------------------------------------------------------------------------------------------------
  415.  
  416. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  417. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  418. function job_precast(spell, action, spellMap, eventArgs)
  419.     -- Check that proper ammo is available if we're using ranged attacks or similar.
  420.     if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  421.         do_bullet_checks(spell, spellMap, eventArgs)
  422.     end
  423.  
  424.     -- gear sets
  425.     if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing.value then
  426.         equip(sets.precast.LuzafRing)
  427.     elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
  428.         classes.CustomClass = 'Acc'
  429.     elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
  430.         if sets.precast.FoldDoubleBust then
  431.             equip(sets.precast.FoldDoubleBust)
  432.             eventArgs.handled = true
  433.         end
  434.     end
  435. end
  436.  
  437. function job_post_precast(spell, action, spellMap, eventArgs)
  438.     -- Equip obi if weather/day matches for WS/Quick Draw.
  439.     if spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  440.         if spell.english == 'Leaden Salute' then
  441.             if world.weather_element == 'Dark' or world.day_element == 'Dark' then
  442.                 equip(sets.Obi)
  443.             end
  444.             if player.tp > 2900 then
  445.                 equip(sets.precast.WS['Leaden Salute'].FullTP)
  446.             end
  447.         elseif spell.english == 'Wildfire' and (world.weather_element == 'Fire' or world.day_element == 'Fire') then
  448.             equip(sets.Obi)
  449.         elseif spell.type == 'CorsairShot' and (spell.element == world.weather_element or spell.element == world.day_element) then
  450.             if spell.english ~= "Light Shot" and spell.english ~= "Dark Shot" then
  451.                 equip(sets.Obi)
  452.             end
  453.         end
  454.     end
  455. end
  456.  
  457. function job_post_midcast(spell, action, spellMap, eventArgs)
  458.     if spell.type == 'CorsairShot' then
  459.         if (spell.english ~= 'Light Shot' and spell.english ~= 'Dark Shot') then
  460.             -- Matching double weather (w/o day conflict).
  461.             if spell.element == world.weather_element and (get_weather_intensity() == 2 and spell.element ~= elements.weak_to[world.day_element]) then
  462.                 equip({waist="Hachirin-no-Obi"})
  463.             -- Target distance under 1.7 yalms.
  464.             --elseif spell.target.distance < (1.7 + spell.target.model_size) then
  465.                 --equip({waist="Orpheus's Sash"})
  466.             -- Matching day and weather.
  467.             elseif spell.element == world.day_element and spell.element == world.weather_element then
  468.                 equip({waist="Hachirin-no-Obi"})
  469.             -- Target distance under 8 yalms.
  470.             --elseif spell.target.distance < (8 + spell.target.model_size) then
  471.                 --equip({waist="Orpheus's Sash"})
  472.             -- Match day or weather.
  473.             elseif spell.element == world.day_element or spell.element == world.weather_element then
  474.                 equip({waist="Hachirin-no-Obi"})
  475.             end
  476.         end
  477.     elseif spell.action_type == 'Ranged Attack' then
  478.         if buffactive['Triple Shot'] then
  479.             equip(sets.TripleShot)
  480.                 end
  481.             end
  482.         end
  483.  
  484.  
  485.  
  486. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  487. function job_aftercast(spell, action, spellMap, eventArgs)
  488.     if spell.type == 'CorsairRoll' and not spell.interrupted then
  489.         display_roll_info(spell)
  490.     end
  491. end
  492.  
  493. -------------------------------------------------------------------------------------------------------------------
  494. -- User code that supplements standard library decisions.
  495. -------------------------------------------------------------------------------------------------------------------
  496.  
  497. -- Return a customized weaponskill mode to use for weaponskill sets.
  498. -- Don't return anything if you're not overriding the default value.
  499. function get_custom_wsmode(spell, spellMap, default_wsmode)
  500.     if buffactive['Transcendancy'] then
  501.         return 'Brew'
  502.     end
  503. end
  504.  
  505.  
  506. -- Called by the 'update' self-command, for common needs.
  507. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  508. function job_update(cmdParams, eventArgs)
  509.     if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  510.         state.OffenseMode:set('Ranged')
  511.     end
  512. end
  513.  
  514.  
  515. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  516. function display_current_job_state(eventArgs)
  517.     local msg = ''
  518.    
  519.     msg = msg .. 'Off.: '..state.OffenseMode.current
  520.     msg = msg .. ', Rng.: '..state.RangedMode.current
  521.     msg = msg .. ', WS.: '..state.WeaponskillMode.current
  522.     msg = msg .. ', QD.: '..state.CastingMode.current
  523.  
  524.     if state.DefenseMode.value ~= 'None' then
  525.         local defMode = state[state.DefenseMode.value ..'DefenseMode'].current
  526.         msg = msg .. ', Defense: '..state.DefenseMode.value..' '..defMode
  527.     end
  528.    
  529.     if state.Kiting.value then
  530.         msg = msg .. ', Kiting'
  531.     end
  532.    
  533.     if state.PCTargetMode.value ~= 'default' then
  534.         msg = msg .. ', Target PC: '..state.PCTargetMode.value
  535.     end
  536.  
  537.     if state.SelectNPCTargets.value then
  538.         msg = msg .. ', Target NPCs'
  539.     end
  540.  
  541.     msg = msg .. ', Roll Size: ' .. ((state.LuzafRing.value and 'Large') or 'Small')
  542.    
  543.     add_to_chat(122, msg)
  544.  
  545.     eventArgs.handled = true
  546. end
  547.  
  548.  
  549. -------------------------------------------------------------------------------------------------------------------
  550. -- Utility functions specific to this job.
  551. -------------------------------------------------------------------------------------------------------------------
  552.  
  553. function define_roll_values()
  554.     rolls = {
  555.         ["Corsair's Roll"]   = {lucky=5, unlucky=9, bonus="Experience Points"},
  556.         ["Ninja Roll"]       = {lucky=4, unlucky=8, bonus="Evasion"},
  557.         ["Hunter's Roll"]    = {lucky=4, unlucky=8, bonus="Accuracy"},
  558.         ["Chaos Roll"]       = {lucky=4, unlucky=8, bonus="Attack"},
  559.         ["Magus's Roll"]     = {lucky=2, unlucky=6, bonus="Magic Defense"},
  560.         ["Healer's Roll"]    = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  561.         ["Puppet Roll"]      = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  562.         ["Choral Roll"]      = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  563.         ["Monk's Roll"]      = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  564.         ["Beast Roll"]       = {lucky=4, unlucky=8, bonus="Pet Attack"},
  565.         ["Samurai Roll"]     = {lucky=2, unlucky=6, bonus="Store TP"},
  566.         ["Evoker's Roll"]    = {lucky=5, unlucky=9, bonus="Refresh"},
  567.         ["Rogue's Roll"]     = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  568.         ["Warlock's Roll"]   = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  569.         ["Fighter's Roll"]   = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  570.         ["Drachen Roll"]     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  571.         ["Gallant's Roll"]   = {lucky=3, unlucky=7, bonus="Defense"},
  572.         ["Wizard's Roll"]    = {lucky=5, unlucky=9, bonus="Magic Attack"},
  573.         ["Dancer's Roll"]    = {lucky=3, unlucky=7, bonus="Regen"},
  574.         ["Scholar's Roll"]   = {lucky=2, unlucky=6, bonus="Conserve MP"},
  575.         ["Bolter's Roll"]    = {lucky=3, unlucky=9, bonus="Movement Speed"},
  576.         ["Caster's Roll"]    = {lucky=2, unlucky=7, bonus="Fast Cast"},
  577.         ["Courser's Roll"]   = {lucky=3, unlucky=9, bonus="Snapshot"},
  578.         ["Blitzer's Roll"]   = {lucky=4, unlucky=9, bonus="Attack Delay"},
  579.         ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  580.         ["Allies's Roll"]    = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  581.         ["Miser's Roll"]     = {lucky=5, unlucky=7, bonus="Save TP"},
  582.         ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  583.         ["Avenger's Roll"]   = {lucky=4, unlucky=8, bonus="Counter Rate"},
  584.     }
  585. end
  586.  
  587. function display_roll_info(spell)
  588.     rollinfo = rolls[spell.english]
  589.     local rollsize = (state.LuzafRing.value and 'Large') or 'Small'
  590.  
  591.     if rollinfo then
  592.         add_to_chat(104, spell.english..' provides a bonus to '..rollinfo.bonus..'.  Roll size: '..rollsize)
  593.         add_to_chat(104, 'Lucky roll is '..tostring(rollinfo.lucky)..', Unlucky roll is '..tostring(rollinfo.unlucky)..'.')
  594.     end
  595. end
  596.  
  597.  
  598. -- Determine whether we have sufficient ammo for the action being attempted.
  599. function do_bullet_checks(spell, spellMap, eventArgs)
  600.     local bullet_name
  601.     local bullet_min_count = 1
  602.    
  603.     if spell.type == 'WeaponSkill' then
  604.         if spell.skill == "Marksmanship" then
  605.             if spell.element == 'None' then
  606.                 -- physical weaponskills
  607.                 bullet_name = gear.WSbullet
  608.             else
  609.                 -- magical weaponskills
  610.                 bullet_name = gear.MAbullet
  611.             end
  612.         else
  613.             -- Ignore non-ranged weaponskills
  614.             return
  615.         end
  616.     elseif spell.type == 'CorsairShot' then
  617.         bullet_name = gear.QDbullet
  618.     elseif spell.action_type == 'Ranged Attack' then
  619.         bullet_name = gear.RAbullet
  620.         if buffactive['Triple Shot'] then
  621.             bullet_min_count = 3
  622.         end
  623.     end
  624.    
  625.     local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  626.    
  627.     -- If no ammo is available, give appropriate warning and end.
  628.     if not available_bullets then
  629.         if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  630.             add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
  631.             return
  632.         elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  633.             add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  634.             return
  635.         else
  636.             add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  637.             eventArgs.cancel = true
  638.             return
  639.         end
  640.     end
  641.    
  642.     -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  643.     if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  644.         add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
  645.         eventArgs.cancel = true
  646.         return
  647.     end
  648.    
  649.     -- Low ammo warning.
  650.     if spell.type ~= 'CorsairShot' and state.warned.value == false
  651.         and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  652.         local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
  653.         --local border = string.repeat("*", #msg)
  654.         local border = ""
  655.         for i = 1, #msg do
  656.             border = border .. "*"
  657.         end
  658.        
  659.         add_to_chat(104, border)
  660.         add_to_chat(104, msg)
  661.         add_to_chat(104, border)
  662.  
  663.         state.warned:set()
  664.     elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  665.         state.warned:reset()
  666.     end
  667. end
  668.  
  669. -- Select default macro book on initial load or subjob change.
  670. function select_default_macro_book()
  671.     set_macro_page(1, 4)
  672. end
  673.  
  674.  
Tags: FFXI
Advertisement
Add Comment
Please, Sign In to add comment