Advertisement
kaldaek

Untitled

Jan 19th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.77 KB | None | 0 0
  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.  
  15. -- Initialization function for this job file.
  16. function get_sets()
  17.     mote_include_version = 2
  18.    
  19.     -- Load and initialize the include file.
  20.     include('Mote-Include.lua')
  21. end
  22.  
  23.  
  24.  
  25.  
  26. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  27. function job_setup()
  28.     -- Whether to use Luzaf's Ring
  29.     state.LuzafRing = M(false, "Luzaf's Ring")
  30.     -- Whether a warning has been given for low ammo
  31.     state.warned = M(false)
  32.  
  33.     define_roll_values()
  34. end
  35.  
  36. -------------------------------------------------------------------------------------------------------------------
  37. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  38. -------------------------------------------------------------------------------------------------------------------
  39.  
  40. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  41. function user_setup()
  42.     state.OffenseMode:options('Ranged', 'Melee', 'Acc')
  43.     state.RangedMode:options('Normal', 'Acc')
  44.     state.WeaponskillMode:options('Normal', 'Acc', 'Att', 'Mod')
  45.     state.CastingMode:options('Normal', 'Resistant')
  46.     state.IdleMode:options('Normal', 'PDT', 'Refresh')
  47.     state.AutoWS = M{['description']='Automatic Weaponskill Mode', 'off', 'COR'}
  48.  
  49.     gear.RAbullet = "Chrono Bullet"
  50.     gear.MAbullet = "Living Bullet"
  51.     gear.QDbullet = "Living Bullet"
  52.     gear.WSbullet = "Chrono Bullet"
  53.     options.ammo_warning_limit = 15
  54.  
  55.     -- Additional local binds
  56.     send_command('bind ^` input /ja "Double-up" <me>')
  57.     send_command('bind !` input /ja "Bolter\'s Roll" <me>')
  58.     send_command('bind ^Delete input //gs c cycle LuzafRing')
  59.  
  60.     select_default_macro_book()
  61. end
  62.  
  63.  
  64. -- Called when this job file is unloaded (eg: job change)
  65. function user_unload()
  66.     send_command('unbind ^`')
  67.     send_command('unbind !`')
  68. end
  69.  
  70. function job_post_midcast(spell, action, spellMap, eventArgs)
  71.        if spell.element == world.weather_element or spell_element == world.day_element then
  72.                 equip({waist="Hachirin-no-Obi"})
  73.             end
  74.             end
  75.  
  76. -- Define sets and vars used by this job file.
  77. function init_gear_sets()
  78.     --------------------------------------
  79.     -- Start defining the sets
  80.     --------------------------------------
  81.    
  82.     include('augmented-items.lua')
  83.  
  84.     --------------------------------------------------------------------------------------------------------------------------------------
  85.     -- Precast sets
  86.     --------------------------------------------------------------------------------------------------------------------------------------
  87.    
  88.     sets.precast.JA['Triple Shot'] = {body="Chasseur's Frac +1"}
  89.     sets.precast.JA['Snake Eye'] = {legs="Lanun Culottes +1"}
  90.     sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +1"}
  91.     sets.precast.JA['Random Deal'] = {body="Lanun Frac +1"}
  92.  
  93.    
  94.     sets.precast.CorsairRoll = {head="Lanun Tricorne +1",hands="Chasseur's Gants +1",Ring1="Barataria Ring",Back="Camulus's Mantle"}
  95.    
  96.     sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chasseur's Culottes +1"})
  97.     sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chasseur's Bottes +1"})
  98.     sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chasseur's Tricorne"})
  99.     sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac +1"})
  100.     sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants +1"})
  101.    
  102.     sets.precast.LuzafRing = {ring2="Luzaf's Ring"}
  103.     sets.precast.FoldDoubleBust = {hands="Lanun Gants +1"}
  104.    
  105.     sets.precast.CorsairShot = {head="Blood Mask"}
  106.    
  107.    
  108.    
  109.     sets.precast.FC = {
  110.     head={ name="Carmine Mask +1", augments={'Accuracy+20','Mag. Acc.+12','"Fast Cast"+4',}},
  111.     body="",
  112.     hands={ name="Leyline Gloves", augments={'Accuracy+15','Mag. Acc.+15','"Mag.Atk.Bns."+15','"Fast Cast"+3',}},
  113.     legs={ name="Psycloth Lappas", augments={'MP+80','Mag. Acc.+15','"Fast Cast"+7',}},
  114.     feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}},
  115.     neck="Voltsurge Torque",
  116.     waist="Witful Belt",
  117.     left_ear="Etiolation Earring",
  118.     right_ear="Loquac. Earring",
  119.     left_ring="Prolix Ring",
  120.     right_ring="Epona's Ring",
  121.     back="Swith Cape +1",
  122. }
  123.  
  124.  
  125.  
  126.     sets.precast.RA = {
  127.     ammo="Chrono Bullet",
  128.     head="Aurore Beret +1",
  129.     body={ name="Lanun Frac +1", augments={'Enhances "Loaded Deck" effect',}},
  130.     hands={ name="Lanun Gants +1", augments={'Enhances "Fold" effect',}},
  131.     legs="Chas. Culottes +1",
  132.     feet={ name="Adhemar Gamashes", augments={'HP+50','"Store TP"+6','"Snapshot"+8',}},
  133.     neck="Loricate Torque +1",
  134.     waist="Impulse Belt",
  135.     left_ear="Infused Earring",
  136.     right_ear="Etiolation Earring",
  137.     left_ring="Sheltered Ring",
  138.     right_ring="Gelatinous Ring +1",
  139.     back={ name="Camulus's Mantle", augments={'"Snapshot"+10',}},
  140. }
  141.        
  142.     --------------------------------------------------------------------------------------------------------------------------------------
  143.     -- Weaponskill sets
  144.     --------------------------------------------------------------------------------------------------------------------------------------
  145.     sets.precast.WS = {}
  146.  
  147.  
  148.     sets.precast.WS['Requiescat'] = {}
  149.  
  150.     sets.precast.WS['Last Stand'] = {
  151.             ammo=gear.WSbullet,
  152.             head=herchelm_rwsd,
  153.             body="Laksa. Frac +2",
  154.             hands="Meg. Gloves +1",
  155.             legs=herchtrou_rwsd,
  156.             feet=hercfeet_rwsd,
  157.             neck="Bilious Torque",
  158.             waist="Fotia Belt",
  159.             left_ear="Enervating Earring",
  160.             right_ear="Neritic Earring",
  161.             left_ring="Garuda Ring +1",
  162.             right_ring="Apate Ring",
  163.             back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Weapon skill damage +10%',}},
  164. }
  165.  
  166.  
  167.     sets.precast.WS['Wildfire'] = {
  168.             ammo=gear.MAbullet,
  169.             head=herchelm_mab,
  170.             body={ name="Carm. Sc. Mail +1", augments={'Attack+20','"Mag.Atk.Bns."+12','"Dbl.Atk."+4',}},
  171.             hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  172.             legs=herctrou_mab,
  173.             feet=hercfeet_mab,
  174.             neck="Baetyl Pendant",
  175.             waist="Eschan Stone",
  176.             left_ear="Friomisi Earring",
  177.             right_ear="Hecate's Earring",
  178.             left_ring="Shiva Ring +1",
  179.             right_ring="Fenrir Ring +1",
  180.             back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Weapon skill damage +10%',}},
  181.            
  182. }
  183.    
  184.     sets.precast.WS['Leaden Salute'] = {
  185.             ammo="Living Bullet",
  186.             head="Pixie Hairpin +1",
  187.             body={ name="Carm. Sc. Mail +1", augments={'Attack+20','"Mag.Atk.Bns."+12','"Dbl.Atk."+4',}},
  188.             hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  189.             legs=herctrou_mab,
  190.             feet=hercfeet_mab,
  191.             neck="Baetyl Pendant",
  192.             waist="Eschan Stone",
  193.             left_ear="Friomisi Earring",
  194.             right_ear="Hecate's Earring",
  195.             left_ring="Archon Ring",
  196.             right_ring="Fenrir Ring +1",
  197.             back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Weapon skill damage +10%',}},
  198. }
  199.    
  200.     --------------------------------------------------------------------------------------------------------------------------------------
  201.     -- Midcast sets
  202.     --------------------------------------------------------------------------------------------------------------------------------------
  203.      
  204.  
  205.     sets.midcast.CorsairShot = {
  206.     ammo="Living Bullet",
  207.     head=herchelm_mab,
  208.     body={ name="Carm. Sc. Mail +1", augments={'Attack+20','"Mag.Atk.Bns."+12','"Dbl.Atk."+4',}},
  209.     hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
  210.     legs=herctrou_mab,
  211.     feet=hercfeet_mab,
  212.     neck="Baetyl Pendant",
  213.     waist="Eschan Stone",
  214.     left_ear="Friomisi Earring",
  215.     right_ear="Hecate's Earring",
  216.     left_ring="Shiva Ring +1",
  217.     right_ring="Fenrir Ring +1",
  218.     back={ name="Gunslinger's Cape", augments={'Enmity-3','"Mag.Atk.Bns."+4','"Phantom Roll" ability delay -3',}},
  219. }
  220.  
  221.  
  222.     sets.midcast.RA = {
  223.     head="Meghanada Visor +1",
  224.     body=herchelm_rwsd,
  225.     hands={ name="Adhemar Wristbands", augments={'AGI+10','Rng.Acc.+15','Rng.Atk.+15',}},
  226.     legs="Meg. Chausses +1",
  227.     feet="Meg. Jam. +1",
  228.     neck="Ej Necklace",
  229.     waist="Yemaya Belt",
  230.     left_ear="Enervating Earring",
  231.     right_ear="Volley Earring",
  232.     left_ring="Hajduk Ring +1",
  233.     right_ring="Hajduk Ring +1",
  234.     back={ name="Camulus's Mantle", augments={'Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10',}},
  235. }
  236.  
  237.    
  238.    
  239.    
  240.  
  241.     --------------------------------------------------------------------------------------------------------------------------------------
  242.     -- Idle sets
  243.     --------------------------------------------------------------------------------------------------------------------------------------
  244.    
  245.    
  246.     sets.idle = {
  247.     main="",
  248.     sub="",
  249.     range="",
  250.     ammo="",
  251.     head="Meghanada Visor +1",
  252.     body="Meg. Cuirie +1",
  253.     hands="Meg. Gloves +1",
  254.     legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  255.     feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}},
  256.     neck="Loricate Torque +1",
  257.     waist="Flume Belt",
  258.     left_ear="Infused Earring",
  259.     right_ear="Etiolation Earring",
  260.     left_ring="Defending Ring",
  261.     right_ring="Gelatinous Ring +1",
  262.     back="Agema Cape",
  263. }
  264.  
  265.  
  266.  
  267.    
  268.    
  269.     --------------------------------------------------------------------------------------------------------------------------------------
  270.     -- Melee sets
  271.     --------------------------------------------------------------------------------------------------------------------------------------
  272.  
  273.  
  274.    
  275.    
  276.     -- Normal melee group
  277.     sets.engaged.Melee = {
  278.     main="",
  279.     sub="",
  280.     range="",
  281.     ammo="",
  282.     head="Meghanada Visor +1",
  283.     body="Meg. Cuirie +1",
  284.     hands="Meg. Gloves +1",
  285.     legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  286.     feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}},
  287.     neck="Lissome Necklace",
  288.     waist="Reiki Yotai",
  289.     left_ear="Brutal Earring",
  290.     right_ear="Suppanomimi",
  291.     left_ring="Hetairoi Ring",
  292.     right_ring="Epona's Ring",
  293.     back="Letalis Mantle",
  294. }
  295.    
  296.  
  297.     sets.engaged.Ranged = {
  298.     head="Meghanada Visor +1",
  299.     body=herchelm_rwsd,
  300.     hands={ name="Adhemar Wristbands", augments={'AGI+10','Rng.Acc.+15','Rng.Atk.+15',}},
  301.     legs="Meg. Chausses +1",
  302.     feet="Meg. Jam. +1",
  303.     neck="Ej Necklace",
  304.     waist="Yemaya Belt",
  305.     left_ear="Enervating Earring",
  306.     right_ear="Volley Earring",
  307.     left_ring="Hajduk Ring +1",
  308.     right_ring="Hajduk Ring +1",
  309.     back={ name="Camulus's Mantle", augments={'Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10',}},
  310. }
  311.  
  312. end
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319. -------------------------------------------------------------------------------------------------------------------
  320. -- Job-specific hooks for standard casting events.
  321. -------------------------------------------------------------------------------------------------------------------
  322.  
  323. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  324. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  325. function job_precast(spell, action, spellMap, eventArgs)
  326.     -- Check that proper ammo is available if we're using ranged attacks or similar.
  327.     if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
  328.         do_bullet_checks(spell, spellMap, eventArgs)
  329.     end
  330.  
  331.     -- gear sets
  332.     if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing.value then
  333.         equip(sets.precast.LuzafRing)
  334.     elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
  335.         classes.CustomClass = 'Acc'
  336.     elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
  337.         if sets.precast.FoldDoubleBust then
  338.             equip(sets.precast.FoldDoubleBust)
  339.             eventArgs.handled = true
  340.         end
  341.     end
  342. end
  343.  
  344.  
  345. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  346. function job_aftercast(spell, action, spellMap, eventArgs)
  347.     if spell.type == 'CorsairRoll' and not spell.interrupted then
  348.         display_roll_info(spell)
  349.     end
  350. end
  351.  
  352.  
  353. -- Weather checker for obi.
  354.  
  355. -------------------------------------------------------------------------------------------------------------------
  356. -- User code that supplements standard library decisions.
  357. -------------------------------------------------------------------------------------------------------------------
  358.  
  359. -- Return a customized weaponskill mode to use for weaponskill sets.
  360. -- Don't return anything if you're not overriding the default value.
  361. function get_custom_wsmode(spell, spellMap, default_wsmode)
  362.     if buffactive['Transcendancy'] then
  363.         return 'Brew'
  364.     end
  365. end
  366.  
  367.  
  368. -- Called by the 'update' self-command, for common needs.
  369. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  370. function job_update(cmdParams, eventArgs)
  371.     if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
  372.         state.OffenseMode:set('Ranged')
  373.     end
  374. end
  375.  
  376.  
  377. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  378. function display_current_job_state(eventArgs)
  379.     local msg = ''
  380.    
  381.     msg = msg .. 'Off.: '..state.OffenseMode.current
  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 spell.element == 'None' 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. -- Select default macro book on initial load or subjob change.
  532. function select_default_macro_book()
  533.     set_macro_page(1, 5)
  534. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement