Advertisement
Guest User

Untitled

a guest
Jul 8th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.32 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job. Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. --[[
  6. Custom commands:
  7.  
  8. Shorthand versions for each strategem type that uses the version appropriate for
  9. the current Arts.
  10.  
  11. Light Arts Dark Arts
  12.  
  13. gs c scholar light Light Arts/Addendum
  14. gs c scholar dark Dark Arts/Addendum
  15. gs c scholar cost Penury Parsimony
  16. gs c scholar speed Celerity Alacrity
  17. gs c scholar aoe Accession Manifestation
  18. gs c scholar power Rapture Ebullience
  19. gs c scholar duration Perpetuance
  20. gs c scholar accuracy Altruism Focalization
  21. gs c scholar enmity Tranquility Equanimity
  22. gs c scholar skillchain Immanence
  23. gs c scholar addendum Addendum: White Addendum: Black
  24. --]]
  25.  
  26.  
  27.  
  28. -- Initialization function for this job file.
  29. function get_sets()
  30. mote_include_version = 2
  31.  
  32. -- Load and initialize the include file.
  33. include('Mote-Include.lua')
  34. end
  35.  
  36. -- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
  37. function job_setup()
  38. info.addendumNukes = S{"Stone IV", "Water IV", "Aero IV", "Fire IV", "Blizzard IV", "Thunder IV",
  39. "Stone V", "Water V", "Aero V", "Fire V", "Blizzard V", "Thunder V"}
  40.  
  41. state.Buff['Sublimation: Activated'] = buffactive['Sublimation: Activated'] or false
  42. update_active_strategems()
  43. end
  44.  
  45. -------------------------------------------------------------------------------------------------------------------
  46. -- User setup functions for this job. Recommend that these be overridden in a sidecar file.
  47. -------------------------------------------------------------------------------------------------------------------
  48.  
  49. -- Setup vars that are user-dependent. Can override this function in a sidecar file.
  50. function user_setup()
  51. state.OffenseMode:options('None', 'Normal')
  52. state.CastingMode:options('Normal', 'Resistant')
  53. state.IdleMode:options('Normal', 'PDT')
  54.  
  55.  
  56. info.low_nukes = S{"Stone", "Water", "Aero", "Fire", "Blizzard", "Thunder"}
  57. info.mid_nukes = S{"Stone II", "Water II", "Aero II", "Fire II", "Blizzard II", "Thunder II",
  58. "Stone III", "Water III", "Aero III", "Fire III", "Blizzard III", "Thunder III",
  59. "Stone IV", "Water IV", "Aero IV", "Fire IV", "Blizzard IV", "Thunder IV",}
  60. info.high_nukes = S{"Stone V", "Water V", "Aero V", "Fire V", "Blizzard V", "Thunder V"}
  61.  
  62. gear.macc_hagondes = {name="Hagondes Cuffs", augments={'Phys. dmg. taken -3%','Mag. Acc.+29'}}
  63.  
  64. send_command('bind ^` input /ma Stun <t>')
  65.  
  66. select_default_macro_book()
  67. end
  68.  
  69. function user_unload()
  70. send_command('unbind ^`')
  71. end
  72.  
  73.  
  74. -- Define sets and vars used by this job file.
  75. function init_gear_sets()
  76. --------------------------------------
  77. -- Start defining the sets
  78. --------------------------------------
  79.  
  80. -- Precast Sets
  81.  
  82. -- Precast sets to enhance JAs
  83.  
  84. sets.precast.JA['Tabula Rasa'] = {legs="Pedagogy Pants"}
  85.  
  86.  
  87. -- Fast cast sets for spells
  88.  
  89. sets.precast.FC = {ear2="Loquacious Earring"}
  90.  
  91. sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {hands="Carapacho Cuffs", body="Weather. Robe+1", main="Eminent Staff"})
  92.  
  93. sets.precast.FC['Elemental Magic'] = set_combine(sets.precast.FC, {head="Buremte hat", neck="Stoicheion Medal", body="literae coat",
  94. ear1="Hecate's earring", ear2="moldavite earring", ring1="shiva ring", ring2="shiva ring", waist="Salire belt",
  95. hands="Weather. cuffs+1", feet="Weather. souliers +1"})
  96.  
  97. sets.precast.FC.Cure = set_combine(sets.precast.FC, {main="Tamaxchi", waist="Bishop's sash",
  98. ring1="Sirona's Ring", ring2="Kunaji ring"})
  99.  
  100. sets.precast.FC.Curaga = sets.precast.FC.Cure
  101.  
  102. sets.precast.FC.Impact = set_combine(sets.precast.FC['Elemental Magic'], {head=empty,body="Twilight Cloak"})
  103.  
  104.  
  105. -- Midcast Sets
  106.  
  107. sets.midcast.FastRecast = {ear2="Loquacious Earring"}
  108.  
  109. sets.midcast.Cure = {main="Tamaxchi", waist="Bishop's sash",
  110. ring1="Sirona's Ring", ring2="Kunaji ring"}
  111.  
  112. sets.midcast.CureWithLightWeather = {main="Tamaxchi", waist="Bishop's sash",
  113. ring1="Sirona's Ring", ring2="Kunaji ring"}
  114.  
  115. sets.midcast.Curaga = sets.midcast.Cure
  116.  
  117. sets.midcast.Regen = {head="Savant's Bonnet +2", main="Coeus"}
  118.  
  119. sets.midcast.Cursna = {}
  120.  
  121. sets.midcast['Enhancing Magic'] = {ammo="Savant's Treatise",
  122. head="Savant's Bonnet +2", neck="Colossus's Torque"}
  123.  
  124. sets.midcast.Stoneskin = set_combine(sets.midcast['Enhancing Magic'], {waist="Siegel Sash"})
  125.  
  126. sets.midcast.Storm = set_combine(sets.midcast['Enhancing Magic'], {feet="Pedagogy Loafers"})
  127.  
  128. sets.midcast.Protect = {ring1="Sheltered Ring"}
  129. sets.midcast.Protectra = sets.midcast.Protect
  130.  
  131. sets.midcast.Shell = {ring1="Sheltered Ring"}
  132. sets.midcast.Shellra = sets.midcast.Shell
  133.  
  134.  
  135. -- Custom spell classes
  136. sets.midcast.MndEnfeebles = sets.precast.FC['Elemental Magic']
  137.  
  138. sets.midcast.IntEnfeebles = sets.precast.FC['Elemental Magic']
  139.  
  140. sets.midcast.ElementalEnfeeble = sets.midcast.IntEnfeebles
  141.  
  142. sets.midcast['Dark Magic'] = sets.precast.FC['Elemental Magic']
  143.  
  144. sets.midcast.Kaustra = sets.precast.FC['Elemental Magic']
  145.  
  146. sets.midcast.Drain = sets.precast.FC['Elemental Magic']
  147.  
  148. sets.midcast.Aspir = sets.midcast.Drain
  149.  
  150. sets.midcast.Stun = sets.precast.FC['Elemental Magic']
  151.  
  152. sets.midcast.Stun.Resistant = set_combine(sets.midcast.Stun, {main="Lehbrailg +2"})
  153.  
  154.  
  155. -- Elemental Magic sets are default for handling low-tier nukes.
  156. sets.midcast['Elemental Magic'] = sets.precast.FC['Elemental Magic']
  157.  
  158. sets.midcast['Elemental Magic'].Resistant = sets.precast.FC['Elemental Magic']
  159.  
  160. -- Custom refinements for certain nuke tiers
  161. sets.midcast['Elemental Magic'].HighTierNuke = set_combine(sets.midcast['Elemental Magic'], {sub="Wizzan Grip"})
  162.  
  163. sets.midcast['Elemental Magic'].HighTierNuke.Resistant = set_combine(sets.midcast['Elemental Magic'].Resistant, {sub="Wizzan Grip"})
  164.  
  165. sets.midcast.Impact = {}
  166.  
  167.  
  168. -- Sets to return to when not performing an action.
  169.  
  170. -- Resting sets
  171. sets.resting = {}
  172.  
  173.  
  174. -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
  175.  
  176. sets.idle.Town = {main="Terra's Staff", sub="Wise Strap", head="Buremte hat", body="Pluviale",
  177. hands="Serpentes cuffs", legs="Weather. pants +1", feet="Serpentes sabots", neck="Veisa collar", waist="Salire belt",
  178. left_ear="Hecate's Earring", right_ear="Moldavite Earring", left_ring="Dark Ring", right_ring="Dark Ring",
  179. back="Cheviot Cape"}
  180.  
  181. sets.idle.Field = {sets.idle.Town}
  182.  
  183. sets.idle.Field.PDT = {sets.idle.Town}
  184.  
  185. sets.idle.Field.Stun = {sets.idle.Town}
  186.  
  187. sets.idle.Weak = {sets.idle.Town}
  188.  
  189. -- Defense sets
  190.  
  191. sets.defense.PDT = {sets.idle.Town}
  192.  
  193. sets.defense.MDT = {sets.idle.Town}
  194.  
  195. sets.Kiting = {feet="Desert Boots"}
  196.  
  197. sets.latent_refresh = {waist="Fucho-no-obi"}
  198.  
  199. -- Engaged sets
  200.  
  201. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  202. -- sets if more refined versions aren't defined.
  203. -- If you create a set with both offense and defense modes, the offense mode should be first.
  204. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  205.  
  206. -- Normal melee group
  207. sets.engaged = {}
  208.  
  209.  
  210.  
  211. -- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
  212. sets.buff['Ebullience'] = {head="Savant's Bonnet +2"}
  213. sets.buff['Rapture'] = {head="Savant's Bonnet +2"}
  214. sets.buff['Perpetuance'] = {hands="Savant's Bracers +2"}
  215. sets.buff['Immanence'] = {hands="Savant's Bracers +2"}
  216. sets.buff['Penury'] = {legs="Savant's Pants +2"}
  217. sets.buff['Parsimony'] = {legs="Savant's Pants +2"}
  218. sets.buff['Celerity'] = {feet="Pedagogy Loafers"}
  219. sets.buff['Alacrity'] = {feet="Pedagogy Loafers"}
  220. sets.buff['Sandstorm'] = {feet="Desert Boots"}
  221. sets.buff['Klimaform'] = {feet="Savant's Loafers +2"}
  222. sets.buff.FullSublimation = {head="Scholar's M.board",ear1="Savant's Earring",body="Argute Gown"}
  223. sets.buff.PDTSublimation = {head="Academic's Mortarboard",ear1="Savant's Earring", body="argute gown"}
  224.  
  225.  
  226. end
  227.  
  228. -------------------------------------------------------------------------------------------------------------------
  229. -- Job-specific hooks for standard casting events.
  230. -------------------------------------------------------------------------------------------------------------------
  231.  
  232. -- Run after the general midcast() is done.
  233. function job_post_midcast(spell, action, spellMap, eventArgs)
  234. if spell.action_type == 'Magic' then
  235. apply_grimoire_bonuses(spell, action, spellMap, eventArgs)
  236. end
  237. end
  238.  
  239. -------------------------------------------------------------------------------------------------------------------
  240. -- Job-specific hooks for non-casting events.
  241. -------------------------------------------------------------------------------------------------------------------
  242.  
  243. -- Called when a player gains or loses a buff.
  244. -- buff == buff gained or lost
  245. -- gain == true if the buff was gained, false if it was lost.
  246. function job_buff_change(buff, gain)
  247. if buff == "Sublimation: Activated" then
  248. handle_equipping_gear(player.status)
  249. end
  250. end
  251.  
  252. -- Handle notifications of general user state change.
  253. function job_state_change(stateField, newValue, oldValue)
  254. if stateField == 'Offense Mode' then
  255. if newValue == 'Normal' then
  256. disable('main','sub','range')
  257. else
  258. enable('main','sub','range')
  259. end
  260. end
  261. end
  262.  
  263. -------------------------------------------------------------------------------------------------------------------
  264. -- User code that supplements standard library decisions.
  265. -------------------------------------------------------------------------------------------------------------------
  266.  
  267. -- Custom spell mapping.
  268. function job_get_spell_map(spell, default_spell_map)
  269. if spell.action_type == 'Magic' then
  270. if default_spell_map == 'Cure' or default_spell_map == 'Curaga' then
  271. if world.weather_element == 'Light' then
  272. return 'CureWithLightWeather'
  273. end
  274. elseif spell.skill == 'Enfeebling Magic' then
  275. if spell.type == 'WhiteMagic' then
  276. return 'MndEnfeebles'
  277. else
  278. return 'IntEnfeebles'
  279. end
  280. elseif spell.skill == 'Elemental Magic' then
  281. if info.low_nukes:contains(spell.english) then
  282. return 'LowTierNuke'
  283. elseif info.mid_nukes:contains(spell.english) then
  284. return 'MidTierNuke'
  285. elseif info.high_nukes:contains(spell.english) then
  286. return 'HighTierNuke'
  287. end
  288. end
  289. end
  290. end
  291.  
  292. function customize_idle_set(idleSet)
  293. if state.Buff['Sublimation: Activated'] then
  294. if state.IdleMode.value == 'Normal' then
  295. idleSet = set_combine(idleSet, sets.buff.FullSublimation)
  296. elseif state.IdleMode.value == 'PDT' then
  297. idleSet = set_combine(idleSet, sets.buff.PDTSublimation)
  298. end
  299. end
  300.  
  301. if player.mpp < 51 then
  302. idleSet = set_combine(idleSet, sets.latent_refresh)
  303. end
  304.  
  305. return idleSet
  306. end
  307.  
  308. -- Called by the 'update' self-command.
  309. function job_update(cmdParams, eventArgs)
  310. if cmdParams[1] == 'user' and not (buffactive['light arts'] or buffactive['dark arts'] or
  311. buffactive['addendum: white'] or buffactive['addendum: black']) then
  312. if state.IdleMode.value == 'Stun' then
  313. send_command('@input /ja "Dark Arts" <me>')
  314. else
  315. send_command('@input /ja "Light Arts" <me>')
  316. end
  317. end
  318.  
  319. update_active_strategems()
  320. update_sublimation()
  321. end
  322.  
  323. -- Function to display the current relevant user state when doing an update.
  324. -- Return true if display was handled, and you don't want the default info shown.
  325. function display_current_job_state(eventArgs)
  326. display_current_caster_state()
  327. eventArgs.handled = true
  328. end
  329.  
  330. -------------------------------------------------------------------------------------------------------------------
  331. -- User code that supplements self-commands.
  332. -------------------------------------------------------------------------------------------------------------------
  333.  
  334. -- Called for direct player commands.
  335. function job_self_command(cmdParams, eventArgs)
  336. if cmdParams[1]:lower() == 'scholar' then
  337. handle_strategems(cmdParams)
  338. eventArgs.handled = true
  339. end
  340. end
  341.  
  342. -------------------------------------------------------------------------------------------------------------------
  343. -- Utility functions specific to this job.
  344. -------------------------------------------------------------------------------------------------------------------
  345.  
  346. -- Reset the state vars tracking strategems.
  347. function update_active_strategems()
  348. state.Buff['Ebullience'] = buffactive['Ebullience'] or false
  349. state.Buff['Rapture'] = buffactive['Rapture'] or false
  350. state.Buff['Perpetuance'] = buffactive['Perpetuance'] or false
  351. state.Buff['Immanence'] = buffactive['Immanence'] or false
  352. state.Buff['Penury'] = buffactive['Penury'] or false
  353. state.Buff['Parsimony'] = buffactive['Parsimony'] or false
  354. state.Buff['Celerity'] = buffactive['Celerity'] or false
  355. state.Buff['Alacrity'] = buffactive['Alacrity'] or false
  356. state.Buff['Klimaform'] = buffactive['Klimaform'] or false
  357. state.Buff['Sandstorm'] = buffactive['Sandstorm'] or false
  358. end
  359.  
  360. function update_sublimation()
  361. state.Buff['Sublimation: Activated'] = buffactive['Sublimation: Activated'] or false
  362. end
  363.  
  364. -- Equip sets appropriate to the active buffs, relative to the spell being cast.
  365. function apply_grimoire_bonuses(spell, action, spellMap)
  366. if state.Buff.Perpetuance and spell.type =='WhiteMagic' and spell.skill == 'Enhancing Magic' then
  367. equip(sets.buff['Perpetuance'])
  368. end
  369. if state.Buff.Rapture and (spellMap == 'Cure' or spellMap == 'Curaga') then
  370. equip(sets.buff['Rapture'])
  371. end
  372. if spell.skill == 'Elemental Magic' and spellMap ~= 'ElementalEnfeeble' then
  373. if state.Buff.Ebullience and spell.english ~= 'Impact' then
  374. equip(sets.buff['Ebullience'])
  375. end
  376. if state.Buff.Immanence then
  377. equip(sets.buff['Immanence'])
  378. end
  379. if state.Buff.Klimaform and spell.element == world.weather_element then
  380. equip(sets.buff['Klimaform'])
  381.  
  382. end
  383. end
  384.  
  385. if state.Buff.Penury then equip(sets.buff['Penury']) end
  386. if state.Buff.Parsimony then equip(sets.buff['Parsimony']) end
  387. if state.Buff.Celerity then equip(sets.buff['Celerity']) end
  388. if state.Buff.Alacrity then equip(sets.buff['Alacrity']) end
  389. if state.Buff.Sandstorm then equip(sets.buff['Sandstorm']) end
  390. end
  391.  
  392.  
  393. -- General handling of strategems in an Arts-agnostic way.
  394. -- Format: gs c scholar <strategem>
  395. function handle_strategems(cmdParams)
  396. -- cmdParams[1] == 'scholar'
  397. -- cmdParams[2] == strategem to use
  398.  
  399. if not cmdParams[2] then
  400. add_to_chat(123,'Error: No strategem command given.')
  401. return
  402. end
  403. local strategem = cmdParams[2]:lower()
  404.  
  405. if strategem == 'light' then
  406. if buffactive['light arts'] then
  407. send_command('input /ja "Addendum: White" <me>')
  408. elseif buffactive['addendum: white'] then
  409. add_to_chat(122,'Error: Addendum: White is already active.')
  410. else
  411. send_command('input /ja "Light Arts" <me>')
  412. end
  413. elseif strategem == 'dark' then
  414. if buffactive['dark arts'] then
  415. send_command('input /ja "Addendum: Black" <me>')
  416. elseif buffactive['addendum: black'] then
  417. add_to_chat(122,'Error: Addendum: Black is already active.')
  418. else
  419. send_command('input /ja "Dark Arts" <me>')
  420. end
  421. elseif buffactive['light arts'] or buffactive['addendum: white'] then
  422. if strategem == 'cost' then
  423. send_command('input /ja Penury <me>')
  424. elseif strategem == 'speed' then
  425. send_command('input /ja Celerity <me>')
  426. elseif strategem == 'aoe' then
  427. send_command('input /ja Accession <me>')
  428. elseif strategem == 'power' then
  429. send_command('input /ja Rapture <me>')
  430. elseif strategem == 'duration' then
  431. send_command('input /ja Perpetuance <me>')
  432. elseif strategem == 'accuracy' then
  433. send_command('input /ja Altruism <me>')
  434. elseif strategem == 'enmity' then
  435. send_command('input /ja Tranquility <me>')
  436. elseif strategem == 'skillchain' then
  437. add_to_chat(122,'Error: Light Arts does not have a skillchain strategem.')
  438. elseif strategem == 'addendum' then
  439. send_command('input /ja "Addendum: White" <me>')
  440. else
  441. add_to_chat(123,'Error: Unknown strategem ['..strategem..']')
  442. end
  443. elseif buffactive['dark arts'] or buffactive['addendum: black'] then
  444. if strategem == 'cost' then
  445. send_command('input /ja Parsimony <me>')
  446. elseif strategem == 'speed' then
  447. send_command('input /ja Alacrity <me>')
  448. elseif strategem == 'aoe' then
  449. send_command('input /ja Manifestation <me>')
  450. elseif strategem == 'power' then
  451. send_command('input /ja Ebullience <me>')
  452. elseif strategem == 'duration' then
  453. add_to_chat(122,'Error: Dark Arts does not have a duration strategem.')
  454. elseif strategem == 'accuracy' then
  455. send_command('input /ja Focalization <me>')
  456. elseif strategem == 'enmity' then
  457. send_command('input /ja Equanimity <me>')
  458. elseif strategem == 'skillchain' then
  459. send_command('input /ja Immanence <me>')
  460. elseif strategem == 'addendum' then
  461. send_command('input /ja "Addendum: Black" <me>')
  462. else
  463. add_to_chat(123,'Error: Unknown strategem ['..strategem..']')
  464. end
  465. else
  466. add_to_chat(123,'No arts has been activated yet.')
  467. end
  468. end
  469.  
  470.  
  471. -- Gets the current number of available strategems based on the recast remaining
  472. -- and the level of the sch.
  473. function get_current_strategem_count()
  474. -- returns recast in seconds.
  475. local allRecasts = windower.ffxi.get_ability_recasts()
  476. local stratsRecast = allRecasts[231]
  477.  
  478. local maxStrategems = (player.main_job_level + 10) / 20
  479.  
  480. local fullRechargeTime = 4*60
  481.  
  482. local currentCharges = math.floor(maxStrategems - maxStrategems * stratsRecast / fullRechargeTime)
  483.  
  484. return currentCharges
  485. end
  486.  
  487.  
  488. -- Select default macro book on initial load or subjob change.
  489. function select_default_macro_book()
  490. set_macro_page(3, 10)
  491. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement