Kushitap

DNC

Feb 12th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.69 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. --[[
  6.     Custom commands:
  7.    
  8.     gs c step
  9.         Uses the currently configured step on the target, with either <t> or <stnpc> depending on setting.
  10.  
  11.     gs c step t
  12.         Uses the currently configured step on the target, but forces use of <t>.
  13.    
  14.    
  15.     Configuration commands:
  16.    
  17.     gs c cycle mainstep
  18.         Cycles through the available steps to use as the primary step when using one of the above commands.
  19.        
  20.     gs c cycle altstep
  21.         Cycles through the available steps to use for alternating with the configured main step.
  22.        
  23.     gs c toggle usealtstep
  24.         Toggles whether or not to use an alternate step.
  25.        
  26.     gs c toggle selectsteptarget
  27.         Toggles whether or not to use <stnpc> (as opposed to <t>) when using a step.
  28. --]]
  29.  
  30.  
  31. -- Initialization function for this job file.
  32. function get_sets()
  33.     mote_include_version = 2
  34.    
  35.     -- Load and initialize the include file.
  36.     include('Mote-Include.lua')
  37. end
  38.  
  39.  
  40. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  41. function job_setup()
  42.     state.Buff['Climactic Flourish'] = buffactive['climactic flourish'] or false
  43.  
  44.     state.MainStep = M{['description']='Main Step', 'Box Step', 'Quickstep', 'Feather Step', 'Stutter Step'}
  45.     state.AltStep = M{['description']='Alt Step', 'Quickstep', 'Feather Step', 'Stutter Step', 'Box Step'}
  46.     state.UseAltStep = M(false, 'Use Alt Step')
  47.     state.SelectStepTarget = M(false, 'Select Step Target')
  48.     state.IgnoreTargetting = M(false, 'Ignore Targetting')
  49.  
  50.     state.CurrentStep = M{['description']='Current Step', 'Main', 'Alt'}
  51.     state.SkillchainPending = M(false, 'Skillchain Pending')
  52.  
  53.     determine_haste_group()
  54. end
  55.  
  56. -------------------------------------------------------------------------------------------------------------------
  57. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  58. -------------------------------------------------------------------------------------------------------------------
  59.  
  60. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  61. function user_setup()
  62.     state.OffenseMode:options('Normal', 'Acc', 'Eva', 'PDT')
  63.     --state.HybridMode:options('Normal', 'Evasion', 'PDT')
  64.     state.WeaponskillMode:options('Normal', 'Acc')
  65.     state.PhysicalDefenseMode:options('PDT')
  66.     state.MagicalDefenseMode:options('MDT')
  67.  
  68.     -- Additional local binds
  69.     send_command('bind ^= gs c cycle mainstep')
  70.     send_command('bind != gs c cycle altstep')
  71.     send_command('bind ^- gs c toggle selectsteptarget')
  72.     send_command('bind !- gs c toggle usealtstep')
  73.     send_command('bind ^` input /ja "Chocobo Jig" <me>')
  74.     send_command('bind !` input /ja "Chocobo Jig II" <me>')
  75.     send_command('bind !q input /ja "Provoke" <t>;input /ma "Utsusemi: Ichi" <me>')
  76.     send_command('bind !w input /ja "Defender" <me>;input /ma "Utsusemi: Ni" <me>')
  77.     send_command('bind !a input /ja "Berserk" <me>')
  78.     send_command('bind !s input /ja "Warcry" <me>')
  79.     send_command('bind !d input /ja "Aggressor" <me>')
  80.     send_command('bind !z input /ja "Spectral Jig" <me>')
  81.  
  82.     select_default_macro_book()
  83. end
  84.  
  85.  
  86. -- Called when this job file is unloaded (eg: job change)
  87. function user_unload()
  88.     send_command('unbind ^`')
  89.     send_command('unbind !`')
  90.     send_command('unbind ^=')
  91.     send_command('unbind !=')
  92.     send_command('unbind ^-')
  93.     send_command('unbind !-')
  94. end
  95.  
  96.  
  97. -- Define sets and vars used by this job file.
  98. function init_gear_sets()
  99.          include('DNC_gear.lua')
  100. end
  101.  
  102. -------------------------------------------------------------------------------------------------------------------
  103. -- Job-specific hooks for standard casting events.
  104. -------------------------------------------------------------------------------------------------------------------
  105.  
  106. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  107. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  108. function job_precast(spell, action, spellMap, eventArgs)
  109.     --auto_presto(spell)
  110. end
  111.  
  112. function job_post_precast(spell, action, spellMap, eventArgs)
  113.     if spell.type == "WeaponSkill" then
  114.         if state.Buff['Climactic Flourish'] then
  115.             equip(sets.buff['Climactic Flourish'])
  116.         end
  117.         if state.SkillchainPending.value == true then
  118.             equip(sets.precast.Skillchain)
  119.         end
  120.     end
  121.     if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  122.         send_command('@wait 3.3; cancel 66; cancel 444')
  123.     end
  124.     if spell.english == 'Spectral Jig' then
  125.         send_command('cancel 71;')
  126.     end
  127. end
  128.  
  129.  
  130. -- Return true if we handled the aftercast work.  Otherwise it will fall back
  131. -- to the general aftercast() code in Mote-Include.
  132. function job_aftercast(spell, action, spellMap, eventArgs)
  133.     if not spell.interrupted then
  134.         if spell.english == "Wild Flourish" then
  135.             state.SkillchainPending:set()
  136.             send_command('wait 5;gs c unset SkillchainPending')
  137.         elseif spell.type:lower() == "weaponskill" then
  138.             state.SkillchainPending:toggle()
  139.             send_command('wait 6;gs c unset SkillchainPending')
  140.         end
  141.     end
  142. end
  143.  
  144. -------------------------------------------------------------------------------------------------------------------
  145. -- Job-specific hooks for non-casting events.
  146. -------------------------------------------------------------------------------------------------------------------
  147.  
  148. -- Called when a player gains or loses a buff.
  149. -- buff == buff gained or lost
  150. -- gain == true if the buff was gained, false if it was lost.
  151. function job_buff_change(buff,gain)
  152.     -- If we gain or lose any haste buffs, adjust which gear set we target.
  153.     if S{'haste','march','embrava','haste samba'}:contains(buff:lower()) then
  154.         determine_haste_group()
  155.         handle_equipping_gear(player.status)
  156.     elseif buff == 'Saber Dance' or buff == 'Climactic Flourish' then
  157.         handle_equipping_gear(player.status)
  158.     end
  159. end
  160.  
  161.  
  162. function job_status_change(new_status, old_status)
  163.     if new_status == 'Engaged' then
  164.         determine_haste_group()
  165.     end
  166. end
  167.  
  168.  
  169. -------------------------------------------------------------------------------------------------------------------
  170. -- User code that supplements standard library decisions.
  171. -------------------------------------------------------------------------------------------------------------------
  172.  
  173. -- Called by the default 'update' self-command.
  174. function job_update(cmdParams, eventArgs)
  175.     determine_haste_group()
  176. end
  177.  
  178.  
  179. function customize_idle_set(idleSet)
  180.     if player.hpp < 80 and not areas.Cities:contains(world.area) then
  181.         idleSet = set_combine(idleSet, sets.ExtraRegen)
  182.     end
  183.    
  184.     return idleSet
  185. end
  186.  
  187. function customize_melee_set(meleeSet)
  188.     if state.DefenseMode.value ~= 'None' then
  189.         if buffactive['saber dance'] then
  190.             meleeSet = set_combine(meleeSet, sets.buff['Saber Dance'])
  191.         end
  192.         if state.Buff['Climactic Flourish'] then
  193.             meleeSet = set_combine(meleeSet, sets.buff['Climactic Flourish'])
  194.         end
  195.     end
  196.    
  197.     if state.DefenseMode.value ~= "None" and buffactive['Reive Mark'] then
  198.         meleeSet = set_combine(meleeSet, {neck="Adoulin's Refuge +1"})
  199.     end
  200.    
  201.     return meleeSet
  202. end
  203.  
  204. -- Handle auto-targetting based on local setup.
  205. function job_auto_change_target(spell, action, spellMap, eventArgs)
  206.     if spell.type == 'Step' then
  207.         if state.IgnoreTargetting.value == true then
  208.             state.IgnoreTargetting:reset()
  209.             eventArgs.handled = true
  210.         end
  211.        
  212.         eventArgs.SelectNPCTargets = state.SelectStepTarget.value
  213.     end
  214. end
  215.  
  216.  
  217. -- Function to display the current relevant user state when doing an update.
  218. -- Set eventArgs.handled to true if display was handled, and you don't want the default info shown.
  219. function display_current_job_state(eventArgs)
  220.     local msg = 'Melee'
  221.    
  222.     if state.CombatForm.has_value then
  223.         msg = msg .. ' (' .. state.CombatForm.value .. ')'
  224.     end
  225.    
  226.     msg = msg .. ': '
  227.    
  228.     msg = msg .. state.OffenseMode.value
  229.     if state.HybridMode.value ~= 'Normal' then
  230.         msg = msg .. '/' .. state.HybridMode.value
  231.     end
  232.     msg = msg .. ', WS: ' .. state.WeaponskillMode.value
  233.    
  234.     if state.DefenseMode.value ~= 'None' then
  235.         msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
  236.     end
  237.    
  238.     if state.Kiting.value then
  239.         msg = msg .. ', Kiting'
  240.     end
  241.  
  242.     msg = msg .. ', ['..state.MainStep.current
  243.  
  244.     if state.UseAltStep.value == true then
  245.         msg = msg .. '/'..state.AltStep.current
  246.     end
  247.    
  248.     msg = msg .. ']'
  249.  
  250.     if state.SelectStepTarget.value == true then
  251.         steps = steps..' (Targetted)'
  252.     end
  253.  
  254.     add_to_chat(122, msg)
  255.  
  256.     eventArgs.handled = true
  257. end
  258.  
  259.  
  260. -------------------------------------------------------------------------------------------------------------------
  261. -- User self-commands.
  262. -------------------------------------------------------------------------------------------------------------------
  263.  
  264. -- Called for custom player commands.
  265. function job_self_command(cmdParams, eventArgs)
  266.     if cmdParams[1] == 'step' then
  267.         if cmdParams[2] == 't' then
  268.             state.IgnoreTargetting:set()
  269.         end
  270.  
  271.         local doStep = ''
  272.         if state.UseAltStep.value == true then
  273.             doStep = state[state.CurrentStep.current..'Step'].current
  274.             state.CurrentStep:cycle()
  275.         else
  276.             doStep = state.MainStep.current
  277.         end        
  278.        
  279.         send_command('@input /ja "'..doStep..'" <t>')
  280.     end
  281. end
  282.  
  283. -------------------------------------------------------------------------------------------------------------------
  284. -- Utility functions specific to this job.
  285. -------------------------------------------------------------------------------------------------------------------
  286.  
  287. function determine_haste_group()
  288.     -- We have three groups of DW in gear: Charis body, Charis neck + DW earrings, and Patentia Sash.
  289.  
  290.     -- For high haste, we want to be able to drop one of the 10% groups (body, preferably).
  291.     -- High haste buffs:
  292.     -- 2x Marches + Haste
  293.     -- 2x Marches + Haste Samba
  294.     -- 1x March + Haste + Haste Samba
  295.     -- Embrava + any other haste buff
  296.    
  297.     -- For max haste, we probably need to consider dropping all DW gear.
  298.     -- Max haste buffs:
  299.     -- Embrava + Haste/March + Haste Samba
  300.     -- 2x March + Haste + Haste Samba
  301.  
  302.     classes.CustomMeleeGroups:clear()
  303.    
  304.     if buffactive.embrava and (buffactive.haste or buffactive.march) and buffactive['haste samba'] then
  305.         classes.CustomMeleeGroups:append('MaxHaste')
  306.     elseif buffactive.march == 2 and buffactive.haste and buffactive['haste samba'] then
  307.         classes.CustomMeleeGroups:append('MaxHaste')
  308.     elseif buffactive.embrava and (buffactive.haste or buffactive.march or buffactive['haste samba']) then
  309.         classes.CustomMeleeGroups:append('HighHaste')
  310.     elseif buffactive.march == 1 and buffactive.haste and buffactive['haste samba'] then
  311.         classes.CustomMeleeGroups:append('HighHaste')
  312.     elseif buffactive.march == 2 and (buffactive.haste or buffactive['haste samba']) then
  313.         classes.CustomMeleeGroups:append('HighHaste')
  314.     end
  315. end
  316.  
  317.  
  318. -- Automatically use Presto for steps when it's available and we have less than 3 finishing moves
  319. function auto_presto(spell)
  320.     if spell.type == 'Step' then
  321.         local allRecasts = windower.ffxi.get_ability_recasts()
  322.         local prestoCooldown = allRecasts[236]
  323.         local under3FMs = not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']
  324.        
  325.         if player.main_job_level >= 77 and prestoCooldown < 1 and under3FMs then
  326.             cast_delay(1.1)
  327.             send_command('@input /ja "Presto" <me>')
  328.         end
  329.     end
  330. end
  331.  
  332.  
  333. -- Select default macro book on initial load or subjob change.
  334. function select_default_macro_book()
  335.     -- Default macro set/book
  336.     if player.sub_job == 'WAR' then
  337.         set_macro_page(3, 4)
  338.     elseif player.sub_job == 'NIN' then
  339.         set_macro_page(3, 4)
  340.     elseif player.sub_job == 'SAM' then
  341.         set_macro_page(3, 4)
  342.     else
  343.         set_macro_page(3, 4)
  344.     end
  345. end
Add Comment
Please, Sign In to add comment