BenWagner

BRD(GS)

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