Guest User

Untitled

a guest
Jan 28th, 2015
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.51 KB | None | 0 0
  1.  
  2.  
  3. function get_sets()
  4. AccIndex = 1
  5. AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For TP/WS/Hybrid. Default ACC Set Is LowACC. The First TP Set Of Your Main Weapon Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  6. IdleIndex = 1
  7. IdleArray = {"Movement","Regen"} -- Default Idle Set Is Movement --
  8. Armor = 'None'
  9. Skillchain = false
  10. target_distance = 5 -- Set Default Distance Here --
  11. select_default_macro_book() -- Change Default Macro Book At The End --
  12.  
  13. sc_map = {SC1="Exenterator", SC2="FeatherStep", SC3="HasteSamba"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  14.  
  15. -- Idle/Town Sets --
  16. sets.Idle = {}
  17. sets.Idle.Regen = {
  18. ammo="Vanir Battery",
  19. head="Oce. Headpiece +1",
  20. neck="Wiglen Gorget",
  21. ear1="Sanare Earring",
  22. ear2="Colossus's Earring",
  23. body="Kheper Jacket",
  24. hands="Iuitl Wristbands",
  25. ring1="Paguroidea Ring",
  26. ring2="Sheltered Ring",
  27. back="Repulse Mantle",
  28. waist="Flume Belt",
  29. legs="Iuitl Tights",
  30. feet="Skd. Jambeaux +1"}
  31. sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  32. ammo="Vanir Battery",
  33. head="Oce. Headpiece +1",
  34. neck="Wiglen Gorget",
  35. ear1="Sanare Earring",
  36. ear2="Colossus's Earring",
  37. body="Kheper Jacket",
  38. hands="Iuitl Wristbands",
  39. ring1="Paguroidea Ring",
  40. ring2="Sheltered Ring",
  41. back="Repulse Mantle",
  42. waist="Flume Belt",
  43. legs="Iuitl Tights",
  44. feet="Skd. Jambeaux +1"})
  45.  
  46. -- Normal TP Sets --
  47. sets.TP = {
  48. ammo="Ginsen",
  49. head="Iuitl Headgear +1",
  50. neck="Charis Necklace",
  51. ear1="Heartseeker Earring",
  52. ear2="Dudgeon Earring",
  53. body="Qaaxo Harness",
  54. hands="Iuitl Wristbands",
  55. ring1="Epona's Ring",
  56. ring2="Rajas Ring",
  57. back="Toetapper Mantle",
  58. waist="Shetal Stone",
  59. legs="Iuitl Tights",
  60. feet="Horos toe Shoes +1"}
  61. sets.TP.MidACC = set_combine(sets.TP,{
  62. ammo="Honed Tathlum",
  63. back="Letalis Mantle"})
  64. sets.TP.HighACC = set_combine(sets.TP.MidACC,{
  65. head="Whirlpool Mask",
  66. neck="Ej necklace +1",
  67. body="Manibozho Jerkin",
  68. hands="Buremte Gloves",
  69. ring1="Patricius Ring",
  70. ring2="Mars's Ring",
  71. waist="Hurch'lan Sash",
  72. legs="Maxixi Tights +1",
  73. feet="Horos toe Shoes +1"})
  74.  
  75. -- March x2 + Haste --
  76. sets.TP.MidHaste = set_combine(sets.TP,{
  77. waist="Windbuffet Belt +1",
  78. ear1="Suppanomimi",
  79. neck="Asperity Necklace",
  80. ear2="Brutal Earring"})
  81. sets.TP.MidACC.MidHaste = set_combine(sets.TP.MidHaste,{
  82. ammo="Honed Tathlum",
  83. back="Letalis Mantle"})
  84. sets.TP.HighACC.MidHaste = set_combine(sets.TP.MidACC.MidHaste,{
  85. head="Whirlpool Mask",
  86. neck="Ej necklace +1",
  87. body="Manibozho Jerkin",
  88. hands="Buremte Gloves",
  89. ring1="Patricius Ring",
  90. ring2="Mars's Ring",
  91. waist="Hurch'lan Sash",
  92. legs="Maxixi Tights +1",
  93. feet="Horos Toe Shoes +1"})
  94.  
  95. -- March x2 + Haste + Samba --
  96. sets.TP.HighHaste = set_combine(sets.TP.MidHaste,{
  97. neck="Asperity Necklace",
  98. ear1="Tripudio Earring",
  99. ear2="Brutal Earring",
  100. back="Bleating Mantle",
  101. waist="Windbuffet Belt +1"})
  102. sets.TP.MidACC.HighHaste = set_combine(sets.TP.HighHaste,{
  103. ammo="Honed Tathlum",
  104. ear1="Steelflash Earring",
  105. ear2="Bladeborn Earring",
  106. back="Letalis Mantle"})
  107. sets.TP.HighACC.HighHaste = set_combine(sets.TP.MidACC.HighHaste,{
  108. head="Whirlpool Mask",
  109. neck="Ej necklace +1",
  110. body="Manibozho Jerkin",
  111. hands="Buremte Gloves",
  112. ring1="Patricius Ring",
  113. ring2="Mars's Ring",
  114. waist="Hurch'lan Sash",
  115. legs="Maxixi Tights +1",
  116. feet="Horos Toe Shoes +1"})
  117.  
  118. -- Saber Dance TP Set --
  119. sets.TP['Saber Dance'] = {legs="Horos Tights"}
  120. -- Climactic Flourish TP Set --
  121. sets.TP['Climactic Flourish'] = {head="Charis Tiara +2"}
  122.  
  123. -- PDT/MDT Sets --
  124. sets.PDT = {
  125. ammo="Ginsen",
  126. head="Iuitl Headgear +1",
  127. neck="Twilight Torque",
  128. ear1="Suppnomimi",
  129. ear2="Brutal Earring",
  130. body="Qaaxo harness",
  131. hands="Iuitl Wristbands",
  132. ring1="Dark Ring",
  133. ring2="Defending Ring",
  134. back="Mollusca Mantle",
  135. waist="Flume Belt",
  136. legs="Iuitl Tights",
  137. feet="Iuitl Gaiters"}
  138.  
  139. sets.MDT = set_combine(sets.PDT,{
  140. ear1="Merman's Earring",
  141. ear2="Sanare Earring",
  142. ring1="Shadow Ring",
  143. back="Engulfer Cape",
  144. waist="Resolute Belt"})
  145.  
  146. -- Hybrid/Evasion Sets --
  147. sets.TP.Hybrid = set_combine(sets.PDT,{
  148. head="Felistris Mask",
  149. ear1="Heartseeker Earring",
  150. ear2="Dudgeon Earring",
  151. body="Thaumas Coat",
  152. waist="Windbuffet Belt"})
  153. sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  154. sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  155.  
  156. sets.Evasion = set_combine(sets.PDT,{})
  157.  
  158. -- WS Base Set --
  159. sets.WS = {}
  160.  
  161. -- WS Sets --
  162. sets.WS.Exenterator = {
  163. head="Felistris Mask",
  164. neck="Justiciar's Torque",
  165. ear1="Steelflash Earring",
  166. ear2="Bladeborn Earring",
  167. body="Khepri Jacket",
  168. hands="Iuitl Wristbands +1",
  169. ring1="Stormsoul Ring",
  170. ring2="Epona's Ring",
  171. back="Atheling Mantle",
  172. waist="Elanid Belt",
  173. legs="Nahtirah Trousers",
  174. feet="Iuitl Gaiters +1"}
  175. sets.WS.Exenterator.MidACC = set_combine(sets.WS.Exenterator,{})
  176. sets.WS.Exenterator.HighACC = set_combine(sets.WS.Exenterator.MidACC,{})
  177.  
  178. sets.WS["Pyrrhic Kleos"] = {
  179. head="Uk'uxkaj Cap",
  180. neck="Love Torque",
  181. ear1="Jupiter's Pearl",
  182. ear2="Brutal Earring",
  183. body="Manibozho Jerkin",
  184. hands="Buremte Gloves",
  185. ring1="Epona's Ring",
  186. ring2="Rajas Ring",
  187. back="Atheling Mantle",
  188. waist="Wanion Belt",
  189. legs="Manibozho Brais",
  190. feet="Iuitl Gaiters +1"}
  191. sets.WS["Pyrrhic Kleos"].MidACC = set_combine(sets.WS["Pyrrhic Kleos"],{})
  192. sets.WS["Pyrrhic Kleos"].HighACC = set_combine(sets.WS["Pyrrhic Kleos"].MidACC,{})
  193.  
  194. sets.WS["Rudra's Storm"] = {
  195. head="Uk'uxkaj Cap",
  196. ammo="Charis Feather",
  197. neck="Snow Gorget",
  198. ear1="Moonshade Earring",
  199. ear2="Jupiter Earring",
  200. body=" Mekosu. Harness",
  201. hands="Buremte Gloves",
  202. ring1="Epona's Ring",
  203. ring2="Ramuh Rihg +1",
  204. back="Kayapa Cape",
  205. waist="Wanion Belt",
  206. legs="Manibozho Brais",
  207. feet="Horos Toe Shoes +1"}
  208. sets.WS["Rudra's Storm"].MidACC = set_combine(sets.WS["Rudra's Storm"],{})
  209. sets.WS["Rudra's Storm"].HighACC = set_combine(sets.WS["Rudra's Storm"].MidACC,{})
  210.  
  211. sets.WS.Evisceration = {
  212. head="Uk'uxkaj Cap",
  213. ammo="Charis Feather",
  214. neck="Soil Gorget",
  215. ear1="Moonshade Earring",
  216. ear2="Brutal Earring",
  217. body=" Mekosu. Harness",
  218. hands="Buremte Gloves",
  219. ring1="Epona's Ring",
  220. ring2="Ramuh Rihg +1",
  221. back="Rancorous Mantle",
  222. waist="Soil Belt",
  223. legs="Manibozho Brais",
  224. feet="Horos Toe Shoes +1"}
  225. sets.WS.Evisceration.MidACC = set_combine(sets.WS.Evisceration,{})
  226. sets.WS.Evisceration.HighACC = set_combine(sets.WS.Evisceration.MidACC,{})
  227.  
  228. -- JA Sets --
  229. sets.JA = {}
  230. sets.JA.Trance = {head="Horos Tiara +1"}
  231. sets.JA['No Foot Rise'] = {body="Horos Casaque"}
  232.  
  233. -- Jig Set --
  234. sets.Jig = {legs="Horos Tights +1",feet="Maxixi Toe. +1"}
  235.  
  236. -- Step Base Set --
  237. sets.Step = {head="Whirlpool Mask",neck="Iqabi Necklace",ear1="Zennaroi Earring",ear2="Heartseeker Earring",body="Mekosu. Harness",hands="Buremte Gloves",ring1="Ramuh Ring +1",ring2="Gorney Ring",back="Toetapper Mantle",waist="Chaac Belt",legs="Manibozho Brais",feet="Horos Toe Shoes +1"}
  238. sets.Step['Feather Step'] = set_combine(sets.Step,{feet="Charis Shoes +2"})
  239.  
  240. -- Samba Set --
  241. sets.Samba = {head="Maxixi Tiara +1"}
  242.  
  243. -- Flourish Base Set --
  244. sets.Flourish = {}
  245. sets.Flourish['Reverse Flourish'] = set_combine(sets.Flourish,{hands="Charis Bangles +2"})
  246. sets.Flourish['Climactic Flourish'] = set_combine(sets.Flourish,{head="Charis Tiara +2"})
  247. sets.Flourish['Striking Flourish'] = set_combine(sets.Flourish,{body="Charis Casaque +2"})
  248. sets.Flourish['Violent Flourish'] = set_combine(sets.Flourish,{body="Horos Casaque", waist="Chaac Belt", ring2="Gorney ring"})
  249. sets.Flourish['Desperate Flourish'] = set_combine(sets.Flourish)
  250. sets.Flourish['Wild Flourish'] = set_combine(sets.Flourish)
  251.  
  252. sets.Skillchain = {hands="Charis Bangles +2"}
  253.  
  254. -- Waltz Set --
  255. sets.Waltz = {
  256. head="Horos Tiara +1",
  257. ammo="Sonia's Plectrum",
  258. ear1="Enchntr. Earring +1",
  259. body="Maxixi Casaque",
  260. back="Toetapper Mantle",
  261. feet="Maxixi Shoes +1"}
  262.  
  263. sets.Precast = {}
  264. -- Fastcast Set --
  265. sets.Precast.FastCast = {
  266. ammo="Impatiens",
  267. head="Haruspex Hat +1",
  268. neck="Orunmila's Torque",
  269. ear1="Loquac. Earring",
  270. ear2="Enchntr. Earring +1",
  271. hands="Thaumas Gloves",
  272. ring1="Prolix Ring",
  273. ring2="Veneficium Ring"}
  274. -- Utsusemi Precast Set --
  275. sets.Precast.Utsusemi = set_combine(sets.Precast.FastCast,{neck="Magoraga Beads"})
  276.  
  277. sets.Midcast = {}
  278. -- Magic Haste Set --
  279. sets.Midcast.Haste = set_combine(sets.PDT,{})
  280. end
  281.  
  282. function pretarget(spell, action)
  283. if (spell.type:endswith('Magic') or spell.type == "Ninjutsu") and buffactive.silence then
  284. cancel_spell()
  285. send_command('input /item "Echo Drops" <me>')
  286. elseif spell.english == "Berserk" and buffactive.Berserk then
  287. cancel_spell()
  288. send_command('Aggressor')
  289. elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then
  290. cancel_spell()
  291. add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  292. return
  293. end
  294. end
  295.  
  296. function precast(spell, action)
  297. if spell.type == "WeaponSkill" then
  298. if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  299. cancel_spell()
  300. add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  301. return
  302. else
  303. equipSet = sets.WS
  304. if equipSet[spell.english] then
  305. equipSet = equipSet[spell.english]
  306. end
  307. if equipSet[AccArray[AccIndex]] then
  308. equipSet = equipSet[AccArray[AccIndex]]
  309. end
  310. if Skillchain then
  311. equipSet = set_combine(equipSet,sets.Skillchain)
  312. end
  313. if spell.english == "Evisceration" and player.tp > 299 then
  314. equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"})
  315. end
  316. equip(equipSet)
  317. end
  318. elseif spell.type == "JobAbility" then
  319. if sets.JA[spell.english] then
  320. if spell.english == 'Trance' and buffactive['Saber Dance'] then
  321. cast_delay(0.2)
  322. send_command('cancel Saber Dance')
  323. end
  324. equip(sets.JA[spell.english])
  325. end
  326. elseif spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  327. if string.find(spell.english,'Utsusemi') then
  328. if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  329. cancel_spell()
  330. add_to_chat(123, spell.english .. ' Canceled: [3+ Images]')
  331. return
  332. else
  333. equip(sets.Precast.Utsusemi)
  334. end
  335. else
  336. equip(sets.Precast.FastCast)
  337. end
  338. elseif spell.type == "Step" then
  339. if not buffactive.Presto then
  340. if not buffactive['Finishing Move 3'] and not buffactive['Finishing Move 4'] and not buffactive['Finishing Move 5'] then
  341. add_to_chat(158,'Current Step: ['..spell.english..']')
  342. cancel_spell()
  343. add_to_chat(158,'No Presto Up - Popping Presto!')
  344. send_command('Presto;wait 2;//'..spell.name)
  345. else
  346. add_to_chat(123,'Skipping Presto.')
  347. end
  348. elseif sets.Step[spell.english] then
  349. equip(sets.Step[spell.english])
  350. else
  351. equip(sets.Step)
  352. end
  353. elseif spell.type == "Waltz" then
  354. if buffactive['Saber Dance'] then
  355. cast_delay(0.2)
  356. send_command('cancel Saber Dance')
  357. end
  358. refine_waltz(spell,action)
  359. equip(sets.Waltz)
  360. elseif spell.type == "Jig" then
  361. if spell.english == 'Spectral Jig' and buffactive.Sneak then
  362. cast_delay(0.2)
  363. send_command('cancel Sneak')
  364. end
  365. equip(sets.Jig)
  366. elseif spell.type == 'Samba' then
  367. if buffactive['Fan Dance'] then
  368. cast_delay(0.2)
  369. send_command('cancel Fan Dance')
  370. end
  371. equip(sets.Samba)
  372. elseif string.find(spell.type,'Flourish') then
  373. if sets.Flourish[spell.english] then
  374. equip(sets.Flourish[spell.english])
  375. end
  376. end
  377. end
  378.  
  379. function midcast(spell, action)
  380. if spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  381. if string.find(spell.english,'Utsusemi') then
  382. if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  383. send_command('@wait 1.7;cancel Copy Image*')
  384. end
  385. equip(sets.Midcast.Haste)
  386. elseif spell.english == 'Monomi: Ichi' then
  387. if buffactive['Sneak'] then
  388. send_command('@wait 1.7;cancel sneak')
  389. end
  390. equip(sets.Midcast.Haste)
  391. else
  392. equip(sets.Midcast.Haste)
  393. end
  394. end
  395. end
  396.  
  397. function aftercast(spell, action)
  398. if spell.english == "Wild Flourish" and not spell.interrupted then
  399. Skillchain = true
  400. send_command('wait 7;gs c clear Skillchain')
  401. elseif spell.type == "WeaponSkill" and not spell.interrupted then
  402. Skillchain = not Skillchain
  403. send_command('wait 0.2;gs c TP;wait 7;gs c clear Skillchain')
  404. else
  405. status_change(player.status)
  406. end
  407. if spell.english == 'Haste Samba' then
  408. timer_haste_samba()
  409. end
  410. end
  411.  
  412. function status_change(new,old)
  413. if Armor == 'PDT' then
  414. equip(sets.PDT)
  415. elseif Armor == 'MDT' then
  416. equip(sets.MDT)
  417. elseif Armor == 'EVA' then
  418. equip(sets.Evasion)
  419. elseif new == 'Engaged' then
  420. equipSet = sets.TP
  421. if Armor == 'Hybrid' and equipSet["Hybrid"] then
  422. equipSet = equipSet["Hybrid"]
  423. end
  424. if equipSet[AccArray[AccIndex]] then
  425. equipSet = equipSet[AccArray[AccIndex]]
  426. end
  427. if (buffactive.Embrava and (buffactive.Haste or buffactive.March) and buffactive['Haste Samba']) or (buffactive.March == 2 and buffactive.Haste and buffactive['Haste Samba']) and equipSet["HighHaste"] then
  428. equipSet = equipSet["HighHaste"]
  429. end
  430. if (buffactive.Embrava and (buffactive.Haste or buffactive.March or buffactive['Haste Samba'])) or (buffactive.March == 1 and buffactive.Haste and buffactive['Haste Samba'] and equipSet["MidHaste"]) or (buffactive.March == 2 and (buffactive.Haste or buffactive['Haste Samba'])) and equipSet["MidHaste"] then
  431. equipSet = equipSet["MidHaste"]
  432. end
  433. if buffactive['Saber Dance'] then
  434. equipSet = set_combine(equipSet,sets.TP['Saber Dance'])
  435. end
  436. if buffactive['Climactic Flourish'] then
  437. equipSet = set_combine(equipSet,sets.TP['Climactic Flourish'])
  438. end
  439. equip(equipSet)
  440. else
  441. equip(sets.Idle[IdleArray[IdleIndex]])
  442. end
  443. end
  444.  
  445. function buff_change(buff,gain)
  446. buff = string.lower(buff)
  447. if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  448. if gain then
  449. 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.]')
  450. else
  451. send_command('timers delete "Aftermath: Lv.3"')
  452. add_to_chat(123,'AM3: [OFF]')
  453. end
  454. elseif buff == 'haste samba' and not gain then
  455. send_command('timers delete "Haste Samba"')
  456. elseif buff == 'weakness' then -- Weakness Timer --
  457. if gain then
  458. send_command('timers create "Weakness" 300 up')
  459. else
  460. send_command('timers delete "Weakness"')
  461. end
  462. end
  463. if not midaction() then
  464. status_change(player.status)
  465. end
  466. end
  467.  
  468. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  469. function self_command(command)
  470. if command == 'C1' then -- Accuracy Level Toggle --
  471. AccIndex = (AccIndex % #AccArray) + 1
  472. status_change(player.status)
  473. add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  474. elseif command == 'C5' then -- Auto Update Gear Toggle --
  475. status_change(player.status)
  476. add_to_chat(158,'Auto Update Gear')
  477. elseif command == 'C2' then -- Hybrid Toggle --
  478. if Armor == 'Hybrid' then
  479. Armor = 'None'
  480. add_to_chat(123,'Hybrid Set: [Unlocked]')
  481. else
  482. Armor = 'Hybrid'
  483. add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  484. end
  485. status_change(player.status)
  486. elseif command == 'C7' then -- PDT Toggle --
  487. if Armor == 'PDT' then
  488. Armor = 'None'
  489. add_to_chat(123,'PDT Set: [Unlocked]')
  490. else
  491. Armor = 'PDT'
  492. add_to_chat(158,'PDT Set: [Locked]')
  493. end
  494. status_change(player.status)
  495. elseif command == 'C15' then -- MDT Toggle --
  496. if Armor == 'MDT' then
  497. Armor = 'None'
  498. add_to_chat(123,'MDT Set: [Unlocked]')
  499. else
  500. Armor = 'MDT'
  501. add_to_chat(158,'MDT Set: [Locked]')
  502. end
  503. status_change(player.status)
  504. elseif command == 'C3' then -- Evasion Toggle --
  505. if Armor == 'EVA' then
  506. Armor = 'None'
  507. add_to_chat(123,'Evasion Set: [Unlocked]')
  508. else
  509. Armor = 'EVA'
  510. add_to_chat(158,'Evasion Set: [Locked]')
  511. end
  512. status_change(player.status)
  513. elseif command == 'C8' then -- Distance Toggle --
  514. if player.target.distance then
  515. target_distance = math.floor(player.target.distance*10)/10
  516. add_to_chat(158,'Distance: '..target_distance)
  517. else
  518. add_to_chat(123,'No Target Selected')
  519. end
  520. elseif command == 'C6' then -- Idle Toggle --
  521. IdleIndex = (IdleIndex % #IdleArray) + 1
  522. status_change(player.status)
  523. add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  524. elseif command == 'TP' then
  525. add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  526. elseif command:match('^SC%d$') then
  527. send_command('//' .. sc_map[command])
  528. end
  529. end
  530.  
  531. function timer_haste_samba()
  532. local duration = 90
  533.  
  534. if player.main_job == 'DNC' then
  535. if player.equipment.head == "Dancer's Tiara" or player.equipment.head == "Dancer's Tiara +1" then
  536. duration = duration + 30
  537. elseif player.equipment.head == 'Maxixi Tiara' then
  538. duration = duration + 40
  539. elseif player.equipment.head == 'Maxixi Tiara +1' then
  540. duration = duration + 45
  541. end
  542.  
  543. if buffactive['Saber Dance'] then
  544. local merits = player.merits.saber_dance
  545. if merits > 1 then
  546. local extend = (merits - 1) * 5
  547. duration = math.floor(duration + (duration * extend / 100))
  548. end
  549. end
  550. end
  551.  
  552. send_command('timers create "Haste Samba" '..tostring(duration)..' down abilities/00216.png')
  553. end
  554.  
  555. function refine_waltz(spell,action)
  556. if spell.type ~= 'Waltz' then
  557. return
  558. end
  559.  
  560. if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  561. return
  562. end
  563.  
  564. local newWaltz = spell.english
  565. local waltzID
  566.  
  567. local missingHP
  568.  
  569. if spell.target.type == "SELF" then
  570. missingHP = player.max_hp - player.hp
  571. elseif spell.target.isallymember then
  572. local target = find_player_in_alliance(spell.target.name)
  573. local est_max_hp = target.hp / (target.hpp/100)
  574. missingHP = math.floor(est_max_hp - target.hp)
  575. end
  576.  
  577. if missingHP ~= nil then
  578. if player.main_job == 'DNC' then
  579. if missingHP < 40 and spell.target.name == player.name then
  580. add_to_chat(123,'Full HP!')
  581. cancel_spell()
  582. return
  583. elseif missingHP < 200 then
  584. newWaltz = 'Curing Waltz'
  585. waltzID = 190
  586. elseif missingHP < 600 then
  587. newWaltz = 'Curing Waltz II'
  588. waltzID = 191
  589. elseif missingHP < 1100 then
  590. newWaltz = 'Curing Waltz III'
  591. waltzID = 192
  592. elseif missingHP < 1500 then
  593. newWaltz = 'Curing Waltz IV'
  594. waltzID = 193
  595. else
  596. newWaltz = 'Curing Waltz V'
  597. waltzID = 311
  598. end
  599. else
  600. return
  601. end
  602. end
  603.  
  604. local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50, ['Curing Waltz IV'] = 65, ['Curing Waltz V'] = 80}
  605. local tpCost = waltzTPCost[newWaltz]
  606.  
  607. local downgrade
  608.  
  609. if player.tp < tpCost and not buffactive.trance then
  610.  
  611. if player.tp < 20 then
  612. add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  613. cancel_spell()
  614. return
  615. elseif player.tp < 35 then
  616. newWaltz = 'Curing Waltz'
  617. elseif player.tp < 50 then
  618. newWaltz = 'Curing Waltz II'
  619. elseif player.tp < 65 then
  620. newWaltz = 'Curing Waltz III'
  621. elseif player.tp < 80 then
  622. newWaltz = 'Curing Waltz IV'
  623. end
  624.  
  625. downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  626. end
  627.  
  628. if newWaltz ~= spell.english then
  629. send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  630. if downgrade then
  631. add_to_chat(158, downgrade)
  632. end
  633. cancel_spell()
  634. return
  635. end
  636.  
  637. if missingHP > 0 then
  638. add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  639. end
  640. end
  641.  
  642. function find_player_in_alliance(name)
  643. for i,v in ipairs(alliance) do
  644. for k,p in ipairs(v) do
  645. if p.name == name then
  646. return p
  647. end
  648. end
  649. end
  650. end
  651.  
  652. function sub_job_change(newSubjob, oldSubjob)
  653. select_default_macro_book()
  654. end
  655.  
  656. function set_macro_page(set,book)
  657. if not tonumber(set) then
  658. add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  659. return
  660. end
  661. if set < 1 or set > 10 then
  662. add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  663. return
  664. end
  665.  
  666. if book then
  667. if not tonumber(book) then
  668. add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  669. return
  670. end
  671. if book < 1 or book > 20 then
  672. add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  673. return
  674. end
  675. send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  676. else
  677. send_command('@input /macro set '..tostring(set))
  678. end
  679. end
  680.  
  681. function select_default_macro_book()
  682. -- Default macro set/book
  683. if player.sub_job == 'WAR' then
  684. set_macro_page(1, 19)
  685. elseif player.sub_job == 'NIN' then
  686. set_macro_page(1, 19)
  687. elseif player.sub_job == 'SAM' then
  688. set_macro_page(1, 19)
  689. else
  690. set_macro_page(1, 19)
  691. end
  692. end
Advertisement
Add Comment
Please, Sign In to add comment