Guest User

Untitled

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