SHARE
TWEET

COR lua

a guest Nov 25th, 2018 147 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     -------------------------------------------------------------------------------------------------------------------
  2.     -- Setup functions for this job.  Generally should not be modified.
  3.     -------------------------------------------------------------------------------------------------------------------
  4.  
  5.     --[[
  6.         gs c toggle LuzafRing -- Toggles use of Luzaf Ring on and off
  7.        
  8.         Offense mode is melee or ranged.  Used ranged offense mode if you are engaged
  9.         for ranged weaponskills, but not actually meleeing.
  10.        
  11.         Weaponskill mode, if set to 'Normal', is handled separately for melee and ranged weaponskills.
  12.     --]]
  13.  
  14.     -- Version fix for phys/mag WS detection failure.
  15.    
  16.     -- Initialization function for this job file.
  17.     function get_sets()
  18.         mote_include_version = 2
  19.        
  20.         -- Load and initialize the include file.
  21.         include('Mote-Include.lua')
  22.     end
  23.  
  24.     -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  25.     function job_setup()
  26.         -- Whether to use Luzaf's Ring
  27.         state.LuzafRing = M(false, "Luzaf's Ring")
  28.         -- Whether a warning has been given for low ammo
  29.         state.warned = M(false)
  30.  
  31.         define_roll_values()
  32.     end
  33.  
  34.     -------------------------------------------------------------------------------------------------------------------
  35.     -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  36.     -------------------------------------------------------------------------------------------------------------------
  37.  
  38.     -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  39.     function user_setup()
  40.         state.OffenseMode:options('Normal', 'Acc', 'Ranged', 'Crit')
  41.         state.HybridMode:options('Normal', 'PDT')
  42.         state.RangedMode:options('Normal', 'Acc')
  43.         state.WeaponskillMode:options('Normal', 'Acc')
  44.         state.CastingMode:options('Normal', 'Resistant')
  45.         state.IdleMode:options('Normal', 'PDT', 'Refresh')
  46.        
  47.         physicalWS = S{'Split Shot','Sniper Shot','Slug Shot','Detonator','Numbing Shot','Last Stand','Coronach'}
  48.         magicalWS = S{'Hot Shot','Wildfire','Leaden Salute'}
  49.        
  50.         gear.Gunslinger = { name="Gunslinger's Cape", augments={'Enmity-5','"Mag.Atk.Bns."+1','"Phantom Roll" ability delay -5',}}
  51.         gear.CamulusMelee = { name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10',}}
  52.         gear.CamulusWSD = { name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','Accuracy+10','Weapon skill damage +10%','Damage taken-5%',}}
  53.         gear.CamulusRng ={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Snapshot"+10',}}
  54.         gear.CamulusWF = { name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','Magic Damage +10','Weapon skill damage +10%',}}
  55.         gear.TaeonBodyFC = { name="Taeon Tabard", augments={'"Fast Cast"+3'}}
  56.         gear.TaeonHandsMAB = { name="Taeon Gloves", augments={'"Mag.Atk.Bns."+17'}}
  57.  
  58.         gear.RAbullet = "Devastating Bullet"
  59.         gear.WSbullet = "Devastating Bullet"
  60.         gear.MAbullet = "Bronze Bullet"
  61.         gear.QDbullet = "Animikii Bullet"
  62.         options.ammo_warning_limit = 15
  63.        
  64.         update_melee_mode()
  65.  
  66.         -- Additional local binds
  67.         send_command('bind ^` gs c toggle LuzafRing')
  68.         --send_command('bind !` input /ja "Bolter\'s Roll" <me>')
  69.        
  70.        
  71.         select_default_macro_book()
  72.     end
  73.  
  74.  
  75.     -- Called when this job file is unloaded (eg: job change)
  76.     function user_unload()
  77.         send_command('unbind ^`')
  78.         send_command('gs enable all')
  79.         --send_command('unbind !`')
  80.     end
  81.  
  82.     -- Define sets and vars used by this job file.
  83.     function init_gear_sets()
  84.         --------------------------------------
  85.         -- Start defining the sets
  86.         --------------------------------------
  87.        
  88.         -- Precast Sets
  89.  
  90.         -- Precast sets to enhance JAs
  91.        
  92.         sets.precast.JA['Triple Shot'] = {body="Chasseur's Frac"}
  93.         sets.precast.JA['Snake Eye'] = {legs="Lanun Trews +1"}
  94.         sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +1"}
  95.         sets.precast.JA['Random Deal'] = {body="Lanun Frac +1"}
  96.  
  97.         --Phantom Roll
  98.         sets.precast.CorsairRoll = {
  99.         head="Lanun Tricorne +1",
  100.         hands="Chasseur's Gants",ring1="Barataria Ring",
  101.         back=gear.Gunslinger}
  102.        
  103.         sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chasseur's Culottes"})
  104.         sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chasseur's Bottes"})
  105.         sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chasseur's Tricorne"})
  106.         sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac"})
  107.         sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants"})
  108.        
  109.         sets.precast.LuzafRing = {ring2="Luzaf's Ring"}
  110.         sets.precast.FoldDoubleBust = {hands="Lanun Gants +1"}
  111.  
  112.         --Quick Draw recast (Blood Mask aug., Mirke Wardecours, etc.)
  113.         sets.precast.CorsairShot = {}
  114.        
  115.  
  116.         -- Waltz set (chr and vit)
  117.         sets.precast.Waltz = {
  118.             head="Mummu Bonnet +2",
  119.             body="Mummu Jacket +2",hands="Meghanada Gloves +2",
  120.             legs="Mummu Kecks +2",feet="Lanun Bottes +1"}      
  121.         -- Don't need any special gear for Healing Waltz.
  122.         sets.precast.Waltz['Healing Waltz'] = {}
  123.  
  124.         -- Fast cast sets for spells
  125.        
  126.         sets.precast.FC = {
  127.         head="Haruspex Hat",neck="Voltsurge Torque",ear2="Loquacious Earring",
  128.         body=gear.TaeonBodyFC,hands="Sombra Mittens",ring1="Weatherspoon Ring",ring2="Lebeche Ring"}
  129.  
  130.         sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})
  131.  
  132.        -- Rapidshot/Snapshot gear.
  133.         sets.precast.RA = {ammo=gear.RAbullet,
  134.             head="Aurore Beret +1",
  135.             body="Laksamana's Frac +2",hands="Lanun Gants +1",
  136.             back=gear.CamulusRng,waist="Impulse Belt",legs="Lanun Trews +1",feet="Meghanada Jambeaux +2"}
  137.  
  138.            
  139.         -- Weaponskill sets
  140.         -- Default set for any weaponskill that isn't any more specifically defined
  141.         sets.precast.WS = {
  142.             head="Meghanada Visor +2",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  143.             body="Laksamana's Frac +2",hands="Meghanada Gloves +2",ring1="Rajas Ring",ring2="Epona's Ring",
  144.             back=gear.CamulusMelee,waist="Windbuffet Belt",legs="Meghanada Chausses +2",feet="Meghanada Jambeaux +2"}
  145.  
  146.         -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  147.        
  148.         sets.precast.WS['Savage Blade'] = {
  149.             head="Meghanada Visor +2", neck="Asperity Necklace", ear1="Bladeborn Earring", ear2="Steelflash Earring",
  150.             body="Laksamana's Frac +2", hands="Meghanada Gloves +2", ring1="Rajas Ring", ring2="Epona's Ring",
  151.             back=gear.CamulusWSD, waist="Windbuffet Belt", legs="Meghanada Chausses +2", feet="Meghanada Jambeaux +2"}
  152.  
  153.         sets.precast.WS['Savage Blade'].Acc = {
  154.             head="Meghanada Visor +2", neck="Iqabi Necklace", ear1="Bladeborn Earring", ear2="Steelflash Earring",
  155.             body="Meghanada Cuirie +2", hands="Meghanada Gloves +2", ring1="Rajas Ring", ring2="Epona's Ring",
  156.             back=gear.CamulusWSD, waist="Windbuffet Belt", legs="Meghanada Chausses +2", feet="Meghanada Jambeaux +2"}         
  157.  
  158.        sets.precast.WS['Aeolian Edge'] = {ammo=gear.MAbullet,
  159.             head="Mummu Bonnet +2",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
  160.             body="Lanun Frac +1",hands=gear.TaeonHandsMAB,ring1="Acumen Ring",ring2="Icesoul Ring",
  161.             back="Toro Cape",waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  162.          
  163.         sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS,
  164.             {head="Mummu Bonnet +2",
  165.             body="Mummu Jacket +2",hands="Mummu Wrists +2",
  166.             legs="Mummu Kecks +2",feet="Mummu Gamashes +2"})
  167.  
  168.         sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {legs="Chasseur's Culottes"})
  169.  
  170.         sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS, {legs="Chasseur's Culottes"})
  171.  
  172.         sets.precast.WS['Last Stand'] = {ammo=gear.WSbullet,
  173.             head="Meghanada Visor +2",neck="Light Gorget",ear1="Clearview Earring",ear2="Volley Earring",
  174.             body="Laksamana's Frac +2",hands="Meghanada Gloves +2",ring1="Rajas Ring",ring2="Longshot Ring",
  175.             back=gear.CamulusRng,waist="Light Belt",legs="Meghanada Chausses +2",feet="Meghanada Jambeaux +2"}
  176.  
  177.         sets.precast.WS['Last Stand'].Acc = set_combine(sets.precast.WS['Last Stand'],
  178.             {neck="Iqabi Necklace",ring1="Hajduk Ring",waist="Kwahu Kachina Belt"})
  179.  
  180.  
  181.         sets.precast.WS['Wildfire'] = {ammo=gear.MAbullet,
  182.             head="Mummu Bonnet +2",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
  183.             body="Lanun Frac +1",hands=gear.TaeonHandsMAB,ring1="Acumen Ring",ring2="Icesoul Ring",
  184.             back=gear.CamulusWF,waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  185.  
  186.         sets.precast.WS['Wildfire'].Brew = sets.precast.WS['Wildfire']
  187.        
  188.         sets.precast.WS['Leaden Salute'] = set_combine(sets.precast.WS['Wildfire'],{waist="Light Belt"})
  189.        
  190.        
  191.         -- Midcast Sets
  192.        -- FastRecast: Fast Cast + Haste, reduce recast on spells
  193.         sets.midcast.FastRecast = {
  194.         head="Haruspex Hat",ear2="Loquacious Earring",
  195.         body="Taeon Tabard",hands="Laksamana's Gants +1",ring1="Weatherspoon Ring",
  196.         waist="Dynamic Belt +1",legs="Laksamana's Trews +1",feet="Lanun Bottes +1"}
  197.  
  198.         -- Specific spells
  199.         sets.midcast.Utsusemi = sets.midcast.FastRecast
  200.         sets.midcast.Refresh = {waist="Gishdubar Sash"}
  201.  
  202.         --Quick Draw
  203.         sets.midcast.CorsairShot = {ammo=gear.QDbullet,
  204.             head="Laksamana's Hat +1",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
  205.             body="Lanun Frac +1",hands=gear.TaeonHandsMAB,ring1="Acumen Ring",ring2="Perception Ring",
  206.             back="Toro Cape",waist="Aquiline Belt",legs="Laksamana's Trews +1",feet="Laksamana's Bottes +1"}
  207.  
  208.         sets.midcast.CorsairShot.Acc = {ammo=gear.QDbullet,
  209.             head="Mummu Bonnet +2",neck="Stoicheion Medal",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  210.             body="Mummu Jacket +2",hands="Mummu Wrists +2",ring1="Weatherspoon Ring",ring2="Perception Ring",
  211.             back="Navarch's Mantle",waist="Kwahu Kachina Belt",legs="Mummu Kecks +2",feet="Mummu Gamashes +2"}
  212.  
  213.         sets.midcast.CorsairShot['Light Shot'] = {ammo=gear.QDbullet,
  214.             head="Mummu Bonnet +2",neck="Stoicheion Medal",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  215.             body="Mummu Jacket +2",hands="Mummu Wrists +2",ring1="Weatherspoon Ring",ring2="Perception Ring",
  216.             back="Navarch's Mantle",waist="Kwahu Kachina Belt",legs="Mummu Kecks +2",feet="Mummu Gamashes +2"}
  217.  
  218.         sets.midcast.CorsairShot['Dark Shot'] = {ammo=gear.QDbullet,
  219.             head="Mummu Bonnet +2",neck="Stoicheion Medal",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  220.             body="Mummu Jacket +2",hands="Mummu Wrists +2",ring1="Weatherspoon Ring",ring2="Perception Ring",
  221.             back="Navarch's Mantle",waist="Kwahu Kachina Belt",legs="Mummu Kecks +2",feet="Mummu Gamashes +2"}
  222.  
  223.  
  224.         -- Ranged gear
  225.         sets.midcast.RA = {ammo=gear.RAbullet,
  226.             head="Meghanada Visor +2",neck="Iqabi Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  227.             body="Laksamana's Frac +2",hands="Meghanada Gloves +2",ring1="Rajas Ring",ring2="Longshot Ring",
  228.             back=gear.CamulusRng,waist="Ponente Sash",legs="Meghanada Chausses +2",feet="Meghanada Jambeaux +2"}
  229.  
  230.         sets.midcast.RA.Acc = {ammo=gear.RAbullet,
  231.             head="Meghanada Visor +2",neck="Iqabi Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  232.             body="Laksamana's Frac +2",hands="Meghanada Gloves +2",ring1="Hajduk Ring",ring2="Longshot Ring",
  233.             back=gear.CamulusRng,waist="Kwahu Kachina Belt",legs="Meghanada Chausses +2",feet="Meghanada Jambeaux +2"}
  234.  
  235.        
  236.         -- Sets to return to when not performing an action.
  237.        
  238.         -- Resting sets
  239.         sets.resting = {ear1="Moonshade Earring",ring1="Sheltered Ring"}
  240.        
  241.  
  242.         -- Idle sets
  243.         sets.idle = {ammo=gear.RAbullet,
  244.             head="Meghanada Visor +2",neck="Twilight Torque",ear1="Flashward Earring",ear2="Spellbreaker Earring",
  245.             body="Meghanada Cuirie +2",hands="Meghanada Gloves +2",ring1="Sheltered Ring",ring2="Defending Ring",
  246.             back="Repulse Mantle",waist="Dynamic Belt +1",legs="Crimson Cuisses",feet="Lanun Bottes +1"}
  247.        
  248.         sets.idle.Refresh = set_combine(sets.idle, {ear1="Moonshade Earring"})
  249.  
  250.         sets.idle.Town = {ammo=gear.RAbullet,
  251.             head="Meghanada Visor +2",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  252.             body="Laksamana's Frac +2",hands="Meghanada Gloves +2",ring1="Rajas Ring",ring2="Epona's Ring",
  253.             back=gear.CamulusMelee,waist="Dynamic Belt +1",legs="Crimson Cuisses",feet="Meghanada Jambeaux +2"}
  254.        
  255.         -- Defense sets
  256.         sets.defense.PDT = {
  257.             head="Meghanada Visor +2",neck="Twilight Torque",
  258.             body="Meghanada Cuirie +2",hands="Meghanada Gloves +2",ring1="Sheltered Ring",ring2="Defending Ring",
  259.             back="Repulse Mantle",legs="Meghanada Chausses +2",feet="Lanun Bottes +1"}
  260.  
  261.         sets.defense.MDT = {
  262.             head="Mummu Bonnet +2",neck="Twilight Torque",ear1="Flashward Earring",ear2="Spellbreaker Earring",
  263.             body="Mummu Jacket +2",hands="Mummu Wrists +2",ring1="Sheltered Ring",ring2="Defending Ring",
  264.             back="Engulfer Cape +1",legs="Mummu Kecks +2",feet="Mummu Gamashes +2"}
  265.        
  266.  
  267.         sets.Kiting = {legs="Crimson Cuisses"}
  268.  
  269.         -- Engaged sets
  270.  
  271.         -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  272.         -- sets if more refined versions aren't defined.
  273.         -- If you create a set with both offense and defense modes, the offense mode should be first.
  274.         -- EG: sets.engaged.Dagger.Accuracy.Evasion
  275.        
  276.         -- Normal melee group
  277.         sets.engaged = {ammo=gear.RAbullet,
  278.             head="Meghanada Visor +2",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  279.             body="Mummu Jacket +2",hands="Meghanada Gloves +2",ring1="Rajas Ring",ring2="Epona's Ring",
  280.             back=gear.CamulusMelee,waist="Dynamic Belt +1",legs="Meghanada Chausses +2",feet="Meghanada Jambeaux +2"}
  281.            
  282.         sets.engaged.Acc = set_combine(sets.engaged,{neck="Iqabi Necklace",ring1="Enlivened Ring"})
  283.  
  284.         sets.engaged.DW = set_combine(sets.engaged,{ear1="Brutal Earring",ear2="Suppanomimi"})
  285.        
  286.         sets.engaged.DW.Acc = set_combine(sets.engaged.Acc,{ear1="Dudgeon Earring",ear2="Heartseeker Earring"})
  287.  
  288.         sets.engaged.Ranged = {ammo=gear.RAbullet,
  289.             head="Meghanada Visor +2",neck="Iqabi Necklace",ear1="Clearview Earring",ear2="Volley Earring",
  290.             body="Mummu Jacket +2",hands="Meghanada Gloves +2",ring1="Hajduk Ring",ring2="Longshot Ring",
  291.             back=gear.CamulusRng,waist="Ponente Sash",legs="Meghanada Chausses +2",feet="Meghanada Jambeaux +2"}
  292.        
  293.         sets.engaged.PDT = {neck="Twilight Torque",ring2="Defending Ring",back="Repulse Mantle"}
  294.  
  295.         sets.engaged.Crit = {ammo=gear.RAbullet,
  296.             head="Mummu Bonnet +2",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  297.             body="Mummu Jacket +2",hands="Mummu Wrists +2",ring1="Mummu Ring",ring2="Epona's Ring",
  298.             back=gear.CamulusMelee,waist="Dynamic Belt +1",legs="Mummu Kecks +2",feet="Mummu Gamashes +2"}
  299.  
  300.     end
  301.  
  302.     -------------------------------------------------------------------------------------------------------------------
  303.     -- Job-specific hooks for standard casting events.
  304.     -------------------------------------------------------------------------------------------------------------------
  305.  
  306.     -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  307.     -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  308.     function job_precast(spell, action, spellMap, eventArgs)
  309.         -- Check that proper ammo is available if we're using ranged attacks or similar.
  310.         if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  311.             do_bullet_checks(spell, spellMap, eventArgs)
  312.         end
  313.  
  314.         -- gear sets
  315.         if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing.value then
  316.             equip(sets.precast.LuzafRing)
  317.         elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
  318.             classes.CustomClass = 'Acc'
  319.         elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
  320.             add_to_chat(154,'Double Bust detected...')
  321.             if sets.precast.FoldDoubleBust then
  322.                 equip(sets.precast.FoldDoubleBust)
  323.                 eventArgs.handled = true
  324.             end
  325.         end
  326.     end
  327.  
  328.  
  329.     -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  330.     function job_aftercast(spell, action, spellMap, eventArgs)
  331.         if spell.type == 'CorsairRoll' and not spell.interrupted then
  332.             display_roll_info(spell)
  333.         end
  334.     end
  335.  
  336.     -------------------------------------------------------------------------------------------------------------------
  337.     -- User code that supplements standard library decisions.
  338.     -------------------------------------------------------------------------------------------------------------------
  339.  
  340.     -- Return a customized weaponskill mode to use for weaponskill sets.
  341.     -- Don't return anything if you're not overriding the default value.
  342.     function get_custom_wsmode(spell, spellMap, default_wsmode)
  343.         if buffactive['Transcendancy'] then
  344.             return 'Brew'
  345.         end
  346.     end
  347.  
  348.  
  349.     -- Called by the 'update' self-command, for common needs.
  350.     -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  351.     function job_update(cmdParams, eventArgs)
  352.        
  353.         if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  354.             state.OffenseMode:set('Ranged')
  355.         end
  356.        
  357.         update_melee_mode()
  358.  
  359.     end
  360.    
  361.     -- Called when status changes (Idle to Engaged, Resting, etc.)
  362.     function job_status_change(newStatus, oldStatus, eventArgs)
  363.         update_melee_mode()
  364.     end
  365.    
  366.     -- Modify the default idle set after it was constructed.
  367.     function customize_idle_set(idleSet)
  368.         if world.area:contains('Adoulin') then
  369.             idleSet = set_combine(idleSet, {body="Councilor's Garb"})
  370.         end
  371.         return idleSet
  372.     end
  373.  
  374.     -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  375.     function display_current_job_state(eventArgs)
  376.         local msg = ''
  377.        
  378.         msg = msg .. 'Off.: '..state.OffenseMode.current
  379.         if state.HybridMode.value ~= 'Normal' then
  380.             msg = msg .. '/' .. state.HybridMode.value
  381.         end
  382.         msg = msg .. ', Rng.: '..state.RangedMode.current
  383.         msg = msg .. ', WS.: '..state.WeaponskillMode.current
  384.         msg = msg .. ', QD.: '..state.CastingMode.current
  385.  
  386.         if state.DefenseMode.value ~= 'None' then
  387.             local defMode = state[state.DefenseMode.value ..'DefenseMode'].current
  388.             msg = msg .. ', Defense: '..state.DefenseMode.value..' '..defMode
  389.         end
  390.        
  391.         if state.Kiting.value then
  392.             msg = msg .. ', Kiting'
  393.         end
  394.        
  395.         if state.PCTargetMode.value ~= 'default' then
  396.             msg = msg .. ', Target PC: '..state.PCTargetMode.value
  397.         end
  398.  
  399.         if state.SelectNPCTargets.value then
  400.             msg = msg .. ', Target NPCs'
  401.         end
  402.  
  403.         msg = msg .. ', Roll Size: ' .. ((state.LuzafRing.value and 'Large') or 'Small')
  404.        
  405.         add_to_chat(122, msg)
  406.  
  407.         eventArgs.handled = true
  408.     end
  409.  
  410.  
  411.     -------------------------------------------------------------------------------------------------------------------
  412.     -- Utility functions specific to this job.
  413.     -------------------------------------------------------------------------------------------------------------------
  414.  
  415.     function define_roll_values()
  416.         rolls = {
  417.             ["Corsair's Roll"]   = {lucky=5, unlucky=9, bonus="Experience Points"},
  418.             ["Ninja Roll"]       = {lucky=4, unlucky=8, bonus="Evasion"},
  419.             ["Hunter's Roll"]    = {lucky=4, unlucky=8, bonus="Accuracy"},
  420.             ["Chaos Roll"]       = {lucky=4, unlucky=8, bonus="Attack"},
  421.             ["Magus's Roll"]     = {lucky=2, unlucky=6, bonus="Magic Defense"},
  422.             ["Healer's Roll"]    = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  423.             ["Puppet Roll"]      = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  424.             ["Choral Roll"]      = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  425.             ["Monk's Roll"]      = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  426.             ["Beast Roll"]       = {lucky=4, unlucky=8, bonus="Pet Attack"},
  427.             ["Samurai Roll"]     = {lucky=2, unlucky=6, bonus="Store TP"},
  428.             ["Evoker's Roll"]    = {lucky=5, unlucky=9, bonus="Refresh"},
  429.             ["Rogue's Roll"]     = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  430.             ["Warlock's Roll"]   = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  431.             ["Fighter's Roll"]   = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  432.             ["Drachen Roll"]     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  433.             ["Gallant's Roll"]   = {lucky=3, unlucky=7, bonus="Defense"},
  434.             ["Wizard's Roll"]    = {lucky=5, unlucky=9, bonus="Magic Attack"},
  435.             ["Dancer's Roll"]    = {lucky=3, unlucky=7, bonus="Regen"},
  436.             ["Scholar's Roll"]   = {lucky=2, unlucky=6, bonus="Conserve MP"},
  437.             ["Bolter's Roll"]    = {lucky=3, unlucky=9, bonus="Movement Speed"},
  438.             ["Caster's Roll"]    = {lucky=2, unlucky=7, bonus="Fast Cast"},
  439.             ["Courser's Roll"]   = {lucky=3, unlucky=9, bonus="Snapshot"},
  440.             ["Blitzer's Roll"]   = {lucky=4, unlucky=9, bonus="Attack Delay"},
  441.             ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
  442.             ["Allies's Roll"]    = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  443.             ["Miser's Roll"]     = {lucky=5, unlucky=7, bonus="Save TP"},
  444.             ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  445.             ["Avenger's Roll"]   = {lucky=4, unlucky=8, bonus="Counter Rate"},
  446.         }
  447.     end
  448.  
  449.     function display_roll_info(spell)
  450.         rollinfo = rolls[spell.english]
  451.         local rollsize = (state.LuzafRing.value and 'Large') or 'Small'
  452.  
  453.         if rollinfo then
  454.             add_to_chat(104, spell.english..' provides a bonus to '..rollinfo.bonus..'.  Roll size: '..rollsize)
  455.             add_to_chat(104, 'Lucky roll is '..tostring(rollinfo.lucky)..', Unlucky roll is '..tostring(rollinfo.unlucky)..'.')
  456.         end
  457.     end
  458.  
  459.  
  460.     -- Determine whether we have sufficient ammo for the action being attempted.
  461.     function do_bullet_checks(spell, spellMap, eventArgs)
  462.         local bullet_name
  463.         local bullet_min_count = 1
  464.        
  465.         if spell.type == 'WeaponSkill' then
  466.             if spell.skill == "Marksmanship" then
  467.                 if physicalWS:contains(spell.english) then
  468.                     -- physical weaponskills
  469.                     bullet_name = gear.WSbullet
  470.                 else
  471.                     -- magical weaponskills
  472.                     bullet_name = gear.MAbullet
  473.                 end
  474.             else
  475.                 -- Ignore non-ranged weaponskills
  476.                 return
  477.             end
  478.         elseif spell.type == 'CorsairShot' then
  479.             bullet_name = gear.QDbullet
  480.         elseif spell.action_type == 'Ranged Attack' then
  481.             bullet_name = gear.RAbullet
  482.             if buffactive['Triple Shot'] then
  483.                 bullet_min_count = 3
  484.             end
  485.         end
  486.        
  487.         local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
  488.        
  489.         -- If no ammo is available, give appropriate warning and end.
  490.         if not available_bullets then
  491.             if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
  492.                 add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
  493.                 return
  494.             elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
  495.                 add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
  496.                 return
  497.             else
  498.                 add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
  499.                 eventArgs.cancel = true
  500.                 return
  501.             end
  502.         end
  503.        
  504.         -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
  505.         if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
  506.             add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
  507.             eventArgs.cancel = true
  508.             return
  509.         end
  510.        
  511.         -- Low ammo warning.
  512.         if spell.type ~= 'CorsairShot' and state.warned.value == false
  513.             and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
  514.             local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
  515.             --local border = string.repeat("*", #msg)
  516.             local border = ""
  517.             for i = 1, #msg do
  518.                 border = border .. "*"
  519.             end
  520.            
  521.             add_to_chat(104, border)
  522.             add_to_chat(104, msg)
  523.             add_to_chat(104, border)
  524.  
  525.             state.warned:set()
  526.         elseif available_bullets.count > options.ammo_warning_limit and state.warned then
  527.             state.warned:reset()
  528.         end
  529.     end
  530.  
  531.     function update_melee_mode()
  532.         if player.sub_job == 'NIN' or player.sub_job == 'DNC' then
  533.             if state.OffenseMode.value == 'Ranged' then
  534.                 state.CombatForm:reset()
  535.             else
  536.                 state.CombatForm:set('DW')
  537.             end
  538.         else
  539.             state.CombatForm:reset()
  540.         end
  541.     end  
  542.    
  543.     -- Select default macro book on initial load or subjob change.
  544.     function select_default_macro_book()
  545.         set_macro_page(5, 17)
  546.     end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top