Advertisement
Guest User

Ranger GearSwap Lua

a guest
Jan 10th, 2014
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.88 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Initialization function that defines sets and variables to be used.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Last Modified: 1/4/2014 6:07:55 PM
  6.  
  7. -- IMPORTANT: Make sure to also get the Mote-Include.lua file to go with this.
  8.  
  9. function get_sets()
  10.     -- Load and initialize the include file that this depends on.
  11.     include('Mote-Include.lua')
  12.     init_include()
  13.    
  14.     -- Options: Override default values
  15.     options.OffenseModes = {'Normal', 'Acc'}
  16.     options.DefenseModes = {'Normal', 'Evasion', 'PDT'}
  17.     options.WeaponskillModes = {'Normal', 'Acc', 'Att', 'Mod'}
  18.     options.CastingModes = {'Normal'}
  19.     options.IdleModes = {'Normal'}
  20.     options.RestingModes = {'Normal'}
  21.     options.PhysicalDefenseModes = {'PDT', 'Evasion'}
  22.     options.MagicalDefenseModes = {'MDT'}
  23.  
  24.     state.Defense.PhysicalMode = 'PDT'
  25.  
  26.     --------------------------------------
  27.     -- Start defining the sets
  28.     --------------------------------------
  29.    
  30.     U_Shot_Ammo = S{'Aeolus Arrow','Animikii Bullet','Crossbow Bolt'}
  31.     DefaultGun = "Eminent Gun"
  32.     DefaultBow = "Eminent Bow"
  33.     DefaultXBow = "Eminent Crossbow"
  34.     DefaultGunAmmo = {ammo="Titanium Bullet"}
  35.     DefaultBowAmmo = {ammo="Tulfaire Arrow"}
  36.     DefaultXBowAmmo = {ammo="Dark Adaman Bolt"}
  37.     DefaultAmmo = DefaultBowAmmo
  38.    
  39.     ranged_ws = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Arching Arrow",
  40.     "Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot",
  41.     "Split Shot", "Sniper Shot", "Slug Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight","Wildfire"}
  42.    
  43.     SoilBeltWS = S{"Numbing Shot", "Wildfire"}
  44.     LightBeltWS = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Blast Arrow", "Arching Arrow",
  45.     "Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot",
  46.     "Split Shot", "Sniper Shot", "Slug Shot", "Blast Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight"}
  47.     LightNeckWS = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Blast Arrow", "Arching Arrow",
  48.     "Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot",
  49.     "Split Shot", "Sniper Shot", "Slug Shot", "Blast Shot", "Heavy Shot", "Detonator", "Last Stand", "Trueflight"}
  50.     -- Precast Sets
  51.    
  52.     sets.precast.RangedAttack = {neck="Ocachi Gorget",ring1="K'ayres Ring",ring2="Rajas Ring",back="Libeccio Mantle",
  53.         ear1="Volley Earring",ear2="Moonshade Earring",waist="Scout's Belt"}
  54.     sets.precast.RangedAttack.Acc = set_combine(sets.precast.RangedAttack, {neck="Ej Necklace"})
  55.    
  56.     -- Precast sets to enhance JAs
  57.     sets.precast.Step = {ear2="Choreia Earring"}
  58.        
  59.     -- Weaponskill sets
  60.     -- Default set for any weaponskill that isn't any more specifically defined
  61.     sets.precast.WS = set_combine(sets.precast.RangedAttack, {back="Vespid Mantle",ear1="Clearview Earring",
  62.         neck="Ocachi Gorget",ring1="K'ayres Ring",ring2="Rajas Ring"})
  63.        
  64.     sets.precast.WS.Acc = set_combine(sets.precast.WS, {neck="Ej Necklace"})
  65.  
  66.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  67.        
  68.     -- Midcast Sets
  69.     sets.midcast.FastRecast = {
  70.         head="Orion Beret",ear2="Moonshade Earring",
  71.         body="Orion Jerkin +1",hands="Buremte Gloves",
  72.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  73.        
  74.     -- Specific spells
  75.     sets.midcast.Utsusemi = {
  76.         head="Orion Beret",ear2="Moonshade Earring",
  77.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",
  78.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  79.  
  80.    
  81.     -- Sets to return to when not performing an action.
  82.    
  83.     -- Resting sets
  84.     sets.resting = {}
  85.    
  86.  
  87.     -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
  88.     sets.idle.Town = {main="Hurlbat", sub="Antican Axe",
  89.         head="Orion Beret",neck="Ocachi Gorget",ear1="Volley Earring",ear2="Moonshade Earring",
  90.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Dark Ring",
  91.         back="Libeccio Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  92.    
  93.     sets.idle.Field = {head="Orion Beret",neck="Ocachi Gorget",ear1="Volley Earring",ear2="Moonshade Earring",
  94.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Dark Ring",
  95.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  96.  
  97.     sets.idle.Weak = {head="Orion Beret",neck="Ocachi Gorget",ear1="Volley Earring",ear2="Moonshade Earring",
  98.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Dark Ring",
  99.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  100.    
  101.     -- Defense sets
  102.     sets.defense.Evasion = {
  103.         head="Orion Beret",body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Dark Ring",
  104.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  105.  
  106.     sets.defense.PDT = {head="Orion Beret",neck="Twilight Torque",
  107.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Dark Ring",
  108.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  109.  
  110.     sets.defense.MDT = {head="Orion Beret",neck="Twilight Torque",
  111.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Dark Ring",
  112.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  113.  
  114.     sets.Kiting = {}
  115.  
  116.     -- Engaged sets
  117.  
  118.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  119.     -- sets if more refined versions aren't defined.
  120.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  121.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  122.    
  123.     -- Normal melee group
  124.     sets.engaged = {head="Orion Beret",neck="Ocachi Gorget",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  125.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
  126.         back="Libeccio Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
  127.     sets.engaged.Acc = {head="Orion Beret",neck="Ocachi Gorget",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  128.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
  129.         back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
  130.     sets.engaged.Evasion = {head="Orion Beret",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  131.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
  132.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  133.     sets.engaged.Acc.Evasion = {head="Orion Beret",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  134.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="K'ayres Ring",ring2="Rajas Ring",
  135.         back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
  136.     sets.engaged.PDT = {head="Orion Beret",neck="Twilight Torque",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  137.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Rajas Ring",
  138.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  139.     sets.engaged.Acc.PDT = {head="Orion Beret",neck="Twilight Torque",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  140.         body="Orion Jerkin +1",hands="Buremte Gloves",ring1="Dark Ring",ring2="Rajas Ring",
  141.         back="Shadow Mantle",waist="Hurch'lan Sash",legs="Nahtirah Trousers",feet="Orion Socks"}
  142.  
  143.  
  144.     windower.send_command('input /macro book 20;wait .1;input /macro set 1')
  145.     gearswap_binds_on_load()
  146.  
  147.     windower.send_command('bind ^- gs c toggle target')
  148.     windower.send_command('bind ^= gs c cycle targetmode')
  149. end
  150.  
  151. -- Called when this job file is unloaded (eg: job change)
  152. function file_unload()
  153.     --spellcast_binds_on_unload()
  154. end
  155.  
  156. -------------------------------------------------------------------------------------------------------------------
  157. -- Job-specific hooks that are called to process player actions at specific points in time.
  158. -------------------------------------------------------------------------------------------------------------------
  159.  
  160. -- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
  161. function job_pretarget(spell, action, spellMap, eventArgs)
  162.  
  163. end
  164.  
  165. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  166. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  167. function job_precast(spell, action, spellMap, eventArgs)
  168.     if spell.type:lower() == 'weaponskill' then
  169.         if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
  170.             add_to_chat(122,"Distance too great for WeaponSkill /Canceling")
  171.             cancel_spell()
  172.             return
  173.         elseif state.Defense.Active then
  174.             -- Don't gearswap for weaponskills when Defense is on.
  175.             eventArgs.handled = true
  176.         end
  177.     end
  178.    
  179.     if player.equipment.range == DefaultGun then
  180.         DefaultAmmo = DefaultGunAmmo
  181.     elseif player.equipment.range == DefaultBow then
  182.         DefaultAmmo = DefaultBowAmmo
  183.     elseif player.equipment.range == DefaultXBow then
  184.         DefaultAmmo = DefaultXBowAmmo
  185.     end
  186.    
  187.     if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
  188.         -- to avoid the ammo being left in, if the default ammo is not present in inventory
  189.         add_to_chat(122,"Unlimited Shot not Active or Ammo Empty, Using Default Ammo")
  190.         equip({ammo=empty})
  191.         equip(DefaultAmmo)
  192.     end
  193.    
  194.     -- Normal Ranged Attack
  195.     if spell.name == 'Ranged' then
  196.         equip(sets.precast.RangedAttack)
  197.     end
  198.  
  199.     -- Job Abilities
  200.     if spell.name == 'Spectral Jig' and buffactive.sneak then
  201.         send_command('cancel 71')
  202.     elseif spell.name == 'Bounty Shot' then
  203.         equip({hands="Sylvan Glovelettes +2"})
  204.     elseif spell.name == 'Scavenge' then
  205.         equip({feet="Orion Socks"})
  206.     end
  207. end
  208.  
  209. -- Return a customized weaponskill mode to use for weaponskill sets.
  210. -- Don't return anything if you're not overriding the default value.
  211. function get_job_wsmode(spell, action, spellMap)
  212.  
  213. end
  214.  
  215. -- Run after the default precast() is done.
  216. -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
  217. function job_post_precast(spell, action, spellMap, eventArgs)
  218.  
  219. end
  220.  
  221.  
  222. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  223. function job_midcast(spell, action, spellMap, eventArgs)
  224.     if SoilBeltWS[spell.name] then
  225.         equip({waist="Soil Belt"})
  226.     end
  227.    
  228.     if LightBeltWS[spell.name] then
  229.         equip({waist="Light Belt"})
  230.     end
  231.    
  232.     if LightNeckWS[spell.name] then
  233.         equip({neck="Light Gorget"})
  234.     end
  235. end
  236.  
  237. -- Run after the default midcast() is done.
  238. -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
  239. function job_post_midcast(spell, action, spellMap, eventArgs)
  240.  
  241. end
  242.  
  243. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  244. function job_aftercast(spell, action, spellMap, eventArgs)
  245. end
  246.  
  247. -- Run after the default aftercast() is done.
  248. -- eventArgs is the same one used in job_aftercast, in case information needs to be persisted.
  249. function job_post_aftercast(spell, action, spellMap, eventArgs)
  250.  
  251. end
  252.  
  253. -------------------------------------------------------------------------------------------------------------------
  254. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  255. -------------------------------------------------------------------------------------------------------------------
  256.  
  257. -- Called before the Include starts constructing melee/idle/resting sets.
  258. -- Can customize state or custom melee class values at this point.
  259. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  260. function job_handle_equipping_gear(status, eventArgs)
  261.  
  262. end
  263.  
  264. -- Modify the default idle set after it was constructed.
  265. function customize_idle_set(idleSet)
  266.     return idleSet
  267. end
  268.  
  269. -- Modify the default melee set after it was constructed.
  270. function customize_melee_set(meleeSet)
  271.     return meleeSet
  272. end
  273.  
  274. -------------------------------------------------------------------------------------------------------------------
  275. -- General hooks for other events.
  276. -------------------------------------------------------------------------------------------------------------------
  277.  
  278. -- Called when the player's status changes.
  279. function job_status_change(newStatus, oldStatus, eventArgs)
  280.     --handle_equipping_gear(newStatus)
  281. end
  282.  
  283. -- Called when a player gains or loses a buff.
  284. -- buff == buff gained or lost
  285. -- gain == true if the buff was gained, false if it was lost.
  286. function job_buff_change(buff, gain)
  287.  
  288. end
  289.  
  290.  
  291. -------------------------------------------------------------------------------------------------------------------
  292. -- User code that supplements self-commands.
  293. -------------------------------------------------------------------------------------------------------------------
  294.  
  295. -- Called for custom player commands.
  296. function job_self_command(cmdParams, eventArgs)
  297.  
  298. end
  299.  
  300. -- Called by the 'update' self-command, for common needs.
  301. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  302. function job_update(cmdParams, eventArgs)
  303.  
  304. end
  305.  
  306. -- Handle notifications of user state values being changed.
  307. function job_state_change(stateField, newValue)
  308.  
  309. end
  310.  
  311. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  312. function display_current_job_state(eventArgs)
  313.  
  314. end
  315.  
  316. -------------------------------------------------------------------------------------------------------------------
  317. -- Utility functions specific to this job.
  318. -------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement