Guest User

Untitled

a guest
Jun 20th, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.50 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Initialization function that defines sets and variables to be used.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
  6.  
  7. --[[
  8. Custom commands:
  9.  
  10. gs c step
  11. Uses the currently configured step on the target, with either <t> or <stnpc> depending on setting.
  12.  
  13. gs c step t
  14. Uses the currently configured step on the target, but forces use of <t>.
  15.  
  16.  
  17. Configuration commands:
  18.  
  19. gs c cycle mainstep
  20. Cycles through the available steps to use as the primary step when using one of the above commands.
  21.  
  22. gs c cycle altstep
  23. Cycles through the available steps to use for alternating with the configured main step.
  24.  
  25. gs c toggle usealtstep
  26. Toggles whether or not to use an alternate step.
  27.  
  28. gs c toggle selectsteptarget
  29. Toggles whether or not to use <stnpc> (as opposed to <t>) when using a step.
  30. --]]
  31.  
  32.  
  33. -- Initialization function for this job file.
  34. function get_sets()
  35. -- Load and initialize the include file.
  36. include('Mote-Include.lua')
  37. end
  38.  
  39.  
  40. -- Setup vars that are user-independent.
  41. function job_setup()
  42. state.Buff['Climactic Flourish'] = buffactive['climactic flourish'] or false
  43.  
  44. options.StepModes = {'Box Step', 'Quickstep', 'Feather Step', 'Stutter Step'}
  45. state.MainStep = 'Box Step'
  46. state.AltStep = 'Quickstep'
  47. state.CurrentStep = 'Main'
  48. state.UseAltStep = false
  49. state.SelectStepTarget = false
  50. state.IgnoreTargetting = false
  51.  
  52. skillchainPending = false
  53.  
  54. determine_haste_group()
  55. end
  56.  
  57.  
  58. -- Setup vars that are user-dependent. Can override this function in a sidecar file.
  59. function user_setup()
  60. -- Options: Override default values
  61. options.OffenseModes = {'Normal', 'Acc', 'iLvl'}
  62. options.DefenseModes = {'Normal', 'Evasion', 'PDT'}
  63. options.WeaponskillModes = {'Normal', 'Acc', 'Att', 'Mod'}
  64. options.IdleModes = {'Normal'}
  65. options.RestingModes = {'Normal'}
  66. options.PhysicalDefenseModes = {'Evasion', 'PDT'}
  67. options.MagicalDefenseModes = {'MDT'}
  68.  
  69. state.Defense.PhysicalMode = 'Evasion'
  70.  
  71. -- Additional local binds
  72. send_command('bind ^= gs c cycle mainstep')
  73. send_command('bind != gs c cycle altstep')
  74. send_command('bind ^- gs c toggle selectsteptarget')
  75. send_command('bind !- gs c toggle usealtstep')
  76. send_command('bind ^` input /ja "Chocobo Jig" <me>')
  77. send_command('bind !` input /ja "Chocobo Jig II" <me>')
  78.  
  79. select_default_macro_book()
  80. end
  81.  
  82.  
  83. -- Called when this job file is unloaded (eg: job change)
  84. function file_unload()
  85. if binds_on_unload then
  86. binds_on_unload()
  87. end
  88.  
  89. send_command('unbind ^`')
  90. send_command('unbind !`')
  91. send_command('unbind ^=')
  92. send_command('unbind !=')
  93. send_command('unbind ^-')
  94. send_command('unbind !-')
  95. end
  96.  
  97.  
  98. -- Define sets and vars used by this job file.
  99. function init_gear_sets()
  100. --------------------------------------
  101. -- Start defining the sets
  102. --------------------------------------
  103.  
  104. -- Precast Sets
  105.  
  106. -- Precast sets to enhance JAs
  107.  
  108. sets.precast.JA['No Foot Rise'] = {body=""}
  109.  
  110. sets.precast.JA['Trance'] = {head=""}
  111.  
  112.  
  113. -- Waltz set (chr and vit)
  114. sets.precast.Waltz = {ammo="",
  115. head="",ear1="",
  116. body="Maxixi Casaque",hands="Horos Bangles",
  117. back="",waist="",legs="Horos Tights",feet="Maxixi Toe Shoes"}
  118.  
  119. -- Don't need any special gear for Healing Waltz.
  120. sets.precast.Waltz['Healing Waltz'] = {}
  121.  
  122. sets.precast.Samba = {head="Maxixi Tiara"}
  123.  
  124. sets.precast.Jig = {legs="Horos Tights", feet="Maxixi Toe Shoes"}
  125.  
  126. sets.precast.Step = {}
  127. sets.precast.Step['Feather Step'] = {feet="Charis Shoes +2"}
  128.  
  129. sets.precast.Flourish1 = {}
  130. sets.precast.Flourish1['Violent Flourish'] = {body="Horos Casaque"} -- magic accuracy
  131. sets.precast.Flourish1['Desperate Flourish'] = {ammo="Charis Feather",
  132. body="Horos Casaque",hands="",ring1="",back="",waist="",legs="",feet=""} -- acc gear
  133.  
  134. sets.precast.Flourish2 = {}
  135. sets.precast.Flourish2['Reverse Flourish'] = {hands="Charis Bangles +2"}
  136.  
  137. sets.precast.Flourish3 = {}
  138. sets.precast.Flourish3['Striking Flourish'] = {body="Charis Casaque +2"}
  139. sets.precast.Flourish3['Climactic Flourish'] = {head="Charis Tiara +2"}
  140.  
  141.  
  142. -- Weaponskill sets
  143. -- Default set for any weaponskill that isn't any more specifically defined
  144. sets.precast.WS = {ammo="Mantis Eye",head="Chocaliztli Mask",neck=gear.ElementalGorget,ear1="Heartseeker Earring",ear2="Dudgeon Earring",body="Qaaxo Harness",hands="Thurandaut Gloves",ring1="Rajas Ring",ring2="Dumakulem's Ring",back="Atheling Mantle",waist=gear.ElementalBelt,legs="Quiahuiz Trousers",feet="Manibozho Boots"}
  145. sets.precast.WS.Acc = set_combine(sets.precast.WS, {ammo="", back=""})
  146.  
  147. gear.default.weaponskill_neck = "Asperity Necklace"
  148. gear.default.weaponskill_waist = "Celt Belt"
  149.  
  150. -- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found.
  151. sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {neck="",hands="",
  152. ring1="",waist="",legs=""})
  153. sets.precast.WS['Exenterator'].Acc = set_combine(sets.precast.WS['Exenterator'], {ammo="", back=""})
  154. sets.precast.WS['Exenterator'].Mod = set_combine(sets.precast.WS['Exenterator'], {body="",waist=gear.ElementalBelt})
  155.  
  156. sets.precast.WS['Pyrrhic Kleos'] = set_combine(sets.precast.WS, {hands=""})
  157. sets.precast.WS['Pyrrhic Kleos'].Acc = set_combine(sets.precast.WS.Acc, {hands=""})
  158.  
  159. sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS, {ammo="Charis Feather",neck="Breeze Gorget",waist=""})
  160. sets.precast.WS['Evisceration'].Acc = set_combine(sets.precast.WS['Evisceration'], {ammo="", back=""})
  161. sets.precast.WS['Evisceration'].Mod = set_combine(sets.precast.WS['Evisceration'], {body="Qaaxo Harness",waist=gear.ElementalBelt})
  162.  
  163. sets.precast.WS["Rudra's Storm"] = set_combine(sets.precast.WS, {ammo="Charis Feather",ear1="Brutal Earring",ear2=""})
  164. sets.precast.WS["Rudra's Storm"].Acc = set_combine(sets.precast.WS["Rudra's Storm"], {ammo="", back=""})
  165.  
  166. sets.precast.WS['Aeolian Edge'] = {ammo="Charis Feather",
  167. head="Thaumas Hat",neck="",ear1="",ear2="",body="Qaaxo Harness",hands="",ring1="Rajas Ring",ring2="",
  168. back="",waist=gear.ElementalBelt,legs="",feet=""}
  169.  
  170. sets.precast.Skillchain = {hands="Charis Bangles +2"}
  171.  
  172.  
  173. -- Midcast Sets
  174.  
  175. sets.midcast.FastRecast = {
  176. head="",ear2="",
  177. body="",hands="",
  178. legs="",feet=""}
  179.  
  180. -- Specific spells
  181. sets.midcast.Utsusemi = {
  182. head="",neck="",ear2="",
  183. body="",hands="",ring1="",
  184. back="",legs="",feet=""}
  185.  
  186.  
  187. -- Sets to return to when not performing an action.
  188.  
  189. -- Resting sets
  190. sets.resting = {head="Umbani cap",neck="Charis Neecklace",
  191. ring1=" K'ayres Ring",ring2="Dumakulem's Ring"}
  192. sets.ExtraRegen = {head=""}
  193.  
  194.  
  195. -- Idle sets
  196.  
  197. sets.idle = {ammo="Mantis Eye",
  198. head="Umbani Cap",neck="",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  199. body="Qaaxo Harness",hands="Horos Bangles",ring1="K'ayres Ring",ring2="Dumakulem's Ring",
  200. back="Athling Mantle",waist="Celt Belt",legs="Maxixi Tights",feet="Horos Toe Shoes"}
  201.  
  202. sets.idle.Town = {main="Izhiikoh", sub="Sabebus",ammo="Charis Feather",
  203. head="Umbani Cap",neck="",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  204. body="Qaaxo Harness",hands="Horos Bangles",ring1="Matrimony Ring",ring2="Dumakulem's Ring",
  205. back="Athling Mantle",waist="Celt Belt",legs="Maxixi Tights",feet="Horos Toe Shoes"}
  206.  
  207.  
  208. sets.idle.Weak = {ammo="Mantis Eye",
  209. head="Umbani Cap",neck="",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  210. body="Qaaxo Harness",hands="Horos Bangles",ring1="K'ayres Ring",ring2="Dumakulem's Ring",
  211. back="Athling Mantle",waist="Celt Belt",legs="Maxixi Tights",feet="Horos Toe Shoes"}
  212.  
  213. -- Defense sets
  214.  
  215. sets.defense.Evasion = {
  216. head="Chocaliztli Mask",neck="Charis Necklace",
  217. body="Qaaxo Harnes",hands="Horos Bangles",ring1="",ring2="",
  218. back="",waist="",legs="Quiahuiz Trousers",feet="Manibozho Boots"}
  219.  
  220. sets.defense.PDT = {ammo="",
  221. head="",neck="",body="",hands="",ring1="",ring2="",back="",waist="",legs="",feet=""}
  222.  
  223. sets.defense.MDT = {ammo="",
  224. head="Umbani Cap",neck="",
  225. body="Qaaxo Harness",hands="Horos Bangles",ring1="",ring2="",
  226. back="",waist="",legs="Quiahuiz Trousers",feet="Horos Toe Shoes"}
  227.  
  228. sets.Kiting = {feet="Tandava Crackows"}
  229.  
  230. -- Engaged sets
  231.  
  232. -- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
  233. sets.buff['Saber Dance'] = {legs="Horos Tights"}
  234. sets.buff['Climactic Flourish'] = {head="Charis Tiara +2"}
  235. end
  236.  
  237.  
  238. -------------------------------------------------------------------------------------------------------------------
  239. -- Job-specific hooks that are called to process player actions at specific points in time.
  240. -------------------------------------------------------------------------------------------------------------------
  241.  
  242. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  243. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  244. function job_precast(spell, action, spellMap, eventArgs)
  245. --auto_presto(spell)
  246. cancel_conflicting_buffs(spell, action, spellMap, eventArgs)
  247.  
  248. if spell.type == 'Waltz' and not eventArgs.cancel then
  249. refine_waltz(spell, action, spellMap, eventArgs)
  250. end
  251. end
  252.  
  253.  
  254. function job_post_precast(spell, action, spellMap, eventArgs)
  255. if spell.type:lower() == "weaponskill" then
  256. if state.Buff['Climactic Flourish'] then
  257. equip(sets.buff['Climactic Flourish'])
  258. end
  259. if skillchainPending then
  260. equip(sets.precast.Skillchain)
  261. end
  262. end
  263. end
  264.  
  265.  
  266. -- Return true if we handled the aftercast work. Otherwise it will fall back
  267. -- to the general aftercast() code in Mote-Include.
  268. function job_aftercast(spell, action, spellMap, eventArgs)
  269. if not spell.interrupted then
  270. if state.Buff[spell.english] ~= nil then
  271. state.Buff[spell.english] = true
  272. end
  273. if spell.english == "Wild Flourish" then
  274. skillchainPending = true
  275. send_command('wait 5;gs c clear skillchainPending')
  276. elseif spell.type:lower() == "weaponskill" then
  277. skillchainPending = not skillchainPending
  278. send_command('wait 5;gs c clear skillchainPending')
  279. end
  280. end
  281. end
  282.  
  283.  
  284. -------------------------------------------------------------------------------------------------------------------
  285. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  286. -------------------------------------------------------------------------------------------------------------------
  287.  
  288. function customize_idle_set(idleSet)
  289. if player.hpp < 80 and not areas.Cities:contains(world.area) then
  290. idleSet = set_combine(idleSet, sets.ExtraRegen)
  291. end
  292.  
  293. return idleSet
  294. end
  295.  
  296.  
  297. function customize_melee_set(meleeSet)
  298. if not state.Defense.Active then
  299. if buffactive['saber dance'] then
  300. meleeSet = set_combine(meleeSet, sets.buff['Saber Dance'])
  301. end
  302. if state.Buff['Climactic Flourish'] then
  303. meleeSet = set_combine(meleeSet, sets.buff['Climactic Flourish'])
  304. end
  305. end
  306.  
  307. return meleeSet
  308. end
  309.  
  310. -------------------------------------------------------------------------------------------------------------------
  311. -- General hooks for other game events.
  312. -------------------------------------------------------------------------------------------------------------------
  313.  
  314. -- Called when a player gains or loses a buff.
  315. -- buff == buff gained or lost
  316. -- gain == true if the buff was gained, false if it was lost.
  317. function job_buff_change(buff,gain)
  318. if state.Buff[buff] ~= nil then
  319. state.Buff[buff] = gain
  320. end
  321.  
  322. -- If we gain or lose any haste buffs, adjust which gear set we target.
  323. if S{'haste','march','embrava','haste samba'}:contains(buff:lower()) then
  324. determine_haste_group()
  325. handle_equipping_gear(player.status)
  326. elseif buff == 'Saber Dance' or buff == 'Climactic Flourish' then
  327. handle_equipping_gear(player.status)
  328. end
  329. end
  330.  
  331.  
  332. -------------------------------------------------------------------------------------------------------------------
  333. -- User code that supplements self-commands.
  334. -------------------------------------------------------------------------------------------------------------------
  335.  
  336. -- Called for custom player commands.
  337. function job_self_command(cmdParams, eventArgs)
  338. if cmdParams[1] == 'clear' and cmdParams[2] and cmdParams[2]:lower() == 'skillchainpending' then
  339. skillchainPending = false
  340. elseif cmdParams[1] == 'step' then
  341. if cmdParams[2] == 't' then
  342. state.IgnoreTargetting = true
  343. end
  344.  
  345. local doStep = state.MainStep
  346. if state.UseAltStep then
  347. doStep = state[state.CurrentStep..'Step']
  348. if state.CurrentStep == 'Main' then
  349. state.CurrentStep = 'Alt'
  350. else
  351. state.CurrentStep = 'Main'
  352. end
  353. end
  354.  
  355. send_command('@input /ja "'..doStep..'" <t>')
  356. end
  357. end
  358.  
  359.  
  360. -- Called by the default 'update' self-command.
  361. function job_update(cmdParams, eventArgs)
  362. determine_haste_group()
  363. end
  364.  
  365. -- Hooks for step mode handling.
  366.  
  367. -- Job-specific toggles.
  368. function job_toggle(field)
  369. if field:lower() == 'selectsteptarget' then
  370. state.SelectStepTarget = not state.SelectStepTarget
  371. return "Select Step Target", state.SelectStepTarget
  372. elseif field:lower() == 'usealtstep' then
  373. state.UseAltStep = not state.UseAltStep
  374. return "Use Alt Step", state.UseAltStep
  375. end
  376. end
  377.  
  378. -- Request job-specific mode tables.
  379. -- Return the list, and the current value for the requested field.
  380. function job_get_option_modes(field)
  381. if field == 'Mainstep' then
  382. return options.StepModes, state.MainStep
  383. elseif field == 'Altstep' then
  384. return options.StepModes, state.AltStep
  385. end
  386. end
  387.  
  388. -- Set job-specific mode values.
  389. -- Return true if we recognize and set the requested field.
  390. function job_set_option_mode(field, val)
  391. if field == 'Mainstep' then
  392. state.MainStep = val
  393. return true
  394. elseif field == 'Altstep' then
  395. state.AltStep = val
  396. return true
  397. end
  398. end
  399.  
  400. -- Handle auto-targetting based on local setup.
  401. function job_auto_change_target(spell, action, spellMap, eventArgs)
  402. if spell.type == 'Step' then
  403. if state.IgnoreTargetting then
  404. state.IgnoreTargetting = false
  405. eventArgs.handled = true
  406. end
  407.  
  408. eventArgs.SelectNPCTargets = state.SelectStepTarget
  409. end
  410. end
  411.  
  412.  
  413. -- Function to display the current relevant user state when doing an update.
  414. -- Set eventArgs.handled to true if display was handled, and you don't want the default info shown.
  415. function display_current_job_state(eventArgs)
  416. local defenseString = ''
  417. if state.Defense.Active then
  418. local defMode = state.Defense.PhysicalMode
  419. if state.Defense.Type == 'Magical' then
  420. defMode = state.Defense.MagicalMode
  421. end
  422.  
  423. defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
  424. end
  425.  
  426. local steps = ''
  427. if state.UseAltStep then
  428. steps = ', ['..state.MainStep..'/'..state.AltStep..']'
  429. else
  430. steps = ', ['..state.MainStep..']'
  431. end
  432.  
  433. if state.SelectStepTarget then
  434. steps = steps..' (Targetted)'
  435. end
  436.  
  437.  
  438. add_to_chat(122,'Melee: '..state.OffenseMode..'/'..state.DefenseMode..', WS: '..state.WeaponskillMode..', '..defenseString..
  439. 'Kiting: '..on_off_names[state.Kiting]..steps)
  440.  
  441. eventArgs.handled = true
  442. end
  443.  
  444.  
  445. -------------------------------------------------------------------------------------------------------------------
  446. -- Utility functions specific to this job.
  447. -------------------------------------------------------------------------------------------------------------------
  448.  
  449. function determine_haste_group()
  450. -- We have three groups of DW in gear: Charis body, Charis neck + DW earrings, and Patentia Sash.
  451.  
  452. -- For high haste, we want to be able to drop one of the 10% groups (body, preferably).
  453. -- High haste buffs:
  454. -- 2x Marches + Haste
  455. -- 2x Marches + Haste Samba
  456. -- 1x March + Haste + Haste Samba
  457. -- Embrava + any other haste buff
  458.  
  459. -- For max haste, we probably need to consider dropping all DW gear.
  460. -- Max haste buffs:
  461. -- Embrava + Haste/March + Haste Samba
  462. -- 2x March + Haste + Haste Samba
  463.  
  464. classes.CustomMeleeGroups:clear()
  465.  
  466. if buffactive.embrava and (buffactive.haste or buffactive.march) and buffactive['haste samba'] then
  467. classes.CustomMeleeGroups:append('MaxHaste')
  468. elseif buffactive.march == 2 and buffactive.haste and buffactive['haste samba'] then
  469. classes.CustomMeleeGroups:append('MaxHaste')
  470. elseif buffactive.embrava and (buffactive.haste or buffactive.march or buffactive['haste samba']) then
  471. classes.CustomMeleeGroups:append('HighHaste')
  472. elseif buffactive.march == 1 and buffactive.haste and buffactive['haste samba'] then
  473. classes.CustomMeleeGroups:append('HighHaste')
  474. elseif buffactive.march == 2 and (buffactive.haste or buffactive['haste samba']) then
  475. classes.CustomMeleeGroups:append('HighHaste')
  476. end
  477. end
  478.  
  479.  
  480. -- Automatically use Presto for steps when it's available and we have less than 3 finishing moves
  481. function auto_presto(spell)
  482. if spell.type == 'Step' then
  483. local allRecasts = windower.ffxi.get_ability_recasts()
  484. local prestoCooldown = allRecasts[236]
  485. local under3FMs = not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5']
  486.  
  487. if player.main_job_level >= 77 and prestoCooldown < 1 and under3FMs then
  488. cast_delay(1.1)
  489. send_command('@input /ja "Presto" <me>')
  490. end
  491. end
  492. end
  493.  
  494.  
  495. -- Select default macro book on initial load or subjob change.
  496. function select_default_macro_book()
  497. -- Default macro set/book
  498. if player.sub_job == 'WAR' then
  499. set_macro_page(1, 3)
  500. elseif player.sub_job == 'NIN' then
  501. set_macro_page(1, 3)
  502. elseif player.sub_job == 'SAM' then
  503. set_macro_page(1, 3)
  504. else
  505. set_macro_page(1, 3)
  506. end
  507. end
Advertisement
Add Comment
Please, Sign In to add comment