Advertisement
Dakpluto

gearswap-dnc

Dec 2nd, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.87 KB | None | 0 0
  1. --[[
  2.     Custom commands:
  3.    
  4.     gs c step
  5.         Uses the currently configured step on the target, with either <t> or <stnpc> depending on setting.
  6.  
  7.     gs c step t
  8.         Uses the currently configured step on the target, but forces use of <t>.
  9.    
  10.    
  11.     Configuration commands:
  12.    
  13.     gs c cycle mainstep
  14.         Cycles through the available steps to use as the primary step when using one of the above commands.
  15.        
  16.     gs c cycle altstep
  17.         Cycles through the available steps to use for alternating with the configured main step.
  18.        
  19.     gs c toggle usealtstep
  20.         Toggles whether or not to use an alternate step.
  21.        
  22.     gs c toggle selectsteptarget
  23.         Toggles whether or not to use <stnpc> (as opposed to <t>) when using a step.
  24. --]]
  25.  
  26.  
  27. -- Initialization function for this job file.
  28. function get_sets()
  29.     mote_include_version = 2
  30.    
  31.     -- Load and initialize the include file.
  32.     include('Mote-Include.lua')
  33. end
  34.  
  35.  
  36. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  37. function job_setup()
  38.     state.Buff['Climactic Flourish'] = buffactive['climactic flourish'] or false
  39.  
  40.     state.MainStep = M{['description']='Main Step', 'Box Step', 'Quickstep', 'Feather Step', 'Stutter Step'}
  41.     state.AltStep = M{['description']='Alt Step', 'Quickstep', 'Feather Step', 'Stutter Step', 'Box Step'}
  42.     state.UseAltStep = M(false, 'Use Alt Step')
  43.     state.SelectStepTarget = M(false, 'Select Step Target')
  44.     state.IgnoreTargetting = M(false, 'Ignore Targetting')
  45.  
  46.     state.CurrentStep = M{['description']='Current Step', 'Main', 'Alt'}
  47.     state.SkillchainPending = M(false, 'Skillchain Pending')
  48.  
  49.     determine_haste_group()
  50. end
  51.  
  52. -------------------------------------------------------------------------------------------------------------------
  53. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  54. -------------------------------------------------------------------------------------------------------------------
  55.  
  56. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  57. function user_setup()
  58.     -- Additional local binds
  59.     send_command('bind ^= gs c cycle mainstep')
  60.     send_command('bind != gs c cycle altstep')
  61.     send_command('bind ^- gs c toggle selectsteptarget')
  62.     send_command('bind !- gs c toggle usealtstep')
  63.     send_command('bind ^` input /ja "Chocobo Jig" <me>')
  64.     send_command('bind !` input /ja "Chocobo Jig II" <me>')
  65.  
  66.     select_default_macro_book()
  67. end
  68.  
  69.  
  70. -- Called when this job file is unloaded (eg: job change)
  71. function user_unload()
  72.     send_command('unbind ^`')
  73.     send_command('unbind !`')
  74.     send_command('unbind ^=')
  75.     send_command('unbind !=')
  76.     send_command('unbind ^-')
  77.     send_command('unbind !-')
  78. end
  79.  
  80.  
  81. -- Define sets and vars used by this job file.
  82. function init_gear_sets()
  83.     sets.precast.Waltz = {head="Etoile tiara",
  84.     body = "Dancer's Casaque",
  85.     ring1 = "Valseur's Ring"}
  86.    
  87.     sets.precast.Samba = {head = "Dancer's Tiara"}
  88.    
  89.     sets.precast.Jig = {feet = "Dancer's Toe Shoes"}
  90.    
  91.     sets.precast.Step = {feet = "Etoile toe shoes +2",back = "Belenos' mantle",waist = "Anguinus belt"}
  92.    
  93.     sets.precast.Flourish1 = {}
  94.     sets.precast.Flourish1['Violent Flourish'] = {} -- magic accuracy
  95.     sets.precast.Flourish1['Desperate Flourish'] = {back = "Belenos' mantle",waist = "Anguinus belt"} -- acc gear
  96.  
  97.     sets.precast.Flourish2 = {}
  98.     sets.precast.Flourish2['Reverse Flourish'] = {}
  99.  
  100.     sets.precast.Flourish3 = {}
  101.     sets.precast.Flourish3['Striking Flourish'] = {}
  102.     sets.precast.Flourish3['Climactic Flourish'] = {}
  103.    
  104.     sets.precast.WS = {ammo="Potestas Bomblet",
  105.         neck="Dancer's Torque",
  106.         waist = "Anguinus belt",
  107.         ear2="Brutal Earring",
  108.         ring1="Rajas ring",
  109.         back="Nifty mantle"}
  110.        
  111.     sets.precast.Skillchain = {}
  112.    
  113.      -- Midcast Sets
  114.    
  115.     sets.midcast.FastRecast = {}
  116.        
  117.     -- Specific spells
  118.     sets.midcast.Utsusemi = {}
  119.    
  120.     -- Resting sets
  121.     sets.resting = {}
  122.     sets.ExtraRegen = {}
  123.    
  124.     sets.idle = {ammo="Charis feather",
  125.         head="Espial cap",
  126.         neck="Charis necklace",
  127.         ear1="Infused Earring",
  128.         ear2="Brutal Earring",
  129.         body="Espial gambison",
  130.         hands="Espial bracers",
  131.         ring1="Rajas Ring",
  132.         ring2="Enlivened Ring",
  133.         back="Belenos' Mantle",
  134.         waist="Velocious Belt",
  135.         legs="Espial hose",
  136.         feet="Espial socks"}
  137.        
  138.     sets.idle.Town = set_combine(sets.idle, {})
  139.    
  140.     sets.idle.Weak = set_combine(sets.idle, {})
  141.    
  142.     sets.defense = set_combine(sets.idle, {})
  143.    
  144.     sets.Kiting = set_combine(sets.defense, {})
  145.    
  146.     sets.engaged = {ammo="Charis feather",
  147.         head="Espial cap",
  148.         neck="Charis necklace",
  149.         ear1="Infused Earring",
  150.         ear2="Brutal Earring",
  151.         body="Espial gambison",
  152.         hands="Espial bracers",
  153.         ring1="Rajas Ring",
  154.         ring2="Enlivened Ring",
  155.         back="Belenos' Mantle",
  156.         waist="Velocious Belt",
  157.         legs="Espial hose",
  158.         feet="Espial socks"}
  159.        
  160.     sets.engaged.HighHaste = set_combine(sets.engaged, {})
  161.    
  162.     sets.engaged.MaxHaste = set_combine(sets.engaged, {})
  163.    
  164.     sets.buff['Saber Dance'] = {}
  165.     sets.buff['Climactic Flourish'] = {}
  166. end
  167.  
  168. function job_post_precast(spell, action, spellMap, eventArgs)
  169.     if spell.type == "WeaponSkill" then
  170.         if state.Buff['Climactic Flourish'] then
  171.             equip(sets.buff['Climactic Flourish'])
  172.         end
  173.         if state.SkillchainPending.value == true then
  174.             equip(sets.precast.Skillchain)
  175.         end
  176.     end
  177. end
  178.  
  179. function job_aftercast(spell, action, spellMap, eventArgs)
  180.     if not spell.interrupted then
  181.         if spell.english == "Wild Flourish" then
  182.             state.SkillchainPending:set()
  183.             send_command('wait 5;gs c unset SkillchainPending')
  184.         elseif spell.type:lower() == "weaponskill" then
  185.             state.SkillchainPending:toggle()
  186.             send_command('wait 6;gs c unset SkillchainPending')
  187.         end
  188.     end
  189. end
  190.  
  191. function job_buff_change(buff,gain)
  192.     -- If we gain or lose any haste buffs, adjust which gear set we target.
  193.     if S{'haste','march','embrava','haste samba'}:contains(buff:lower()) then
  194.         determine_haste_group()
  195.         handle_equipping_gear(player.status)
  196.     elseif buff == 'Saber Dance' or buff == 'Climactic Flourish' then
  197.         handle_equipping_gear(player.status)
  198.     end
  199. end
  200.  
  201. function job_status_change(new_status, old_status)
  202.     if new_status == 'Engaged' then
  203.         determine_haste_group()
  204.     end
  205. end
  206.  
  207. -------------------------------------------------------------------------------------------------------------------
  208. -- User code that supplements standard library decisions.
  209. -------------------------------------------------------------------------------------------------------------------
  210.  
  211. -- Called by the default 'update' self-command.
  212. function job_update(cmdParams, eventArgs)
  213.     determine_haste_group()
  214. end
  215.  
  216.  
  217. function customize_idle_set(idleSet)
  218.     if player.hpp < 80 and not areas.Cities:contains(world.area) then
  219.         idleSet = set_combine(idleSet, sets.ExtraRegen)
  220.     end
  221.    
  222.     return idleSet
  223. end
  224.  
  225. function customize_melee_set(meleeSet)
  226.     if state.DefenseMode.value ~= 'None' then
  227.         if buffactive['saber dance'] then
  228.             meleeSet = set_combine(meleeSet, sets.buff['Saber Dance'])
  229.         end
  230.         if state.Buff['Climactic Flourish'] then
  231.             meleeSet = set_combine(meleeSet, sets.buff['Climactic Flourish'])
  232.         end
  233.     end
  234.    
  235.     return meleeSet
  236. end
  237.  
  238. -- Handle auto-targetting based on local setup.
  239. function job_auto_change_target(spell, action, spellMap, eventArgs)
  240.     if spell.type == 'Step' then
  241.         if state.IgnoreTargetting.value == true then
  242.             state.IgnoreTargetting:reset()
  243.             eventArgs.handled = true
  244.         end
  245.        
  246.         eventArgs.SelectNPCTargets = state.SelectStepTarget.value
  247.     end
  248. end
  249.  
  250. -- Called for custom player commands.
  251. function job_self_command(cmdParams, eventArgs)
  252.     if cmdParams[1] == 'step' then
  253.         if cmdParams[2] == 't' then
  254.             state.IgnoreTargetting:set()
  255.         end
  256.  
  257.         local doStep = ''
  258.         if state.UseAltStep.value == true then
  259.             doStep = state[state.CurrentStep.current..'Step'].current
  260.             state.CurrentStep:cycle()
  261.         else
  262.             doStep = state.MainStep.current
  263.         end        
  264.        
  265.         send_command('@input /ja "'..doStep..'" <t>')
  266.     end
  267. end
  268.  
  269. function determine_haste_group()
  270.     -- We have three groups of DW in gear: Charis body, Charis neck + DW earrings, and Patentia Sash.
  271.  
  272.     -- For high haste, we want to be able to drop one of the 10% groups (body, preferably).
  273.     -- High haste buffs:
  274.     -- 2x Marches + Haste
  275.     -- 2x Marches + Haste Samba
  276.     -- 1x March + Haste + Haste Samba
  277.     -- Embrava + any other haste buff
  278.    
  279.     -- For max haste, we probably need to consider dropping all DW gear.
  280.     -- Max haste buffs:
  281.     -- Embrava + Haste/March + Haste Samba
  282.     -- 2x March + Haste + Haste Samba
  283.  
  284.     classes.CustomMeleeGroups:clear()
  285.    
  286.     if buffactive.embrava and (buffactive.haste or buffactive.march) and buffactive['haste samba'] then
  287.         classes.CustomMeleeGroups:append('MaxHaste')
  288.     elseif buffactive.march == 2 and buffactive.haste and buffactive['haste samba'] then
  289.         classes.CustomMeleeGroups:append('MaxHaste')
  290.     elseif buffactive.embrava and (buffactive.haste or buffactive.march or buffactive['haste samba']) then
  291.         classes.CustomMeleeGroups:append('HighHaste')
  292.     elseif buffactive.march == 1 and buffactive.haste and buffactive['haste samba'] then
  293.         classes.CustomMeleeGroups:append('HighHaste')
  294.     elseif buffactive.march == 2 and (buffactive.haste or buffactive['haste samba']) then
  295.         classes.CustomMeleeGroups:append('HighHaste')
  296.     end
  297. end
  298.  
  299. -- Automatically use Presto for steps when it's available and we have less than 3 finishing moves
  300. function job_pretarget(spell, action, spellMap, eventArgs)
  301.     if spell.type == 'Step' then
  302.         local allRecasts = windower.ffxi.get_ability_recasts()
  303.         local prestoCooldown = allRecasts[236]
  304.         local under3FMs = not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']
  305.          
  306.         if player.main_job_level >= 77 and prestoCooldown < 1 and under3FMs then
  307.             cast_delay(1.1)
  308.             send_command('input /ja "Presto" <me>')
  309.         end
  310.     end
  311. end
  312.  
  313. -- Select default macro book on initial load or subjob change.
  314. function select_default_macro_book()
  315.     -- Default macro set/book
  316.     if player.sub_job == 'WAR' then
  317.         set_macro_page(2, 19)
  318.     elseif player.sub_job == 'NIN' then
  319.         set_macro_page(4, 19)
  320.     elseif player.sub_job == 'SAM' then
  321.         set_macro_page(3, 19)
  322.     elseif player.sub_job == 'THF' then
  323.         set_macro_page(1, 19)
  324.     else
  325.         set_macro_page(5, 19)
  326.     end
  327. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement