Advertisement
KBeezie

Ranger Gearswap 1/21/2014 - RNG.lua

Jan 21st, 2014
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.91 KB | None | 0 0
  1. -- Last Modified: 1/21/2014
  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. -- Gear is loaded from rng_gear.lua to make it easier to update this file without re-doing gear sets
  9. --
  10. -- I don't have a PDT/MDT set configured in this file, but the stuff is there to be filled in as needed
  11. -- Engaged does have a TP set, but nothing different is filled in. I only TP off ranged attacks.
  12. --
  13. -- I only use the Augmented (Trial 5004) Scout's Beret +2 for TP Build.
  14. -- It's not much use for recycle since 90% is capped with Base + Merits + Manibozho gloves
  15. -- Getting an extra 5TP/shot with fully Merited Recycle is more useful for the head
  16. -- Thus why that's in the TP set.
  17. --
  18. -- WeaponSkill set automatically checks for a matching elemental belt or gorget in your inventory
  19. -- You can adjust UserGlobals.lua to change the default belt/gorget used when no match can be equipped
  20. -- If you leave default to blank "", It'll just keep whatever belt/neck you were using.
  21. --
  22. -- While there is a function to check for "Unlimited Shot" before using one of the special ammo
  23. -- it does not protect from loss against multi-hit weaponskills (ie: Jishnu's Radiance being a 3-hit WS)
  24.  
  25. -- === In Precast ===
  26. -- 1) Checks to make sure you're in an engaged state and have 100+ TP before firing a weaponskill
  27. -- 2) Checks the distance to target to prevent WS from being fired when target is too far (prevents TP loss)
  28. -- 3) Does not allow gear-swapping on weaponskills when Defense mode is enabled
  29. -- 4) Checks to see of "Unlimited Shot" buff is on, if there's any special ammo defined in sets equipped
  30. -- 5) Checks for empty ammo (or special without buff) and fills in the default ammunition for that weapon
  31. --    ^ keeps empty if that ammo cannot be found, or there is no match to the weapon equipped
  32. -- 6) Provides a low ammunition warning if current ammo in slot (counts all in inventory) is less than 15
  33. --    ^ If you have 5 Tulfaire arrows in slot, but 20 also in inventory it see's it as 25 total
  34.  
  35. -- === In Midcast ===
  36. -- If Sneak is active, sends the cancel command before Spectral Jig finish casting
  37.  
  38. -- === In Post-Midcast ===
  39. -- If Barrage Buff is active, equips sets.BarrageMid
  40.  
  41. -- === In Buff Change ===
  42. -- If Camouflage is active, disable body swaping
  43. -- This is done to preserve the +100 Camouflage Duration given by Orion Jerkin
  44.  
  45. function get_sets()
  46.     -- Load and initialize the include file.
  47.     include('Mote-Include.lua')
  48.     init_include()
  49.  
  50.     -- UserGlobals may define additional sets to be added to the local ones.
  51.     if define_global_sets then
  52.         define_global_sets()
  53.     end
  54.  
  55.     -- Optional: load a sidecar version of the init and unload functions.
  56.     load_user_gear(player.main_job)
  57.     init_gear_sets()
  58.  
  59.     -- Global default binds
  60.     binds_on_load()
  61.  
  62.     send_command('bind f9 gs c cycle RangedMode')
  63.     send_command('bind ^f9 gs c cycle OffenseMode')
  64.     send_command('bind !f9 gs c cycle WeaponskillMode')
  65. end
  66.  
  67. -- Called when this job file is unloaded (eg: job change)
  68. function file_unload()
  69.         binds_on_unload()
  70. end
  71.  
  72. function init_gear_sets()
  73.     -- using sidecar file rng_gear.lua
  74. end
  75.  
  76. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  77. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  78.  
  79. function job_precast(spell, action, spellMap, eventArgs)
  80.     if spell.type:lower() == 'weaponskill' then
  81.         if player.status ~= "Engaged" or player.tp < 100 then
  82.             eventArgs.cancel = true
  83.             return
  84.         end
  85.         if (spell.target.distance >8 and not bow_gun_weaponskills:contains(spell.english)) or (spell.target.distance >21) then
  86.             -- Cancel Action if distance is too great, saving TP
  87.             add_to_chat(122,"Distance too great for WeaponSkill /Canceling")
  88.             eventArgs.cancel = true
  89.             return
  90.         elseif state.Defense.Active then
  91.             -- Don't gearswap for weaponskills when Defense is on.
  92.             eventArgs.handled = true
  93.         end
  94.     end
  95.    
  96.     if spell.type == 'Waltz' then
  97.         refine_waltz(spell, action, spellMap, eventArgs)
  98.     end
  99.    
  100.     if spell.name == "Ranged" or spell.type:lower() == 'weaponskill' then
  101.         -- If ammo is empty, or special ammo being used without buff, replace with default ammo
  102.         if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
  103.             if DefaultAmmo[player.equipment.range] and player.inventory[DefaultAmmo[player.equipment.range]] then
  104.                 add_to_chat(122,"Unlimited Shot not Active or Ammo Empty, Using Default Ammo")
  105.                 equip({ammo=DefaultAmmo[player.equipment.range]})
  106.             else
  107.                 add_to_chat(122,"Either Defaul Ammo is Unavailable or Unknown Weapon. Staying empty")
  108.                 equip({ammo=empty})
  109.             end
  110.         end
  111.         if not buffactive['unlimited shot'] then
  112.             -- If not empty, and if unlimited shot is not active
  113.             -- Not doing it for unlimited shot to avoid excessive log
  114.             if player.equipment.ammo ~= 'empty' then
  115.                 if player.inventory[player.equipment.ammo].count < 15 then
  116.                     add_to_chat(122,"Ammo '"..player.inventory[player.equipment.ammo].shortname.."' running low ("..player.inventory[player.equipment.ammo].count..")")
  117.                 end
  118.             end
  119.         end
  120.     end
  121. end
  122.  
  123. -- Run after the default precast() is done.
  124. -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
  125. -- This is where you place gear swaps you want in precast but applied on top of the precast sets
  126. function job_post_precast(spell, action, spellMap, eventArgs)
  127.  
  128. end
  129.  
  130. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  131. function job_midcast(spell, action, spellMap, eventArgs)
  132.     if spell.name == 'Spectral Jig' and buffactive.sneak then
  133.         -- If sneak is active when using, cancel before completion
  134.         send_command('cancel 71')
  135.     end
  136. end
  137.  
  138. -- Run after the default midcast() is done.
  139. -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
  140. function job_post_midcast(spell, action, spellMap, eventArgs)
  141.     if buffactive["Barrage"] then
  142.         equip(sets.BarrageMid)
  143.     end
  144. end
  145.  
  146. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  147. function job_aftercast(spell, action, spellMap, eventArgs)
  148.  
  149. end
  150.  
  151. -- Run after the default aftercast() is done.
  152. -- eventArgs is the same one used in job_aftercast, in case information needs to be persisted.
  153. function job_post_aftercast(spell, action, spellMap, eventArgs)
  154.  
  155. end
  156.  
  157. -- Called before the Include starts constructing melee/idle/resting sets.
  158. -- Can customize state or custom melee class values at this point.
  159. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  160. function job_handle_equipping_gear(status, eventArgs)
  161.  
  162. end
  163.  
  164. function customize_idle_set(idleSet)
  165.     return idleSet
  166. end
  167.  
  168. function customize_melee_set(meleeSet)
  169.     return meleeSet
  170. end
  171.  
  172. function job_status_change(newStatus, oldStatus, eventArgs)
  173.    
  174. end
  175.  
  176. -- Called when a player gains or loses a buff.
  177. -- buff == buff gained or lost
  178. -- gain == true if the buff was gained, false if it was lost.
  179. function job_buff_change(buff, gain)
  180.     if status == "Camouflage" then
  181.         if gain_or_loss == "gain" then
  182.             send_command('@wait .5;gs disable body')
  183.         else
  184.             enable('body')
  185.         end
  186.     end
  187. end
  188.  
  189. -------------------------------------------------------------------------------------------------------------------
  190. -- User code that supplements self-commands.
  191. -------------------------------------------------------------------------------------------------------------------
  192.  
  193. -- Called for custom player commands.
  194. function job_self_command(cmdParams, eventArgs)
  195.  
  196. end
  197.  
  198. -- Called by the 'update' self-command, for common needs.
  199. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  200. function job_update(cmdParams, eventArgs)
  201.  
  202. end
  203.  
  204. -- Job-specific toggles.
  205. function job_toggle(field)
  206.  
  207. end
  208.  
  209. -- Request job-specific mode lists.
  210. -- Return the list, and the current value for the requested field.
  211. function job_get_mode_list(field)
  212.  
  213. end
  214.  
  215. -- Set job-specific mode values.
  216. -- Return true if we recognize and set the requested field.
  217. function job_set_mode(field, val)
  218.  
  219. end
  220.  
  221. -- Handle auto-targetting based on local setup.
  222. function job_auto_change_target(spell, action, spellMap, eventArgs)
  223.  
  224. end
  225.  
  226. -- Handle notifications of user state values being changed.
  227. function job_state_change(stateField, newValue)
  228.  
  229. end
  230.  
  231. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  232. function display_current_job_state(eventArgs)
  233.  
  234. end
  235.  
  236. -------------------------------------------------------------------------------------------------------------------
  237. -- Utility functions specific to this job.
  238. -------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement