Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.02 KB | None | 0 0
  1. include('common_commands.lua')
  2. --include('how_about_no.lua')
  3. include('organizer-lib.lua')
  4. include('no_interruptions.lua')
  5. include('spam_protection.lua')
  6. include('spell_stack.lua')
  7. include('AugmentedGear.lua')
  8.  
  9. valid_controllers = alt_names
  10.  
  11. lullabyWearing = false
  12. --Duration of non JA songs
  13. songDuration = 120
  14. --Duration of JA songs
  15. songDurationJA = 420
  16. --self_status_fix
  17. totalSongs = 3
  18. currentMaxSongs = totalSongs
  19.  
  20. dummySongs = T{stack_spells['Shining Fantasia'], stack_spells['Gold Capriccio']}
  21. threnodies = I{'Ice Threnody', 'Lightning Threnody', 'Earth Threnody', 'Wind Threnody', 'Ice Threnody', 'Light Threnody', 'Dark Threnody', 'Fire Threnody'}
  22. maccLevel = I{'Low', 'Mid', 'High'}
  23.  
  24. function get_sets()
  25. currentThrenody = 'Fire Threnody'
  26. songMode = 'Gjallarhorn'
  27. mythicTries = 0
  28. lastSongs = 0
  29. lastChat = 0
  30. doCures = true
  31. allianceCheck = true
  32. allianceHeal = false
  33. autoJA = false
  34. auto1hr = false
  35. autoSS = false
  36. lastx = 0
  37. lasty = 0
  38. songs = T{}
  39. doingSV = false
  40. replaceSong = "Sentinel's Scherzo"
  41. dtMode = false
  42. justUsedJA = false
  43.  
  44. send_command('input /macro book 6;wait 15;gs c check_has_marsyas;')
  45. self_command('check_has_marsyas')
  46.  
  47. load_gear_file()
  48.  
  49. if sets['ExtraSong']['PrecastSet'].range == 'Terpander' then
  50. totalSongs = 4
  51. end
  52. currentMaxSongs = totalSongs
  53. end
  54.  
  55.  
  56. function pretarget(spell)
  57. if check_ready(spell) == false then
  58. cancel_spell()
  59. end
  60.  
  61. queue_spell_if_busy(spell)
  62.  
  63. if spell.english == 'Sneak' and spell.target.name == player.name and player.sub_job == 'DNC' and is_ability_ready('Spectral Jig') then
  64. cancel_spell()
  65. windower.send_command('input /ja "Spectral Jig" <me>;')
  66. end
  67.  
  68. if buffactive['Nightingale'] and buffactive['Troubadour'] then
  69. if spell.english == "Honor March" then
  70. equip(sets['Honor March']['MidcastSet'])
  71. elseif spell.english:sub(1,13) == "Mage's Ballad" then
  72. equip(sets['Gjallarhorn']['BalladMidcast'])
  73. elseif spell.english == "Sentinel's Scherzo" then
  74. equip(sets['Gjallarhorn']['Scherzo'])
  75. elseif spell.english == 'Horde Lullaby' or spell.english == 'Horde Lullaby II' then
  76. equip(sets[maccLevel:current()]['Horde Lullaby'])
  77. elseif spell.english == 'Foe Lullaby' or spell.english == 'Foe Lullaby II' then
  78. equip(sets[maccLevel:current()]['Lullaby'])
  79. elseif spell.english:sub(1,12) == "Army's Paeon" then
  80. equip(sets['Gjallarhorn']['Paeon'])
  81. else
  82. equip(sets[songMode]['MidcastSet'])
  83. end
  84. end
  85. end
  86.  
  87. function precast(spell,action)
  88. if check_ready(spell) then
  89. if spell.type == 'WeaponSkill' then
  90. if spell.target.distance > 10 or player.tp < 900 then
  91. cancel_spell()
  92. return
  93. end
  94.  
  95. if sets[spell.english] then
  96. if buffactive['Reive Mark'] then
  97. equip(sets[spell.english],sets['Reive'])
  98. else
  99. equip(sets[spell.english])
  100. end
  101. end
  102.  
  103. windower.add_to_chat(050, '['..spell.name..'] '..spell.target.name..' <'..player.tp..'%>')
  104. elseif spell.english == "Spectral Jig" and is_ability_ready('Spectral Jig') then
  105. send_command('cancel 71;')
  106. elseif spell.type == "JobAbility" then
  107. if sets[spell.english] then
  108. equip(sets[spell.english])
  109. end
  110. if spell.english == "Clarion Call" then
  111. currentMaxSongs = totalSongs + 1
  112. end
  113. elseif spell.type == "BardSong" then
  114. if buffactive["clarion call"] then
  115. currentMaxSongs = totalSongs+1
  116. end
  117.  
  118. if buffactive['pianissimo'] and (spell.english =='Horde Lullaby' or spell.english == 'Horde Lullaby II') then
  119. send_command('cancel 409;')
  120. end
  121.  
  122. songMode = 'Gjallarhorn'
  123.  
  124. if type(dummySongs) == 'table' then
  125. for i,v in pairs(dummySongs) do
  126. if v.en ~= nil and v.en == spell.english then
  127. songMode = 'ExtraSong'
  128. end
  129. end
  130. end
  131.  
  132. if buffactive['Nightingale'] and buffactive['Troubadour'] then
  133. if spell.english == "Honor March" then
  134. equip(sets['Honor March']['MidcastSet'])
  135. elseif spell.english:sub(1,13) == "Mage's Ballad" then
  136. equip(sets[songMode]['BalladMidcast'])
  137. elseif spell.english == "Sentinel's Scherzo" then
  138. equip(sets[songMode]['Scherzo'])
  139. elseif spell.english == 'Horde Lullaby' or spell.english == 'Horde Lullaby II' then
  140. equip(sets[maccLevel:current()]['Horde Lullaby'])
  141. elseif spell.english == 'Foe Lullaby' or spell.english == 'Foe Lullaby II' then
  142. equip(sets[maccLevel:current()]['Lullaby'])
  143. elseif spell.english:sub(1,12) == "Army's Paeon" then
  144. equip(sets[songMode]['Paeon'])
  145. else
  146. equip(sets[songMode]['MidcastSet'])
  147. end
  148. else
  149. if spell.english == "Honor March" then
  150. equip(sets['Honor March']['PrecastSet'])
  151. else
  152. equip(sets[songMode]['PrecastSet'])
  153. end
  154. end
  155. elseif spell.type == 'WhiteMagic' then
  156. if player.sub_job == "DNC" and spell.english == 'Sneak' then
  157. cancel_spell()
  158. send_command('input /ja "Spectral Jig" <me>;')
  159. elseif spell.english:sub(1,4) == 'Cure' or spell.english:sub(1,4) == 'Cura' then
  160. equip(sets.precast['CureSet'])
  161. else
  162. if spell.skill == 'Enhancing Magic' then
  163. equip(sets.precast['Enhancing Magic'])
  164. else
  165. equip(sets.precast['General'])
  166. end
  167. end
  168. elseif spell.type == 'BlackMagic' or spell.type == 'Trust' then
  169. equip(sets.precast['General'])
  170. elseif spell.english == "Spectral Jig" and is_ability_ready('Spectral Jig') then
  171. send_command('cancel 71;')
  172. end
  173.  
  174. spam_protection_on(spell)
  175. else
  176. cancel_spell()
  177. end
  178. end
  179.  
  180. function midcast(spell,action)
  181. if spell.type == "BardSong" then
  182. songMode = 'Gjallarhorn'
  183.  
  184. if type(dummySongs) == 'table' then
  185. for i,v in pairs(dummySongs) do
  186. if v.en ~= nil and v.en == spell.english then
  187. songMode = 'ExtraSong'
  188. end
  189. end
  190. end
  191.  
  192. if spell.english == "Honor March" then
  193. equip(sets['Honor March']['MidcastSet'])
  194. elseif spell.english:sub(1,13) == "Mage's Ballad" then
  195. equip(sets[songMode]['BalladMidcast'])
  196. elseif spell.english:sub(-8) == "Madrigal" then
  197. equip(sets[songMode]['Madrigal'])
  198. elseif spell.english:sub(-7) == "Prelude" then
  199. equip(sets[songMode]['Prelude'])
  200. elseif spell.english == "Sentinel's Scherzo" then
  201. equip(sets[songMode]['Scherzo'])
  202. elseif spell.english == 'Horde Lullaby' or spell.english == 'Horde Lullaby II' then
  203. equip(sets[maccLevel:current()]['Horde Lullaby'])
  204. elseif spell.english == 'Foe Lullaby' or spell.english == 'Foe Lullaby II' then
  205. equip(sets[maccLevel:current()]['Lullaby'])
  206. elseif spell.english:sub(1,12) == "Army's Paeon" then
  207. equip(sets[songMode]['Paeon'])
  208. 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
  209. equip(sets['MaccSet'])
  210. else
  211. equip(sets[songMode]['MidcastSet'])
  212. end
  213. elseif spell.skill == 'Enhancing Magic' then
  214. if spell.english == 'Stoneskin' then
  215. equip(set_combine(sets.midcast['Enhancing Magic Duration'], sets.midcast['Stoneskin']))
  216. elseif spell.english == 'Aquaveil' then
  217. equip(set_combine(sets.midcast['Enhancing Magic Duration'], sets.midcast['Aquaveil']))
  218. elseif spell.english:sub(1,5) == 'Regen' then
  219. equip(set_combine(sets.midcast['Enhancing Magic'], set_combine(sets.midcast['Enhancing Magic Duration'], sets.midcast['Regen']) ))
  220. elseif spell.english == 'Haste' or
  221. spell.english == 'Invisible' or
  222. spell.english == 'Sneak' or
  223. spell.english:sub(-5) == 'storm' or
  224. spell.english:sub(4) == 'Prot' or
  225. spell.english:sub(4) == 'Shel' or
  226. spell.english == 'Blink' or
  227. spell.english == 'Refresh' then
  228. equip(set_combine(sets.midcast['General'],sets.midcast['Enhancing Magic Duration']))
  229. else
  230. equip(set_combine(sets.midcast['Enhancing Magic'], sets.midcast['Enhancing Magic Duration']))
  231. end
  232. elseif spell.type == "WhiteMagic" then
  233. if spell.english:sub(1,4) == 'Cure' or spell.english:sub(1,4) == 'Cura' then
  234. equip(sets.midcast['Cure'])
  235. elseif spell.skill == 'Enfeebling Magic' then
  236. equip(sets.midcast['Enfeebling Magic'])
  237. end
  238. elseif spell.type == 'BlackMagic' then
  239. if spell.skill == 'Enfeebling Magic' then
  240. equip(sets.midcast['Enfeebling Magic'])
  241. elseif spell.skill == 'Elemental Magic' then
  242. equip(sets.midcast['Elemental Magic'])
  243. end
  244. elseif spell.type == 'Ninjutsu' then
  245. equip(sets.midcast['General'])
  246. if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)'] or buffactive['Copy Image (4)']) then
  247. send_command('wait 1.5;cancel 66;cancel 446;cancel 445;cancel 444;')
  248. end
  249. elseif spell.type ~= 'WeaponSkill' and spell.type ~= 'JobAbility' then
  250. equip(sets.midcast['General'])
  251. end
  252. end
  253.  
  254. function aftercast(spell,action)
  255. if spam_protection_off(spell)then
  256. if spell.english == 'Troubadour' or spell.english == 'Nightingale' then
  257. justUsedJA = true
  258. end
  259. if spell.english == 'Horde Lullaby II' then
  260. if buffactive['Troubadour'] and buffactive['Nightingale'] and buffactive['Clarion Call'] then
  261. send_command('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 426 up;')
  262. send_to_alts_in_range('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 426 up;')
  263. lullabyWearing = os.clock()+426-30
  264. elseif buffactive['Troubadour'] and buffactive['Nightingale'] and buffactive['Marcato'] then
  265. send_command('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 366 up;')
  266. send_to_alts_in_range('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 366 up;')
  267. lullabyWearing = os.clock()+366-30
  268. elseif buffactive['Troubadour'] and buffactive['Nightingale'] then
  269. send_command('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 346 up;')
  270. send_to_alts_in_range('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 346 up;')
  271. lullabyWearing = os.clock()+346-30
  272. else
  273. send_command('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 174 up;')
  274. send_to_alts_in_range('timers d "Horde Lullaby II";timers c "Horde Lullaby II" 174 up;')
  275. lullabyWearing = os.clock()+174-30
  276. end
  277. end
  278. handle_idle()
  279. end
  280.  
  281. checkAftercast(spell)
  282. end
  283.  
  284. function handle_idle()
  285. if player.status == 'Engaged' then
  286. if player.sub_job == 'DNC' or player.sub_job == 'NIN' then
  287. equip(sets['DWMeleeSet'])
  288. else
  289. equip(sets['MeleeSet'])
  290. end
  291. elseif player.status == 'Resting' then
  292. equip(sets['Resting'])
  293.  
  294. 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
  295. equip({ring2 = "Balrahn's Ring"})
  296. end
  297. else
  298. if player.mpp > 80 or dtMode then
  299. equipSet = sets['IdleSet']
  300. else
  301. equipSet = sets['IdleRefreshSet']
  302.  
  303. 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
  304. equip({ring2 = "Balrahn's Ring"})
  305. end
  306. end
  307.  
  308. if not dtMode then
  309. equipSet = set_combine(equipSet, sets['Running'])
  310. end
  311. equip(equipSet)
  312. end
  313.  
  314. if buffactive['Reive Mark'] then
  315. equip(sets['Reive'])
  316. end
  317. end
  318.  
  319. function filtered_action(spell,action)
  320. if player.sub_job == "DNC" and spell.english == 'Sneak' then
  321. cancel_spell()
  322. send_command('input /ja "Spectral Jig" <me>;')
  323. end
  324. end
  325.  
  326. function status_change(new,old)
  327. if check_ready_status()then
  328. handle_idle(new)
  329. end
  330. end
  331.  
  332. function buff_change(buff,gain_or_loss)
  333. if gain_or_loss then
  334. if buff == 'Aftermath: Lv.3' then
  335. send_command('timers c "AM3" 180 up "Aftermath"')
  336. elseif buff == 'Aftermath: Lv.2' then
  337. send_command('timers c "AM2" 180 up "Aftermath"')
  338. elseif buff == 'Aftermath: Lv.1' then
  339. send_command('timers c "AM1" 180 up "Aftermath"')
  340. end
  341.  
  342. if buff == 'weakness' then
  343. send_command('timers c "Weakness" 300 up "Weakness"')
  344. end
  345. else
  346. if buff == 'Aftermath: Lv.3' then
  347. send_command('timers d "AM3"')
  348. elseif buff == 'Aftermath: Lv.2' then
  349. send_command('timers d "AM2"')
  350. elseif buff == 'Aftermath: Lv.1' then
  351. send_command('timers d "AM1"')
  352. elseif buff == 'encumbrance' then
  353. windower.send_command('gs c dt_end;')
  354. end
  355.  
  356. if buff == 'Troubadour' or buff == 'Nightingale' then
  357. justUsedJA = false
  358. end
  359.  
  360. if buff == 'weakness' then
  361. send_command('timers d "Weakness"')
  362. end
  363. end
  364. end
  365.  
  366. function self_command(command)
  367. if command == 'heal' then
  368. local j = windower.ffxi.get_party() or {}
  369. biggestCureNeeded = 0
  370. playerToCure = ''
  371. for i,v in pairs(j) do
  372. if v.hp > 0 and v.hpp > 0 and v.hpp < 100 then
  373. if (v.hp/((v.hpp)/100))-v.hp > biggestCureNeeded then
  374. biggestCureNeeded = math.floor((v.hp/((v.hpp)/100))-v.hp)
  375. playerToCure = v.name
  376. end
  377. end
  378. end
  379.  
  380. if buffactive['doom'] then
  381. send_command('send nekachu //cursna '..player.name..';')
  382. elseif biggestCureNeeded > 900 then
  383. send_command('send nekachu //cure5 '..playerToCure..';')
  384. elseif biggestCureNeeded > 650 then
  385. send_command('send nekachu //cure4 '..playerToCure..';')
  386. elseif buffactive['petrification'] then
  387. send_command('send nekachu //stona '..player.name..';')
  388. elseif buffactive['curse'] then
  389. send_command('send nekachu gs c castspell cursna '..player.name:lower()..';')
  390. elseif buffactive['paralysis'] then
  391. send_command('send nekachu //paralyna '..player.name:lower()..';')
  392. elseif buffactive['Max HP Down'] then
  393. send_command('send nekachu //erase '..player.name:lower()..';')
  394. elseif biggestCureNeeded > 300 then
  395. send_command('send nekachu //cure3 '..playerToCure..';')
  396. elseif buffactive['poison'] then
  397. send_command('send nekachu //poisona '..player.name:lower()..';')
  398. elseif buffactive['bind'] or buffactive['weight'] or buffactive['bio'] then
  399. send_command('send nekachu //erase '..player.name:lower()..';')
  400. elseif buffactive['Sleep'] then
  401. send_command('send nekachu //cure '..player.name:lower()..';')
  402. elseif buffactive['Regen'] == nil then
  403. send_command('send nekachu //regen4 '..player.name:lower()..';')
  404. else
  405. windower.add_to_chat(050,"Nothing to do.")
  406. end
  407. elseif command == 'buff' then
  408. if buffactive['Haste'] == nil then
  409. send_command('send nekachu //haste '..player.name:lower()..';')
  410. elseif buffactive['Protect'] == nil then
  411. send_command('send nekachu //protectrav;')
  412. elseif buffactive['Shell'] == nil then
  413. send_command('send nekachu //shellrav;')
  414. else
  415. windower.add_to_chat(050,"Nothing to do.")
  416. end
  417. elseif command == 'ws' then
  418. if player.status == 'Engaged' and player.tp >= 1000 then
  419. send_command('input /ws "Rudra\'s Storm" <t>;')
  420. end
  421. elseif command == 'step' and songs['sing'] == false then
  422. if player.status == 'Engaged' and player.sub_job == 'DNC' then
  423. send_command('input /ja "Box Step" <t>;')
  424. end
  425. elseif command == 'flourish' and songs['sing'] == false then
  426. if player.status == 'Engaged' and player.sub_job == 'DNC' then
  427. send_command('input /ja "Violent Flourish" <t>;')
  428. end
  429. elseif command:sub(1,12) == 'remove songs' then
  430. commandSplit = T{}
  431. command = command:gsub("[%w ]+","%1")
  432. if #command > 14 then
  433. command = command:sub(14,#command)
  434. commandSplit = string.split(command," ")
  435. local nameToRemove = checkName(commandSplit[#commandSplit])
  436. if spell_target ~= '' then
  437. remove_song_by_target(nameToRemove)
  438. end
  439. end
  440. elseif command:sub(1,12) == 'keep singing' then
  441. commandSplit = T{}
  442. command = command:gsub("[%w ]+","%1")
  443. if #command > 14 then
  444. command = command:sub(14,#command)
  445. commandSplit = string.split(command," ")
  446. table.clear(songs)
  447.  
  448. songCount = #commandSplit-1
  449. spell_target = ''
  450.  
  451. if check_for_target(commandSplit[#commandSplit]) then
  452. if commandSplit[#commandSplit] == 'self' then
  453. spell_target = 'self'
  454. else
  455. spell_target = checkName(commandSplit[#commandSplit])
  456. end
  457. songCount = songCount - 1
  458. end
  459.  
  460. if spell_target == '' then
  461. spell_target = player.name
  462. end
  463. --Add the command to resing array for this target (only one set of songs to resing per target)
  464. resingSongs[spell_target] = {
  465. nextSing = os.clock()+1,
  466. fails=0,
  467. songs=command,
  468. target=spell_target
  469. }
  470. end
  471. elseif command:sub(1,4) == 'sing' then
  472. commandSplit = T{}
  473. command = command:gsub("[%w ]+","%1")
  474. if #command > 6 then
  475. command = command:sub(6,#command)
  476. commandSplit = string.split(command," ")
  477. table.clear(songs)
  478.  
  479. doingSV = false
  480. doingJA = false
  481.  
  482. for i=1, #commandSplit, 1 do
  483. if commandSplit[i] and commandSplit[i]:lower() == 'ja' then
  484. doingJA = true
  485. commandSplit:remove(i)
  486. end
  487. if commandSplit[i] and commandSplit[i]:lower() == '1hr' then
  488. doingSV = true
  489. commandSplit:remove(i)
  490. end
  491. end
  492.  
  493. songCount = #commandSplit
  494. spell_target = ''
  495. if check_for_target(commandSplit[#commandSplit]) then
  496. if commandSplit[#commandSplit] == 'self' then
  497. spell_target = 'self'
  498. else
  499. spell_target = checkName(commandSplit[#commandSplit])
  500. end
  501. songCount = songCount - 1
  502. end
  503.  
  504. if spell_target == '' then
  505. spell_target = player.name
  506. end
  507.  
  508. if spell_target ~= player.name then
  509. args = {partyCheck=true, pianissimo=true}
  510. else
  511. args = {partyCheck=true}
  512. end
  513.  
  514. if (autoJA or doingJA) and not buffactive['encumbrance'] and spell_target == player.name and not buffactive['paralysis'] and not buffactive['amnesia'] and not buffactive['impairment'] and is_ability_ready('Troubadour') and is_ability_ready('Nightingale') then
  515. if (auto1hr or doingSV) and is_ability_ready('Soul Voice') and is_ability_ready('Clarion Call') then
  516. doingSV = true
  517. doingJA = true
  518. currentMaxSongs = totalSongs+1
  519. direct_push_front(gearswap.res.job_abilities[164], 'ja', player.name, false)
  520. direct_push_front(gearswap.res.job_abilities[163], 'ja', player.name, false)
  521. direct_push_front(gearswap.res.job_abilities[25], 'ja', player.name, false)
  522. direct_push_front(gearswap.res.job_abilities[332], 'ja', player.name, false)
  523. elseif is_ability_ready('Marcato') then
  524. doingJA = true
  525. direct_push_front(gearswap.res.job_abilities[164], 'ja', player.name, false)
  526. direct_push_front(gearswap.res.job_abilities[163], 'ja', player.name, false)
  527. direct_push_front(gearswap.res.job_abilities[284], 'ja', player.name, false)
  528. end
  529. end
  530.  
  531. --If this command is in the resing array, set the next sing time, and reset fail count to 0
  532. if type(resingSongs) == 'table' and resingSongs[spell_target] ~= nil then
  533. if resingSongs[spell_target].songs == command then
  534. if doingJA or justUsedJA or buffactive['Troubadour'] or buffactive['Nightingale'] then
  535. resingSongs[spell_target].nextSing = os.clock()+songDurationJA
  536. resingSongs[spell_target].fails = 0
  537. send_command('timers c "Songs ['..spell_target..']" '..songDurationJA..' up "Advancing March"')
  538. else
  539. resingSongs[spell_target].nextSing = os.clock()+songDuration
  540. resingSongs[spell_target].fails = 0
  541. send_command('timers c "Songs ['..spell_target..']" '..songDuration..' up "Advancing March"')
  542. end
  543. end
  544. else
  545. windower.add_to_chat(158,'Songs on '..spell_target..' added to queue')
  546. end
  547.  
  548. for i=1, currentMaxSongs, 1 do
  549. if commandSplit[i] ~= nil then
  550. if totalSongs == 3 then
  551. if currentMaxSongs == 3 and i == 3 and songCount > 2 then
  552. add_to_back(dummySongs[1], spell_target, args)
  553. elseif currentMaxSongs == 4 and i == 4 and songCount > 3 then
  554. add_to_back(dummySongs[1], spell_target, args)
  555. end
  556. elseif totalSongs == 4 then
  557. if currentMaxSongs == 4 then
  558. if i == 3 and songCount > 2 then
  559. add_to_back(dummySongs[1], spell_target, args)
  560. elseif i == 4 and songCount > 3 then
  561. add_to_back(dummySongs[2], spell_target, args)
  562. end
  563. elseif currentMaxSongs == 5 then
  564. if i == 4 and songCount > 3 then
  565. add_to_back(dummySongs[1], spell_target, args)
  566. elseif i == 5 and songCount > 4 then
  567. add_to_back(dummySongs[2], spell_target, args)
  568. end
  569. end
  570. end
  571. get_song_from_command(commandSplit[i], spell_target)
  572. end
  573. end
  574.  
  575. if (doingSV or buffactive['Soul Voice']) and songs:contains("Victory March") and songs:contains("Advancing March") then
  576. --See what we can replace Advancing March with
  577. 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
  578. --Melee songs, see if 4 3 2 or 1 are set
  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. else
  590. replaceSong = "Sentinel's Scherzo"
  591. end
  592. elseif songs:contains("Sword Madrigal") or songs:contains("Blade Madrigal") then
  593. if songs:contains("Sword Madrigal") and songs:contains("Blade Madrigal") then
  594. --Both acc songs on, throw on minuets
  595. if not songs:contains("Valor Minuet V") then
  596. replaceSong = 'Valor Minuet V'
  597. elseif not songs:contains("Valor Minuet IV") then
  598. replaceSong = 'Valor Minuet IV'
  599. elseif not songs:contains("Valor Minuet III") then
  600. replaceSong = 'Valor Minuet III'
  601. elseif not songs:contains("Valor Minuet II") then
  602. replaceSong = 'Valor Minuet II'
  603. elseif not songs:contains("Valor Minuet") then
  604. replaceSong = 'Valor Minuet'
  605. end
  606. elseif songs:contains("Sword Madrigal") and not songs:contains("Blade Madrigal") then
  607. replaceSong = 'Blade Madrigal'
  608. elseif songs:contains("Blade Madrigal") and not songs:contains("Sword Madrigal") then
  609. replaceSong = 'Sword Madrigal'
  610. else
  611. replaceSong = "Sentinel's Scherzo"
  612. end
  613. elseif songs:contains("Mage's Ballad III") or songs:contains("Mage's Ballad II") or songs:contains("Mage's Ballad") then
  614. --Mage songs, see if all ballads are on
  615. if not songs:contains("Mage's Ballad III") then
  616. replaceSong = "Mage's Ballad III"
  617. elseif not songs:contains("Mage's Ballad II") then
  618. replaceSong = "Mage's Ballad II"
  619. elseif not songs:contains("Mage's Ballad") then
  620. replaceSong = "Mage's Ballad"
  621. else
  622. replaceSong = "Sentinel's Scherzo"
  623. end
  624. 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
  625. --Tank songs, see if 4 3 2 or 1 are set
  626. if not songs:contains("Knight's Minne V") then
  627. replaceSong = "Knight's Minne V"
  628. elseif not songs:contains("Knight's Minne IV") then
  629. replaceSong = "Knight's Minne IV"
  630. elseif not songs:contains("Knight's Minne III") then
  631. replaceSong = "Knight's Minne III"
  632. elseif not songs:contains("Knight's Minne II") then
  633. replaceSong = "Knight's Minne II"
  634. elseif not songs:contains("Knight's Minne") then
  635. replaceSong = "Knight's Minne"
  636. else
  637. replaceSong = "Sentinel's Scherzo"
  638. end
  639. end
  640. if replaceSong ~= nil then
  641. spell_stack_replace('Advancing March',replaceSong)
  642. end
  643. end
  644. end
  645. elseif command:lower() == '3song' then
  646. currentMaxSongs = tonumber(totalSongs)
  647. windower.add_to_chat(050,tostring(currentMaxSongs).." song mode.")
  648. elseif command:lower() == '4song' then
  649. currentMaxSongs = tonumber(totalSongs)+1
  650. windower.add_to_chat(050,tostring(currentMaxSongs).." song mode.")
  651. elseif command == 'macc' then
  652. maccLevel:next()
  653. windower.add_to_chat(050,"Macc level ["..maccLevel:current().."]")
  654. elseif command == 'finale' then
  655. if player.sub_job == "DNC" then
  656. threnodies:next()
  657. send_command('input /ma "'..threnodies:current()..'" <bt>;')
  658. else
  659. send_command('input /ma "Magic Finale" <bt>;')
  660. end
  661. elseif command == 'requiem' then
  662. send_command('input /ma "Foe Requiem VII" <bt>;wait 4;input /ma "Carnage Elegy" <bt>;')
  663. elseif command == 'melee' then
  664. if player.sub_job == "DNC" then
  665. equip(sets['dualWield'])
  666. windower.add_to_chat(050,"Dual Wield On")
  667. else
  668. equip(sets['dagger'])
  669. windower.add_to_chat(050,"Dagger On")
  670. end
  671. if player.sub_job == "DNC" and player.equipment.main == 'Taming Sari' and player.equipment.sub == 'Atoyac' then
  672. disable('main','sub')
  673. mythicTries = 0
  674. windower.add_to_chat(167,"Melee [ON]")
  675. elseif player.equipment.main == 'Taming Sari' and player.equipment.sub == "Genbu's Shield" then
  676. disable('main','sub')
  677. mythicTries = 0
  678. windower.add_to_chat(167,"Melee [ON]")
  679. elseif mythicTries > 10 then
  680. windower.add_to_chat(050,"Melee couldn't be equipped at this time.")
  681. else
  682. enable('main','sub')
  683. mythicTries = mythicTries +1
  684. send_command('wait 1;gs c melee;')
  685. end
  686. elseif command == 'off' then
  687. enable('main','sub')
  688. windower.add_to_chat(050,"Melee Mode [OFF]")
  689. equip(sets[idleSet])
  690. elseif command == 'ja' then
  691. 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
  692. 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
  693. else
  694. direct_push_front(gearswap.res.job_abilities[163], 'ja', player.name, {fixed_order=true})
  695. direct_push_front(gearswap.res.job_abilities[164], 'ja', player.name, {fixed_order=true})
  696. direct_push_front(gearswap.res.job_abilities[284], 'ja', player.name, {fixed_order=true})
  697. end
  698. else
  699. if buffactive['paralysis'] then
  700. send_command('input /p Paralyzed, not using JA')
  701. elseif buffactive['impairment'] then
  702. send_command("input /p JA Locked, can't use JA")
  703. elseif buffactive['amnesia'] then
  704. send_command("input /p Amnesia, can't use JA")
  705. else
  706. send_command("input /p JA not ready")
  707. end
  708. end
  709. elseif command == 'sneak' then
  710. send_command('input /ma "Sneak" <me>')
  711. elseif command == 'invisible' then
  712. send_command('input /ma "Invisible" <me>')
  713. elseif command == 'tank' then
  714. if not dtMode then
  715. dtMode = true
  716. windower.add_to_chat(028, "Idle DT [ON]")
  717. else
  718. dtMode = false
  719. windower.add_to_chat(028, "Idle DT [OFF]")
  720. end
  721. handle_idle()
  722. elseif command == 'levi' then
  723. dtMode = true
  724. autoJA = true
  725. autoSS = true
  726. resingSongs['Mazuki'] = {
  727. nextSing = os.clock()+1,
  728. fails=0,
  729. songs='march scherzo march min min Mazuki',
  730. target='Mazuki'
  731. }
  732. resingSongs['Nekachu'] = {
  733. nextSing = os.clock()+15,
  734. fails=0,
  735. songs='bal Nekachu',
  736. target='Nekachu'
  737. }
  738. resingSongs['Norzu'] = {
  739. nextSing = os.clock()+20,
  740. fails=0,
  741. songs='bal Norzu',
  742. target='Norzu'
  743. }
  744. resingSongs['self'] = {
  745. nextSing = os.clock()+25,
  746. fails=0,
  747. songs='bal self',
  748. target='self'
  749. }
  750. elseif command == 'ambu' then
  751. dtMode = true
  752. autoJA = true
  753. auto1hr = true
  754. autoSS = false
  755. resingSongs['Mazuki'] = {
  756. nextSing = os.clock()+1,
  757. fails=0,
  758. songs='int bal bal march2 march1 Mazuki',
  759. target='Mazuki'
  760. }
  761. resingSongs['Ulor'] = {
  762. nextSing = os.clock()+13,
  763. fails=0,
  764. songs='march scherzo march bal mad Ulor',
  765. target='Ulor'
  766. }
  767. elseif command == 'ambu2' then
  768. dtMode = true
  769. autoJA = true
  770. auto1hr = true
  771. autoSS = false
  772. resingSongs['Mazuki'] = {
  773. nextSing = os.clock()+1,
  774. fails=0,
  775. songs='march mad march min min Mazuki',
  776. target='Mazuki'
  777. }
  778. resingSongs['Tosel'] = {
  779. nextSing = os.clock()+13,
  780. fails=0,
  781. songs='bal bal Tosel',
  782. target='Tosel'
  783. }
  784. resingSongs['Nekachu'] = {
  785. nextSing = os.clock()+19,
  786. fails=0,
  787. songs='bal Nekachu',
  788. target='Nekachu'
  789. }
  790. resingSongs['Vijara'] = {
  791. nextSing = os.clock()+26,
  792. fails=0,
  793. songs='bal Vijara',
  794. target='Vijara'
  795. }
  796.  
  797. resingSongs['self'] = {
  798. nextSing = os.clock()+30,
  799. fails=0,
  800. songs='bal self',
  801. target='self'
  802. }
  803. elseif command == 'ambu3' then
  804. dtMode = true
  805. autoJA = true
  806. auto1hr = true
  807. autoSS = false
  808. resingSongs['Mazuki'] = {
  809. nextSing = os.clock()+1,
  810. fails=0,
  811. songs='bal bal bal march march Mazuki',
  812. target='Mazuki'
  813. }
  814. resingSongs['Miang'] = {
  815. nextSing = os.clock()+13,
  816. fails=0,
  817. songs='march march mad scherzo min Miang',
  818. target='Miang'
  819. }
  820. resingSongs['Ulor'] = {
  821. nextSing = os.clock()+26,
  822. fails=0,
  823. songs='march march mad bal mad Ulor',
  824. target='Ulor'
  825. }
  826. direct_push(gearswap.res.spells[54], 'ma', player.name, false)
  827. direct_push(gearswap.res.spells[53], 'ma', player.name, false)
  828. direct_push(gearswap.res.spells[55], 'ma', player.name, false)
  829. elseif command == 'ambu rng' then
  830. dtMode = true
  831. autoJA = true
  832. auto1hr = true
  833. autoSS = false
  834. resingSongs['Mazuki'] = {
  835. nextSing = os.clock()+1,
  836. fails=0,
  837. songs='honor prelude prelude min min Mazuki',
  838. target='Mazuki'
  839. }
  840. resingSongs['Ulor'] = {
  841. nextSing = os.clock()+13,
  842. fails=0,
  843. songs='scherzo march march bal mad Ulor',
  844. target='Ulor'
  845. }
  846. resingSongs['Nekachu'] = {
  847. nextSing = os.clock()+30,
  848. fails=0,
  849. songs='bal Nekachu',
  850. target='Nekachu'
  851. }
  852. resingSongs['Norzu'] = {
  853. nextSing = os.clock()+34,
  854. fails=0,
  855. songs='bal Norzu',
  856. target='Norzu'
  857. }
  858. resingSongs['self'] = {
  859. nextSing = os.clock()+38,
  860. fails=0,
  861. songs='bal self',
  862. target='self'
  863. }
  864. direct_push(gearswap.res.spells[54], 'ma', player.name, false)
  865. direct_push(gearswap.res.spells[53], 'ma', player.name, false)
  866. direct_push(gearswap.res.spells[55], 'ma', player.name, false)
  867. elseif command == 'omen trash' then
  868. dtMode = false
  869. autoJA = true
  870. auto1hr = false
  871. autoSS = false
  872. resingSongs['Mazuki'] = {
  873. nextSing = os.clock()+1,
  874. fails=0,
  875. songs='march march min min min Mazuki',
  876. target='Mazuki'
  877. }
  878. resingSongs['Nekachu'] = {
  879. nextSing = os.clock()+13,
  880. fails=0,
  881. songs='bal Nekachu',
  882. target='Nekachu'
  883. }
  884. resingSongs['Norzu'] = {
  885. nextSing = os.clock()+19,
  886. fails=0,
  887. songs='bal Norzu',
  888. target='Norzu'
  889. }
  890. resingSongs['self'] = {
  891. nextSing = os.clock()+25,
  892. fails=0,
  893. songs='bal self',
  894. target='self'
  895. }
  896. elseif command == 'omen boss' then
  897. dtMode = false
  898. autoJA = true
  899. auto1hr = false
  900. autoSS = false
  901. resingSongs['Mazuki'] = {
  902. nextSing = os.clock()+1,
  903. fails=0,
  904. songs='scherzo march march mad mad Mazuki',
  905. target='Mazuki'
  906. }
  907. resingSongs['Ulor'] = {
  908. nextSing = os.clock()+18,
  909. fails=0,
  910. songs='scherzo march bal mad mad Ulor',
  911. target='Ulor'
  912. }
  913. resingSongs['Nekachu'] = {
  914. nextSing = os.clock()+24,
  915. fails=0,
  916. songs='bal Nekachu',
  917. target='Nekachu'
  918. }
  919. resingSongs['Norzu'] = {
  920. nextSing = os.clock()+30,
  921. fails=0,
  922. songs='bal Norzu',
  923. target='Norzu'
  924. }
  925. resingSongs['self'] = {
  926. nextSing = os.clock()+36,
  927. fails=0,
  928. songs='bal self',
  929. target='self'
  930. }
  931. elseif command == 'check_has_marsyas' then
  932. has_marsyas = false
  933. if checkNumberOfItem(windower.ffxi.get_items(0), 21398) == true then
  934. has_marsyas = true
  935. elseif not has_marsyas and checkNumberOfItem(windower.ffxi.get_items(8), 21398) == true then
  936. has_marsyas = true
  937. elseif not has_marsyas and checkNumberOfItem(windower.ffxi.get_items(10), 21398) == true then
  938. has_marsyas = true
  939. elseif not has_marsyas and checkNumberOfItem(windower.ffxi.get_items(11), 21398) == true then
  940. has_marsyas = true
  941. elseif not has_marsyas and checkNumberOfItem(windower.ffxi.get_items(12), 21398) == true then
  942. has_marsyas = true
  943. end
  944. elseif execute_common_command(command) then
  945. --done
  946. elseif stack_command(command) then
  947. --done
  948. end
  949. end
  950.  
  951. function check_if_songs_contains_carols()
  952.  
  953. end
  954.  
  955. function handle_ping()
  956. if lullabyWearing ~= false and lullabyWearing-os.clock() <= 0 then
  957. send_command('input /p Lullaby wearing in 30s')
  958. lullabyWearing = false
  959. elseif buffactive['petrification'] and os.clock()-lastChat > 10 then
  960. send_command('input /p stoned')
  961. lastChat = os.clock()
  962. elseif buffactive['sleep'] and os.clock()-lastChat > 10 then
  963. send_command('input /p zzz')
  964. lastChat = os.clock()
  965. elseif buffactive['silence'] and os.clock()-lastChat > 2 then
  966. send_command('input /item "Echo Drops" <me>;')
  967. lastChat = os.clock()
  968. return
  969. elseif (buffactive['doom'] or buffactive['curse']) and os.clock()-lastChat > 2 then
  970. send_command('input /item "Holy Water" <me>;')
  971. lastChat = os.clock()
  972. return
  973. end
  974.  
  975. if check_ready_silent() and player.x == lastx and player.y == lasty then
  976.  
  977. if player.sub_job_level > 0 then
  978. if player.sub_job == 'WHM' then
  979. if not buffactive['reraise'] and is_spell_ready('Reraise') then
  980. direct_push(gearswap.res.spells[135], 'ma', player.name, true)
  981. end
  982. if autoSS and not buffactive['stoneskin'] and is_spell_ready('Stoneskin') then
  983. direct_push(gearswap.res.spells[54], 'ma', player.name, false)
  984. end
  985. if autoBlink and not buffactive['Blink'] and is_spell_ready('Blink') then
  986. direct_push(gearswap.res.spells[53], 'ma', player.name, false)
  987. end
  988. if autoAquaveil and not buffactive['Aquaveil'] and is_spell_ready('Aquaveil') then
  989. direct_push(gearswap.res.spells[55], 'ma', player.name, false)
  990. end
  991.  
  992. if selfFix['cursna'] and (buffactive['doom'] or buffactive['curse']) and is_spell_ready('Cursna') then
  993. direct_push_front(gearswap.res.spells[20], 'ma', player.name, false)
  994. end
  995. if selfFix['erase'] and (buffactive['bind'] or buffactive['weight'] or buffactive['slow']) then
  996. direct_push(gearswap.res.spells[143], 'ma', player.name, false)
  997. end
  998. if selfFix['poisona'] and buffactive['poison'] then
  999. direct_push(gearswap.res.spells[14], 'ma', player.name, false)
  1000. end
  1001. if selfFix['paralyna'] and buffactive['paralysis'] then
  1002. direct_push(gearswap.res.spells[15], 'ma', player.name, false)
  1003. end
  1004.  
  1005. elseif player.sub_job == 'DNC' then
  1006. if (buffactive['paralysis'] or buffactive['bind'] or buffactive['weight'] or buffactive['slow']) and player.tp >= gearswap.res.job_abilities[194].tp_cost then
  1007. direct_push(gearswap.res.job_abilities[194], 'ja', player.name, true)
  1008. end
  1009.  
  1010. local testhp = player.max_hp-player.hp
  1011.  
  1012. if player.tp >= gearswap.res.job_abilities[189].tp_cost and testhp > 390 then
  1013. direct_push(gearswap.res.job_abilities[192], 'ja', player.name, false)
  1014. end
  1015.  
  1016. if player.status == 'Engaged' and not buffactive['amnesia'] and not buffactive['impairment'] and not buffactive['Haste Samba'] and player.tp >= gearswap.res.job_abilities[189].tp_cost then
  1017. direct_push(gearswap.res.job_abilities[189], 'ja', player.name, false)
  1018. end
  1019. elseif player.sub_job == 'RDM' then
  1020.  
  1021. if autoSS and not buffactive['stoneskin'] and is_spell_ready('Stoneskin') then
  1022. direct_push(gearswap.res.spells[54], 'ma', player.name, false)
  1023. end
  1024. if autoBlink and not buffactive['Blink'] and is_spell_ready('Blink') then
  1025. direct_push(gearswap.res.spells[53], 'ma', player.name, false)
  1026. end
  1027. if autoAquaveil and not buffactive['Aquaveil'] and is_spell_ready('Aquaveil') then
  1028. direct_push(gearswap.res.spells[55], 'ma', player.name, false)
  1029. end
  1030.  
  1031. if not buffactive['weakness'] and player.mp < 200 and player.hp > 1000 and is_ability_ready('Convert') then
  1032. direct_push(gearswap.res.job_abilities[83], 'ja', player.name, true)
  1033. end
  1034. if not buffactive['refresh'] and recastData[gearswap.res.spells[109].recast_id] == 0 and player.mp > gearswap.res.spells[109].mp_cost then
  1035. direct_push(gearswap.res.spells[109], 'ma', player.name, true)
  1036. end
  1037. if autoPhalanx and not buffactive['Phalanx'] and recastData[gearswap.res.spells[106].recast_id] == 0 and player.mp > gearswap.res.spells[106].mp_cost then
  1038. direct_push(gearswap.res.spells[109], 'ma', player.name, true)
  1039. end
  1040. elseif player.sub_job == 'NIN' then
  1041. if not buffactive['Copy Image (2)'] and not buffactive['Copy Image (3)'] and not buffactive['Copy Image (4)'] then
  1042. if is_spell_ready('Utsusemi: Ni') then
  1043. direct_push_front(gearswap.res.spells[339], 'ma', player.name, false)
  1044. elseif is_spell_ready('Utsusemi: Ichi') then
  1045. direct_push_front(gearswap.res.spells[338], 'ma', player.name, false)
  1046. end
  1047. end
  1048. end
  1049. end
  1050.  
  1051. if doCures then
  1052. cure_process()
  1053. end
  1054.  
  1055. check_auto_spell()
  1056. check_songs()
  1057. handleSpareTime()
  1058. else
  1059. if player.hp == 0 then
  1060. clear_spell_stack()
  1061. end
  1062. lastx = player.x
  1063. lasty = player.y
  1064. end
  1065. end
  1066.  
  1067. function file_unload(file_name)
  1068. windower.text.delete('stackoutput')
  1069. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement