Advertisement
starfishsky

Untitled

Mar 23rd, 2017
1,219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.76 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job. Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. --[[
  6. Custom commands:
  7.  
  8. ExtraSongsMode may take one of three values: None, Dummy, FullLength
  9.  
  10. You can set these via the standard 'set' and 'cycle' self-commands. EG:
  11. gs c cycle ExtraSongsMode
  12. gs c set ExtraSongsMode Dummy
  13.  
  14. The Dummy state will equip the bonus song instrument and ensure non-duration gear is equipped.
  15. The FullLength state will simply equip the bonus song instrument on top of standard gear.
  16.  
  17.  
  18. Simple macro to cast a dummy Daurdabla song:
  19. /console gs c set ExtraSongsMode Dummy
  20. /ma "Shining Fantasia" <me>
  21.  
  22. To use a Terpander rather than Daurdabla, set the info.ExtraSongInstrument variable to
  23. 'Terpander', and info.ExtraSongs to 1.
  24. --]]
  25.  
  26. -- Initialization function for this job file.
  27. function get_sets()
  28. mote_include_version = 2
  29.  
  30. -- Load and initialize the include file.
  31. include('Mote-Include.lua')
  32.  
  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.ExtraSongsMode = M{['description']='Extra Songs', 'None', 'Dummy', 'FullLength'}
  39.  
  40. state.Buff['Pianissimo'] = buffactive['pianissimo'] or false
  41.  
  42. -- For tracking current recast timers via the Timers plugin.
  43. custom_timers = {}
  44. end
  45.  
  46. -------------------------------------------------------------------------------------------------------------------
  47. -- User setup functions for this job. Recommend that these be overridden in a sidecar file.
  48. -------------------------------------------------------------------------------------------------------------------
  49.  
  50. -- Setup vars that are user-dependent. Can override this function in a sidecar file.
  51. function user_setup()
  52. state.OffenseMode:options('None', 'Normal')
  53. state.CastingMode:options('Normal', 'Resistant')
  54. state.IdleMode:options('Normal', 'PDT')
  55.  
  56.  
  57.  
  58. brd_daggers = S{'Taming Sari'}
  59. pick_tp_weapon()
  60.  
  61. -- Adjust this if using the Terpander (new +song instrument)
  62. --info.ExtraSongInstrument = 'Daurdabla'
  63. info.ExtraSongInstrument = 'Terpander'
  64. -- How many extra songs we can keep from Daurdabla/Terpander
  65. --info.ExtraSongs = 2
  66. info.ExtraSongs = 1
  67.  
  68. -- Set this to false if you don't want to use custom timers.
  69. state.UseCustomTimers = M(true, 'Use Custom Timers')
  70.  
  71. -- Additional local binds
  72. send_command('bind ^` gs c cycle ExtraSongsMode')
  73. send_command('bind !` input /ma "Chocobo Mazurka" <me>')
  74.  
  75. select_default_macro_book()
  76. send_command('wait 2; input /lockstyleset 12')
  77.  
  78. end
  79.  
  80.  
  81. -- Called when this job file is unloaded (eg: job change)
  82. function user_unload()
  83. send_command('unbind ^`')
  84. send_command('unbind !`')
  85. end
  86.  
  87.  
  88. -- Define sets and vars used by this job file.
  89. function init_gear_sets()
  90. --------------------------------------
  91. -- Start defining the sets
  92. --------------------------------------
  93.  
  94. -- Precast Sets
  95.  
  96. -- Fast cast sets for spells
  97. sets.precast.FC = {head="Nahtirah Hat",ear2="Loquac. Earring",
  98. body="Inyanga Jubbah",
  99. hands="Gendewitha Gages",ring1="Prolix Ring",
  100. back="Swith Cape",waist="Witful Belt",legs="Orvail Pants +1",feet="Chelona Boots"}
  101.  
  102. sets.precast.FC.Cure = set_combine(sets.precast.FC, {})
  103.  
  104. sets.precast.FC.Stoneskin = set_combine(sets.precast.FC, {head="Umuthi Hat"})
  105.  
  106. sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  107.  
  108. sets.precast.FC.BardSong = {main="Felibre's Dague",range="Gjallarhorn",
  109. head="Fili calot",neck="Aoidos' Matinee",ear1="Aoidos' Earring",ear2="Loquac. Earring",
  110. body="Sha'ir Manteel",hands="Gendewitha Gages",ring1="Prolix Ring",
  111. back="Swith Cape",waist="Witful Belt",legs="Gendewitha Spats",feet="telchine pigaches"}
  112.  
  113. -- sets.precast.FC.BardSong = {main="Felibre's Dague",range="Gjallarhorn",
  114. -- head="Aoidos' Calot +2",neck="Aoidos' Matinee",ear1="Aoidos' Earring",ear2="Loquac. Earring",
  115. -- body="Sha'ir Manteel",hands="Gendewitha Gages",ring1="Prolix Ring",
  116. -- back="Swith Cape +1",waist="Witful Belt",legs="Gendewitha Spats",feet="Bihu Slippers"}
  117.  
  118.  
  119. sets.precast.FC.Daurdabla = set_combine(sets.precast.FC.BardSong, {range=info.ExtraSongInstrument})
  120.  
  121.  
  122. -- Precast sets to enhance JAs
  123.  
  124. sets.precast.JA.Nightingale = {feet="Bihu Slippers"}
  125. sets.precast.JA.Troubadour = {body="Bihu Justaucorps"}
  126. sets.precast.JA['Soul Voice'] = {legs="Bihu Cannions"}
  127.  
  128. -- Waltz set (chr and vit)
  129. sets.precast.Waltz = {range="Gjallarhorn",
  130. head="Nahtirah Hat",
  131. body="Gendewitha Bliaut",hands="Buremte Gloves",
  132. back="Kumbira Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  133.  
  134.  
  135. -- Weaponskill sets
  136. -- Default set for any weaponskill that isn't any more specifically defined
  137. sets.precast.WS = {range="Gjallarhorn",
  138. head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
  139. body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  140. back="Atheling Mantle",waist="Caudata Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
  141.  
  142. -- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found.
  143. sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS)
  144.  
  145. sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS)
  146.  
  147. sets.precast.WS['Mordant Rime'] = set_combine(sets.precast.WS)
  148.  
  149.  
  150. -- Midcast Sets
  151.  
  152. -- General set for recast times.
  153. sets.midcast.FastRecast = {range="Angel Lyre",
  154. head="Nahtirah Hat",ear2="Loquacious Earring",
  155. body="Sha'ir Manteel",hands="Gendewitha Gages",ring1="Prolix Ring",
  156. back="Swith Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  157.  
  158. -- Gear to enhance certain classes of songs. No instruments added here since Gjallarhorn is being used.
  159. sets.midcast.Ballad = {legs="Aoidos' Rhing. +2"}
  160.  
  161.  
  162. --sets.midcast.Lullaby = {hands="Brioso Cuffs"}
  163.  
  164. sets.midcast.Lullaby ={
  165. main={ name="Malevolence", augments={'INT+10','"Mag.Atk.Bns."+6',}},
  166. range="Pan's Horn",
  167. head="Aya. Zucchetto +1",
  168. body="Ayanmo Corazza +1",
  169. hands="Inyanga Dastanas",
  170. legs="Aya. Cosciales +1",
  171. feet="Aya. Gambieras +1",
  172. neck="Deceiver's Torque",
  173. waist="Witful Belt",
  174. left_ear="Lifestorm Earring",
  175. right_ear="Psystorm Earring",
  176. left_ring="Stikini Ring",
  177. right_ring="Stikini Ring",
  178. back="Refraction Cape",
  179. }
  180.  
  181.  
  182. --sets.midcast.Madrigal = {head="Aoidos' Calot +2"}
  183. sets.midcast.Madrigal = {range="cantabank's Horn"}
  184.  
  185. sets.midcast.March = {range="Langeleik"}
  186. --sets.midcast.March = {hands="Aoidos' Manchettes +2"}
  187.  
  188. sets.midcast.Minuet = {range="Apollo's flute"}
  189. --sets.midcast.Minuet = {body="Aoidos' Hongreline +2"}
  190.  
  191. sets.midcast.Minne = {}
  192. sets.midcast.Paeon = {head="Brioso Roundlet +1"}
  193. sets.midcast.Carol = {head="Aoidos' Calot +2",
  194. body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",
  195. legs="Aoidos' Rhing. +2",feet="Aoidos' Cothrn. +2"}
  196. sets.midcast["Sentinel's Scherzo"] = {feet="Aoidos' Cothrn. +2"}
  197. sets.midcast['Magic Finale'] = {neck="Wind Torque",waist="Corvax Sash",legs="Aoidos' Rhing. +2"}
  198.  
  199. sets.midcast.Mazurka = {range=info.ExtraSongInstrument}
  200.  
  201.  
  202. -- For song buffs (duration and AF3 set bonus)
  203. sets.midcast.SongEffect = {main="Legato Dagger",range="Gjallarhorn",
  204. head="Aoidos' Calot +2",neck="Aoidos' Matinee",ear2="Loquacious Earring",
  205. body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",
  206. back="Harmony Cape",waist="Corvax Sash",legs="Marduk's Shalwar +1",feet="Brioso Slippers +1"}
  207.  
  208. -- For song defbuffs (duration primary, accuracy secondary)
  209. sets.midcast.SongDebuff = {main="Lehbrailg +2",sub="Mephitis Grip",range="Gjallarhorn",
  210. head="Brioso Roundlet +1",neck="Aoidos' Matinee",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  211. body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
  212. back="Kumbira Cape",waist="Goading Belt",legs="Marduk's Shalwar +1",feet="Brioso Slippers +1"}
  213.  
  214. -- For song defbuffs (accuracy primary, duration secondary)
  215. sets.midcast.ResistantSongDebuff = {main="Lehbrailg +2",sub="Mephitis Grip",range="Gjallarhorn",
  216. head="Brioso Roundlet +1",neck="Wind Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  217. body="Brioso Justaucorps +1",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
  218. back="Kumbira Cape",waist="Demonry Sash",legs="Brioso Cannions +1",feet="Bokwus Boots"}
  219.  
  220. -- Song-specific recast reduction
  221. sets.midcast.SongRecast = {ear2="Loquacious Earring",
  222. ring1="Prolix Ring",
  223. back="Harmony Cape",waist="Corvax Sash",legs="Aoidos' Rhing. +2"}
  224.  
  225. --sets.midcast.Daurdabla = set_combine(sets.midcast.FastRecast, sets.midcast.SongRecast, {range=info.ExtraSongInstrument})
  226.  
  227. -- Cast spell with normal gear, except using Daurdabla instead
  228. sets.midcast.Daurdabla = {range=info.ExtraSongInstrument}
  229.  
  230. -- Dummy song with Daurdabla; minimize duration to make it easy to overwrite.
  231. sets.midcast.DaurdablaDummy = {main="Izhiikoh",range=info.ExtraSongInstrument,
  232. head="Nahtirah Hat",neck="Wind Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  233. body="Brioso Justaucorps +1",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
  234. back="Swith Cape +1",waist="Goading Belt",legs="Gendewitha Spats",feet="Bokwus Boots"}
  235.  
  236. -- Other general spells and classes.
  237. sets.midcast.Cure = {main="Arka IV",sub='Achaq Grip',
  238. head="Gendewitha Caubeen",
  239. body="Gendewitha Bliaut",hands="Bokwus Gloves",ring1="Ephedra Ring",ring2="Sirona's Ring",
  240. legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  241.  
  242. sets.midcast.Curaga = sets.midcast.Cure
  243.  
  244. sets.midcast.Stoneskin = {
  245. head="Nahtirah Hat",
  246. body="Gendewitha Bliaut",hands="Gendewitha Gages",
  247. legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  248.  
  249. sets.midcast.Cursna = {
  250. neck="Malison Medallion",
  251. hands="Hieros Mittens",ring1="Ephedra Ring"}
  252.  
  253.  
  254. -- Sets to return to when not performing an action.
  255.  
  256. -- Resting sets
  257. sets.resting = {main=gear.Staff.HMP,
  258. body="Gendewitha Bliaut",
  259. legs="Nares Trews",feet="Chelona Boots +1"}
  260.  
  261.  
  262. -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
  263. sets.idle ={
  264. main={ name="Malevolence", augments={'INT+10','"Mag.Atk.Bns."+6',}},
  265. range="Terpander",
  266. head="Aya. Zucchetto +1",
  267. body={ name="Gende. Bilaut +1", augments={'Phys. dmg. taken -2%','"Cure" potency +4%',}},
  268. hands="Inyanga Dastanas",
  269. legs="Assid. Pants +1",
  270. feet="Aya. Gambieras +1",
  271. neck="Deceiver's Torque",
  272. waist="Witful Belt",
  273. left_ear="Lifestorm Earring",
  274. right_ear="Loquac. Earring",
  275. left_ring="Stikini Ring",
  276. right_ring="Stikini Ring",
  277. back="Refraction Cape",
  278. }
  279. --sets.idle = {main=gear.Staff.PDT, sub="Mephitis Grip",range="Oneiros Harp",
  280. -- head="Gendewitha Caubeen",neck="Wiglen Gorget",ear1="Bloodgem Earring",ear2="Loquacious Earring",
  281. -- body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Paguroidea Ring",ring2="Sangoma Ring",
  282. -- back="Umbra Cape",waist="Flume Belt",legs="Nares Trews",feet="Aoidos' Cothurnes +2"}
  283.  
  284. sets.idle.PDT = sets.idle
  285.  
  286. sets.idle.Town = sets.idle
  287.  
  288. sets.idle.Weak = sets.idle
  289.  
  290.  
  291. -- Defense sets
  292.  
  293. sets.defense.PDT = sets.idle
  294.  
  295. sets.defense.MDT = sets.idle
  296.  
  297. sets.Kiting = {feet="Aoidos' Cothurnes +2"}
  298.  
  299. sets.latent_refresh = {waist="Fucho-no-obi"}
  300.  
  301. -- Engaged sets
  302.  
  303. -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous
  304. -- sets if more refined versions aren't defined.
  305. -- If you create a set with both offense and defense modes, the offense mode should be first.
  306. -- EG: sets.engaged.Dagger.Accuracy.Evasion
  307.  
  308. -- Basic set for if no TP weapon is defined.
  309. sets.engaged ={
  310. main={ name="Taming Sari", augments={'STR+5','DEX+8','DMG:+8',}},
  311. range="Terpander",
  312. head="Aya. Zucchetto +1",
  313. body="Ayanmo Corazza +1",
  314. hands="Aya. Manopolas +1",
  315. legs="Aya. Cosciales +1",
  316. feet="Aya. Gambieras +1",
  317. neck="Lissome Necklace",
  318. waist="Kentarch Belt +1",
  319. left_ear="Bladeborn Earring",
  320. right_ear="Steelflash Earring",
  321. left_ring="Chirich Ring",
  322. right_ring="Chirich Ring",
  323. back="Aptitude Mantle +1",
  324. }
  325.  
  326. --sets.engaged = {range="Angel Lyre",
  327. --head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  328. --body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  329. --back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
  330.  
  331. -- Sets with weapons defined.
  332. sets.engaged.Dagger = sets.engaged
  333.  
  334. --sets.engaged.Dagger = {range="Angel Lyre",
  335. -- head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  336. -- body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  337. -- back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
  338.  
  339. -- Set if dual-wielding
  340. sets.engaged.DW = {range="Angel Lyre",
  341. head="Nahtirah Hat",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  342. body="Bihu Justaucorps",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  343. back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes"}
  344. end
  345.  
  346.  
  347. -------------------------------------------------------------------------------------------------------------------
  348. -- Job-specific hooks for standard casting events.
  349. -------------------------------------------------------------------------------------------------------------------
  350.  
  351. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  352. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  353. function job_precast(spell, action, spellMap, eventArgs)
  354. if spell.type == 'BardSong' then
  355. -- Auto-Pianissimo
  356. if ((spell.target.type == 'PLAYER' and not spell.target.charmed) or (spell.target.type == 'NPC' and spell.target.in_party)) and
  357. not state.Buff['Pianissimo'] then
  358.  
  359. local spell_recasts = windower.ffxi.get_spell_recasts()
  360. if spell_recasts[spell.recast_id] < 2 then
  361. send_command('@input /ja "Pianissimo" <me>; wait 1.5; input /ma "'..spell.name..'" '..spell.target.name)
  362. eventArgs.cancel = true
  363. return
  364. end
  365. end
  366. end
  367. end
  368.  
  369. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  370. function job_midcast(spell, action, spellMap, eventArgs)
  371. if spell.action_type == 'Magic' then
  372. if spell.type == 'BardSong' then
  373. -- layer general gear on first, then let default handler add song-specific gear.
  374. local generalClass = get_song_class(spell)
  375. if generalClass and sets.midcast[generalClass] then
  376. equip(sets.midcast[generalClass])
  377. end
  378. end
  379. end
  380. end
  381.  
  382. function job_post_midcast(spell, action, spellMap, eventArgs)
  383. if spell.type == 'BardSong' then
  384. if state.ExtraSongsMode.value == 'FullLength' then
  385. equip(sets.midcast.Daurdabla)
  386. end
  387.  
  388. state.ExtraSongsMode:reset()
  389. end
  390. end
  391.  
  392. -- Set eventArgs.handled to true if we don't want automatic gear equipping to be done.
  393. function job_aftercast(spell, action, spellMap, eventArgs)
  394. if spell.type == 'BardSong' and not spell.interrupted then
  395. if spell.target and spell.target.type == 'SELF' then
  396. adjust_timers(spell, spellMap)
  397. end
  398. end
  399. end
  400.  
  401. -------------------------------------------------------------------------------------------------------------------
  402. -- Job-specific hooks for non-casting events.
  403. -------------------------------------------------------------------------------------------------------------------
  404.  
  405. -- Handle notifications of general user state change.
  406. function job_state_change(stateField, newValue, oldValue)
  407. if stateField == 'Offense Mode' then
  408. if newValue == 'Normal' then
  409. disable('main','sub','ammo')
  410. else
  411. enable('main','sub','ammo')
  412. end
  413. end
  414. end
  415.  
  416. -------------------------------------------------------------------------------------------------------------------
  417. -- User code that supplements standard library decisions.
  418. -------------------------------------------------------------------------------------------------------------------
  419.  
  420. -- Called by the 'update' self-command.
  421. function job_update(cmdParams, eventArgs)
  422. pick_tp_weapon()
  423. end
  424.  
  425.  
  426. -- Modify the default idle set after it was constructed.
  427. function customize_idle_set(idleSet)
  428. if player.mpp < 51 then
  429. idleSet = set_combine(idleSet, sets.latent_refresh)
  430. end
  431.  
  432. return idleSet
  433. end
  434.  
  435.  
  436. -- Function to display the current relevant user state when doing an update.
  437. function display_current_job_state(eventArgs)
  438. display_current_caster_state()
  439. eventArgs.handled = true
  440. end
  441.  
  442. -------------------------------------------------------------------------------------------------------------------
  443. -- Utility functions specific to this job.
  444. -------------------------------------------------------------------------------------------------------------------
  445.  
  446. -- Determine the custom class to use for the given song.
  447. function get_song_class(spell)
  448. -- Can't use spell.targets:contains() because this is being pulled from resources
  449. if set.contains(spell.targets, 'Enemy') then
  450. if state.CastingMode.value == 'Resistant' then
  451. return 'ResistantSongDebuff'
  452. else
  453. return 'SongDebuff'
  454. end
  455. elseif state.ExtraSongsMode.value == 'Dummy' then
  456. return 'DaurdablaDummy'
  457. else
  458. return 'SongEffect'
  459. end
  460. end
  461.  
  462.  
  463. -- Function to create custom buff-remaining timers with the Timers plugin,
  464. -- keeping only the actual valid songs rather than spamming the default
  465. -- buff remaining timers.
  466. function adjust_timers(spell, spellMap)
  467. if state.UseCustomTimers.value == false then
  468. return
  469. end
  470.  
  471. local current_time = os.time()
  472.  
  473. -- custom_timers contains a table of song names, with the os time when they
  474. -- will expire.
  475.  
  476. -- Eliminate songs that have already expired from our local list.
  477. local temp_timer_list = {}
  478. for song_name,expires in pairs(custom_timers) do
  479. if expires < current_time then
  480. temp_timer_list[song_name] = true
  481. end
  482. end
  483. for song_name,expires in pairs(temp_timer_list) do
  484. custom_timers[song_name] = nil
  485. end
  486.  
  487. local dur = calculate_duration(spell.name, spellMap)
  488. if custom_timers[spell.name] then
  489. -- Songs always overwrite themselves now, unless the new song has
  490. -- less duration than the old one (ie: old one was NT version, new
  491. -- one has less duration than what's remaining).
  492.  
  493. -- If new song will outlast the one in our list, replace it.
  494. if custom_timers[spell.name] < (current_time + dur) then
  495. send_command('timers delete "'..spell.name..'"')
  496. custom_timers[spell.name] = current_time + dur
  497. send_command('timers create "'..spell.name..'" '..dur..' down')
  498. end
  499. else
  500. -- Figure out how many songs we can maintain.
  501. local maxsongs = 2
  502. if player.equipment.range == info.ExtraSongInstrument then
  503. maxsongs = maxsongs + info.ExtraSongs
  504. end
  505. if buffactive['Clarion Call'] then
  506. maxsongs = maxsongs + 1
  507. end
  508. -- If we have more songs active than is currently apparent, we can still overwrite
  509. -- them while they're active, even if not using appropriate gear bonuses (ie: Daur).
  510. if maxsongs < table.length(custom_timers) then
  511. maxsongs = table.length(custom_timers)
  512. end
  513.  
  514. -- Create or update new song timers.
  515. if table.length(custom_timers) < maxsongs then
  516. custom_timers[spell.name] = current_time + dur
  517. send_command('timers create "'..spell.name..'" '..dur..' down')
  518. else
  519. local rep,repsong
  520. for song_name,expires in pairs(custom_timers) do
  521. if current_time + dur > expires then
  522. if not rep or rep > expires then
  523. rep = expires
  524. repsong = song_name
  525. end
  526. end
  527. end
  528. if repsong then
  529. custom_timers[repsong] = nil
  530. send_command('timers delete "'..repsong..'"')
  531. custom_timers[spell.name] = current_time + dur
  532. send_command('timers create "'..spell.name..'" '..dur..' down')
  533. end
  534. end
  535. end
  536. end
  537.  
  538. -- Function to calculate the duration of a song based on the equipment used to cast it.
  539. -- Called from adjust_timers(), which is only called on aftercast().
  540. function calculate_duration(spellName, spellMap)
  541. local mult = 1
  542. if player.equipment.range == 'Daurdabla' then mult = mult + 0.3 end -- change to 0.25 with 90 Daur
  543. if player.equipment.range == "Gjallarhorn" then mult = mult + 0.4 end -- change to 0.3 with 95 Gjall
  544.  
  545. if player.equipment.main == "Carnwenhan" then mult = mult + 0.1 end -- 0.1 for 75, 0.4 for 95, 0.5 for 99/119
  546. if player.equipment.main == "Legato Dagger" then mult = mult + 0.05 end
  547. if player.equipment.sub == "Legato Dagger" then mult = mult + 0.05 end
  548. if player.equipment.neck == "Aoidos' Matinee" then mult = mult + 0.1 end
  549. if player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
  550. if player.equipment.legs == "Mdk. Shalwar +1" then mult = mult + 0.1 end
  551. if player.equipment.feet == "Brioso Slippers" then mult = mult + 0.1 end
  552. if player.equipment.feet == "Brioso Slippers +1" then mult = mult + 0.11 end
  553.  
  554. if spellMap == 'Paeon' and player.equipment.head == "Brioso Roundlet" then mult = mult + 0.1 end
  555. if spellMap == 'Paeon' and player.equipment.head == "Brioso Roundlet +1" then mult = mult + 0.1 end
  556. if spellMap == 'Madrigal' and player.equipment.head == "Aoidos' Calot +2" then mult = mult + 0.1 end
  557. if spellMap == 'Minuet' and player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
  558. if spellMap == 'March' and player.equipment.hands == 'Ad. Mnchtte. +2' then mult = mult + 0.1 end
  559. if spellMap == 'Ballad' and player.equipment.legs == "Aoidos' Rhing. +2" then mult = mult + 0.1 end
  560. if spellName == "Sentinel's Scherzo" and player.equipment.feet == "Aoidos' Cothrn. +2" then mult = mult + 0.1 end
  561.  
  562. if buffactive.Troubadour then
  563. mult = mult*2
  564. end
  565. if spellName == "Sentinel's Scherzo" then
  566. if buffactive['Soul Voice'] then
  567. mult = mult*2
  568. elseif buffactive['Marcato'] then
  569. mult = mult*1.5
  570. end
  571. end
  572.  
  573. local totalDuration = math.floor(mult*120)
  574.  
  575. return totalDuration
  576. end
  577.  
  578.  
  579. -- Examine equipment to determine what our current TP weapon is.
  580. function pick_tp_weapon()
  581. if brd_daggers:contains(player.equipment.main) then
  582. state.CombatWeapon:set('Dagger')
  583.  
  584. if S{'NIN','DNC'}:contains(player.sub_job) and brd_daggers:contains(player.equipment.sub) then
  585. state.CombatForm:set('DW')
  586. else
  587. state.CombatForm:reset()
  588. end
  589. else
  590. state.CombatWeapon:reset()
  591. state.CombatForm:reset()
  592. end
  593. end
  594.  
  595. -- Function to reset timers.
  596. function reset_timers()
  597. for i,v in pairs(custom_timers) do
  598. send_command('timers delete "'..i..'"')
  599. end
  600. custom_timers = {}
  601. end
  602.  
  603.  
  604. -- Select default macro book on initial load or subjob change.
  605. function select_default_macro_book()
  606. set_macro_page(1, 13)
  607. end
  608.  
  609.  
  610. windower.raw_register_event('zone change',reset_timers)
  611. windower.raw_register_event('logout',reset_timers)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement