Advertisement
Vamperica

Ranger

Dec 14th, 2016
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 32.56 KB | None | 0 0
  1. -- Owner: AlanWarren, aka ~ Orestes
  2. -- current file resides @ https://github.com/AlanWarren/gearswap
  3. --[[
  4.  === Notes ===
  5.  -- Set format is as follows:
  6.     sets.midcast.RA.[CustomClass][CombatForm][CombatWeapon][RangedMode][CustomRangedGroup]
  7.     ex: sets.midcast.RA.SAM.Bow.Mid.SamRoll = {}
  8.     you can also append CustomRangedGroups to each other
  9.  
  10.  -- These are the available sets per category
  11.  -- CustomClass = SAM
  12.  -- CombatForm = DW
  13.  -- CombatWeapon = weapon name, ex: Yoichinoyumi  (you can make new sets for any ranged weapon)
  14.  -- RangedMode = Normal, Mid, Acc
  15.  -- CustomRangedGroup = SamRoll
  16.  -- SamRoll is applied automatically whenever you have the roll on you.
  17.  -- SAM is used when you're RNG/SAM
  18.  * Auto RA
  19.  - You can use the built in hotkey (CTRL -) or create a macro. (like below) Note "AutoRA" is case sensitive
  20.    /console gs c toggle AutoRA
  21.  - You have to shoot once after toggling autora for it to begin.
  22.  - AutoRA will use weaponskills @ 1000TP, depending on which weapon you're using. However, this will only
  23.    work if you set gear.Gun or gear.Bow to the weapon you're using. You also have to specify the desired
  24.    ws it should use, with the settings auto_gun_ws and auto_bow_ws.
  25.  
  26.  === Helpful Commands ===
  27.     //gs validate
  28.     //gs showswaps
  29.     //gs debugmode
  30. --]]
  31.  
  32. function get_sets()
  33.         mote_include_version = 2
  34.         -- Load and initialize the include file.
  35.         include('Mote-Include.lua')
  36.         include('organizer-lib')
  37. end
  38.  
  39. -- setup vars that are user-independent.
  40. function job_setup()
  41. end
  42.  
  43. -- setup vars that are user-dependent.
  44. function user_setup()
  45.         -- Options: Override default values
  46.         state.OffenseMode:options('Normal', 'Melee')
  47.         state.RangedMode:options('Normal', 'Mid', 'Acc')
  48.         state.HybridMode:options('Normal', 'PDT')
  49.         state.IdleMode:options('Normal', 'PDT')
  50.         state.WeaponskillMode:options('Normal', 'Mid', 'Acc')
  51.         state.PhysicalDefenseMode:options('PDT')
  52.         state.MagicalDefenseMode:options('MDT')
  53.  
  54.         state.Buff.Barrage = buffactive.Barrage or false
  55.         state.Buff.Camouflage = buffactive.Camouflage or false
  56.         state.Buff.Overkill = buffactive.Overkill or false
  57.  
  58.         -- settings
  59.         state.CapacityMode = M(false, 'Capacity Point Mantle')
  60.  
  61.         state.AutoRA = M{['description']='Auto RA', 'Normal', 'Shoot', 'WS' }
  62.         auto_gun_ws = "Coronach"
  63.         auto_bow_ws = "Jishnu's Radiance"
  64.  
  65.  
  66.         gear.Gun = "Annihilator"
  67.         gear.Bow = "Nobility"
  68.        
  69.         rng_sub_weapons = S{'Perun', 'Malevolence'}
  70.        
  71.         sam_sj = player.sub_job == 'SAM' or false
  72.  
  73.         DefaultAmmo = {[gear.Bow] = "Achiyalabopa arrow", [gear.Gun] = "Eradicating bullet"}
  74.         U_Shot_Ammo = {[gear.Bow] = "Achiyalabopa arrow", [gear.Gun] = "Eradicating bullet"}
  75.  
  76.         get_combat_form()
  77.         get_custom_ranged_groups()
  78.         select_default_macro_book()
  79.  
  80.         send_command('bind != gs c toggle CapacityMode')
  81.         send_command('bind f9 gs c cycle RangedMode')
  82.         send_command('bind !f9 gs c cycle OffenseMode')
  83.         send_command('bind ^f9 gs c cycle HybridMode')
  84.         send_command('bind ^] gs c cycle WeaponskillMode')
  85.         send_command('bind ^- gs c cycle AutoRA')
  86.         send_command('bind ^[ input /lockstyle on')
  87.         send_command('bind ![ input /lockstyle off')
  88.        
  89.         -- Testing
  90.         --windower.register_event('incoming text', detect_cor_rolls)
  91. end
  92.  
  93. -- Called when this job file is unloaded (eg: job change)
  94. function file_unload()
  95.     send_command('unbind f9')
  96.     send_command('unbind ^f9')
  97.     send_command('unbind ^[')
  98.     send_command('unbind ![')
  99.     send_command('unbind !=')
  100.     send_command('unbind ^=')
  101.     send_command('unbind @=')
  102.     send_command('unbind ^-')
  103. end
  104.  
  105. function init_gear_sets()
  106.  
  107.         sets.Organizer = {}
  108.  
  109.         -- Misc. Job Ability precasts
  110.         sets.precast.JA['Bounty Shot'] = {
  111.             body={ name="Herculean Vest", augments={'Pet: INT+6','VIT+12','"Treasure Hunter"+2','Accuracy+2 Attack+2',}},
  112.             hands="Amini Glove. +1",
  113.             waist="Chaac Belt",
  114.             }
  115.         sets.precast.JA['Double Shot'] = {}
  116.         sets.precast.JA['Camouflage'] = {body="Orion Jerkin"}
  117.         sets.precast.JA['Sharpshot'] = {}
  118.         sets.precast.JA['Velocity Shot'] = {body="Amini Caban +1"}
  119.         sets.precast.JA['Scavenge'] = {feet="Orion Socks +2"}
  120.  
  121.         sets.CapacityMantle = {back="Mecistopins Mantle"}
  122.  
  123.         sets.precast.JA['Eagle Eye Shot'] = set_combine(sets.midcast.RA, {})
  124.         sets.precast.JA['Eagle Eye Shot'].Mid = set_combine(sets.precast.JA['Eagle Eye Shot'], {})
  125.         sets.precast.JA['Eagle Eye Shot'].Acc = set_combine(sets.precast.JA['Eagle Eye Shot'].Mid, {})
  126.  
  127.         sets.precast.FC = {
  128.             head={ name="Herculean Helm", augments={'"Fast Cast"+6','Enmity-6','Mag. Acc.+2 "Mag.Atk.Bns."+2',}},
  129.             neck="Baetyl Pendant",
  130.             ear1="Etiolation Earring",
  131.             ear2="Loquacious Earring",
  132.             body="Samnuha Coat",
  133.             hands="Leyline Gloves",
  134.             ring1="Prolix Ring",
  135.             ring2="Lebeche Ring",
  136.             legs="Limbo Trousers",
  137.             feet="Carmine Greaves +1"
  138.             }
  139.         sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Bead Necklace",})
  140.        
  141.         sets.idle = {
  142.             head="Meghanada Visor +2",
  143.             body="Meg. Cuirie +2",
  144.             hands="Malignance Gloves",
  145.             legs="Carmine Cuisses +1",
  146.             feet="Meg. Jam. +2",
  147.             neck="Loricate Torque +1",
  148.             waist="Flume Belt",
  149.             left_ear="Infused Earring",
  150.             right_ear="Dawn Earring",
  151.             left_ring="Defending Ring",
  152.             right_ring="Patricius Ring",
  153.             back={ name="Belenus's Cape", augments={'INT+20','Eva.+20 /Mag. Eva.+20','"Snapshot"+10','Damage taken-5%',}},
  154.             }
  155.         sets.idle.Regen = set_combine(sets.idle, {})
  156.         sets.idle.PDT = set_combine(sets.idle, {})
  157.         sets.idle.Town = set_combine(sets.idle, {})
  158.  
  159.         -- Engaged sets
  160.         sets.engaged =  {}
  161.         sets.engaged.PDT = set_combine(sets.engaged, {})
  162.         sets.engaged.Bow = set_combine(sets.engaged, {})
  163.  
  164.         sets.engaged.Melee = {}
  165.         sets.engaged.Bow.Melee = sets.engaged.Melee
  166.  
  167.         sets.engaged.Melee.PDT = set_combine(sets.engaged.Melee, {})
  168.  
  169.         sets.engaged.DW = set_combine(sets.engaged, {})
  170.  
  171.         sets.engaged.DW.Melee = set_combine(sets.engaged.Melee, {})
  172.  
  173.         ------------------------------------------------------------------
  174.         -- Preshot / Snapshot sets
  175.         ------------------------------------------------------------------
  176.         sets.precast.RA = {
  177.             head="Amini Gapette", --SS 6(7)--
  178.             body="Amini Caban +1", --VS 5(7)--
  179.             hands="Carmine Fin. Ga. +1", --SS 8 RS 11--
  180.             legs="Adhemar Kecks", --SS 9--
  181.             feet="Meg. Jam. +2",--SS 10--
  182.             back={ name="Belenus's Cape", augments={'INT+20','Eva.+20 /Mag. Eva.+20','"Snapshot"+10','Damage taken-5%',}}, --SS 10--
  183.             waist="Impulse Belt" --SS 3--
  184.             }
  185.  
  186.         sets.precast.RA.F1 = {
  187.             head="Amini Gapette", --SS 6(7)--
  188.             body="Amini Caban +1", --VS 5(7)--
  189.             hands="Carmine Fin. Ga. +1", --SS 8 RS 11--
  190.             legs="Adhemar Kecks", --SS 9--
  191.             feet="Meg. Jam. +2",--SS 10--
  192.             back={ name="Belenus's Cape", augments={'INT+20','Eva.+20 /Mag. Eva.+20','"Snapshot"+10','Damage taken-5%',}}, --SS 10--
  193.             waist="Impulse Belt" --SS 3--
  194.             }
  195.  
  196.         sets.precast.RA.F2 = {
  197.             head="Orion Beret +3", --RS --
  198.             body="Amini Caban +1", --VS 5(7)--
  199.             hands="Carmine Fin. Ga. +1", --SS 8 RS 11--
  200.             legs="Adhemar Kecks", --SS 9--
  201.             feet="",--RS 8--
  202.             back={ name="Belenus's Cape", augments={'INT+20','Eva.+20 /Mag. Eva.+20','"Snapshot"+10','Damage taken-5%',}}, --SS 10--
  203.             waist="Impulse Belt" --SS 3--
  204.             }
  205.  
  206.        
  207.         ------------------------------------------------------------------
  208.         -- Default Base Gear Sets for Ranged Attacks. Geared for Gun
  209.         ------------------------------------------------------------------
  210.  
  211.         sets.midcast.FC = set_combine(sets.precast.FC, {})
  212.  
  213.         sets.midcast.RA = {
  214.             head="Arcadian Beret +1",
  215.             body="Adhemar Jacket +1",
  216.             hands="Adhemar Wrist. +1",
  217.             legs="Meg. Chausses +2",
  218.             feet="Meg. Jam. +2",
  219.             neck="Iskur Gorget",
  220.             waist="Kwahu Kachina Belt",
  221.             left_ring="Cacoethic Ring +1",
  222.             right_ring="Ilabrat Ring",
  223.             back={ name="Belenus's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','"Store TP"+10',}},
  224.             ear1="Enervating Earring",
  225.             ear2="Dedition Earring",
  226.             }
  227.         sets.midcast.RA.Mid = set_combine(sets.midcast.RA, {head="Orion Beret +3", ear2="Neritic Earring", feet="Orion Socks +2"})
  228.         sets.midcast.RA.Acc = set_combine(sets.midcast.RA.Mid, {})
  229.    
  230.         -- Samurai Roll sets
  231.         sets.midcast.RA.SamRoll = set_combine(sets.midcast.RA, {})
  232.         sets.midcast.RA.Mid.SamRoll = set_combine(sets.midcast.RA.SamRoll, {})
  233.         sets.midcast.RA.Acc.SamRoll = set_combine(sets.midcast.RA.Mid.SamRoll, {})
  234.        
  235.         -- SAM Subjob
  236.         sets.midcast.RA.SAM = set_combine(sets.midcast.RA, {})
  237.         sets.midcast.RA.SAM.Mid = set_combine(sets.midcast.RA.Mid, {})
  238.         sets.midcast.RA.SAM.Acc = set_combine(sets.midcast.RA.Acc, {})
  239.  
  240.         -- Samurai Roll for /sam, assume we're using a staff
  241.         sets.midcast.RA.SAM.SamRoll = set_combine(sets.midcast.RA.SAM, {})
  242.         sets.midcast.RA.SAM.Mid.SamRoll = set_combine(sets.midcast.RA.SAM.Mid, {})
  243.         sets.midcast.RA.SAM.Acc.SamRoll = set_combine(sets.midcast.RA.SAM.Acc, {})
  244.  
  245.         -- Bow base set.
  246.         sets.midcast.RA.Bow = set_combine(sets.midcast.RA,{})
  247.         sets.midcast.RA.Bow.Mid = set_combine(sets.midcast.RA.Bow, {})
  248.         sets.midcast.RA.Bow.Acc = set_combine(sets.midcast.RA.Bow.Mid, {})
  249.        
  250.         -- Bow Sam roll
  251.         sets.midcast.RA.Bow.SamRoll = set_combine(sets.midcast.RA.Bow, {})
  252.         sets.midcast.RA.Bow.Mid.SamRoll = set_combine(sets.midcast.RA.Bow.SamRoll, {})
  253.         sets.midcast.RA.Bow.Acc.SamRoll = set_combine(sets.midcast.RA.Bow.Mid.SamRoll, {})
  254.        
  255.         -- Sam SJ / Bow
  256.         sets.midcast.RA.SAM.Bow = set_combine(sets.midcast.RA.SAM, {})
  257.         sets.midcast.RA.SAM.Bow.Mid = set_combine(sets.midcast.RA.SAM.Mid, {})
  258.         sets.midcast.RA.SAM.Bow.Acc = set_combine(sets.midcast.RA.SAM.Acc, {})
  259.  
  260.         -- Sam SJ / Bow / Sam's Roll
  261.         sets.midcast.RA.SAM.Bow.SamRoll = set_combine(sets.midcast.RA.SAM.Bow, {})
  262.  
  263.         sets.midcast.RA.SAM.Bow.Mid.SamRoll = set_combine(sets.midcast.RA.SAM.Bow.Mid, {})
  264.         sets.midcast.RA.SAM.Bow.Acc.SamRoll = set_combine(sets.midcast.RA.SAM.Bow.Acc, {})
  265.  
  266.  
  267.         -- Weaponskill sets  
  268.         sets.precast.WS = {
  269.             head="Orion Beret +3",
  270.             body="Adhemar Jacket +1",
  271.             hands="Adhemar Wrist. +1",
  272.             legs="Meg. Chausses +2",
  273.             feet={ name="Herculean Boots", augments={'"Waltz" potency +2%','CHR+10','Weapon skill damage +8%','Accuracy+9 Attack+9','Mag. Acc.+9 "Mag.Atk.Bns."+9',}},
  274.             neck="Iskur Gorget",
  275.             waist="Kwahu Kachina Belt",
  276.             left_ring="Ilabrat Ring",
  277.             right_ring="Dingir Ring",
  278.             back={ name="Belenus's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  279.             ear1="Enervating Earring",
  280.             ear2="Moonshade Earring",
  281.             }
  282.  
  283.         sets.precast.WS.Mid = set_combine(sets.precast.WS, {})
  284.         sets.precast.WS.Acc = set_combine(sets.precast.WS.Mid, {})
  285.  
  286.         -- WILDFIRE
  287.         sets.Wildfire = {
  288.             head={ name="Herculean Helm", augments={'Magic dmg. taken -5%','"Mag.Atk.Bns."+30','Accuracy+5 Attack+5','Mag. Acc.+17 "Mag.Atk.Bns."+17',}},
  289.             body="Samnuha Coat",
  290.             hands="Carmine Fin. Ga. +1",
  291.             legs={ name="Herculean Trousers", augments={'Mag. Acc.+16 "Mag.Atk.Bns."+16','"Dbl.Atk."+2','MND+9','Mag. Acc.+13','"Mag.Atk.Bns."+15',}},
  292.             feet={ name="Herculean Boots", augments={'"Waltz" potency +2%','CHR+10','Weapon skill damage +8%','Accuracy+9 Attack+9','Mag. Acc.+9 "Mag.Atk.Bns."+9',}},
  293.             neck="Sanctity Necklace",
  294.             waist="Eschan Stone",
  295.             left_ear="Moonshade Earring",
  296.             right_ear="Friomisi Earring",
  297.             left_ring="Ilabrat Ring",
  298.             right_ring="Dingir Ring",
  299.             back={ name="Belenus's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  300.             }
  301.         sets.precast.WS['Wildfire'] = set_combine(sets.precast.WS, sets.Wildfire)
  302.         sets.precast.WS['Wildfire'].Mid = set_combine(sets.precast.WS.Mid, sets.Wildfire)
  303.         sets.precast.WS['Wildfire'].Acc = set_combine(sets.precast.WS.Acc, sets.Wildfire)
  304.        
  305.         sets.Trueflight = {
  306.             head={ name="Herculean Helm", augments={'Magic dmg. taken -5%','"Mag.Atk.Bns."+30','Accuracy+5 Attack+5','Mag. Acc.+17 "Mag.Atk.Bns."+17',}},
  307.             body="Samnuha Coat",
  308.             hands="Carmine Fin. Ga. +1",
  309.             legs={ name="Herculean Trousers", augments={'Mag. Acc.+16 "Mag.Atk.Bns."+16','"Dbl.Atk."+2','MND+9','Mag. Acc.+13','"Mag.Atk.Bns."+15',}},
  310.             feet={ name="Herculean Boots", augments={'"Waltz" potency +2%','CHR+10','Weapon skill damage +8%','Accuracy+9 Attack+9','Mag. Acc.+9 "Mag.Atk.Bns."+9',}},
  311.             neck="Sanctity Necklace",
  312.             waist="Hachirin-no-Obi",
  313.             left_ear="Moonshade Earring",
  314.             right_ear="Friomisi Earring",
  315.             left_ring="Ilabrat Ring",
  316.             right_ring="Dingir Ring",
  317.             back={ name="Belenus's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  318.             }
  319.         sets.precast.WS['Trueflight'] = set_combine(sets.precast.WS, sets.Trueflight)
  320.         sets.precast.WS['Trueflight'].Mid = set_combine(sets.precast.WS.Mid, sets.Trueflight)
  321.         sets.precast.WS['Trueflight'].Acc = set_combine(sets.precast.WS.Acc, sets.Trueflight)
  322.  
  323.         -- CORONACH
  324.         sets.Coronach = set_combine(sets.precast.WS, {})
  325.         sets.precast.WS['Coronach'] = set_combine(sets.precast.WS, sets.Coronach)
  326.         sets.precast.WS['Coronach'].Mid = set_combine(sets.precast.WS.Mid, sets.Coronach)
  327.         sets.precast.WS['Coronach'].Acc = set_combine(sets.precast.WS.Acc, sets.Coronach)
  328.  
  329.         sets.precast.WS['Coronach'].SAM = set_combine(sets.precast.WS, {})
  330.  
  331.         -- LAST STAND
  332.         sets.LastStand = set_combine(sets.precast.WS, {})
  333.         sets.precast.WS['Last Stand'] = set_combine(sets.precast.WS, sets.LastStand)
  334.         sets.precast.WS['Last Stand'].Mid = set_combine(sets.precast.WS.Mid, sets.LastStand)
  335.         sets.precast.WS['Last Stand'].Acc = set_combine(sets.precast.WS.Acc, sets.LastStand)
  336.  
  337.         sets.precast.WS['Last Stand'].SAM = set_combine(sets.precast.WS, {})
  338.        
  339.         -- DETONATOR
  340.         sets.Detonator = {}
  341.         sets.precast.WS['Detonator'] = set_combine(sets.precast.WS, sets.Detonator)
  342.         sets.precast.WS['Detonator'].Mid = set_combine(sets.precast.WS.Mid, sets.Detonator)
  343.         sets.precast.WS['Detonator'].Acc = set_combine(sets.precast.WS.Acc, sets.Detonator)
  344.        
  345.         -- SLUG SHOT
  346.         sets.SlugShot = {}
  347.         sets.precast.WS['Slug Shot'] = set_combine(sets.precast.WS, sets.SlugShot)
  348.         sets.precast.WS['Slug Shot'].Mid = set_combine(sets.precast.WS.Mid, sets.SlugShot)
  349.         sets.precast.WS['Slug Shot'].Acc = set_combine(sets.precast.WS.Acc, sets.SlugShot)
  350.        
  351.         sets.precast.WS['Heavy Shot'] = set_combine(sets.precast.WS, sets.SlugShot)
  352.         sets.precast.WS['Heavy Shot'].Mid = set_combine(sets.precast.WS.Mid, sets.SlugShot)
  353.         sets.precast.WS['Heavy Shot'].Acc = set_combine(sets.precast.WS.Acc, sets.SlugShot)
  354.  
  355.         -- NAMAS
  356.         sets.Namas = {}
  357.         sets.precast.WS['Namas Arrow'] = set_combine(sets.precast.WS, sets.Namas)
  358.         sets.precast.WS['Namas Arrow'].Mid = set_combine(sets.precast.WS.Mid, sets.Namas)
  359.         sets.precast.WS['Namas Arrow'].Acc = set_combine(sets.precast.WS.Acc, sets.Namas)
  360.        
  361.         sets.precast.WS['Namas Arrow'].SAM = set_combine(sets.precast.WS, {})
  362.  
  363.         -- JISHNUS
  364.         sets.Jishnus = {
  365.  
  366.             head="Meghanada Visor +2",
  367.             body="Adhemar Jacket +1",
  368.             hands="Adhemar Wrist. +1",
  369.             legs="Meg. Chausses +2",
  370.             feet="Meg. Jam. +2",
  371.             neck="Fotia Gorget",
  372.             waist="Fotia Belt",
  373.             left_ear="Enervating Earring",
  374.             right_ear="Moonshade Earring",
  375.             left_ring="Cacoethic Ring +1",
  376.             right_ring="Begrudging Ring",
  377.             back={ name="Belenus's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  378.             }
  379.         sets.precast.WS['Jishnu\'s Radiance'] = set_combine(sets.precast.WS, sets.Jishnus)
  380.         sets.precast.WS['Jishnu\'s Radiance'].Mid = set_combine(sets.precast.WS.Mid, {})
  381.         sets.precast.WS['Jishnu\'s Radiance'].Acc = set_combine(sets.precast.WS.Acc, {})
  382.  
  383.         -- SIDEWINDER
  384.         sets.Sidewinder = {}
  385.         sets.precast.WS['Sidewinder'] = set_combine(sets.precast.WS, sets.Sidewinder)
  386.         sets.precast.WS['Sidewinder'].Mid = set_combine(sets.precast.WS.Mid, sets.Sidewinder)
  387.         sets.precast.WS['Sidewinder'].Acc = set_combine(sets.precast.WS.Acc, sets.Sidewinder)
  388.  
  389.         sets.precast.WS['Refulgent Arrow'] = sets.precast.WS['Sidewinder']
  390.         sets.precast.WS['Refulgent Arrow'].Mid = sets.precast.WS['Sidewinder'].Mid
  391.         sets.precast.WS['Refulgent Arrow'].Acc = sets.precast.WS['Sidewinder'].Acc
  392.        
  393.         -- Resting sets
  394.         sets.resting = {}
  395.        
  396.         -- Defense sets
  397.         sets.defense.PDT = set_combine(sets.idle, {})
  398.         sets.defense.MDT = set_combine(sets.idle, {})
  399.         --sets.Kiting = {feet="Fajin Boots"}
  400.        
  401.         sets.buff.Barrage = {
  402.             head="Orion Beret +3",
  403.             body="Adhemar Jacket +1",
  404.             hands="Orion Bracers +2",
  405.             legs="Meg. Chausses +2",
  406.             feet="Orion Socks +2",
  407.             neck="Iskur Gorget",
  408.             waist="Kwahu Kachina Belt",
  409.             left_ear="Enervating Earring",
  410.             right_ear="Neritic Earring",
  411.             left_ring="Ilabrat Ring",
  412.             right_ring="Cacoethic Ring +1",
  413.             back={ name="Belenus's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
  414.             }
  415.         -- placeholder until I can get to it
  416.         sets.buff.Barrage.Mid = sets.buff.Barrage
  417.         sets.buff.Barrage.Acc = sets.buff.Barrage
  418.  
  419.         sets.buff.Camouflage =  {body="Orion Jerkin"}
  420.  
  421.         sets.Overkill =  {}
  422.         sets.Overkill.Preshot = set_combine(sets.precast.RA, sets.Overkill)
  423.  
  424. end
  425.  
  426. function job_pretarget(spell, action, spellMap, eventArgs)
  427.     -- If autora enabled, use WS automatically at 100+ TP
  428.     if spell.action_type == 'Ranged Attack' then
  429.         if player.tp >= 1000 and state.AutoRA.value == 'WS' and not buffactive.amnesia then
  430.             cancel_spell()
  431.             use_weaponskill()
  432.         end
  433.     end
  434. end
  435. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  436. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  437.  
  438. function job_precast(spell, action, spellMap, eventArgs)
  439.        
  440.         if state.Buff[spell.english] ~= nil then
  441.             state.Buff[spell.english] = true
  442.         end
  443.         --add_to_chat(8, state.CombatForm)
  444.         if sam_sj then
  445.             classes.CustomClass = 'SAM'
  446.         end
  447.  
  448.         if spell.action_type == 'Ranged Attack' and player.equipment.range == gear.Bow then
  449.             state.CombatWeapon:set('Bow')
  450.         end
  451.         -- add support for RangedMode toggles to EES
  452.         if spell.english == 'Eagle Eye Shot' then
  453.             classes.JAMode = state.RangedMode.value
  454.         end
  455.         -- Safety checks for weaponskills
  456.         if spell.type:lower() == 'weaponskill' then
  457.             if player.tp < 1000 then
  458.                     eventArgs.cancel = true
  459.                     return
  460.             end
  461.             if ((spell.target.distance >8 and spell.skill ~= 'Archery' and spell.skill ~= 'Marksmanship') or (spell.target.distance >21)) then
  462.                 -- Cancel Action if distance is too great, saving TP
  463.                 add_to_chat(122,"Outside WS Range! /Canceling")
  464.                 eventArgs.cancel = true
  465.                 return
  466.            
  467.             elseif state.DefenseMode.value ~= 'None' then
  468.                 -- Don't gearswap for weaponskills when Defense is on.
  469.                 eventArgs.handled = true
  470.             end
  471.         end
  472.         -- Ammo checks
  473.         if spell.action_type == 'Ranged Attack' or
  474.           (spell.type == 'WeaponSkill' and (spell.skill == 'Marksmanship' or spell.skill == 'Archery')) then
  475.             check_ammo(spell, action, spellMap, eventArgs)
  476.         end
  477. end
  478.  
  479. -- Run after the default precast() is done.
  480. -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
  481. -- This is where you place gear swaps you want in precast but applied on top of the precast sets
  482. function job_post_precast(spell, action, spellMap, eventArgs)
  483.     if state.Buff.Camouflage then
  484.         equip(sets.buff.Camouflage)
  485.     elseif state.Buff.Overkill then
  486.         equip(sets.Overkill.Preshot)
  487.     end
  488.     if spell.type == 'WeaponSkill' then
  489.         if state.CapacityMode.value then
  490.             equip(sets.CapacityMantle)
  491.         end
  492.     end
  493. end
  494.  
  495. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  496. function job_midcast(spell, action, spellMap, eventArgs)
  497.     -- Barrage
  498.     if spell.action_type == 'Ranged Attack' and state.Buff.Barrage then
  499.         if state.RangedMode.current == 'Mid' then
  500.             equip(sets.buff.Barrage.Mid)
  501.         elseif state.RangedMode.current == 'Acc' then
  502.             equip(sets.buff.Barrage.Acc)
  503.         else
  504.             equip(sets.buff.Barrage.Acc)
  505.         end
  506.         eventArgs.handled = true
  507.     end
  508.     if state.Buff.Camouflage then
  509.         equip(sets.buff.Camouflage)
  510.     end
  511.     if state.Buff.Overkill then
  512.         equip(sets.Overkill)
  513.     end
  514.     if spell.action_type == 'Ranged Attack' then
  515.         if state.CapacityMode.value then
  516.             equip(sets.CapacityMantle)
  517.         end
  518.     end
  519. end
  520.  
  521.  
  522. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  523. function job_aftercast(spell, action, spellMap, eventArgs)
  524.     -- autora
  525.     if state.AutoRA.value ~= 'Normal' then
  526.         use_ra(spell)
  527.     end
  528.  
  529.     if state.Buff[spell.name] ~= nil then
  530.         state.Buff[spell.name] = not spell.interrupted or buffactive[spell.english]
  531.     end
  532.  
  533. end
  534.  
  535. -- Called when a player gains or loses a buff.
  536. -- buff == buff gained or lost
  537. -- gain == true if the buff was gained, false if it was lost.
  538. function job_buff_change(buff, gain)
  539.     --if S{"courser's roll"}:contains(buff:lower()) then
  540.     --if string.find(buff:lower(), 'samba') then
  541.  
  542.     if state.Buff[buff] ~= nil then
  543.         state.Buff[buff] = gain
  544.         handle_equipping_gear(player.status)
  545.     end
  546.     if buff == 'Velocity Shot' and gain then
  547.         windower.send_command('wait 290;input /echo **VELOCITY SHOT** Wearing off in 10 Sec.')
  548.     elseif buff == 'Double Shot' and gain then
  549.         windower.send_command('wait 90;input /echo **DOUBLE SHOT OFF**;wait 90;input /echo **DOUBLE SHOT READY**')
  550.     elseif buff == 'Decoy Shot' and gain then
  551.         windower.send_command('wait 170;input /echo **DECOY SHOT** Wearing off in 10 Sec.];wait 120;input /echo **DECOY SHOT READY**')
  552.     end
  553.  
  554.     if  buff == "Samurai Roll" or buff == "Courser's Roll" or string.find(buff:lower(), 'flurry') then
  555.         classes.CustomRangedGroups:clear()
  556.  
  557.         if (buff == "Samurai Roll" and gain) or buffactive['Samurai Roll'] then
  558.             classes.CustomRangedGroups:append('SamRoll')
  559.         end
  560.        
  561.     end
  562.  
  563.     if buff == "Camouflage" then
  564.         if gain then
  565.             equip(sets.buff.Camouflage)
  566.             disable('body')
  567.         else
  568.             enable('body')
  569.         end
  570.     end
  571.  
  572.     if buff == "Camouflage" or buff == "Overkill" or buff == "Samurai Roll" or buff == "Courser's Roll" then
  573.         if not midaction() then
  574.             handle_equipping_gear(player.status)
  575.         end
  576.     end
  577. end
  578.  
  579. -- Called before the Include starts constructing melee/idle/resting sets.
  580. -- Can customize state or custom melee class values at this point.
  581. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  582. function job_handle_equipping_gear(status, eventArgs)
  583.     --select_earring()
  584. end
  585.  
  586. function customize_idle_set(idleSet)
  587.     if state.HybridMode.value == 'PDT' then
  588.         state.IdleMode.value = 'PDT'
  589.     elseif state.HybridMode.value ~= 'PDT' then
  590.         state.IdleMode.value = 'Normal'
  591.     end
  592.     if state.Buff.Camouflage then
  593.         idleSet = set_combine(idleSet, sets.buff.Camouflage)
  594.     end
  595.     if player.hpp < 90 then
  596.         idleSet = set_combine(idleSet, sets.idle.Regen)
  597.     end
  598.     return idleSet
  599. end
  600.  
  601. function customize_melee_set(meleeSet)
  602.     if state.Buff.Camouflage then
  603.         meleeSet = set_combine(meleeSet, sets.buff.Camouflage)
  604.     end
  605.     if state.Buff.Overkill then
  606.         meleeSet = set_combine(meleeSet, sets.Overkill)
  607.     end
  608.     if state.CapacityMode.value then
  609.         meleeSet = set_combine(meleeSet, sets.CapacityMantle)
  610.     end
  611.     return meleeSet
  612. end
  613.  
  614. function job_status_change(newStatus, oldStatus, eventArgs)
  615.     if newStatus == "Engaged" and player.equipment.range == gear.Bow then
  616.          state.CombatWeapon:set('Bow')
  617.     end
  618.  
  619.     if camo_active() then
  620.         disable('body')
  621.     else
  622.         enable('body')
  623.     end
  624. end
  625.  
  626.  
  627. -------------------------------------------------------------------------------------------------------------------
  628. -- User code that supplements self-commands.
  629. -------------------------------------------------------------------------------------------------------------------
  630.  
  631. -- Called for custom player commands.
  632. function job_self_command(cmdParams, eventArgs)
  633. end
  634.  
  635. -- Called by the 'update' self-command, for common needs.
  636. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  637. function job_update(cmdParams, eventArgs)
  638.     get_combat_form()
  639.     get_custom_ranged_groups()
  640.     sam_sj = player.sub_job == 'SAM' or false
  641.     -- called here incase buff_change failed to update value
  642.     state.Buff.Camouflage = buffactive.camouflage or false
  643.     state.Buff.Overkill = buffactive.overkill or false
  644.  
  645.     if camo_active() then
  646.         disable('body')
  647.     else
  648.         enable('body')
  649.     end
  650. end
  651.  
  652. ---- Job-specific toggles.
  653. --function job_toggle_state(field)
  654. --    if field:lower() == 'autora' then
  655. --        state.AutoRA = not state.AutoRA
  656. --        return state.AutoRA
  657. --    end
  658. --end
  659.  
  660. ---- Request job-specific mode lists.
  661. ---- Return the list, and the current value for the requested field.
  662. --function job_get_option_modes(field)
  663. --    if field:lower() == 'autora' then
  664. --        return state.AutoRA
  665. --    end
  666. --end
  667. --
  668. ---- Set job-specific mode values.
  669. ---- Return true if we recognize and set the requested field.
  670. --function job_set_option_mode(field, val)
  671. --    if field:lower() == 'autora' then
  672. --        state.AutoRA = val
  673. --        return true
  674. --    end
  675. --end
  676.  
  677. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  678. function display_current_job_state(eventArgs)
  679.     local msg = ''
  680.     if state.AutoRA.value ~= 'Normal' then
  681.         msg = '[Auto RA: ON]['..state.AutoRA.value..']'
  682.     else
  683.         msg = '[Auto RA: OFF]'
  684.     end
  685.  
  686.     add_to_chat(122, 'Ranged: '..state.RangedMode.value..'/'..state.HybridMode.value..', WS: '..state.WeaponskillMode.value..', '..msg)
  687.    
  688.     eventArgs.handled = true
  689.  
  690. end
  691. -- Special WS mode for Sam subjob
  692. function get_custom_wsmode(spell, spellMap, ws_mode)
  693.     if spell.skill == 'Archery' or spell.skill == 'Marksmanship' then
  694.         if player.sub_job == 'SAM' then
  695.             return 'SAM'
  696.         end
  697.     end
  698. end
  699. -------------------------------------------------------------------------------------------------------------------
  700. -- Utility functions specific to this job.
  701. -------------------------------------------------------------------------------------------------------------------
  702. function get_combat_form()
  703.     if S{'NIN', 'DNC'}:contains(player.sub_job) and rng_sub_weapons:contains(player.equipment.sub) then
  704.         state.CombatForm:set("DW")
  705.     else
  706.         state.CombatForm:reset()
  707.     end
  708. end
  709.  
  710. function get_custom_ranged_groups()
  711.     classes.CustomRangedGroups:clear()
  712.    
  713.     if buffactive['Samurai Roll'] then
  714.         classes.CustomRangedGroups:append('SamRoll')
  715.     end
  716.  
  717. end
  718.  
  719. function use_weaponskill()
  720.     if player.equipment.range == gear.Bow then
  721.         send_command('input /ws "'..auto_bow_ws..'" <t>')
  722.     elseif player.equipment.range == gear.Gun then
  723.         send_command('input /ws "'..auto_gun_ws..'" <t>')
  724.     end
  725. end
  726.  
  727. function job_state_change(stateField, newValue, oldValue)
  728.     if stateField == 'Auto RA' then
  729.         if newValue ~= 'Normal' then
  730.             send_command('@wait 2.5; input /ra <t>')
  731.         end
  732.     end
  733. end
  734.  
  735. function use_ra(spell)
  736.    
  737.     local delay = '2.2'
  738.     -- BOW
  739.     if player.equipment.range == gear.Bow then
  740.         if spell.type:lower() == 'weaponskill' then
  741.             delay = '2.25'
  742.          else
  743.              if buffactive["Courser's Roll"] then
  744.                  delay = '0.7' -- MAKE ADJUSTMENT HERE
  745.              elseif buffactive["Flurry II"] or buffactive.Overkill then
  746.                  delay = '0.5'
  747.              else
  748.                 delay = '1.05' -- MAKE ADJUSTMENT HERE
  749.             end
  750.         end
  751.     else
  752.     -- GUN
  753.         if spell.type:lower() == 'weaponskill' then
  754.             delay = '2.25'
  755.         else
  756.             if buffactive["Courser's Roll"] then
  757.                 delay = '0.7' -- MAKE ADJUSTMENT HERE
  758.             elseif buffactive.Overkill or buffactive['Flurry II'] then
  759.                 delay = '0.5'
  760.             else
  761.                 delay = '1.05' -- MAKE ADJUSTMENT HERE
  762.             end
  763.         end
  764.     end
  765.     send_command('@wait '..delay..'; input /ra <t>')
  766. end
  767.  
  768. function camo_active()
  769.     return state.Buff['Camouflage']
  770. end
  771. -- Check for proper ammo when shooting or weaponskilling
  772. function check_ammo(spell, action, spellMap, eventArgs)
  773.     -- Filter ammo checks depending on Unlimited Shot
  774.     if state.Buff['Unlimited Shot'] then
  775.         if player.equipment.ammo ~= U_Shot_Ammo[player.equipment.range] then
  776.             if player.inventory[U_Shot_Ammo[player.equipment.range]] or player.wardrobe[U_Shot_Ammo[player.equipment.range]] then
  777.                 add_to_chat(122,"Unlimited Shot active. Using custom ammo.")
  778.                 equip({ammo=U_Shot_Ammo[player.equipment.range]})
  779.             elseif player.inventory[DefaultAmmo[player.equipment.range]] or player.wardrobe[DefaultAmmo[player.equipment.range]] then
  780.                 add_to_chat(122,"Unlimited Shot active but no custom ammo available. Using default ammo.")
  781.                 equip({ammo=DefaultAmmo[player.equipment.range]})
  782.             else
  783.                 add_to_chat(122,"Unlimited Shot active but unable to find any custom or default ammo.")
  784.             end
  785.         end
  786.     else
  787.         if player.equipment.ammo == U_Shot_Ammo[player.equipment.range] and player.equipment.ammo ~= DefaultAmmo[player.equipment.range] then
  788.             if DefaultAmmo[player.equipment.range] then
  789.                 if player.inventory[DefaultAmmo[player.equipment.range]] then
  790.                     add_to_chat(122,"Unlimited Shot not active. Using Default Ammo")
  791.                     equip({ammo=DefaultAmmo[player.equipment.range]})
  792.                 else
  793.                     add_to_chat(122,"Default ammo unavailable.  Removing Unlimited Shot ammo.")
  794.                     equip({ammo=empty})
  795.                 end
  796.             else
  797.                 add_to_chat(122,"Unable to determine default ammo for current weapon.  Removing Unlimited Shot ammo.")
  798.                 equip({ammo=empty})
  799.             end
  800.         elseif player.equipment.ammo == 'empty' then
  801.             if DefaultAmmo[player.equipment.range] then
  802.                 if player.inventory[DefaultAmmo[player.equipment.range]] then
  803.                     add_to_chat(122,"Using Default Ammo")
  804.                     equip({ammo=DefaultAmmo[player.equipment.range]})
  805.                 else
  806.                     add_to_chat(122,"Default ammo unavailable.  Leaving empty.")
  807.                 end
  808.             else
  809.                 add_to_chat(122,"Unable to determine default ammo for current weapon.  Leaving empty.")
  810.             end
  811.         elseif player.inventory[player.equipment.ammo].count < 15 then
  812.             add_to_chat(122,"Ammo '"..player.inventory[player.equipment.ammo].shortname.."' running low ("..player.inventory[player.equipment.ammo].count..")")
  813.         end
  814.     end
  815. end
  816. -- Orestes uses Samurai Roll. The total comes to 5!
  817. --function detect_cor_rolls(old,new,color,newcolor)
  818. --    if string.find(old,'uses Samurai Roll. The total comes to') then
  819. --        add_to_chat(122,"SAM Roll")
  820. --    end
  821. --end
  822. -- Select default macro book on initial load or subjob change.
  823. function select_default_macro_book()
  824.     -- Default macro set/book
  825.     if player.sub_job == 'WAR'then
  826.             set_macro_page(1, 4)
  827.     elseif player.sub_job == 'SAM' then
  828.             set_macro_page(1, 4)
  829.     else
  830.         set_macro_page(1, 4)
  831.     end
  832. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement