Advertisement
Guest User

Untitled

a guest
Jun 21st, 2014
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.41 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Some of Motenten's Functions ** --
  3. -- Last Updated: 05/03/14 6:30 AM *Advanced Version* --
  4.  
  5. function get_sets()
  6. AccIndex = 1
  7. AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For Shooting/QD/TP/WS. 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 --
  8. IdleIndex = 1
  9. IdleArray = {'Movement', 'Regen'} -- Default Idle Set Is Movement --
  10. Armor = 'None'
  11. define_roll_values()
  12. AutoMode = 'OFF' -- Set Default Auto RA/WS ON or OFF Here --
  13. Obi = 'ON' -- Turn Default Obi ON or OFF Here --
  14. target_distance = 5 -- Set Default Distance Here --
  15. select_default_macro_book() -- Change Default Macro Book At The End --
  16.  
  17. ACC_Shots = S{"Light Shot","Dark Shot"}
  18.  
  19. Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  20. Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  21. sc_map = {SC1="CoursersRoll", SC2="DiaII", SC3="LightShot"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  22.  
  23. -- Idle/Town Sets --
  24. sets.Idle = {}
  25. sets.Idle.Regen = {
  26. ammo="Adlivun Bullet",
  27. head="Lak. Hat +1",
  28. neck="Twilight Torque",
  29. body="Lak. Frac +1",
  30. ear1="Merman's Earring",
  31. ear2="Merman's Earring",
  32. hands="Umuthi gloves",
  33. ring1="Dark Ring",
  34. ring2="Dark Ring",
  35. back="Repulse Mantle",
  36. legs="Crimson Cuisses",
  37. waist="Aquiline belt",
  38. feet="Lak. bottes +1"}
  39. sets.Idle.Movement = set_combine(sets.Idle.Regen,{})
  40.  
  41. -- QD Sets --
  42. sets.QD = {
  43. ammo="Animikii Bullet",
  44. head="Lak. Hat +1",
  45. neck="Atzintli necklace",
  46. ear1="Hecate's Earring",
  47. ear2="Moldavite Earring",
  48. body="Mirke wardecors",
  49. hands="Schutzen mittens",
  50. ring1="Breeze Ring",
  51. ring2="Breeze Ring",
  52. back="Gunslinger's Cape",
  53. waist="Aquiline Belt",
  54. legs="Shneddick tights +1",
  55. feet="Lak. bottes +1"}
  56. sets.QD.MidACC = set_combine(sets.QD,{})
  57. sets.QD.HighACC = set_combine(sets.QD.MidACC,{
  58. ammo="Animikii Bullet",
  59. head="Lak. Hat +1",
  60. neck="Atzintli necklace",
  61. body="Mirke wardecors",
  62. back="Gunslinger's Cape",
  63. waist="Aquiline Belt",
  64. feet="Lak. bottes +1",
  65. ear1="Lifestorm Earring",
  66. ear2="Psystorm Earring",
  67. hands="Sigyn's Bazubands",
  68. ring1="Balrahn's Ring",
  69. ring2="Sangoma Ring",
  70. legs="Iuitl tights"})
  71.  
  72. -- PDT/MDT Sets --
  73. sets.PDT = {
  74. ammo="Adlivun Bullet",
  75. head="Lak. Hat +1",
  76. neck="Twilight Torque",
  77. ear1="Merman's Earring",
  78. ear2="Merman's Earring",
  79. hands="Umuthi gloves",
  80. ring1="Dark Ring",
  81. ring2="Dark Ring",
  82. back="Repulse Mantle",
  83. legs="Crimson Cuisses",
  84. feet="Iuitl Gaiters"}
  85.  
  86. sets.MDT = set_combine(sets.PDT,{})
  87.  
  88. -- Roll Set --
  89. sets.Rolls = {
  90. head="Comm. Tricorne +1",
  91. hands="Nvrch. Gants +2",
  92. legs="Desultor tassets",
  93. ring1="Luzaf's Ring",
  94. ring2="Barataria ring"}
  95.  
  96. -- Preshot --
  97. sets.Preshot = {
  98. ammo="Adlivun Bullet",
  99. head="Aurore Beret",
  100. body="Laksamana's Frac",
  101. hands="Iuitl wristbands",
  102. back="Navarch's Mantle",
  103. waist="Impulse Belt"}
  104.  
  105. -- Shooting Base Set --
  106. sets.Midshot = {}
  107.  
  108. -- Death Penalty Sets --
  109. sets.Midshot['Death Penalty'] = {}
  110. sets.Midshot['Death Penalty'].MidACC = set_combine(sets.Midshot['Death Penalty'],{})
  111. sets.Midshot['Death Penalty'].HighACC = set_combine(sets.Midshot['Death Penalty'].MidACC,{})
  112.  
  113. -- Deathlocke Sets --
  114. sets.Midshot.Deathlocke = {
  115. ammo="Adlivun Bullet",
  116. head="Lak. Hat +1",
  117. neck="Iqabi necklace",
  118. ear1="Navarch's earring",
  119. ear2="Volley Earring",
  120. body="Laksamana's Frac",
  121. hands="Buremte gloves",
  122. ring1="Paqichikaji Ring",
  123. ring2="Behemoth Ring +1",
  124. back="Gunslinger's Mantle",
  125. waist="Commodore belt",
  126. legs="Thur. tights +1",
  127. feet="Iuitl Gaiters"}
  128. sets.Midshot.Deathlocke.MidACC = set_combine(sets.Midshot.Deathlocke,{})
  129. sets.Midshot.Deathlocke.HighACC = set_combine(sets.Midshot.Deathlocke.MidACC,{})
  130.  
  131. -- Armageddon Sets --
  132. sets.Midshot.Armageddon = {}
  133. sets.Midshot.Armageddon.MidACC = set_combine(sets.Midshot.Armageddon,{})
  134. sets.Midshot.Armageddon.HighACC = set_combine(sets.Midshot.Armageddon.MidACC,{})
  135.  
  136. -- Melee Sets --
  137. sets.Melee = {
  138. ammo="Adlivun Bullet",
  139. head="Lak. Hat +1",
  140. neck="Asperity necklace",
  141. ear1="Brutal Earring",
  142. ear2="Suppanomimi",
  143. body="Lanun frac",
  144. hands="Buremte gloves",
  145. ring1="Epona's Ring",
  146. ring2="Rajas Ring",
  147. back="Letalis Mantle",
  148. waist="Twilight belt",
  149. legs="Kaabnax trousers",
  150. feet="Lanun bottes"}
  151. sets.Melee.MidACC = set_combine(sets.Melee,{})
  152. sets.Melee.HighACC = set_combine(sets.Melee.MidACC,{})
  153.  
  154. -- WS Base Set --
  155. sets.WS = {}
  156.  
  157. -- Last Stand Sets --
  158. sets.WS["Last Stand"] = {
  159. ammo="Achiyal. Bullet",
  160. head="Lak. Hat +1",
  161. neck="Light Gorget",
  162. ear1="Navarch's Earring",
  163. ear2="Volley earring",
  164. body="Lak. Frac +1",
  165. hands="Skadi's Bazubands +1",
  166. ring1="Breeze Ring",
  167. ring2="Breeze Ring",
  168. back="Gunslinger's cape",
  169. waist="Flame Belt",
  170. legs="Lanun culottes",
  171. feet="Iuitl gaiters"}
  172. sets.WS["Last Stand"].MidACC = set_combine(sets.WS["Last Stand"],{})
  173. sets.WS["Last Stand"].HighACC = set_combine(sets.WS["Last Stand"].MidACC,{
  174. ring1="Paqichikaji Ring",
  175. ring2="Behemoth's Ring +1",
  176. legs="Thur. Tights +1"})
  177.  
  178. -- Wildfire Sets --
  179. sets.WS["Wildfire"] = {
  180. ammo="Bronze Bullet",
  181. head="Lak. Hat +1",
  182. neck="Atzintli necklace",
  183. ear1="Hecate's Earring",
  184. ear2="Moldavite Earring",
  185. body="Lanun frac",
  186. hands="Schutzen mittens",
  187. ring1="Breeze Ring",
  188. ring2="Breeze Ring",
  189. back="Gunslinger's Cape",
  190. waist="Aquiline Belt",
  191. legs="Shneddick tights +1",
  192. feet="Lanun Bottes"}
  193. sets.WS["Wildfire"].MidACC = set_combine(sets.WS["Wildfire"],{})
  194. sets.WS["Wildfire"].HighACC = set_combine(sets.WS["Wildfire"].MidACC,{
  195. ear1="Lifestorm Earring",
  196. ear2="Psystorm Earring",
  197. hands="Sigyn's Bazubands",
  198. ring1="Balrahn's Ring",
  199. ring2="Sangoma Ring",
  200. legs="Iuitl tights",
  201. feet="Iuitl gaiters"})
  202.  
  203. -- Leaden Salute Sets --
  204. sets.WS['Leaden Salute'] = {
  205. ammo="Bronze Bullet",
  206. head="Lak. Hat +1",
  207. neck="Atzintli necklace",
  208. ear1="Hecate's Earring",
  209. ear2="Moldavite Earring",
  210. body="Lanun frac",
  211. hands="Schutzen mittens",
  212. ring1="Breeze Ring",
  213. ring2="Breeze Ring",
  214. back="Gunslinger's Cape",
  215. waist="Aquiline Belt",
  216. legs="Shneddick tights +1",
  217. feet="Lanun Bottes"}
  218. sets.WS['Leaden Salute'].MidACC = set_combine(sets.WS['Leaden Salute'],{})
  219. sets.WS['Leaden Salute'].HighACC = set_combine(sets.WS['Leaden Salute'].MidACC,{
  220. ear1="Lifestorm Earring",
  221. ear2="Psystorm Earring",
  222. hands="Sigyn's Bazubands",
  223. ring1="Balrahn's Ring",
  224. ring2="Sangoma Ring",
  225. legs="Iuitl tights",
  226. feet="Iuitl gaiters"})
  227.  
  228. -- Elemental Obi --
  229. sets.Obi = {}
  230. sets.Obi.Thunder = {waist='Rairin Obi'}
  231. sets.Obi.Water = {waist='Suirin Obi'}
  232. sets.Obi.Fire = {waist='Karin Obi'}
  233. sets.Obi.Ice = {waist='Hyorin Obi'}
  234. sets.Obi.Wind = {waist='Furin Obi'}
  235. sets.Obi.Earth = {waist='Dorin Obi'}
  236. sets.Obi.Light = {waist='Korin Obi'}
  237. sets.Obi.Dark = {waist='Anrin Obi'}
  238.  
  239. -- JA Sets --
  240. sets.JA = {}
  241. sets.JA["Random Deal"] = {body="Lanun Frac"}
  242. sets.JA["Snake Eye"] = {legs="Lanun Culottes"}
  243. sets.JA["Wild Card"] = {feet="Lanun Bottes"}
  244.  
  245. -- Waltz Set --
  246. sets.Waltz = {}
  247.  
  248. sets.Precast = {}
  249. --Fastcast Set --
  250. sets.Precast.FastCast = {}
  251.  
  252. sets.Midcast = {}
  253. -- Magic Haste Set --
  254. sets.Midcast.Haste = set_combine(sets.PDT,{})
  255. end
  256.  
  257. function pretarget(spell,action)
  258. if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  259. cancel_spell()
  260. send_command('input /item "Echo Drops" <me>')
  261. elseif spell.type == "CorsairRoll" and buffactive[spell.english] then -- Change Any Rolls To Double-Up When You Have A Roll Up --
  262. cancel_spell()
  263. send_command('doubleup')
  264. elseif spell.english == "Seigan" and buffactive.Seigan then -- Change Seigan To Third Eye If Seigan Is On --
  265. cancel_spell()
  266. send_command('ThirdEye')
  267. elseif spell.english == "Meditate" and player.tp > 290 then -- Cancel Meditate If TP Is Above 290 --
  268. cancel_spell()
  269. add_to_chat(123, spell.name .. ' Canceled: ' .. player.tp)
  270. elseif spell.action_type == 'Ranged Attack' then -- Auto WS
  271. if player.tp >= 100 and AutoMode == 'ON' and not buffactive.amnesia then
  272. cancel_spell()
  273. autoWS()
  274. end
  275. elseif spell.action_type == 'Ranged Attack' and spell.target.distance > 24.9 then
  276. cancel_spell()
  277. add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  278. return
  279. elseif spell.type == 'WeaponSkill' and player.status == 'Engaged' then
  280. if spell.skill == 'Marksmanship' then
  281. if spell.target.distance > 16+target_distance then
  282. cancel_spell()
  283. add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  284. return
  285. end
  286. else
  287. if spell.target.distance > target_distance then
  288. cancel_spell()
  289. add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  290. return
  291. end
  292. end
  293. end
  294. end
  295.  
  296. function precast(spell,action)
  297. if spell.action_type == 'Ranged Attack' or spell.type == "WeaponSkill" then
  298. if player.equipment.ammo == "Animikii Bullet" then -- Cancel Ranged Attack or WS If You Have Animikii Bullet Equipped --
  299. cancel_spell()
  300. add_to_chat(123, spell.name .. ' Canceled: [Animikii Bullet Equipped!]')
  301. return
  302. else
  303. if spell.action_type == 'Ranged Attack' then
  304. equip(sets.Preshot)
  305. elseif spell.type == "WeaponSkill" then
  306. if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  307. cancel_spell()
  308. add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  309. return
  310. else
  311. equipSet = sets.WS
  312. if equipSet[spell.english] then
  313. equipSet = equipSet[spell.english]
  314. end
  315. if equipSet[AccArray[AccIndex]] then
  316. equipSet = equipSet[AccArray[AccIndex]]
  317. end
  318. if spell.english == "Last Stand" and (player.tp > 299 or buffactive.Sekkanoki) then -- Equip Altdorf's Earring and Wilhelm's Earring When You Have 300 TP or Sekkanoki For Last Stand --
  319. equipSet = set_combine(equipSet,{ear1="Altdorf's Earring",ear2="Wilhelm's Earring"})
  320. end
  321. equip(equipSet)
  322. end
  323. end
  324. end
  325. elseif spell.type == "JobAbility" then
  326. if sets.JA[spell.english] then
  327. equip(sets.JA[spell.english])
  328. if spell.english == "Snake Eye" then -- Auto Double-Up After You Use Snake Eye --
  329. send_command('@wait 1;input /ja Double-Up <me>')
  330. end
  331. end
  332. elseif spell.type == "CorsairRoll" then
  333. equip(sets.Rolls)
  334. if spell.english == "Tactician's Roll" then
  335. equip({body="Nvrch. Frac +2"})
  336. elseif spell.english == "Caster's Roll" then
  337. equip({legs="Nvrch. Culottes +2"})
  338. elseif spell.english == "Courser's Roll" then
  339. equip({feet="Nvrch. Bottes +2"})
  340. end
  341. elseif spell.english == "Double-Up" then
  342. equip(sets.Rolls)
  343. elseif spell.type == "CorsairShot" then
  344. equipSet = sets.QD
  345. if ACC_Shots:contains(spell.english) then
  346. equipSet = sets.QD.HighACC
  347. else
  348. if equipSet[AccArray[AccIndex]] then
  349. equipSet = equipSet[AccArray[AccIndex]]
  350. end
  351. if not ACC_Shots:contains(spell.english) and (world.day_element == spell.element or world.weather_element == spell.element) and sets.Obi[spell.element] and Obi == 'ON' then -- Use Obi Toggle To Unlock Elemental Obi --
  352. equipSet = set_combine(equipSet,sets.Obi[spell.element])
  353. end
  354. end
  355. equip(equipSet)
  356. elseif spell.action_type == 'Magic' then
  357. if string.find(spell.english,'Utsusemi') then
  358. if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  359. cancel_spell()
  360. add_to_chat(123, spell.name .. ' Canceled: [3+ Images]')
  361. return
  362. else
  363. equip(sets.Precast.FastCast)
  364. end
  365. else
  366. equip(sets.Precast.FastCast)
  367. end
  368. elseif spell.type == "Waltz" then
  369. refine_waltz(spell,action)
  370. equip(sets.Waltz)
  371. elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  372. cast_delay(0.2)
  373. send_command('cancel Sneak')
  374. end
  375. end
  376.  
  377. function midcast(spell,action)
  378. if spell.action_type == 'Ranged Attack' then
  379. equipSet = sets.Midshot
  380. if equipSet[player.equipment.range] then
  381. equipSet = equipSet[player.equipment.range]
  382. end
  383. if equipSet[AccArray[AccIndex]] then
  384. equipSet = equipSet[AccArray[AccIndex]]
  385. end
  386. equip(equipSet)
  387. elseif spell.action_type == 'Magic' then
  388. if spell.english == "Stoneskin" then
  389. if buffactive.Stoneskin then
  390. send_command('@wait 2.8;cancel stoneskin')
  391. end
  392. equip(sets.Midcast.Stoneskin)
  393. elseif spell.english == "Sneak" then
  394. if spell.target.name == player.name and buffactive['Sneak'] then
  395. send_command('cancel sneak')
  396. end
  397. equip(sets.Midcast.Haste)
  398. elseif string.find(spell.english,'Utsusemi') then
  399. if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  400. send_command('@wait 1.7;cancel Copy Image*')
  401. end
  402. equip(sets.Midcast.Haste)
  403. elseif spell.english == 'Monomi: Ichi' then
  404. if buffactive['Sneak'] then
  405. send_command('@wait 1.7;cancel sneak')
  406. end
  407. equip(sets.Midcast.Haste)
  408. else
  409. equip(sets.Midcast.Haste)
  410. end
  411. end
  412. end
  413.  
  414. function aftercast(spell,action)
  415. if spell.action_type == 'Ranged Attack' and AutoMode == 'ON' then
  416. autoRA()
  417. elseif not spell.interrupted then
  418. if spell.type == "WeaponSkill" then
  419. send_command('wait 0.2;gs c TP')
  420. elseif spell.type == 'CorsairRoll' then
  421. display_roll_info(spell)
  422. elseif spell.english == 'Light Shot' then -- Sleep Countdown --
  423. send_command('wait 50;input /echo '..spell.name..' Effect: [WEARING OFF IN 10 SEC.];wait 10;input /echo '..spell.name..' Effect: [OFF]')
  424. end
  425. else
  426. status_change(player.status)
  427. end
  428. end
  429.  
  430. function status_change(new,old)
  431. if Armor == 'PDT' then
  432. equip(sets.PDT)
  433. elseif Armor == 'MDT' then
  434. equip(sets.MDT)
  435. elseif new == 'Engaged' then
  436. equipSet = sets.Melee
  437. if equipSet[AccArray[AccIndex]] then
  438. equipSet = equipSet[AccArray[AccIndex]]
  439. end
  440. equip(equipSet)
  441. elseif new == 'Idle' then
  442. equip(sets.Idle[IdleArray[IdleIndex]])
  443. elseif new == 'Resting' then
  444. equip(sets.Resting)
  445. end
  446. end
  447.  
  448. function buff_change(buff,gain)
  449. buff = string.lower(buff)
  450. if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  451. if gain then
  452. 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.]')
  453. else
  454. send_command('timers delete "Aftermath: Lv.3"')
  455. add_to_chat(123,'AM3: [OFF]')
  456. end
  457. elseif buff == 'weakness' then -- Weakness Timer --
  458. if gain then
  459. send_command('timers create "Weakness" 300 up')
  460. else
  461. send_command('timers delete "Weakness"')
  462. end
  463. end
  464. if not midaction() then
  465. status_change(player.status)
  466. end
  467. end
  468.  
  469. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  470. function self_command(command)
  471. if command == 'C1' then -- Accuracy Level Toggle --
  472. AccIndex = (AccIndex % #AccArray) + 1
  473. status_change(player.status)
  474. add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  475. elseif command == 'C5' then -- Auto Update Gear Toggle --
  476. status_change(player.status)
  477. add_to_chat(158,'Auto Update Gear')
  478. elseif command == 'C3' then -- Obi Toggle --
  479. if Obi == 'ON' then
  480. Obi = 'OFF'
  481. add_to_chat(123,'Obi: [OFF]')
  482. else
  483. Obi = 'ON'
  484. add_to_chat(158,'Obi: [ON]')
  485. end
  486. status_change(player.status)
  487. elseif command == 'C7' then -- PDT Toggle --
  488. if Armor == 'PDT' then
  489. Armor = 'None'
  490. add_to_chat(123,'PDT Set: [Unlocked]')
  491. else
  492. Armor = 'PDT'
  493. add_to_chat(158,'PDT Set: [Locked]')
  494. end
  495. status_change(player.status)
  496. elseif command == 'C15' then -- MDT Toggle --
  497. if Armor == 'MDT' then
  498. Armor = 'None'
  499. add_to_chat(123,'MDT Set: [Unlocked]')
  500. else
  501. Armor = 'MDT'
  502. add_to_chat(158,'MDT Set: [Locked]')
  503. end
  504. status_change(player.status)
  505. elseif command == 'C8' then -- Distance Toggle --
  506. if player.target.distance then
  507. target_distance = math.floor(player.target.distance*10)/10
  508. add_to_chat(158,'Distance: '..target_distance)
  509. else
  510. add_to_chat(123,'No Target Selected')
  511. end
  512. elseif command == 'C6' then -- Idle Toggle --
  513. IdleIndex = (IdleIndex % #IdleArray) + 1
  514. status_change(player.status)
  515. add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  516. elseif command == 'C2' then -- Auto RA/WS Toggle. *Don't Rely On This. It Isn't As Fast As Shooting Manually. It Is Mainly For AFK or When You Dualbox* --
  517. if AutoMode == 'ON' then
  518. AutoMode = 'OFF'
  519. add_to_chat(123,'Auto Mode: [OFF]')
  520. else
  521. AutoMode = 'ON'
  522. add_to_chat(158,'Auto Mode: [ON]')
  523. end
  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 autoRA()
  532. send_command('@wait 2.7; input /ra <t>')
  533. end
  534.  
  535. function autoWS() -- Change Auto WS Here --
  536. send_command('input /ws "Last Stand" <t>')
  537. end
  538.  
  539. function define_roll_values()
  540. rolls = {
  541. CorsairsRoll = {lucky=5, unlucky=9, bonus="Experience Points"},
  542. NinjaRoll = {lucky=4, unlucky=8, bonus="Evasion"},
  543. HuntersRoll = {lucky=4, unlucky=8, bonus="Accuracy"},
  544. ChaosRoll = {lucky=4, unlucky=8, bonus="Attack"},
  545. MagussRoll = {lucky=2, unlucky=6, bonus="Magic Defense"},
  546. HealersRoll = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  547. PuppetRoll = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  548. ChoralRoll = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  549. MonksRoll = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  550. BeastRoll = {lucky=4, unlucky=8, bonus="Pet Attack"},
  551. SamuraiRoll = {lucky=2, unlucky=6, bonus="Store TP"},
  552. EvokersRoll = {lucky=5, unlucky=9, bonus="Refresh"},
  553. RoguesRoll = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  554. WarlocksRoll = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  555. FightersRoll = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  556. DrachenRoll = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  557. GallantsRoll = {lucky=3, unlucky=7, bonus="Defense"},
  558. WizardsRoll = {lucky=5, unlucky=9, bonus="Magic Attack"},
  559. DancersRoll = {lucky=3, unlucky=7, bonus="Regen"},
  560. ScholarsRoll = {lucky=2, unlucky=6, bonus="Conserve MP"},
  561. BoltersRoll = {lucky=3, unlucky=9, bonus="Movement Speed"},
  562. CastersRoll = {lucky=2, unlucky=7, bonus="Fast Cast"},
  563. CoursersRoll = {lucky=3, unlucky=9, bonus="Snapshot"},
  564. BlitzersRoll = {lucky=4, unlucky=9, bonus="Attack Delay"},
  565. TacticiansRoll = {lucky=5, unlucky=8, bonus="Regain"},
  566. AlliessRoll = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  567. MisersRoll = {lucky=5, unlucky=7, bonus="Save TP"},
  568. CompanionsRoll = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  569. AvengersRoll = {lucky=4, unlucky=8, bonus="Counter Rate"}
  570. }
  571. end
  572.  
  573. function display_roll_info(spell)
  574. rollinfo = rolls[(string.gsub((string.gsub(spell.english, "%'+", "")), "%s+", ""))]
  575. if rollinfo then
  576. add_to_chat(158, spell.english..' = '..rollinfo.bonus..'. Lucky Roll is '..
  577. tostring(rollinfo.lucky)..', Unlucky Roll is '..tostring(rollinfo.unlucky)..'.')
  578. end
  579. end
  580.  
  581. function refine_waltz(spell,action)
  582. if spell.type ~= 'Waltz' then
  583. return
  584. end
  585.  
  586. if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  587. return
  588. end
  589.  
  590. local newWaltz = spell.english
  591.  
  592. local missingHP = 0
  593. local targ
  594.  
  595. if spell.target.type == "SELF" then
  596. targ = alliance[1][1]
  597. missingHP = player.max_hp - player.hp
  598. elseif spell.target.isallymember then
  599. targ = find_player_in_alliance(spell.target.name)
  600. local est_max_hp = targ.hp / (targ.hpp/100)
  601. missingHP = math.floor(est_max_hp - targ.hp)
  602. end
  603.  
  604. if targ then
  605. if player.sub_job == 'DNC' then
  606. if missingHP < 40 then
  607. add_to_chat(123,'Full HP!')
  608. cancel_spell()
  609. return
  610. elseif missingHP < 150 then
  611. newWaltz = 'Curing Waltz'
  612. elseif missingHP < 300 then
  613. newWaltz = 'Curing Waltz II'
  614. else
  615. newWaltz = 'Curing Waltz III'
  616. end
  617. else
  618. return
  619. end
  620. end
  621.  
  622. local waltzTPCost = {['Curing Waltz'] = 20,['Curing Waltz II'] = 35,['Curing Waltz III'] = 50,['Curing Waltz IV'] = 65,['Curing Waltz V'] = 80}
  623. local tpCost = waltzTPCost[newWaltz]
  624. local downgrade
  625.  
  626. if player.tp < tpCost and not buffactive.trance then
  627. if player.tp < 20 then
  628. add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  629. cancel_spell()
  630. return
  631. elseif player.tp < 35 then
  632. newWaltz = 'Curing Waltz'
  633. elseif player.tp < 50 then
  634. newWaltz = 'Curing Waltz II'
  635. elseif player.tp < 65 then
  636. newWaltz = 'Curing Waltz III'
  637. elseif player.tp < 80 then
  638. newWaltz = 'Curing Waltz IV'
  639. end
  640. downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  641. end
  642.  
  643. if newWaltz ~= spell.english then
  644. send_command('wait 0.03;input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  645. if downgrade then
  646. add_to_chat(158, downgrade)
  647. end
  648. cancel_spell()
  649. return
  650. end
  651.  
  652. if missingHP > 0 then
  653. add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  654. end
  655. end
  656.  
  657. function find_player_in_alliance(name)
  658. for i,v in ipairs(alliance) do
  659. for k,p in ipairs(v) do
  660. if p.name == name then
  661. return p
  662. end
  663. end
  664. end
  665. end
  666.  
  667. function actualCost(originalCost)
  668. if buffactive["Penury"] then
  669. return originalCost*.5
  670. elseif buffactive["Light Arts"] then
  671. return originalCost*.9
  672. else
  673. return originalCost
  674. end
  675. end
  676.  
  677. function degrade_spell(spell,degrade_array)
  678. spell_index = table.find(degrade_array,spell.name)
  679. if spell_index>1 then
  680. new_spell = degrade_array[spell_index - 1]
  681. change_spell(new_spell,spell.target.raw)
  682. add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  683. end
  684. end
  685.  
  686. function change_spell(spell_name,target)
  687. cancel_spell()
  688. send_command('//'..spell_name..' '..target)
  689. end
  690.  
  691. function sub_job_change(newSubjob, oldSubjob)
  692. select_default_macro_book()
  693. end
  694.  
  695. function set_macro_page(set,book)
  696. if not tonumber(set) then
  697. add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  698. return
  699. end
  700. if set < 1 or set > 10 then
  701. add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  702. return
  703. end
  704.  
  705. if book then
  706. if not tonumber(book) then
  707. add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  708. return
  709. end
  710. if book < 1 or book > 20 then
  711. add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  712. return
  713. end
  714. send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  715. else
  716. send_command('@input /macro set '..tostring(set))
  717. end
  718. end
  719.  
  720. function select_default_macro_book()
  721. -- Default macro set/book
  722. if player.sub_job == 'SAM' then
  723. set_macro_page(1, 7)
  724. elseif player.sub_job == 'WHM' then
  725. set_macro_page(1, 7)
  726. elseif player.sub_job == 'DNC' then
  727. set_macro_page(1, 7)
  728. elseif player.sub_job == 'NIN' then
  729. set_macro_page(1, 7)
  730. elseif player.sub_job == 'RDM' then
  731. set_macro_page(1, 7)
  732. elseif player.sub_job == 'WAR' then
  733. set_macro_page(1, 7)
  734. elseif player.sub_job == 'DRG' then
  735. set_macro_page(1, 7)
  736. else
  737. set_macro_page(1, 7)
  738. end
  739. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement