Advertisement
Guest User

Untitled

a guest
Jan 18th, 2014
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.91 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Initialization function that defines sets and variables to be used.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Last Modified: 1/18/2014 12:00AM EST
  6.  
  7. -- IMPORTANT: Make sure to also get the Mote-Include.lua file to go with this.
  8.  
  9. -- Features/Changes
  10. -- Normal/Accuracy/TP build modes for Ranged Attacks (Offense Mode)
  11. -- Normal/Accuracy for Weaponskills
  12. -- Engaged set for Normal/Accuracy/TP
  13. -- The Casting, Resting, PDT/MDT modes aren't really used, but the sets are there
  14. --     so fill in equipment as needed, they're merged from idle
  15. --
  16. -- Precast set for Ranged (Misc->Ranged) set
  17. -- Midcast set for Ranged (Follows Offense Mode)
  18. --
  19. -- A set for Unlimited Shot is there, filled with ammo that should only be used with unlimited shot
  20. -- There's a function in precast that makes sure the buff is active, otherwise equips the default ammo
  21. -- this check won't protect against multi-hit WS or barrage.
  22. --
  23. -- Ability to set the default amunition used for different weapons
  24. -- simply set DefaultAmmo["Name of Ranged Weapon"] = "Name of Ammo"
  25. -- This is used in case ammo slot is empty, or special ammo needs to be replaced in precast
  26. -- If it can't find the ammo or weapon, it'll simply keep the ammo slot empty to protect
  27. -- against the possibility of spending the rare/ex amunition.
  28. --
  29. -- A Ranged WS set has been created to prevent WS from being fired over 21 yalms
  30. -- All other WS not included are prevent from being fired over 8 yalms
  31. -- the Ranged WS set does not include short-ranged WS or cor-only WS
  32. --
  33. -- A simple JA precast for Steps, BountyShot, and Scavenge are set
  34. -- A if/then condition for Camouflage is in place to keep body the same
  35. -- if the buff is active (set to match idle/engaged body)
  36. --
  37. -- Barrage if/then set to equip Orion Bracers in post_precast if the buff is active
  38. -- The Set sets.BarrageMid is combined form the Ranged Accuracy Set.
  39. --
  40. -- Low ammunition warning implemented (warns if the TOTAL amount of ammo in the current slot is under 15)
  41. --
  42. -- Sneak-Cancelation performed when Spectral Jig is used, and sneak is still active.
  43.  
  44. function get_sets()
  45.     -- Load and initialize the include file that this depends on.
  46.     include('Mote-Include.lua')
  47.     init_include()
  48.    
  49.     -- Options: Override default values
  50.     -- Resting, PDT/MDT sets are currently blank, fill as needed below
  51.     options.OffenseModes = {'Normal', 'Acc', "TP"}
  52.     options.DefenseModes = {'Normal', 'PDT'}
  53.     options.WeaponskillModes = {'Normal', 'Acc'}
  54.     options.CastingModes = {'Normal'}
  55.     options.IdleModes = {'Normal','Ammo'}
  56.     options.RestingModes = {'Normal'}
  57.     options.PhysicalDefenseModes = {'PDT'}
  58.     options.MagicalDefenseModes = {'MDT'}
  59.     state.Defense.PhysicalMode = 'PDT'
  60.  
  61.     --------------------------------------
  62.     -- Start defining the sets
  63.     --------------------------------------
  64.    
  65.     -- List of ammunition that should only be used under unlimited shot
  66.     -- Does not currently protect from being lost in multi-hit weapon skills
  67.     U_Shot_Ammo = S{'Aeolus Arrow','Animikii Bullet','Crossbow Bolt'}
  68.    
  69.     -- Simply add a line of DefaultAmmo["Weapon"] = "Ammo Name"
  70.     -- to add another default ammo choice for specific weapon
  71.     DefaultAmmo = {}
  72.     DefaultAmmo["Eminent Gun"] = "Titanium Bullet"
  73.     DefaultAmmo["Echidna's Bow"] = "Tulfaire Arrow"
  74.     DefaultAmmo["Eminent Bow"] = "Tulfaire Arrow"
  75.     DefaultAmmo["Eminent Crossbow"] = "Bloody Bolt"
  76.     DefaultAmmo["Astrild"] = "Ruszor Arrow"
  77.     DefaultAmmo["Gandiva"] = "Tulfaire Arrow"
  78.    
  79.     -- List of all ranged WS that can be fired up to 21 yalms from target
  80.     -- It excludes Cor-only WS, as well as the few short-ranged WS (blast arrow, etc)
  81.     ranged_ws = S{"Flaming Arrow", "Piercing Arrow", "Dulling Arrow", "Sidewinder", "Arching Arrow",
  82.     "Empyreal Arrow", "Refulgent Arrow", "Apex Arrow", "Namas Arrow", "Jishnu's Radiance", "Hot Shot",
  83.     "Split Shot", "Sniper Shot", "Slug Shot", "Heavy Shot", "Detonator", "Last Stand",
  84.     "Coronach", "Trueflight", "Wildfire"}
  85.  
  86.     -- Misc. Job Ability precasts
  87.  
  88.     sets.precast.Step = {ear2="Choreia Earring"}
  89.     sets.precast.JA['Bounty Shot'] = {hands="Sylvan Glovelettes +2"}
  90.     sets.precast.JA['Scavenge'] = {feet="Orion Socks"}
  91.    
  92.     -- Idle Set (my 'base', makes it easier to not repeat re-used items)
  93.     sets.idle = {
  94.         head="Orion Beret",neck="Twilight Torque",ear1="Volley Earring",ear2="Moonshade Earring",
  95.         body="Orion Jerkin +1",hands="Manibozho Gloves",ring1="Dark Ring",ring2="Dark Ring",
  96.         back="Shadow Mantle",waist="Scout's Belt",legs="Nahtirah Trousers",feet="Orion Socks"}
  97.    
  98.     -- Engaged sets
  99.     sets.engaged = set_combine(sets.idle, {
  100.         neck="Asperity Necklace",ear1="Steelflash Earring",ear2="Bladeborn Earring",
  101.         ring1="K'ayres Ring",ring2="Rajas Ring",
  102.         back="Sylvan Chlamys",waist="Hurch'lan Sash"})
  103.     sets.engaged.Acc = set_combine(sets.engaged, {
  104.         neck="Ej Necklace",
  105.         hands="Buremte Gloves"})
  106.     sets.engaged.TP = set_combine(sets.engaged, {
  107.         })
  108.         -- No TP Build currently for engaged, fill as needed
  109.    
  110.     -- Ranged Attack Sets (normal, not WeaponSkills)
  111.     sets.precast.Misc = {}
  112.     sets.midcast.Misc = {}
  113.    
  114.     sets.precast.Misc['Ranged'] = set_combine(sets.idle, {
  115.         head="Sylvan Gapette +2",
  116.         body="Sylvan Caban +2",hands="Iuitl Wristbands",
  117.         pants="Nahtirah Trousers"})
  118.         -- AF3 Head +5, AF3 Body +5 (under velocity shot), Iuitl 10%, Nahtirah 9%
  119.         -- Impulse Belt (3%) Recommended for 3rd "snapshot" item
  120.         -- 5/5 Snapshot Merit gives 10%
  121.         -- One thing to bear in mind, changing body when Camoflauge is on, will drop Camo.
  122.    
  123.     --Commented out for now, Orion Beret +1 will give significant rapid shot increase
  124.     --Which may aid to TP build even if the shot is weaker
  125.     --
  126.     --sets.precast.Misc['Ranged'].TP = set_combine(sets.precast.Misc['Ranged'], {
  127.     --  head="Orion Beret +1"})
  128.    
  129.     sets.midcast.Misc['Ranged'] = set_combine(sets.idle, {
  130.         neck="Ocachi Gorget",
  131.         ring1="K'ayres Ring",ring2="Rajas Ring",
  132.         back="Libeccio Mantle",waist="Scout's Belt"})
  133.     sets.midcast.Misc['Ranged'].Acc = set_combine(sets.midcast.Misc['Ranged'], {
  134.         neck="Ej Necklace",
  135.         hands="Buremte Gloves",ring1="Paqichikaji Ring"})
  136.     sets.midcast.Misc['Ranged'].TP = set_combine(sets.midcast.Misc['Ranged'], {
  137.         head="Scout's Beret +2",
  138.         back="Sylvan Chlamys", ear2="Bladeborn Earring"})
  139.         -- Only the Augmented (Trial 5004) Scout's Beret +2 is recommended
  140.         -- For Extra 5% TP per shot [w/o aug. mainly good for recycle which is already capped]
  141.        
  142.     -- Weaponskill sets
  143.     -- No longer need a list of weaponskills with belts and gorgets
  144.     -- It's handled by gear.ElementalBelt and gear.ElementalGorget
  145.     -- Check UserGlobals.lua for defaults, blank defaults to continue using TP/idle gear
  146.    
  147.     sets.precast.WS = set_combine(sets.midcast.Misc['Ranged'], {
  148.         ear1="Clearview Earring",
  149.         back="Sylvan Chlamys", waist=gear.ElementalBelt, neck=gear.ElementalGorget})
  150.    
  151.     sets.precast.WS.Acc = set_combine(sets.precast.WS, {
  152.         neck="Ej Necklace",
  153.         hands="Buremte Gloves",ring1="Paqichikaji Ring",
  154.         back="Libeccio Mantle"})
  155.    
  156.     -- Resting sets
  157.     sets.resting = {}
  158.    
  159.     -- Defense sets
  160.     sets.defense.PDT = set_combine(sets.idle, {})
  161.     sets.defense.MDT = set_combine(sets.idle, {})
  162.     sets.Kiting = {feet="Fajin Boots"} -- Fajin Boots (+18% Movement) recommended for kiting
  163.    
  164.     -- Barrage Set
  165.     sets.BarrageMid = set_combine(sets.midcast.Misc['Ranged'].Acc, {
  166.         hands="Orion Bracers"})
  167.        
  168.     -- initialize sets Macro to Book 20, Page 1
  169.     -- set_macro_page(1,20)
  170.     binds_on_load()
  171.  
  172.     -- binds Ctrl+- and Ctrl+= to targeting modes
  173.     windower.send_command('bind ^- gs c toggle target')
  174.     windower.send_command('bind ^= gs c cycle targetmode')
  175. end
  176.  
  177. -- Called when this job file is unloaded (eg: job change)
  178. function file_unload()
  179.     --spellcast_binds_on_unload()
  180. end
  181.  
  182. -- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
  183. function job_pretarget(spell, action, spellMap, eventArgs)
  184.  
  185. end
  186.  
  187. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  188. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  189.  
  190. function job_precast(spell, action, spellMap, eventArgs)
  191.     if spell.type:lower() == 'weaponskill' then
  192.         if player.status ~= "Engaged" or player.tp < 100 then
  193.             eventArgs.cancel = true
  194.             return
  195.         end
  196.         if (spell.target.distance >8 and not ranged_ws[spell.name]) or (spell.target.distance >21) then
  197.             -- Cancel Action if distance is too great, saving TP
  198.             add_to_chat(122,"Distance too great for WeaponSkill /Canceling")
  199.             eventArgs.cancel = true
  200.             return
  201.         elseif state.Defense.Active then
  202.             -- Don't gearswap for weaponskills when Defense is on.
  203.             eventArgs.handled = true
  204.         end
  205.     end
  206.    
  207.     if spell.name == "Ranged" or spell.type:lower() == 'weaponskill' then
  208.         -- If ammo is empty, or special ammo being used without buff, replace with default ammo
  209.         if U_Shot_Ammo[player.equipment.ammo] and not buffactive['unlimited shot'] or player.equipment.ammo == 'empty' then
  210.             if DefaultAmmo[player.equipment.range] and player.inventory[DefaultAmmo[player.equipment.range]] then
  211.                 add_to_chat(122,"Unlimited Shot not Active or Ammo Empty, Using Default Ammo")
  212.                 equip({ammo=DefaultAmmo[player.equipment.range]})
  213.             else
  214.                 add_to_chat(122,"Either Defaul Ammo is Unavailable or Unknown Weapon. Staying empty")
  215.                 equip({ammo=empty})
  216.             end
  217.         end
  218.         if not buffactive['unlimited shot'] then
  219.             -- If not empty, and if unlimited shot is not active
  220.             -- Not doing it for unlimited shot to avoid excessive log
  221.             if player.equipment.ammo ~= 'empty' then
  222.                 if player.inventory[player.equipment.ammo].count < 15 then
  223.                     add_to_chat(122,"Ammo '"..player.inventory[player.equipment.ammo].shortname.."' running low ("..player.inventory[player.equipment.ammo].count..")")
  224.                 end
  225.             end
  226.         end
  227.     end
  228. end
  229.  
  230. -- Run after the default precast() is done.
  231. -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
  232. -- This is where you place gear swaps you want in precast but applied on top of the precast sets
  233. function job_post_precast(spell, action, spellMap, eventArgs)
  234.  
  235.     if spell.name == 'Spectral Jig' and buffactive.sneak then
  236.         -- If sneak is active when using, cancel before completion
  237.         send_command('cancel 71')
  238.     end
  239.    
  240.     if buffactive["Camouflage"] then
  241.         -- to avoid interuptions in the Camouflage duration
  242.         equip({body="Orion Jerkin +1"})
  243.     end
  244. end
  245.  
  246. -- Return a customized weaponskill mode to use for weaponskill sets.
  247. -- Don't return anything if you're not overriding the default value.
  248. function get_job_wsmode(spell, action, spellMap)
  249.  
  250. end
  251.  
  252. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  253. -- Midcast actions
  254. function job_midcast(spell, action, spellMap, eventArgs)
  255.  
  256. end
  257.  
  258. -- Run after the default midcast() is done.
  259. -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
  260. function job_post_midcast(spell, action, spellMap, eventArgs)
  261.     if buffactive["Barrage"] then
  262.         equip(sets.BarrageMid)
  263.     end
  264. end
  265.  
  266. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  267. function job_aftercast(spell, action, spellMap, eventArgs)
  268. end
  269.  
  270. -- Run after the default aftercast() is done.
  271. -- eventArgs is the same one used in job_aftercast, in case information needs to be persisted.
  272. function job_post_aftercast(spell, action, spellMap, eventArgs)
  273.  
  274. end
  275.  
  276. -------------------------------------------------------------------------------------------------------------------
  277. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  278. -------------------------------------------------------------------------------------------------------------------
  279.  
  280. -- Called before the Include starts constructing melee/idle/resting sets.
  281. -- Can customize state or custom melee class values at this point.
  282. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  283. function job_handle_equipping_gear(status, eventArgs)
  284.  
  285. end
  286.  
  287. -- Modify the default idle set after it was constructed.
  288. function customize_idle_set(idleSet)
  289.     return idleSet
  290. end
  291.  
  292. -- Modify the default melee set after it was constructed.
  293. function customize_melee_set(meleeSet)
  294.     return meleeSet
  295. end
  296.  
  297. -------------------------------------------------------------------------------------------------------------------
  298. -- General hooks for other events.
  299. -------------------------------------------------------------------------------------------------------------------
  300.  
  301. -- Called when the player's status changes.
  302. function job_status_change(newStatus, oldStatus, eventArgs)
  303.     --handle_equipping_gear(newStatus)
  304. end
  305.  
  306. -- Called when a player gains or loses a buff.
  307. -- buff == buff gained or lost
  308. -- gain == true if the buff was gained, false if it was lost.
  309. function job_buff_change(buff, gain)
  310.  
  311. end
  312.  
  313.  
  314. -------------------------------------------------------------------------------------------------------------------
  315. -- User code that supplements self-commands.
  316. -------------------------------------------------------------------------------------------------------------------
  317.  
  318. -- Called for custom player commands.
  319. function job_self_command(cmdParams, eventArgs)
  320.  
  321. end
  322.  
  323. -- Called by the 'update' self-command, for common needs.
  324. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  325. function job_update(cmdParams, eventArgs)
  326.  
  327. end
  328.  
  329. -- Handle notifications of user state values being changed.
  330. function job_state_change(stateField, newValue)
  331.  
  332. end
  333.  
  334. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  335. function display_current_job_state(eventArgs)
  336.  
  337. end
  338.  
  339. -------------------------------------------------------------------------------------------------------------------
  340. -- Utility functions specific to this job.
  341. -------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement