Advertisement
Guest User

Untitled

a guest
Dec 1st, 2016
643
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.44 KB | None | 0 0
  1. include('how_about_no.lua')
  2. include('organizer-lib.lua')
  3. include('no_interruptions.lua')
  4. include('spam_protection.lua')
  5. include('spell_stack.lua')
  6. include('common_commands.lua')
  7.  
  8. valid_controllers = alt_names
  9.  
  10. --Duration of non JA songs
  11. songDuration = 250
  12. --Duration of JA songs
  13. songDurationJA = 540
  14. --self_status_fix
  15. totalSongs = 3
  16. currentMaxSongs = totalSongs
  17.  
  18. dummySongs = T{'Fire Carol II', 'Ice Carol II'}
  19. threnodies = I{'Ice Threnody', 'Lightning Threnody', 'Earth Threnody', 'Wind Threnody', 'Ice Threnody', 'Light Threnody', 'Dark Threnody', 'Fire Threnody'}
  20.  
  21. function get_sets()
  22. currentThrenody = 'Fire Threnody'
  23. songMode = 'Gjallarhorn'
  24. mythicTries = 0
  25. lastSongs = 0
  26. lastChat = 0
  27. doCures = true
  28. allianceCheck = true
  29. allianceHeal = false
  30. autoJA = false
  31. auto1hr = false
  32. autoSS = false
  33. lastx = 0
  34. lasty = 0
  35. songs = T{}
  36. doingSV = false
  37. replaceSong = "Sentinel's Scherzo"
  38. dtMode = false
  39. justUsedJA = false
  40.  
  41. send_command('input /macro book 10;')
  42.  
  43. if file_exists('gear/'..player.name..'_BRD.lua') then
  44. include('gear/'..player.name..'_BRD.lua')
  45. elseif file_exists('gear/'..player.name..'_brd.lua') then
  46. include('gear/'..player.name..'_brd.lua')
  47. elseif file_exists('gear/'..player.name:lower()..'_BRD.lua') then
  48. include('gear/'..player.name:lower()..'_BRD.lua')
  49. elseif file_exists('gear/'..player.name:lower()..'_brd.lua') then
  50. include('gear/'..player.name:lower()..'_brd.lua')
  51. elseif file_exists('gear/'..player.name:upper()..'_BRD.lua') then
  52. include('gear/'..player.name:upper()..'_BRD.lua')
  53. elseif file_exists('gear/'..player.name:upper()..'_brd.lua') then
  54. include('gear/'..player.name:upper()..'_brd.lua')
  55. elseif file_exists('gear/brd.lua') then
  56. include('gear/brd.lua')
  57. elseif file_exists('gear/BRD.lua') then
  58. include('gear/BRD.lua')
  59. else
  60. windower.add_to_chat(028,'Error: Gear file is missing. Please add gear file in /gearswap/data/gear/ named as '..player.name..'_BRD.lua')
  61. end
  62.  
  63. if sets['ExtraSong']['PrecastSet'].range == 'Daurdabla' then
  64. totalSongs = 4
  65. end
  66. currentMaxSongs = totalSongs
  67. end
  68.  
  69.  
  70. function pretarget(spell)
  71. local validSpell = true
  72. --Determine if spell is castable, cancel if not and don't add to spellStack queue
  73. if spell.target.type == 'SELF' then
  74.  
  75. thisTarget = player.name
  76.  
  77. if spell.targets['Self'] == false then
  78. cancel_spell()
  79. validSpell = false
  80. end
  81.  
  82. elseif spell.target.type == 'PLAYER' then
  83.  
  84. thisTarget = spell.target.name
  85.  
  86. --Check if the spell target is a party member, and if so make sure the spell is castable on party members, otherwise check if castable on general players
  87. if checkPartyName(spell.target.name) then
  88.  
  89. if spell.targets['Party'] == false then
  90. cancel_spell()
  91. validSpell = false
  92. end
  93.  
  94. else
  95.  
  96. if spell.targets['Player'] == false then
  97. cancel_spell()
  98. validSpell = false
  99. end
  100.  
  101. end
  102.  
  103. elseif spell.target.type == 'MONSTER' then
  104.  
  105. if spell.target.raw == '<bt>' then
  106. thisTarget = 'bt'
  107. else
  108. thisTarget = 't'
  109. end
  110.  
  111. if spell.targets['Enemy'] == false then
  112. cancel_spell()
  113. validSpell = false
  114. end
  115.  
  116. else
  117. validSpell = false
  118. end
  119.  
  120. if spell.prefix == '/magic' then
  121. thisPrefix = 'ma'
  122. elseif spell.prefix == '/weaponskill' then
  123. thisPrefix = 'ws'
  124. elseif spell.prefix == '/jobability' then
  125. thisPrefix = 'ja'
  126. elseif spell.prefix == '/song' then
  127. thisPrefix = 'song'
  128.  
  129. end if spell.english == 'Horde Lullaby' or spell.english == 'Horde Lullaby II' or spell.english == 'Foe Lullaby' or spell.english == 'Foe Lullaby II' then
  130. if thisTarget ~= 'bt' and thisTarget ~= 't' then
  131. thisTarget = 't'
  132. end
  133. end
  134.  
  135. --Ensure the spell was castable, spellStack has a queue and the spell isn't already in it, if so then add to front of spellStack queue to allow players to add to queue by using macros in emergencies
  136. if validSpell and #spellStack > 0 and spell.prefix ~= '/item' and not checkInQueue(spell.english,thisTarget,thisPrefix) then
  137. windower.add_to_chat(050,'Added '..spell.english..' on '..thisTarget..' to front of queue')
  138. add_to_front(spell.english, thisTarget, false, thisPrefix)
  139. end
  140.  
  141. if spell.english == 'Sneak' and spell.target.name == player.name and player.sub_job == 'DNC' and is_ability_ready('Spectral Jig') then
  142. cancel_spell()
  143. windower.send_command('input /ja "Spectral Jig" <me>;')
  144. end
  145. end
  146.  
  147. function precast(spell,action)
  148. if check_ready(spell) then
  149. if spell.type == 'WeaponSkill' then
  150. if spell.target.distance > 10 or player.tp < 900 then
  151. cancel_spell()
  152. return
  153. end
  154.  
  155. if sets[spell.english] then
  156. if buffactive['Reive Mark'] then
  157. equip(sets[spell.english],sets['Reive'])
  158. else
  159. equip(sets[spell.english])
  160. end
  161. end
  162.  
  163. windower.add_to_chat(050, '['..spell.name..'] '..spell.target.name..' <'..player.tp..'%>')
  164. elseif spell.english == "Spectral Jig" and is_ability_ready('Spectral Jig') then
  165. send_command('cancel 71;')
  166. elseif spell.type == "JobAbility" then
  167. if sets[spell.english] then
  168. equip(sets[spell.english])
  169. end
  170. if spell.english == "Clarion Call" then
  171. currentMaxSongs = totalSongs + 1
  172. end
  173. elseif spell.type == "BardSong" then
  174. if buffactive["clarion call"] then
  175. currentMaxSongs = totalSongs+1
  176. end
  177.  
  178. if buffactive['pianissimo'] and (spell.english =='Horde Lullaby' or spell.english == 'Horde Lullaby II') then
  179. send_command('cancel 409;')
  180. end
  181.  
  182. if dummySongs:contains(spell.english) then
  183. songMode = 'ExtraSong'
  184. else
  185. songMode = 'Gjallarhorn'
  186. end
  187.  
  188. if buffactive['Nightingale'] and buffactive['Troubadour'] then
  189. if spell.english:sub(1,13) == "Mage's Ballad" then
  190. equip(sets[songMode]['BalladMidcast'])
  191. elseif spell.english == "Sentinel's Scherzo" then
  192. equip(sets[songMode]['Scherzo'])
  193. elseif spell.english == 'Horde Lullaby' or spell.english == 'Horde Lullaby II' then
  194. equip(sets['Horde Lullaby'])
  195. elseif spell.english == 'Foe Lullaby' or spell.english == 'Foe Lullaby II' then
  196. equip(sets['Lullaby'])
  197. elseif spell.english:sub(1,12) == "Army's Paeon" then
  198. equip(sets[songMode]['Paeon'])
  199. else
  200. equip(sets[songMode]['MidcastSet'])
  201. end
  202. else
  203. equip(sets[songMode]['PrecastSet'])
  204. end
  205. elseif spell.type == "WhiteMagic" then
  206. if player.sub_job == "DNC" and spell.english == 'Sneak' then
  207. cancel_spell()
  208. send_command('input /ja "Spectral Jig" <me>;')
  209. elseif spell.english:sub(1,4) == 'Cure' or spell.english:sub(1,4) == 'Cura' then
  210. equip(sets['PreCureSet'])
  211. else
  212. equip(sets['PrecastSpell'])
  213. end
  214. elseif spell.english == "Spectral Jig" and is_ability_ready('Spectral Jig') then
  215. send_command('cancel 71;')
  216. end
  217.  
  218. spam_protection_on(spell)
  219. else
  220. cancel_spell()
  221. end
  222. end
  223.  
  224. function midcast(spell,action)
  225. if spell.type == "BardSong" then
  226. if dummySongs:contains(spell.english) then
  227. songMode = 'ExtraSong'
  228. else
  229. songMode = 'Gjallarhorn'
  230. end
  231.  
  232. if spell.english:sub(1,13) == "Mage's Ballad" then
  233. equip(sets[songMode]['BalladMidcast'])
  234. elseif spell.english:sub(-8) == "Madrigal" then
  235. equip(sets[songMode]['Madrigal'])
  236. elseif spell.english:sub(-7) == "Prelude" then
  237. equip(sets[songMode]['Prelude'])
  238. elseif spell.english == "Sentinel's Scherzo" then
  239. equip(sets[songMode]['Scherzo'])
  240. elseif spell.english == 'Horde Lullaby' or spell.english == 'Horde Lullaby II' then
  241. equip(sets['Horde Lullaby'])
  242. elseif spell.english == 'Foe Lullaby' or spell.english == 'Foe Lullaby II' then
  243. equip(sets['Lullaby'])
  244. elseif spell.english:sub(1,12) == "Army's Paeon" then
  245. equip(sets[songMode]['Paeon'])
  246. elseif spell.english == "Maiden's Virelai" or spell.english == 'Pining Nocturne' or spell.english:sub(-5) == 'Elegy' or spell.english:sub(-11) == 'Threnody II' or spell.english:sub(-8) == 'Threnody' or spell.english == 'Magic Finale' or spell.english:sub(0,7) == 'Foe Req' then
  247. equip(sets['MaccSet'])
  248. else
  249. equip(sets[songMode]['MidcastSet'])
  250. end
  251. elseif spell.type == "WhiteMagic" then
  252. if spell.english:sub(1,4) == 'Cure' or spell.english:sub(1,4) == 'Cura' then
  253. equip(sets['CureSet'])
  254. else
  255. equip(sets['PrecastSpell'])
  256. end
  257. end
  258. end
  259.  
  260. function aftercast(spell,action)
  261. if spam_protection_off(spell)then
  262. if spell.english == 'Troubadour' or spell.english == 'Nightingale' then
  263. justUsedJA = true
  264. end
  265. handle_idle()
  266. end
  267.  
  268. checkAftercast(spell)
  269. end
  270.  
  271. function handle_idle()
  272. if player.status == 'Engaged' then
  273. if player.sub_job == 'DNC' or player.sub_job == 'NIN' then
  274. equip(sets['DWMeleeSet'])
  275. else
  276. equip(sets['MeleeSet'])
  277. end
  278. elseif player.status == 'Resting' then
  279. equip(sets['Resting'])
  280.  
  281. if world.area == 'NYZUL ISLE' or world.area == 'ALZADAAL UNDERSEA RUINS' or world.area == 'ZHAYOLM REMNANTS' or world.area == 'ARRAPAGO REMNANTS' or world.area == 'BHAFLAU REMNANTS' or world.area == 'SILVER SEA REMNANTS' then
  282. equip({ring2 = "Balrahn's Ring"})
  283. end
  284. else
  285. if player.mpp > 80 or dtMode then
  286. equipSet = sets['IdleSet']
  287. else
  288. equipSet = sets['IdleRefreshSet']
  289.  
  290. if world.area == 'NYZUL ISLE' or world.area == 'ALZADAAL UNDERSEA RUINS' or world.area == 'ZHAYOLM REMNANTS' or world.area == 'ARRAPAGO REMNANTS' or world.area == 'BHAFLAU REMNANTS' or world.area == 'SILVER SEA REMNANTS' then
  291. equip({ring2 = "Balrahn's Ring"})
  292. end
  293. end
  294.  
  295. if not dtMode then
  296. equipSet = set_combine(equipSet, sets['Running'])
  297. end
  298. equip(equipSet)
  299. end
  300.  
  301. if buffactive['Reive Mark'] then
  302. equip(sets['Reive'])
  303. end
  304. end
  305.  
  306. function filtered_action(spell,action)
  307. if player.sub_job == "DNC" and spell.english == 'Sneak' then
  308. cancel_spell()
  309. send_command('input /ja "Spectral Jig" <me>;')
  310. end
  311. end
  312.  
  313. function status_change(new,old)
  314. if check_ready_status()then
  315. handle_idle(new)
  316. end
  317. end
  318.  
  319. function buff_change(buff,gain_or_loss)
  320. if gain_or_loss then
  321. if buff == 'Aftermath: Lv.3' then
  322. send_command('timers c "AM3" 180 up "Aftermath"')
  323. elseif buff == 'Aftermath: Lv.2' then
  324. send_command('timers c "AM2" 180 up "Aftermath"')
  325. elseif buff == 'Aftermath: Lv.1' then
  326. send_command('timers c "AM1" 180 up "Aftermath"')
  327. end
  328.  
  329. if buff == 'weakness' then
  330. send_command('timers c "Weakness" 300 up "Weakness"')
  331. end
  332. else
  333. if buff == 'Aftermath: Lv.3' then
  334. send_command('timers d "AM3"')
  335. elseif buff == 'Aftermath: Lv.2' then
  336. send_command('timers d "AM2"')
  337. elseif buff == 'Aftermath: Lv.1' then
  338. send_command('timers d "AM1"')
  339. elseif buff == 'encumbrance' then
  340. windower.send_command('gs c dt_end;')
  341. end
  342.  
  343. if buff == 'Troubadour' or buff == 'Nightingale' then
  344. justUsedJA = false
  345. end
  346.  
  347. if buff == 'weakness' then
  348. send_command('timers d "Weakness"')
  349. end
  350. end
  351. end
  352.  
  353. function self_command(command)
  354. if command == 'heal' then
  355. local j = windower.ffxi.get_party() or {}
  356. biggestCureNeeded = 0
  357. playerToCure = ''
  358. for i,v in pairs(j) do
  359. if v.hp > 0 and v.hpp > 0 and v.hpp < 100 then
  360. if (v.hp/((v.hpp)/100))-v.hp > biggestCureNeeded then
  361. biggestCureNeeded = math.floor((v.hp/((v.hpp)/100))-v.hp)
  362. playerToCure = v.name
  363. end
  364. end
  365. end
  366.  
  367. if buffactive['doom'] then
  368. send_command('send nekachu //cursna '..player.name..';')
  369. elseif biggestCureNeeded > 900 then
  370. send_command('send nekachu //cure5 '..playerToCure..';')
  371. elseif biggestCureNeeded > 650 then
  372. send_command('send nekachu //cure4 '..playerToCure..';')
  373. elseif buffactive['petrification'] then
  374. send_command('send nekachu //stona '..player.name..';')
  375. elseif buffactive['curse'] then
  376. send_command('send nekachu gs c castspell cursna '..player.name:lower()..';')
  377. elseif buffactive['paralysis'] then
  378. send_command('send nekachu //paralyna '..player.name:lower()..';')
  379. elseif buffactive['Max HP Down'] then
  380. send_command('send nekachu //erase '..player.name:lower()..';')
  381. elseif biggestCureNeeded > 300 then
  382. send_command('send nekachu //cure3 '..playerToCure..';')
  383. elseif buffactive['poison'] then
  384. send_command('send nekachu //poisona '..player.name:lower()..';')
  385. elseif buffactive['bind'] or buffactive['weight'] or buffactive['bio'] then
  386. send_command('send nekachu //erase '..player.name:lower()..';')
  387. elseif buffactive['Sleep'] then
  388. send_command('send nekachu //cure '..player.name:lower()..';')
  389. elseif buffactive['Regen'] == nil then
  390. send_command('send nekachu //regen4 '..player.name:lower()..';')
  391. else
  392. windower.add_to_chat(050,"Nothing to do.")
  393. end
  394. elseif command == 'buff' then
  395. if buffactive['Haste'] == nil then
  396. send_command('send nekachu //haste '..player.name:lower()..';')
  397. elseif buffactive['Protect'] == nil then
  398. send_command('send nekachu //protectrav;')
  399. elseif buffactive['Shell'] == nil then
  400. send_command('send nekachu //shellrav;')
  401. else
  402. windower.add_to_chat(050,"Nothing to do.")
  403. end
  404. elseif command == 'ws' then
  405. if player.status == 'Engaged' and player.tp >= 1000 then
  406. send_command('input /ws "Rudra\'s Storm" <t>;')
  407. end
  408. elseif command == 'step' and songs['sing'] == false then
  409. if player.status == 'Engaged' and player.sub_job == 'DNC' then
  410. send_command('input /ja "Box Step" <t>;')
  411. end
  412. elseif command == 'flourish' and songs['sing'] == false then
  413. if player.status == 'Engaged' and player.sub_job == 'DNC' then
  414. send_command('input /ja "Violent Flourish" <t>;')
  415. end
  416. elseif command:sub(1,12) == 'remove songs' then
  417. commandSplit = T{}
  418. command = command:gsub("[%w ]+","%1")
  419. if #command > 14 then
  420. command = command:sub(14,#command)
  421. commandSplit = string.split(command," ")
  422. local nameToRemove = checkName(commandSplit[#commandSplit])
  423. if spell_target ~= '' then
  424. remove_song_by_target(nameToRemove)
  425. end
  426. end
  427. elseif command:sub(1,12) == 'keep singing' then
  428. commandSplit = T{}
  429. command = command:gsub("[%w ]+","%1")
  430. if #command > 14 then
  431. command = command:sub(14,#command)
  432. commandSplit = string.split(command," ")
  433. table.clear(songs)
  434.  
  435. songCount = #commandSplit-1
  436. spell_target = ''
  437.  
  438. if check_for_target(commandSplit[#commandSplit]) then
  439. if commandSplit[#commandSplit] == 'self' then
  440. spell_target = 'self'
  441. else
  442. spell_target = checkName(commandSplit[#commandSplit])
  443. end
  444. songCount = songCount - 1
  445. end
  446.  
  447. if spell_target == '' then
  448. spell_target = player.name
  449. end
  450. --Add the command to resing array for this target (only one set of songs to resing per target)
  451. resingSongs[spell_target] = {
  452. nextSing = os.clock()+1,
  453. fails=0,
  454. songs=command,
  455. target=spell_target
  456. }
  457. end
  458. elseif command:sub(1,4) == 'sing' then
  459. commandSplit = T{}
  460. command = command:gsub("[%w ]+","%1")
  461. if #command > 6 then
  462. command = command:sub(6,#command)
  463. commandSplit = string.split(command," ")
  464. table.clear(songs)
  465.  
  466. doingSV = false
  467. doingJA = false
  468.  
  469. for i=1, #commandSplit, 1 do
  470. if commandSplit[i] and commandSplit[i]:lower() == 'ja' then
  471. doingJA = true
  472. commandSplit:remove(i)
  473. end
  474. if commandSplit[i] and commandSplit[i]:lower() == '1hr' then
  475. doingSV = true
  476. commandSplit:remove(i)
  477. end
  478. end
  479.  
  480. songCount = #commandSplit
  481. spell_target = ''
  482. if check_for_target(commandSplit[#commandSplit]) then
  483. if commandSplit[#commandSplit] == 'self' then
  484. spell_target = 'self'
  485. else
  486. spell_target = checkName(commandSplit[#commandSplit])
  487. end
  488. songCount = songCount - 1
  489. end
  490.  
  491. if spell_target == '' then
  492. spell_target = player.name
  493. end
  494.  
  495.  
  496. if (autoJA or doingJA) and not buffactive['paralysis'] and not buffactive['amnesia'] and not buffactive['impairment'] and is_ability_ready('Troubadour') and is_ability_ready('Nightingale') then
  497. if (auto1hr or doingSV) and not buffactive['encumbrance'] and is_ability_ready('Soul Voice') and is_ability_ready('Clarion Call') then
  498. doingSV = true
  499. doingJA = true
  500. currentMaxSongs = totalSongs+1
  501. direct_push_front('Soul Voice', 'ja', player.name, false)
  502. direct_push_front('Clarion Call', 'ja', player.name, false)
  503. direct_push_front('Troubadour', 'ja', player.name, false)
  504. direct_push_front('Nightingale', 'ja', player.name, false)
  505. elseif is_ability_ready('Marcato') then
  506. doingJA = true
  507. direct_push_front('Troubadour', 'ja', player.name, false)
  508. direct_push_front('Nightingale', 'ja', player.name, false)
  509. direct_push_front('Marcato', 'ja', player.name, false)
  510. end
  511. end
  512.  
  513. for i=1, currentMaxSongs, 1 do
  514. if commandSplit[i] ~= nil then
  515. if totalSongs == 3 then
  516. if currentMaxSongs == 3 and i == 3 and songCount > 2 then
  517. add_to_back(dummySongs[1], spell_target, true, 'song')
  518. elseif currentMaxSongs == 4 and i == 4 and songCount > 3 then
  519. add_to_back(dummySongs[1], spell_target, true, 'song')
  520. end
  521. elseif totalSongs == 4 then
  522. if currentMaxSongs == 4 then
  523. if i == 3 and songCount > 2 then
  524. add_to_back(dummySongs[1], spell_target, true, 'song')
  525. elseif i == 4 and songCount > 3 then
  526. add_to_back(dummySongs[2], spell_target, true, 'song')
  527. end
  528. elseif currentMaxSongs == 5 then
  529. if i == 4 and songCount > 3 then
  530. add_to_back(dummySongs[1], spell_target, true, 'song')
  531. elseif i == 5 and songCount > 4 then
  532. add_to_back(dummySongs[2], spell_target, true, 'song')
  533. end
  534. end
  535. end
  536. get_song_from_command(commandSplit[i], spell_target)
  537. end
  538. end
  539.  
  540. --If this command is in the resing array, set the next sing time, and reset fail count to 0
  541. if type(resingSongs) == 'table' and resingSongs[spell_target] ~= nil then
  542. if resingSongs[spell_target].songs == command then
  543. if doingJA or justUsedJA or buffactive['Troubadour'] or buffactive['Nightingale'] then
  544. resingSongs[spell_target].nextSing = os.clock()+songDurationJA
  545. --resingSongs[spell_target].nextSing = os.clock()+30
  546. resingSongs[spell_target].fails = 0
  547. send_command('timers c "Songs ['..spell_target..']" '..songDurationJA..' up "Advancing March"')
  548. else
  549. resingSongs[spell_target].nextSing = os.clock()+songDuration
  550. --resingSongs[spell_target].nextSing = os.clock()+30
  551. resingSongs[spell_target].fails = 0
  552. send_command('timers c "Songs ['..spell_target..']" '..songDuration..' up "Advancing March"')
  553. end
  554. end
  555. else
  556. windower.add_to_chat(158,'Songs on '..spell_target..' added to queue')
  557. end
  558.  
  559. if (doingSV or buffactive['Soul Voice']) and songs:contains("Victory March") and songs:contains("Advancing March") then
  560. --See what we can replace Advancing March with
  561. if songs:contains("Valor Minuet V") or songs:contains("Valor Minuet IV") or songs:contains("Valor Minuet III") or songs:contains("Valor Minuet II") or songs:contains("Valor Minuet") then
  562. --Melee songs, see if 4 3 2 or 1 are set
  563. if not songs:contains("Valor Minuet V") then
  564. replaceSong = 'Valor Minuet V'
  565. elseif not songs:contains("Valor Minuet IV") then
  566. replaceSong = 'Valor Minuet IV'
  567. elseif not songs:contains("Valor Minuet III") then
  568. replaceSong = 'Valor Minuet III'
  569. elseif not songs:contains("Valor Minuet II") then
  570. replaceSong = 'Valor Minuet II'
  571. elseif not songs:contains("Valor Minuet") then
  572. replaceSong = 'Valor Minuet'
  573. else
  574. replaceSong = "Sentinel's Scherzo"
  575. end
  576. elseif songs:contains("Sword Madrigal") or songs:contains("Blade Madrigal") then
  577. if songs:contains("Sword Madrigal") and songs:contains("Blade Madrigal") then
  578. --Both acc songs on, throw on minuets
  579. if not songs:contains("Valor Minuet V") then
  580. replaceSong = 'Valor Minuet V'
  581. elseif not songs:contains("Valor Minuet IV") then
  582. replaceSong = 'Valor Minuet IV'
  583. elseif not songs:contains("Valor Minuet III") then
  584. replaceSong = 'Valor Minuet III'
  585. elseif not songs:contains("Valor Minuet II") then
  586. replaceSong = 'Valor Minuet II'
  587. elseif not songs:contains("Valor Minuet") then
  588. replaceSong = 'Valor Minuet'
  589. end
  590. elseif songs:contains("Sword Madrigal") and not songs:contains("Blade Madrigal") then
  591. replaceSong = 'Blade Madrigal'
  592. elseif songs:contains("Blade Madrigal") and not songs:contains("Sword Madrigal") then
  593. replaceSong = 'Sword Madrigal'
  594. else
  595. replaceSong = "Sentinel's Scherzo"
  596. end
  597. elseif songs:contains("Mage's Ballad III") or songs:contains("Mage's Ballad II") or songs:contains("Mage's Ballad") then
  598. --Mage songs, see if all ballads are on
  599. if not songs:contains("Mage's Ballad III") then
  600. replaceSong = "Mage's Ballad III"
  601. elseif not songs:contains("Mage's Ballad II") then
  602. replaceSong = "Mage's Ballad II"
  603. elseif not songs:contains("Mage's Ballad") then
  604. replaceSong = "Mage's Ballad"
  605. else
  606. replaceSong = "Sentinel's Scherzo"
  607. end
  608. elseif songs:contains("Knight's Minne V") and songs:contains("Knight's Minne IV") and songs:contains("Knight's Minne III") and songs:contains("Knight's Minne II") and songs:contains("Knight's Minne") then
  609. --Tank songs, see if 4 3 2 or 1 are set
  610. if not songs:contains("Knight's Minne V") then
  611. replaceSong = "Knight's Minne V"
  612. elseif not songs:contains("Knight's Minne IV") then
  613. replaceSong = "Knight's Minne IV"
  614. elseif not songs:contains("Knight's Minne III") then
  615. replaceSong = "Knight's Minne III"
  616. elseif not songs:contains("Knight's Minne II") then
  617. replaceSong = "Knight's Minne II"
  618. elseif not songs:contains("Knight's Minne") then
  619. replaceSong = "Knight's Minne"
  620. else
  621. replaceSong = "Sentinel's Scherzo"
  622. end
  623. end
  624. if replaceSong ~= nil then
  625. spell_stack_replace('Advancing March',replaceSong)
  626. end
  627. end
  628. showArrayContents()
  629. end
  630. elseif command:lower() == '3song' then
  631. currentMaxSongs = totalSongs
  632. windower.add_to_chat(050,"3 song mode.")
  633. elseif command:lower() == '4song' then
  634. currentMaxSongs = totalSongs+1
  635. windower.add_to_chat(050,"4 song mode.")
  636. elseif command == 'finale' then
  637. if player.sub_job == "DNC" then
  638. threnodies:next()
  639. send_command('input /ma "'..threnodies:current()..'" <bt>;')
  640. else
  641. send_command('input /ma "Magic Finale" <bt>;')
  642. end
  643. elseif command == 'requiem' then
  644. send_command('input /ma "Foe Requiem VII" <bt>;wait 4;input /ma "Carnage Elegy" <bt>;')
  645. elseif command == 'melee' then
  646. if player.sub_job == "DNC" then
  647. equip(sets['dualWield'])
  648. windower.add_to_chat(050,"Dual Wield On")
  649. else
  650. equip(sets['dagger'])
  651. windower.add_to_chat(050,"Dagger On")
  652. end
  653. if player.sub_job == "DNC" and player.equipment.main == 'Taming Sari' and player.equipment.sub == 'Atoyac' then
  654. disable('main','sub')
  655. mythicTries = 0
  656. windower.add_to_chat(167,"Melee [ON]")
  657. elseif player.equipment.main == 'Taming Sari' and player.equipment.sub == "Genbu's Shield" then
  658. disable('main','sub')
  659. mythicTries = 0
  660. windower.add_to_chat(167,"Melee [ON]")
  661. elseif mythicTries > 10 then
  662. windower.add_to_chat(050,"Melee couldn't be equipped at this time.")
  663. else
  664. enable('main','sub')
  665. mythicTries = mythicTries +1
  666. send_command('wait 1;gs c melee;')
  667. end
  668. elseif command == 'off' then
  669. enable('main','sub')
  670. windower.add_to_chat(050,"Melee Mode [OFF]")
  671. equip(sets[idleSet])
  672. elseif command == 'ja' then
  673. if not buffactive['paralysis'] and not buffactive['amnesia'] and not buffactive['impairment'] and is_ability_ready('Troubadour') and is_ability_ready('Nightingale') and is_ability_ready('Marcato') then
  674. if world.area:find("San d'Oria") or world.area:find("Bastok") or world.area:find("Windurst") or world.area:find("Jeuno") or world.area:find("Adoulin") or world.area == "Ru'Lude Gardens" or world.area == 'Al Zahbi' or world.area == "Aht Urhgan Whitegate" or world.area == "Tavnazian Safehold" then
  675. else
  676. direct_push_front('Troubadour', 'ja', player.name, false)
  677. direct_push_front('Nightingale', 'ja', player.name, false)
  678. direct_push_front('Marcato', 'ja', player.name, false)
  679. end
  680. else
  681. if buffactive['paralysis'] then
  682. send_command('input /p Paralyzed, not using JA')
  683. elseif buffactive['impairment'] then
  684. send_command("input /p JA Locked, can't use JA")
  685. elseif buffactive['amnesia'] then
  686. send_command("input /p Amnesia, can't use JA")
  687. else
  688. send_command("input /p JA not ready")
  689. end
  690. end
  691. elseif command == 'sneak' then
  692. send_command('input /ma "Sneak" <me>')
  693. elseif command == 'invisible' then
  694. send_command('input /ma "Invisible" <me>')
  695. elseif command == 'tank' then
  696. if not dtMode then
  697. dtMode = true
  698. windower.add_to_chat(028, "Idle DT [ON]")
  699. else
  700. dtMode = false
  701. windower.add_to_chat(028, "Idle DT [OFF]")
  702. end
  703. handle_idle()
  704. elseif command == 'levi' then
  705. dtMode = true
  706. autoJA = true
  707. autoSS = true
  708. resingSongs['Mazuki'] = {
  709. nextSing = os.clock()+1,
  710. fails=0,
  711. songs='scherzo march march Mazuki',
  712. target='Mazuki'
  713. }
  714. resingSongs['Nekachu'] = {
  715. nextSing = os.clock()+15,
  716. fails=0,
  717. songs='bal Nekachu',
  718. target='Nekachu'
  719. }
  720. resingSongs['Norzu'] = {
  721. nextSing = os.clock()+20,
  722. fails=0,
  723. songs='bal Norzu',
  724. target='Norzu'
  725. }
  726. resingSongs['self'] = {
  727. nextSing = os.clock()+25,
  728. fails=0,
  729. songs='bal self',
  730. target='self'
  731. }
  732. elseif command == 'ambu' then
  733. dtMode = false
  734. autoJA = true
  735. auto1hr = true
  736. autoSS = false
  737. resingSongs['Mazuki'] = {
  738. nextSing = os.clock()+1,
  739. fails=0,
  740. songs='int bal bal march Mazuki',
  741. target='Mazuki'
  742. }
  743. resingSongs['Ulor'] = {
  744. nextSing = os.clock()+13,
  745. fails=0,
  746. songs='scherzo march bal march Ulor',
  747. target='Ulor'
  748. }
  749. elseif command == 'ambu2' then
  750. dtMode = true
  751. autoJA = true
  752. auto1hr = true
  753. autoSS = false
  754. resingSongs['Mazuki'] = {
  755. nextSing = os.clock()+1,
  756. fails=0,
  757. songs='bal bal march bal Mazuki',
  758. target='Mazuki'
  759. }
  760. resingSongs['Miang'] = {
  761. nextSing = os.clock()+13,
  762. fails=0,
  763. songs='mad march march min Miang',
  764. target='Miang'
  765. }
  766. resingSongs['Ulor'] = {
  767. nextSing = os.clock()+26,
  768. fails=0,
  769. songs='mad march march min Ulor',
  770. target='Ulor'
  771. }
  772. elseif execute_common_command(command) then
  773. --done
  774. elseif stack_command(command) then
  775. --done
  776. end
  777. end
  778.  
  779. function check_if_songs_contains_carols()
  780.  
  781. end
  782.  
  783. function handle_ping()
  784. if buffactive['petrification'] and os.clock()-lastChat > 10 then
  785. send_command('input /p stoned')
  786. lastChat = os.clock()
  787. elseif buffactive['sleep'] and os.clock()-lastChat > 10 then
  788. send_command('input /p zzz')
  789. lastChat = os.clock()
  790. elseif buffactive['silence'] and os.clock()-lastChat > 2 then
  791. send_command('input /item "Echo Drops" <me>;')
  792. lastChat = os.clock()
  793. elseif (buffactive['doom'] or buffactive['curse']) and os.clock()-lastChat > 2 then
  794. send_command('input /item "Holy Water" <me>;')
  795. lastChat = os.clock()
  796. end
  797.  
  798. if check_ready_silent() and player.x == lastx and player.y == lasty then
  799.  
  800. if player.sub_job_level > 0 then
  801. if player.sub_job == 'WHM' then
  802. if not buffactive['reraise'] and recastData[spellIDs['Reraise']] == 0 and player.mp > spellCosts['Reraise'] then
  803. direct_push('Reraise', 'ma', player.name, true)
  804. end
  805. if autoSS and not buffactive['stoneskin'] and recastData[spellIDs['Stoneskin']] == 0 and player.mp > spellCosts['Stoneskin'] then
  806. direct_push('Stoneskin', 'ma', player.name, true)
  807. end
  808. if autoBlink and not buffactive['Blink'] and recastData[spellIDs['Blink']] == 0 and player.mp > spellCosts['Blink'] then
  809. direct_push('Blink', 'ma', player.name, true)
  810. end
  811. if autoAquaveil and not buffactive['Aquaveil'] and recastData[spellIDs['Aquaveil']] == 0 and player.mp > spellCosts['Aquaveil'] then
  812. direct_push('Aquaveil', 'ma', player.name, true)
  813. end
  814. if buffactive['paralysis'] then
  815. direct_push('Paralyna', 'ma', player.name, true)
  816. end
  817. if buffactive['bind'] or buffactive['weight'] or buffactive['slow'] then
  818. direct_push('Erase', 'ma', player.name, true)
  819. end
  820.  
  821. if buffactive['poison'] then
  822. direct_push('Poisona', 'ma', player.name, true)
  823. end
  824.  
  825. if player.max_hp-player.hp > 600 and recastData[spellIDs['Cure IV']] == 0 and player.mp > spellCosts['Cure IV'] then
  826. direct_push_front('Cure IV', 'ma', player.name, true)
  827. end
  828.  
  829. local testhp = player.max_hp-player.hp
  830.  
  831.  
  832. elseif player.sub_job == 'RDM' then
  833. if autoSS and not buffactive['stoneskin'] and recastData[spellIDs['Stoneskin']] == 0 and player.mp > spellCosts['Stoneskin'] then
  834. direct_push('Stoneskin', 'ma', player.name, true)
  835. end
  836. if autoBlink and not buffactive['Blink'] and recastData[spellIDs['Blink']] == 0 and player.mp > spellCosts['Blink'] then
  837. direct_push('Blink', 'ma', player.name, true)
  838. end
  839. if autoAquaveil and not buffactive['Aquaveil'] and recastData[spellIDs['Aquaveil']] == 0 and player.mp > spellCosts['Aquaveil'] then
  840. direct_push('Aquaveil', 'ma', player.name, true)
  841. end
  842. if not buffactive['weakness'] and player.mp < 200 and player.hp > 1000 and is_ability_ready('Convert') then
  843. direct_push('Convert', 'ja', player.name, true)
  844. end
  845. if not buffactive['refresh'] and recastData[spellIDs['Refresh']] == 0 and player.mp > spellCosts['Refresh'] then
  846. direct_push('Refresh', 'ma', player.name, true)
  847. end
  848. if autoPhalanx and not buffactive['Phalanx'] and recastData[spellIDs['Phalanx']] == 0 and player.mp > spellCosts['Phalanx'] then
  849. direct_push('Phalanx', 'ma', player.name, true)
  850. end
  851.  
  852. if player.max_hp-player.hp > 600 and recastData[spellIDs['Cure IV']] == 0 and player.mp > spellCosts['Cure IV'] then
  853. direct_push_front('Cure IV', 'ma', player.name, true)
  854. end
  855. elseif player.sub_job == 'NIN' then
  856. if not buffactive['Copy Image (2)'] and not buffactive['Copy Image (3)'] and not buffactive['Copy Image (4)'] then
  857. if is_spell_ready('Utsusemi: Ni') then
  858. direct_push_front('Utsusemi: Ni', 'ma', player.name, false)
  859. elseif is_spell_ready('Utsusemi: Ichi') then
  860. direct_push_front('Utsusemi: Ichi', 'ma', player.name, false)
  861. end
  862. end
  863. end
  864. end
  865.  
  866. if doCures then
  867. cure_process()
  868. end
  869.  
  870. check_auto_spell()
  871. check_songs()
  872. handleSpareTime()
  873. else
  874. if player.hp == 0 then
  875. clear_spell_stack()
  876. end
  877. lastx = player.x
  878. lasty = player.y
  879. end
  880. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement