Advertisement
Guest User

brd.lua

a guest
Jul 8th, 2014
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.71 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Byrth & Motenten's Functions ** --
  3. -- Last Updated: 05/05/14 12:00 AM ** --
  4.  
  5. function get_sets()
  6. AccIndex = 1
  7. AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For TP/WS. First Set Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  8. IdleIndex = 1
  9. IdleArray = {"Movement","Regen","PDT"} -- Default Idle Set Is Movement --
  10. timer_reg = {}
  11. pianissimo_cycle = false
  12. Daurdabla = 'ON' -- Set Default Daurdabla ON or OFF Here --
  13. ElementalStaff = 'OFF' -- Set Default Precast Elemental Staff ON or OFF Here --
  14. Main = 'OFF' -- Set Default Main Weapon ON or OFF Here --
  15. target_distance = 5 -- Set Default Distance Here --
  16. select_default_macro_book() -- Change Default Macro Book At The End --
  17.  
  18. -- Daurdabla Trigger Songs --
  19. DaurdSongs = S{"Army's Paeon","Army's Paeon II","Shining Fantasia","Herb Pastoral","Goblin Gavotte"}
  20. Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  21. Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  22. sc_map = {SC1 = "ChocoboMazurka", SC2 = "HerbPastoral", SC3 = "GoblinGavotte"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  23.  
  24. sets.Idle = {}
  25. -- Idle Sets --
  26. sets.Idle.Movement = {
  27. main="Terra's Staff",
  28. sub="Oneiros Grip",
  29. range="Daurdabla",
  30. head="Wivre Hairpin",
  31. neck="Twilight Torque",
  32. ear1="Dawn Earring",
  33. ear2="Black Earring",
  34. body="Gendewitha Bliaut +1",
  35. hands="Serpentes Cuffs",
  36. ring1="Sheltered Ring",
  37. ring2="Defending Ring",
  38. back="Umbra Cape",
  39. waist="Flume Belt",
  40. legs="Nares Trews",
  41. feet="Serpentes Sabots"}
  42. sets.Idle.Regen = {
  43. main="Terra's Staff",
  44. sub="Oneiros Grip",
  45. range="Oneiros Harp",
  46. head="Wivre Hairpin",
  47. neck="Wiglen Gorget",
  48. ear1="Dawn Earring",
  49. ear2="Black Earring",
  50. body="Gendewitha Bliaut +1",
  51. hands="Gendewitha Gages",
  52. ring1="Sheltered Ring",
  53. ring2="Defending Ring",
  54. back="Umbra Cape",
  55. waist="Flume Belt",
  56. legs="Nares Trews",
  57. feet="Aoidos' Cothurnes +2"}
  58. sets.Idle.PDT = set_combine(sets.Idle.Movement,{
  59. hands="Gendewitha Gages",
  60. feet="Battlecast Gaiters"})
  61. sets.Resting = set_combine(sets.Idle.Movement,{
  62. main="Terra's Staff",
  63. sub="Oneiros Grip",
  64. ammo="Mana Ampulla",
  65. head="Wivre Hairpin",
  66. neck="Wiglen Gorget",
  67. ear1="Dawn Earring",
  68. ear2="Black Earring",
  69. body="Gendewitha Bliaut +1",
  70. hands="Serpentes Cuffs",
  71. ring1="Sheltered Ring",
  72. ring2="Defending Ring",
  73. back="Umbra Cape",
  74. waist="Flume Belt",
  75. legs="Nares Trews",
  76. feet="Serpentes Sabots"})
  77. sets.Precast = {
  78. main="Terra's Staff",
  79. sub="Oneiros Grip",
  80. range=empty,
  81. head="Nahtirah Hat",
  82. neck="Orunmila's Torque",
  83. ear1="Loquac. Earring",
  84. body="Marduk's Jubbah +1",
  85. hands="Gendewitha Gages +1",
  86. ring1="Prolix Ring",
  87. ring2="Veneficium Ring",
  88. back="Switch Cape +1",
  89. waist="Witful Belt"}
  90. -- Song Precast Set --
  91. sets.Precast.SongCast = {
  92. main="Felibre's Dague",
  93. sub="Genbu's Shield",
  94. range=empty,
  95. ammo="Impatiens",
  96. head="Aoidos' Calot +2",
  97. neck="Orunmila's Torque",
  98. ear1="Loquac. Earring",
  99. ear2="Aoidos' Earring",
  100. body="Marduk's Jubbah +1",
  101. hands="Gendewitha Gages +1",
  102. ring1="Prolix Ring",
  103. ring2="Veneficium Ring",
  104. back="Swith Cape +1",
  105. waist="Witful Belt",
  106. legs="Gendewitha Spats",
  107. feet="Bihu Slippers"}
  108.  
  109. -- Elemental Staves --
  110. sets.Precast.Thunder = {main='Apamajas I'}
  111. sets.Precast.Water = {main='Haoma I'}
  112. sets.Precast.Fire = {main='Atar I'}
  113. sets.Precast.Ice = {main='Vourukasha I'}
  114. sets.Precast.Wind = {main='Vayuvata I'}
  115. sets.Precast.Earth = {main='Vishrava I'}
  116. sets.Precast.Light = {main='Arka I'}
  117. sets.Precast.Dark = {main='Xsaeta I'}
  118.  
  119. -- Precast Daurdabla Set --
  120. sets.Precast.Daurdabla = {
  121. main="Felibre's Dague",
  122. sub="Genbu's Shield",
  123. range="Daurdabla",
  124. ammo=empty,
  125. head="Aoidos' Calot +2",
  126. neck="Orunmila's Torque",
  127. ear1="Loquac. Earring",
  128. ear2="Aoidos' Earring",
  129. body="Marduk's Jubbah +1",
  130. hands="Gendewitha Gages +1",
  131. ring1="Prolix Ring",
  132. ring2="Veneficium Ring",
  133. back="Swith Cape +1",
  134. waist="Witful Belt",
  135. legs="Gendewitha Spats",
  136. feet="Bihu Slippers"}
  137.  
  138. -- Fastcast Set --
  139. sets.Precast.FastCast = {
  140. main="Terra's Staff",
  141. sub="Oneiros Grip",
  142. ammo="Impatiens",
  143. head="Nahtirah Hat",
  144. neck="Orunmila's Torque",
  145. ear1="Loquac. Earring",
  146. body="Marduk's Jubbah +1",
  147. hands="Gendewitha Gages",
  148. ring1="Prolix Ring",
  149. ring2="Veneficium Ring",
  150. back="Swith Cape +1",
  151. waist="Witful Belt"}
  152.  
  153. -- Cure Precast Set --
  154. sets.Precast.Cure = {
  155. ammo="Impatiens",
  156. head="Nahtirah Hat",
  157. neck="Orunmila's Torque",
  158. ear2="Loquac. Earring",
  159. body="Heka's Kalasiris",
  160. hands="Gendewitha Gages +1",
  161. ring1="Prolix Ring",
  162. ring2="Veneficium Ring",
  163. back="Pahtli Cape",
  164. waist="Witful Belt"}
  165.  
  166. -- Midcast Base Set --
  167. sets.Midcast = {
  168. head="Nahtirah Hat",
  169. neck="Orunmila's Torque",
  170. ear1="Loquac. Earring",
  171. body="Hedera Cotehardie",
  172. hands="Gendewitha Gages +1",
  173. ring1="Prolix Ring",
  174. ring2="Veneficium Ring",
  175. back="Swith Cape +1",
  176. waist="Phos Belt +1",
  177. legs="Brioso Cann. +1",
  178. feet="Brioso Slippers +1"}
  179.  
  180. -- Song Debuff Set --
  181. sets.Midcast.Wind = {
  182. main="Venabulum",
  183. sub="Mephitis Grip,"
  184. range="Gjallarhorn",
  185. head="Brioso Roundlet +1",
  186. neck="Wind Torque",
  187. ear1="Lifestorm Earring",
  188. ear2="Psystorm Earring",
  189. body="Brioso Just. +1",
  190. hands="Lurid Mitts",
  191. ring1="Maquette Ring",
  192. ring2="Sangoma Ring",
  193. back="Refraction Cape",
  194. waist="Ovate Rope",
  195. legs="Brioso Cann. +1",
  196. feet="Bokwus Boots"}
  197.  
  198. -- Song Buff Set --
  199. sets.Midcast.WindBuff = {
  200. main="Legato Dagger",
  201. sub="Genbu's Shield",
  202. range="Gjallarhorn",
  203. ammo=empty,
  204. head="Aoidos' Calot +2",
  205. neck="Aoidos' Matinee",
  206. ear1="Loquac. Earring",
  207. ear2="Aoidos' Earring",
  208. body="Aoidos' Hngrln. +2",
  209. hands="Ad. Mnchtte. +2",
  210. ring1="Prolix Ring",
  211. ring2="Veneficium Ring",
  212. back="Swith Cape +1",
  213. waist="Witful Belt",
  214. legs="Mdk. Shalwar +1",
  215. feet="Brioso Slippers +1"}
  216.  
  217. sets.Midcast.March = {hands="Ad. Mnchtte. +2"}
  218. sets.Midcast.Minuet = {body="Aoidos' Hngrln. +2"}
  219. sets.Midcast.Madrigal = {head="Aoidos' Calot +2"}
  220. sets.Midcast.Ballad = {legs="Aoidos' Rhing. +2"}
  221. sets.Midcast.Scherzo = {feet="Aoidos' Cothrn. +2"}
  222. sets.Midcast.Mazurka = {head="Nahtirah Hat"}
  223. sets.Midcast.Paeon = {head="Brioso Roundlet +1"}
  224. sets.Midcast.Finale = {}
  225. sets.Midcast.Lullaby = {hands="Brioso Cuffs+1"}
  226.  
  227. -- Cure Set --
  228. sets.Midcast.Cure = {
  229. main="Arka IV",
  230. sub="Achaq Grip",
  231. ammo="Mana Ampulla",
  232. head="Gende. Caubeen",
  233. neck="Colossus's Torque",
  234. ear1="Lifestorm Earring",
  235. ear2="Novia Earring",
  236. body="Heka's Kalasiris",
  237. hands="Gendewitha Gages +1",
  238. ring1="Haoma's Ring",
  239. ring2="Sangoma Ring",
  240. back="Tempered Cape",
  241. waist="Pythia Sash +1",
  242. legs="Mdk. Shalwar +1",
  243. feet="Brioso Slippers +1"}
  244.  
  245. -- Curaga Set --
  246. sets.Midcast.Curaga = {
  247. main="Arka IV",
  248. sub="Achaq Grip",
  249. ammo="Oreiad's Tathlum",
  250. head="Gende. Caubeen",
  251. neck="Nuna Gorget +1",
  252. ear1="Lifestorm Earring",
  253. ear2="Loquac. Earring",
  254. body="Heka's Kalasiris",
  255. hands="Gendewitha Gages",
  256. ring1="Aquasoul Ring",
  257. ring2="Karka Ring",
  258. back="Pahtli Cape",
  259. waist="Pythia Sash +1",
  260. legs="Gendewitha Spats",
  261. feet="Brioso Slippers +1"}
  262.  
  263. -- Haste Set --
  264. sets.Midcast.Haste = set_combine(sets.Precast.FastCast,{
  265. head="Nahtirah Hat",
  266. neck="Orunmila's Torque",
  267. ear1="Loquac. Earring",
  268. body="Hedera Cotehardie",
  269. hands="Gendewitha Gages +1",
  270. ring1="Prolix Ring",
  271. ring2="Veneficium Ring",
  272. back="Swith Cape +1",
  273. waist="Phos Belt +1",
  274. legs="Brioso Cann. +1",
  275. feet="Brioso Slippers +1"}
  276.  
  277. -- Cursna Set --
  278. sets.Midcast.Cursna = set_combine(sets.Midcast.Haste,{
  279. ring1="Haoma's Ring",
  280. feet="Gende. Galoshes"})
  281.  
  282. -- Stoneskin Set --
  283. sets.Midcast.Stoneskin = set_combine(sets.Midcast.Haste)
  284.  
  285. -- JA Sets --
  286. sets.JA = {}
  287. sets.JA.Nightingale = {feet="Bihu Slippers"}
  288. sets.JA.Troubadour = {body="Bard's Justaucorps +2"}
  289. sets.JA["Soul Voice"] = {legs="Brd. Cannions +2"}
  290.  
  291. -- Waltz --
  292. sets.Waltz = {}
  293.  
  294. -- Melee Sets --
  295. sets.Melee = {}
  296. sets.Melee.MidACC = set_combine(sets.Melee,{})
  297. sets.Melee.HighACC = set_combine(sets.Melee.MidACC,{})
  298.  
  299. -- WS Base Set --
  300. sets.WS = {}
  301.  
  302. sets.WS.Exenterator = {}
  303. sets.WS.Exenterator.MidACC = set_combine(sets.WS.Exenterator,{})
  304. sets.WS.Exenterator.HighACC = set_combine(sets.WS.Exenterator.MidACC,{})
  305.  
  306. sets.WS.Evisceration = {}
  307. sets.WS.Evisceration.MidACC = set_combine(sets.WS.Evisceration,{})
  308. sets.WS.Evisceration.HighACC = set_combine(sets.WS.Evisceration.MidACC,{})
  309.  
  310. sets.WS["Mercy Stroke"] = {}
  311. sets.WS["Mercy Stroke"].MidACC = set_combine(sets.WS["Mercy Stroke"],{})
  312. sets.WS["Mercy Stroke"].HighACC = set_combine(sets.WS["Mercy Stroke"].MidACC,{})
  313.  
  314. sets.WS["Rudra's Storm"] = {}
  315. sets.WS["Rudra's Storm"].MidACC = set_combine(sets.WS["Rudra's Storm"],{})
  316. sets.WS["Rudra's Storm"].HighACC = set_combine(sets.WS["Rudra's Storm"].MidACC,{})
  317.  
  318. sets.WS["Mordant Rime"] = {}
  319.  
  320. -- Lock Main Weapon --
  321. sets.MainWeapon = {
  322. main="Legato Dagger",
  323. sub="Genbu's Shield"}
  324. end
  325.  
  326. function pretarget(spell,action)
  327. if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  328. cancel_spell()
  329. send_command('input /item "Echo Drops" <me>')
  330. elseif spell.type == "BardSong" and spell.target.name == player.name and buffactive.Pianissimo then -- Change Target From <me> To <t> When Pianissimo Is Active --
  331. change_target('<t>')
  332. elseif spell.type == 'BardSong' and spell.target.type and spell.target.type == 'PLAYER' and not buffactive.Pianissimo and not spell.target.charmed and not pianissimo_cycle then -- Auto Pianoissimo When You Cast A Song On A Player --
  333. cancel_spell()
  334. pianissimo_cycle = true
  335. send_command('input /ja "Pianissimo" <me>;wait 1.5;input /ma "'..spell.name..'" '..spell.target.name..';')
  336. return
  337. elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  338. degrade_spell(spell,Cure_Spells)
  339. elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  340. degrade_spell(spell,Curaga_Spells)
  341. end
  342. if spell.name ~= 'Pianissimo' then
  343. pianissimo_cycle = false
  344. end
  345. end
  346.  
  347. function precast(spell,action)
  348. if spell.action_type == 'Magic' then
  349. if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu or BardSong If You Are Silenced or Out of Range --
  350. cancel_spell()
  351. add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  352. return
  353. else
  354. if spell.type == 'BardSong' then
  355. if Daurdabla == 'ON' then
  356. equip(sets.Precast.Daurdabla)
  357. else
  358. if buffactive.Nightingale then
  359. equip_song_gear(spell)
  360. return
  361. else
  362. equip_song_gear(spell)
  363. equip(sets.Precast.SongCast)
  364. end
  365. end
  366. elseif string.find(spell.english,'Cur') and spell.english ~= "Cursna" then
  367. equip(sets.Precast.Cure)
  368. elseif string.find(spell.english,'Utsusemi') then
  369. if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  370. cancel_spell()
  371. add_to_chat(123, spell.english .. ' Canceled: [3+ Images]')
  372. return
  373. else
  374. equip(sets.Precast.FastCast)
  375. end
  376. else
  377. equip(sets.Precast.FastCast)
  378. end
  379. end
  380. elseif spell.type == "WeaponSkill" then
  381. if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  382. cancel_spell()
  383. add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  384. return
  385. else
  386. equipSet = sets.WS
  387. if equipSet[spell.english] then
  388. equipSet = equipSet[spell.english]
  389. end
  390. if equipSet[AccArray[AccIndex]] then
  391. equipSet = equipSet[AccArray[AccIndex]]
  392. end
  393. if spell.english == "Evisceration" and player.tp > 299 then
  394. equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"})
  395. end
  396. equip(equipSet)
  397. end
  398. elseif spell.type == "JobAbility" then
  399. if sets.JA[spell.english] then
  400. equip(sets.JA[spell.english])
  401. end
  402. elseif spell.type == "Waltz" then
  403. refine_waltz(spell,action)
  404. equip(sets.Waltz)
  405. elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  406. cast_delay(0.2)
  407. send_command('cancel Sneak')
  408. end
  409. if sets.Precast[spell.element] and not buffactive.Nightingale and ElementalStaff == 'ON' then
  410. equip(sets.Precast[spell.element])
  411. end
  412. if Main == 'ON' then
  413. equip(sets.MainWeapon)
  414. end
  415. end
  416.  
  417. function midcast(spell,action)
  418. equipSet = {}
  419. if spell.type:endswith('Magic') or spell.type == 'Ninjutsu' then
  420. equipSet = sets.Midcast
  421. if equipSet[spell.english] then
  422. equipSet = equipSet[spell.english]
  423. elseif string.find(spell.english,'Cure') then
  424. equipSet = equipSet.Cure
  425. elseif string.find(spell.english,'Cura') then
  426. equipSet = equipSet.Curaga
  427. elseif spell.english == "Stoneskin" then
  428. if buffactive.Stoneskin then
  429. send_command('@wait 2.8;cancel stoneskin')
  430. end
  431. equipSet = equipSet.Stoneskin
  432. elseif spell.english == "Sneak" then
  433. if spell.target.name == player.name and buffactive['Sneak'] then
  434. send_command('cancel sneak')
  435. end
  436. equipSet = equipSet.Haste
  437. elseif string.find(spell.english,'Utsusemi') then
  438. if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  439. send_command('@wait 1.7;cancel Copy Image*')
  440. end
  441. equipSet = equipSet.Haste
  442. elseif spell.english == 'Monomi: Ichi' then
  443. if buffactive['Sneak'] then
  444. send_command('@wait 1.7;cancel sneak')
  445. end
  446. equipSet = equipSet.Haste
  447. end
  448. elseif spell.type == 'BardSong' then
  449. if Daurdabla == 'ON' then
  450. equip(sets.Precast.Daurdabla)
  451. else
  452. equip_song_gear(spell)
  453. end
  454. end
  455. equip(equipSet)
  456. if Main == 'ON' then
  457. equip(sets.MainWeapon)
  458. end
  459. end
  460.  
  461. function aftercast(spell,action)
  462. if spell.type and spell.type == 'BardSong' and spell.target and spell.target.name == player.name and not spell.interrupted then
  463. local t = os.time()
  464.  
  465. local tempreg = {}
  466. for i,v in pairs(timer_reg) do
  467. if v < t then tempreg[i] = true end
  468. end
  469. for i,v in pairs(tempreg) do
  470. timer_reg[i] = nil
  471. end
  472.  
  473. local dur = calculate_duration(spell.name)
  474. if timer_reg[spell.name] then
  475. if (timer_reg[spell.name] - t) <= 120 then
  476. send_command('timers delete "'..spell.name..'"')
  477. timer_reg[spell.name] = t + dur
  478. send_command('timers create "'..spell.name..'" '..dur..' down')
  479. end
  480. else
  481. local maxsongs = 2
  482. if player.equipment.range == 'Daurdabla' then
  483. maxsongs = maxsongs+2
  484. end
  485. if buffactive['Clarion Call'] then
  486. maxsongs = maxsongs+1
  487. end
  488. if maxsongs < table.length(timer_reg) then
  489. maxsongs = table.length(timer_reg)
  490. end
  491.  
  492. if table.length(timer_reg) < maxsongs then
  493. timer_reg[spell.name] = t+dur
  494. send_command('timers create "'..spell.name..'" '..dur..' down')
  495. else
  496. local rep,repsong
  497. for i,v in pairs(timer_reg) do
  498. if t+dur > v then
  499. if not rep or rep > v then
  500. rep = v
  501. repsong = i
  502. end
  503. end
  504. end
  505. if repsong then
  506. timer_reg[repsong] = nil
  507. send_command('timers delete "'..repsong..'"')
  508. timer_reg[spell.name] = t+dur
  509. send_command('timers create "'..spell.name..'" '..dur..' down')
  510. end
  511. end
  512. end
  513. end
  514. status_change(player.status)
  515. end
  516.  
  517. function status_change(new,old)
  518. if new == 'Engaged' then
  519. equipSet = sets.Melee
  520. if equipSet[AccArray[AccIndex]] then
  521. equipSet = equipSet[AccArray[AccIndex]]
  522. end
  523. equip(equipSet)
  524. elseif new == 'Idle' then
  525. equip(sets.Idle[IdleArray[IdleIndex]])
  526. elseif new == 'Resting' then
  527. equip(sets.Resting)
  528. end
  529. if Main == 'ON' then
  530. equip(sets.MainWeapon)
  531. end
  532. end
  533.  
  534. function buff_change(buff,gain)
  535. buff = string.lower(buff)
  536. if buff == "aftermath: lv.3" then -- AM3 Timer --
  537. if gain then
  538. send_command('timers create "Aftermath: Lv.3" 180 down;wait 120;input /echo Aftermath: Lv.3 [WEARING OFF IN 60 SEC.];wait 30;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 20;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
  539. else
  540. send_command('timers delete "Aftermath: Lv.3"')
  541. add_to_chat(123,'AM3: [OFF]')
  542. end
  543. elseif buff == 'weakness' then -- Weakness Timer --
  544. if gain then
  545. send_command('timers create "Weakness" 300 up')
  546. else
  547. send_command('timers delete "Weakness"')
  548. end
  549. end
  550. if not midaction() then
  551. status_change(player.status)
  552. end
  553. end
  554.  
  555. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  556. function self_command(command)
  557. if command == 'C1' then
  558. send_command('input /ma "Victory March" <me>')
  559. add_to_chat(158,'Melee Speed II: [Victory March]')
  560. elseif command == 'C2' then
  561. send_command('input /ma "Advancing March" <me>')
  562. add_to_chat(158,'Melee Speed: [Advancing March]')
  563. elseif command == 'C3' then
  564. send_command('input /ma "Valor Minuet V" <me>')
  565. add_to_chat(158,'Melee Attack: [Valor Minuet V]')
  566. elseif command == 'C5' then
  567. send_command('input /ma "Valor Minuet IV" <me>')
  568. add_to_chat(158,'Melee Attack: [Valor Minuet IV]')
  569. elseif command == 'C7' then
  570. send_command('input /ma "Hunter\'s Prelude" <me>')
  571. add_to_chat(158,'Ranged Accuracy: [Hunter\'s Prelude]')
  572. elseif command == 'C15' then
  573. send_command('input /ma "Archer\'s Prelude" <me>')
  574. add_to_chat(158,'Ranged Accuracy: [Archer\'s Prelude]')
  575. elseif command == 'C9' then
  576. send_command('input /ma "Blade Madrigal" <me>')
  577. add_to_chat(158,'Melee Accuracy II: [Blade Madrigal]')
  578. elseif command == 'C10' then
  579. send_command('input /ma "Sword Madrigal" <me>')
  580. add_to_chat(158,'Melee Accuracy: [Sword Madrigal]')
  581. elseif command == 'C12' then
  582. send_command('input /ma "Valor Minuet III" <me>')
  583. add_to_chat(158,'Melee Attack: [Valor Minuet III]')
  584. elseif command == 'C8' then -- Distance Toggle --
  585. if player.target.distance then
  586. target_distance = math.floor(player.target.distance*10)/10
  587. add_to_chat(158,'Distance: '..target_distance)
  588. else
  589. add_to_chat(123,'No Target Selected')
  590. end
  591. elseif command == 'C16' then -- Main Weapon Toggle --
  592. if Main == 'ON' then
  593. Main = 'OFF'
  594. add_to_chat(123,'Main Weapon: [Unlocked]')
  595. else
  596. Main = 'ON'
  597. add_to_chat(158,'Main Weapon: [Locked]')
  598. end
  599. status_change(player.status)
  600. elseif command == 'C18' then -- Daurdabla Toggle --
  601. if Daurdabla == 'ON' then
  602. Daurdabla = 'OFF'
  603. add_to_chat(123,'Daurdabla: [OFF]')
  604. else
  605. Daurdabla = 'ON'
  606. add_to_chat(158,'Daurdabla: [ON]')
  607. end
  608. status_change(player.status)
  609. elseif command == 'C17' then -- Accuracy Level Toggle --
  610. AccIndex = (AccIndex % #AccArray) + 1
  611. status_change(player.status)
  612. add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  613. elseif command == 'C6' then -- Idle Toggle --
  614. IdleIndex = (IdleIndex % #IdleArray) + 1
  615. add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
  616. status_change(player.status)
  617. elseif command:match('^SC%d$') then
  618. send_command('//' .. sc_map[command])
  619. end
  620. end
  621.  
  622. function equip_song_gear(spell)
  623. if DaurdSongs:contains(spell.english) then
  624. equip(sets.Precast.Daurdabla)
  625. add_to_chat(158,'Daurdabla: [ON]')
  626. else
  627. if spell.target.type == 'MONSTER' then
  628. equip(sets.Midcast.Wind)
  629. if string.find(spell.english,'Finale') then equip(sets.Midcast.Finale) end
  630. if string.find(spell.english,'Lullaby') then equip(sets.Midcast.Lullaby) end
  631. else
  632. equip(sets.Midcast.WindBuff)
  633. if string.find(spell.english,'March') then equip(sets.Midcast.March) end
  634. if string.find(spell.english,'Minuet') then equip(sets.Midcast.Minuet) end
  635. if string.find(spell.english,'Madrigal') then equip(sets.Midcast.Madrigal) end
  636. if string.find(spell.english,'Ballad') then equip(sets.Midcast.Ballad) end
  637. if string.find(spell.english,'Scherzo') then equip(sets.Midcast.Scherzo) end
  638. if string.find(spell.english,'Mazurka') then equip(sets.Midcast.Mazurka) end
  639. if string.find(spell.english,'Paeon') then equip(sets.Midcast.Paeon) end
  640. end
  641. end
  642. end
  643.  
  644. function calculate_duration(name)
  645. local mult = 1
  646. if player.equipment.main == "Carnwenhan" then mult = mult + 0.5 end
  647. if player.equipment.range == 'Daurdabla' then mult = mult + 0.3 end
  648. if player.equipment.range == "Gjallarhorn" then mult = mult + 0.4 end
  649. if player.equipment.neck == "Aoidos' Matinee" then mult = mult + 0.1 end
  650. if player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
  651. if player.equipment.legs == "Mdk. Shalwar +1" then mult = mult + 0.1 end
  652. if player.equipment.feet == "Brioso Slippers +1" then mult = mult + 0.11 end
  653.  
  654. if string.find(name,'Paeon') and player.equipment.head == 'Brioso Roundlet +1' then mult = mult + 0.1 end
  655. if string.find(name,'March') and player.equipment.hands == 'Ad. Mnchtte. +2' then mult = mult + 0.1 end
  656. if string.find(name,'Minuet') and player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
  657. if string.find(name,'Madrigal') and player.equipment.head == "Aoidos' Calot +2" then mult = mult + 0.1 end
  658. if string.find(name,'Ballad') and player.equipment.legs == "Aoidos' Rhing. +2" then mult = mult + 0.1 end
  659. if string.find(name,'Scherzo') and player.equipment.feet == "Aoidos' Cothrn. +2" then mult = mult + 0.1 end
  660.  
  661. if buffactive.Troubadour then
  662. mult = mult*2
  663. end
  664. if string.find(name,'Scherzo') then
  665. if buffactive['Soul Voice'] then
  666. mult = mult*2
  667. elseif buffactive['marcato'] then
  668. mult = mult*1.5
  669. end
  670. end
  671.  
  672. mult = mult - 0.05
  673.  
  674. local totalDuration = mult*120
  675.  
  676. return totalDuration
  677. end
  678.  
  679. function actualCost(originalCost)
  680. if buffactive["Penury"] then
  681. return originalCost*.5
  682. elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
  683. return originalCost*.9
  684. elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
  685. return originalCost*1.1
  686. else
  687. return originalCost
  688. end
  689. end
  690.  
  691. function degrade_spell(spell,degrade_array)
  692. spell_index = table.find(degrade_array,spell.name)
  693. if spell_index > 1 then
  694. new_spell = degrade_array[spell_index - 1]
  695. change_spell(new_spell,spell.target.raw)
  696. add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  697. end
  698. end
  699.  
  700. function change_spell(spell_name,target)
  701. cancel_spell()
  702. send_command('//'..spell_name..' '..target)
  703. end
  704.  
  705. function refine_waltz(spell,action)
  706. if spell.type ~= 'Waltz' then
  707. return
  708. end
  709.  
  710. if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" then
  711. return
  712. end
  713.  
  714. local newWaltz = spell.english
  715. local waltzID
  716.  
  717. local missingHP
  718.  
  719. if spell.target.type == "SELF" then
  720. missingHP = player.max_hp - player.hp
  721. elseif spell.target.isallymember then
  722. local target = find_player_in_alliance(spell.target.name)
  723. local est_max_hp = target.hp / (target.hpp/100)
  724. missingHP = math.floor(est_max_hp - target.hp)
  725. end
  726.  
  727. if missingHP ~= nil then
  728. if player.sub_job == 'DNC' then
  729. if missingHP < 40 and spell.target.name == player.name then
  730. add_to_chat(123,'Full HP!')
  731. cancel_spell()
  732. return
  733. elseif missingHP < 150 then
  734. newWaltz = 'Curing Waltz'
  735. waltzID = 190
  736. elseif missingHP < 300 then
  737. newWaltz = 'Curing Waltz II'
  738. waltzID = 191
  739. else
  740. newWaltz = 'Curing Waltz III'
  741. waltzID = 192
  742. end
  743. else
  744. return
  745. end
  746. end
  747.  
  748. local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50}
  749. local tpCost = waltzTPCost[newWaltz]
  750.  
  751. local downgrade
  752.  
  753. if player.tp < tpCost then
  754.  
  755. if player.tp < 20 then
  756. add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  757. cancel_spell()
  758. return
  759. elseif player.tp < 35 then
  760. newWaltz = 'Curing Waltz'
  761. elseif player.tp < 50 then
  762. newWaltz = 'Curing Waltz II'
  763. end
  764.  
  765. downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  766. end
  767.  
  768. if newWaltz ~= spell.english then
  769. send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  770. if downgrade then
  771. add_to_chat(8, downgrade)
  772. end
  773. cancel_spell()
  774. return
  775. end
  776.  
  777. if missingHP > 0 then
  778. add_to_chat(8,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  779. end
  780. end
  781.  
  782. function find_player_in_alliance(name)
  783. for i,v in ipairs(alliance) do
  784. for k,p in ipairs(v) do
  785. if p.name == name then
  786. return p
  787. end
  788. end
  789. end
  790. end
  791.  
  792. function sub_job_change(newSubjob, oldSubjob)
  793. select_default_macro_book()
  794. end
  795.  
  796. function set_macro_page(set,book)
  797. if not tonumber(set) then
  798. add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  799. return
  800. end
  801. if set < 1 or set > 10 then
  802. add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  803. return
  804. end
  805.  
  806. if book then
  807. if not tonumber(book) then
  808. add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  809. return
  810. end
  811. if book < 1 or book > 20 then
  812. add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  813. return
  814. end
  815. send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  816. else
  817. send_command('@input /macro set '..tostring(set))
  818. end
  819. end
  820.  
  821. function select_default_macro_book()
  822. -- Default macro set/book
  823. if player.sub_job == 'WHM' then
  824. set_macro_page(1, 5)
  825. elseif player.sub_job == 'BLM' then
  826. set_macro_page(1, 5)
  827. elseif player.sub_job == 'DNC' then
  828. set_macro_page(1, 5)
  829. elseif player.sub_job == 'NIN' then
  830. set_macro_page(1, 5)
  831. elseif player.sub_job == 'WAR' then
  832. set_macro_page(1, 5)
  833. else
  834. set_macro_page(1, 3)
  835. end
  836. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement