Advertisement
KBeezie

Ranger Gearswap 1/19/2014

Jan 19th, 2014
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.80 KB | None | 0 0
  1. -- Last Modified: 1/18/2014 5:00PM EST
  2. -- Cleaned File up, Check https://github.com/Kinematics/GearSwap-Jobs/blob/master/Template.lua
  3. -- Get the latest Mote-* files and examples from:
  4. -- https://github.com/Kinematics/GearSwap-Jobs
  5. -- for list of other functions that can be used.
  6.  
  7. -- === Some Notes On Sets ===
  8. -- I don't have a PDT/MDT set configured in this file, but the stuff is there to be filled in as needed
  9. -- Engaged does have a TP set, but nothing different is filled in. I only TP off ranged attacks.
  10. --
  11. -- I only use the Augmented (Trial 5004) Scout's Beret +2 for TP Build.
  12. -- It's not much use for recycle since 90% is capped with Base + Merits + Manibozho gloves
  13. -- Getting an extra 5TP/shot with fully Merited Recycle is more useful for the head
  14. -- Thus why that's in the TP set.
  15. --
  16. -- WeaponSkill set automatically checks for a matching elemental belt or gorget in your inventory
  17. -- You can adjust UserGlobals.lua to change the default belt/gorget used when no match can be equipped
  18. -- If you leave default to blank "", It'll just keep whatever belt/neck you were using.
  19. --
  20. -- While there is a function to check for "Unlimited Shot" before using one of the special ammo
  21. -- it does not protect from loss against multi-hit weaponskills (ie: Jishnu's Radiance being a 3-hit WS)
  22.  
  23. -- === In Precast ===
  24. -- 1) Checks to make sure you're in an engaged state and have 100+ TP before firing a weaponskill
  25. -- 2) Checks the distance to target to prevent WS from being fired when target is too far (prevents TP loss)
  26. -- 3) Does not allow gear-swapping on weaponskills when Defense mode is enabled
  27. -- 4) Checks to see of "Unlimited Shot" buff is on, if there's any special ammo defined in sets equipped
  28. -- 5) Checks for empty ammo (or special without buff) and fills in the default ammunition for that weapon
  29. --    ^ keeps empty if that ammo cannot be found, or there is no match to the weapon equipped
  30. -- 6) Provides a low ammunition warning if current ammo in slot (counts all in inventory) is less than 15
  31. --    ^ If you have 5 Tulfaire arrows in slot, but 20 also in inventory it see's it as 25 total
  32.  
  33. -- === In Post-Precast ===
  34. -- If Sneak is active, sends the cancel command before Spectral Jig finish casting
  35.  
  36. -- === In Post-Midcast ===
  37. -- If Barrage Buff is active, equips sets.BarrageMid
  38.  
  39. -- === In Buff Change ===
  40. -- If Camouflage is active, disable body swaping
  41. -- This is done to preserve the +100 Camouflage Duration given by Orion Jerkin
  42.  
  43. function get_sets()
  44.     include('Mote-Include.lua')
  45.     init_include()
  46.    
  47.     if define_global_sets then
  48.         define_global_sets()
  49.     end
  50.  
  51.     self_initialize()
  52.  
  53.     -- Default macro set/book
  54.     set_macro_page(1, 20)
  55.    
  56.     binds_on_load()
  57.    
  58.     send_command('bind f9 gs c cycle RangedMode')
  59.     send_command('bind ^f9 gs c cycle OffenseMode')
  60.     send_command('bind !f9 gs c cycle WeaponskillMode')
  61. end
  62.  
  63. function file_unload()
  64.     binds_on_unload()
  65. end
  66.  
  67. function self_initialize() 
  68.     -- Options: Override default values
  69.     options.OffenseModes = {'Normal', 'Acc', 'TP'}
  70.     options.RangedModes = {'Normal', 'Acc', 'TP'}
  71.     options.DefenseModes = {'Normal', 'PDT'}
  72.     options.WeaponskillModes = {'Normal', 'Acc'}
  73.     options.PhysicalDefenseModes = {'PDT'}
  74.     options.MagicalDefenseModes = {'MDT'}
  75.     state.Defense.PhysicalMode = 'PDT'
  76.  
  77.     -- Misc. Job Ability precasts
  78.     sets.precast.Step = {ear2="Choreia Earring"}
  79.     sets.precast.JA['Bounty Shot'] = {hands="Sylvan Glovelettes +2"}
  80.     sets.precast.JA['Scavenge'] = {feet="Orion Socks"}
  81.    
  82.     -- Idle Set (My 'base')
  83.     sets.idle = {
  84.         head="Orion Beret",neck="Twilight Torque",ear1="Volley Earring",ear2="Moonshade Earring",
  85.         body="Orion Jerkin +1",hands="Manibozho Gloves",ring1="Dark Ring",ring2="Dark Ring",
  86.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  87.  
  88.     -- Engaged sets
  89.     sets.engaged = set_combine(sets.idle, {
  90.         neck="Asperity Necklace",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  91.         ring1="K'ayres Ring",ring2="Rajas Ring",
  92.         back="Sylvan Chlamys",waist="Hurch'lan Sash"})
  93.    
  94.     sets.engaged.Acc = set_combine(sets.engaged, {
  95.         neck="Ej Necklace",
  96.         hands="Buremte Gloves"})
  97.    
  98.     sets.engaged.TP = set_combine(sets.engaged, {
  99.         })
  100.  
  101.     -- Ranged Attack
  102.     sets.precast.Ranged = set_combine(sets.idle, {
  103.         head="Sylvan Gapette +2",
  104.         body="Sylvan Caban +2",hands="Iuitl Wristbands",
  105.         waist="Impulse Belt",pants="Nahtirah Trousers",feet="Wurrukatte Boots"})
  106.  
  107.     sets.midcast.Ranged = set_combine(sets.idle, {
  108.         neck="Ocachi Gorget",
  109.         ring1="K'ayres Ring",ring2="Rajas Ring",
  110.         back="Moondoe Mantle",waist="Scout's Belt"})
  111.        
  112.     sets.midcast.Ranged.Acc = set_combine(sets.midcast.Ranged, {
  113.         neck="Ej Necklace",
  114.         hands="Buremte Gloves",ring1="Paqichikaji Ring"})
  115.        
  116.     sets.midcast.Ranged.TP = set_combine(sets.midcast.Ranged, {
  117.         head="Scout's Beret +2",back="Sylvan Chlamys"})
  118.  
  119.     -- Weaponskill sets
  120.    
  121.     sets.precast.WS = set_combine(sets.midcast.Ranged, {
  122.         ear1="Clearview Earring",
  123.         back="Sylvan Chlamys", waist=gear.ElementalBelt, neck=gear.ElementalGorget})
  124.    
  125.     sets.precast.WS.Acc = set_combine(sets.precast.WS, {
  126.         neck="Ej Necklace",
  127.         hands="Buremte Gloves",ring1="Paqichikaji Ring",
  128.         back="Moondoe Mantle"})
  129.    
  130.     -- Resting sets
  131.     sets.resting = {}
  132.    
  133.     -- Defense sets
  134.     sets.defense.PDT = set_combine(sets.idle, {})
  135.     sets.defense.MDT = set_combine(sets.idle, {})
  136.     sets.Kiting = {feet="Fajin Boots"}
  137.    
  138.     -- Barrage Set
  139.     sets.BarrageMid = set_combine(sets.midcast.Ranged.Acc, {
  140.         hands="Orion Bracers"})
  141.    
  142.     -- List of ammunition that should only be used under unlimited shot
  143.     U_Shot_Ammo = S{'Aeolus Arrow','Animikii Bullet','Crossbow Bolt'}
  144.    
  145.     -- Simply add a line of DefaultAmmo["Weapon"] = "Ammo Name"
  146.     DefaultAmmo = {}
  147.     DefaultAmmo["Eminent Gun"] = "Titanium Bullet"
  148.     DefaultAmmo["Echidna's Bow"] = "Tulfaire Arrow"
  149.     DefaultAmmo["Eminent Bow"] = "Tulfaire Arrow"
  150.     DefaultAmmo["Eminent Crossbow"] = "Bloody Bolt"
  151.     DefaultAmmo["Gandiva"] = "Tulfaire Arrow"
  152.    
  153.     -- List of all ranged WS that can be fired up to 21 yalms from target
  154.     -- It excludes Cor-only WS, as well as the few short-ranged WS (blast arrow, etc)
  155.     ranged_ws = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Arching Arrow",
  156.     "Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot",
  157.     "Split Shot", "Sniper Shot", "Slug Shot", "Heavy Shot", "Detonator", "Last Stand",
  158.     "Coronach", "Trueflight", "Wildfire"}
  159. end
  160.  
  161. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  162. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  163.  
  164. function job_precast(spell, action, spellMap, eventArgs)
  165.     if spell.type:lower() == 'weaponskill' then
  166.         if player.status ~= "Engaged" or player.tp < 100 then
  167.             eventArgs.cancel = true
  168.             return
  169.         end
  170.         if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
  171.             -- Cancel Action if distance is too great, saving TP
  172.             add_to_chat(122,"Distance too great for WeaponSkill /Canceling")
  173.             eventArgs.cancel = true
  174.             return
  175.         elseif state.Defense.Active then
  176.             -- Don't gearswap for weaponskills when Defense is on.
  177.             eventArgs.handled = true
  178.         end
  179.     end
  180.    
  181.     if spell.name == "Ranged" or spell.type:lower() == 'weaponskill' then
  182.         -- If ammo is empty, or special ammo being used without buff, replace with default ammo
  183.         if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
  184.             if DefaultAmmo[player.equipment.range] and player.inventory[DefaultAmmo[player.equipment.range]] then
  185.                 add_to_chat(122,"Unlimited Shot not Active or Ammo Empty, Using Default Ammo")
  186.                 equip({ammo=DefaultAmmo[player.equipment.range]})
  187.             else
  188.                 add_to_chat(122,"Either Defaul Ammo is Unavailable or Unknown Weapon. Staying empty")
  189.                 equip({ammo=empty})
  190.             end
  191.         end
  192.         if not buffactive['unlimited shot'] then
  193.             -- If not empty, and if unlimited shot is not active
  194.             -- Not doing it for unlimited shot to avoid excessive log
  195.             if player.equipment.ammo ~= 'empty' then
  196.                 if player.inventory[player.equipment.ammo].count < 15 then
  197.                     add_to_chat(122,"Ammo '"..player.inventory[player.equipment.ammo].shortname.."' running low ("..player.inventory[player.equipment.ammo].count..")")
  198.                 end
  199.             end
  200.         end
  201.     end
  202. end
  203.  
  204. -- Run after the default precast() is done.
  205. -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
  206. -- This is where you place gear swaps you want in precast but applied on top of the precast sets
  207. function job_post_precast(spell, action, spellMap, eventArgs)
  208.  
  209.     if spell.name == 'Spectral Jig' and buffactive.sneak then
  210.         -- If sneak is active when using, cancel before completion
  211.         send_command('cancel 71')
  212.     end
  213.    
  214. end
  215.  
  216. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  217. function job_midcast(spell, action, spellMap, eventArgs)
  218.  
  219. end
  220.  
  221. -- Run after the default midcast() is done.
  222. -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
  223. function job_post_midcast(spell, action, spellMap, eventArgs)
  224.     if buffactive["Barrage"] then
  225.         equip(sets.BarrageMid)
  226.     end
  227. end
  228.  
  229. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  230. function job_aftercast(spell, action, spellMap, eventArgs)
  231.  
  232. end
  233.  
  234. -- Run after the default aftercast() is done.
  235. -- eventArgs is the same one used in job_aftercast, in case information needs to be persisted.
  236. function job_post_aftercast(spell, action, spellMap, eventArgs)
  237.  
  238. end
  239.  
  240. -- Called before the Include starts constructing melee/idle/resting sets.
  241. -- Can customize state or custom melee class values at this point.
  242. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  243. function job_handle_equipping_gear(status, eventArgs)
  244.  
  245. end
  246.  
  247. function customize_idle_set(idleSet)
  248.     return idleSet
  249. end
  250.  
  251. function customize_melee_set(meleeSet)
  252.     return meleeSet
  253. end
  254.  
  255. function job_status_change(newStatus, oldStatus, eventArgs)
  256.    
  257. end
  258.  
  259. -- Called when a player gains or loses a buff.
  260. -- buff == buff gained or lost
  261. -- gain == true if the buff was gained, false if it was lost.
  262. function job_buff_change(buff, gain)
  263.     if status == "Camouflage" then
  264.         if gain_or_loss == "gain" then
  265.             send_command('@wait .5;gs disable body')
  266.         else
  267.             enable('body')
  268.         end
  269.     end
  270. end
  271.  
  272. -- Called for custom player commands.
  273. function job_self_command(cmdParams, eventArgs)
  274.  
  275. end
  276.  
  277. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  278. function job_update(cmdParams, eventArgs)
  279.  
  280. end
  281.  
  282. -- Handle notifications of user state values being changed.
  283. function job_state_change(stateField, newValue)
  284.  
  285. end
  286.  
  287. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  288. function display_current_job_state(eventArgs)
  289.  
  290. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement