Advertisement
Bokura

Bokura_NIN

Jan 28th, 2014
1,636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.59 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Some of Motenten's Functions ** --
  3.  
  4. function get_sets()
  5.     AccIndex = 1
  6.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For TP/WS/Hybrid. First Set Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  7.     IdleIndex = 1
  8.     IdleArray = {'Movement','Regen'} -- Default Idle Set Is Movement --
  9.     TypeIndex = 1
  10.     Armor = 'None'
  11.     Obi = 'ON' -- Set Default Obi ON or OFF Here --
  12.     Attack = 'OFF' -- Set Default Attack WS Set ON or OFF Here --
  13.     Migawari = 'OFF' -- Set Default Migawari Body ON or OFF Here --
  14.     Rancor = 'OFF' -- Set Default Rancor ON or OFF Here --
  15.     target_distance = 5 -- Set Default Distance Here --
  16.     select_default_macro_book() -- Change Default Macro Book At The End --
  17.  
  18.     -- Gavialis Helm --
  19.     elements = {}
  20.     elements.equip = {head="Gavialis Helm"}
  21.     elements["Blade: Shun"] = S{"Light","Lightning","Fire"}
  22.  
  23.     sc_map = {SC1="BladeHi", SC2="UtsusemiSan", SC3="UtsusemiNi"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  24.  
  25.     sets.Idle = {}
  26.     -- Idle/Town Sets --
  27.     sets.Idle.Regen = {}
  28.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  29.             feet="Danzo Sune-Ate"})
  30.  
  31.     -- Normal TP Sets --
  32.     sets.TP = {}
  33.     sets.TP.MidACC = set_combine(sets.TP,{})
  34.     sets.TP.HighACC = set_combine(sets.TP.MidACC,{})
  35.  
  36.     -- March x2 --
  37.     -- March + Haste + Haste Samba --
  38.     -- Geo Haste --
  39.     -- Mid Haste: 19% - 22% In Gear --
  40.     sets.TP.MidHaste = {}
  41.     sets.TP.MidACC.MidHaste = set_combine(sets.TP.MidHaste,{})
  42.     sets.TP.HighACC.MidHaste = set_combine(sets.TP.MidACC.MidHaste,{})
  43.  
  44.     -- Embrava + (Haste or March) --
  45.     -- Embrava Haste: 7% DW In Gear --
  46.     sets.TP.EmbravaHaste = {}
  47.     sets.TP.MidACC.EmbravaHaste = set_combine(sets.TP.EmbravaHaste,{})
  48.     sets.TP.HighACC.EmbravaHaste = set_combine(sets.TP.MidACC.EmbravaHaste,{})
  49.  
  50.     -- March x2 + Haste --
  51.     -- Embrava + (March x2 or March + Haste) --
  52.     -- Geo Haste + (March or Haste or Embrava) --
  53.     -- Max Haste: Can Drop All DW Gear --
  54.     sets.TP.MaxHaste = {}
  55.     sets.TP.MidACC.MaxHaste = set_combine(sets.TP.MaxHaste,{})
  56.     sets.TP.HighACC.MaxHaste = set_combine(sets.TP.MidACC.MaxHaste,{})
  57.  
  58.     -- TP Rancor Neck --
  59.     sets.TP.Rancor = {neck="Rancor Collar"}
  60.  
  61.     -- TP Migawari Set --
  62.     sets.TP.Migawari = {body="Hattori Ningi +1"}
  63.  
  64.     -- PDT/MDT Sets --
  65.     sets.PDT = {}
  66.  
  67.     sets.MDT = set_combine(sets.PDT,{})
  68.  
  69.     -- Hybrid/Evasion Sets --
  70.     sets.TP.Hybrid = set_combine(sets.PDT,{})
  71.     sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  72.     sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  73.  
  74.     sets.Evasion = set_combine(sets.PDT,{})
  75.  
  76.     -- WS Base Set --
  77.     sets.WS = {}
  78.  
  79.     -- Blade: Hi Sets --
  80.     sets.WS["Blade: Hi"] = {}
  81.     sets.WS["Blade: Hi"].MidACC = set_combine(sets.WS["Blade: Hi"],{})
  82.     sets.WS["Blade: Hi"].HighACC = set_combine(sets.WS["Blade: Hi"].MidACC,{})
  83.  
  84.     -- Blade: Hi(Attack) Set --
  85.     sets.WS["Blade: Hi"].ATT = set_combine(sets.WS["Blade: Hi"],{})
  86.  
  87.     -- Blade: Shun Sets --
  88.     sets.WS["Blade: Shun"] = {}
  89.     sets.WS["Blade: Shun"].MidACC = set_combine(sets.WS["Blade: Shun"],{})
  90.     sets.WS["Blade: Shun"].HighACC = set_combine(sets.WS["Blade: Shun"].MidACC,{})
  91.  
  92.     -- Blade: Shun(Attack) Set --
  93.     sets.WS["Blade: Shun"].ATT = set_combine(sets.WS["Blade: Shun"],{})
  94.  
  95.     sets.WS.Exenterator = {}
  96.  
  97.     sets.WS.Evisceration = {}
  98.  
  99.     sets.WS["Sanguine Blade"] = {}
  100.  
  101.     -- Waltz Set --
  102.     sets.Waltz = {}
  103.  
  104.     sets.Precast = {}
  105.     -- Fastcast Set --
  106.     sets.Precast.FastCast = {}
  107.     -- Utsusemi Precast Set --
  108.     sets.Precast.Utsusemi = set_combine(sets.Precast.FastCast,{neck="Magoraga Beads",body="Mochi. Chainmail +1"})
  109.  
  110.     sets.Midcast = {}
  111.     -- -- Magic Haste/Utsusemi Set --
  112.     sets.Midcast.Haste = set_combine(sets.PDT,{hands="Mochizuki Tekko +1",feet="Hattori Kyahan +1"})
  113.  
  114.     -- Migawari Magic Set --
  115.     sets.Midcast.Migawari = {}
  116.  
  117.     -- Ninjutsu Set --
  118.     sets.Midcast.Ninjutsu = {}
  119.  
  120.     -- Elemental Ninjutsu Set --
  121.     sets.Midcast.Elemental_Ninjutsu {}
  122. end
  123.  
  124. function pretarget(spell,action)
  125.     if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  126.         cancel_spell()
  127.         send_command('input /item "Echo Drops" <me>')
  128.     elseif spell.english == "Yonin" and buffactive.Yonin then -- Change Yonin To Innin If Yonin Is On --
  129.         cancel_spell()
  130.         send_command('Innin')
  131.     elseif spell.english == "Innin" and buffactive.Innin then -- Change Innin To Yonin If Innin Is On --
  132.         cancel_spell()
  133.         send_command('Yonin')
  134.     elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On --
  135.         cancel_spell()
  136.         send_command('Aggressor')
  137.     elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
  138.         cancel_spell()
  139.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  140.         return
  141.     end
  142. end
  143.  
  144. function precast(spell,action)
  145.     if spell.type == "WeaponSkill" then
  146.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  147.             cancel_spell()
  148.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  149.             return
  150.         else
  151.             equipSet = sets.WS
  152.             if equipSet[spell.english] then
  153.                 equipSet = equipSet[spell.english]
  154.             end
  155.             if Attack == 'ON' then
  156.                 equipSet = equipSet["ATT"]
  157.             end
  158.             if equipSet[AccArray[AccIndex]] then
  159.                 equipSet = equipSet[AccArray[AccIndex]]
  160.             end
  161.             if elements[spell.name] and elements[spell.name]:contains(world.day_element) then
  162.                 equipSet = set_combine(equipSet,elements.equip)
  163.             end
  164.             if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  165.                 equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  166.             end
  167.             if TypeIndex == 1 and spell.english == "Blade: Hi" then
  168.                 if world.time <= (7*60) or world.time >= (17*60) then -- Equip Lugra Earring +1 & Lugra Earring From Dusk To Dawn --
  169.                     equipSet = set_combine(equipSet,{ear1="Lugra Earring +1",ear2="Lugra Earring"})
  170.                 elseif player.tp > 2990 then
  171.                     equipSet = set_combine(equipSet,{ear1="Auster's Pearl"}) -- 3000 TP: Equip Auster's Pearl --
  172.                 end
  173.             end
  174.             if TypeIndex == 1 and spell.english == "Blade: Shun" and player.tp > 2990 then
  175.                 if world.time <= (7*60) or world.time >= (17*60) then -- 3000 TP: Equip Lugra Earring +1 From Dusk To Dawn --
  176.                     equipSet = set_combine(equipSet,{ear1="Lugra Earring +1"})
  177.                 else
  178.                     equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"}) -- 3000 TP: Equip Jupiter's Pearl --
  179.                 end
  180.             end
  181.             equip(equipSet)
  182.         end
  183.     elseif spell.action_type == 'Magic' then
  184.         if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
  185.             cancel_spell()
  186.             add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  187.             return
  188.         else
  189.             if spell.english:startswith('Utsusemi') then
  190.                 if spell.english == 'Utsusemi: San' then
  191.                     if buffactive['Copy Image (3)'] or buffactive['Copy Image (4+)'] then
  192.                         cancel_spell()
  193.                         add_to_chat(123, spell.name .. ' Canceled: [3+ Images]')
  194.                         return
  195.                     else
  196.                         equip(sets.Precast.Utsusemi)
  197.                     end
  198.                 elseif spell.english == 'Utsusemi: Ni' then
  199.                     if buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)'] or buffactive['Copy Image (4+)'] then
  200.                         send_command('cancel Copy Image*')
  201.                     end
  202.                     equip(sets.Precast.Utsusemi)
  203.                 else
  204.                     equip(sets.Precast.Utsusemi)
  205.                 end
  206.             else
  207.                 equip(sets.Precast.FastCast)
  208.             end
  209.         end
  210.     elseif spell.type == "Waltz" then
  211.         refine_waltz(spell,action)
  212.         equip(sets.Waltz)
  213.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  214.         cast_delay(0.2)
  215.         send_command('cancel Sneak')
  216.     end
  217. end
  218.  
  219. function midcast(spell,action)
  220.     equipSet = {}
  221.     if spell.action_type == 'Magic' then
  222.         equipSet = sets.Midcast
  223.         if spell.english:startswith('Utsusemi') then
  224.             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
  225.                 send_command('@wait 1.7;cancel Copy Image*')
  226.             end
  227.             equipSet = equipSet.Haste
  228.         elseif spell.english == 'Monomi: Ichi' then
  229.             if buffactive['Sneak'] then
  230.                 send_command('@wait 1.7;cancel sneak')
  231.             end
  232.             equipSet = equipSet.Haste
  233.         elseif spell.english:startswith('Tonko') then
  234.             equipSet = equipSet.Haste
  235.         elseif spell.english == 'Migawari: Ichi' then
  236.             equipSet = equipSet.Migawari
  237.         elseif spell.english:startswith('Katon') or spell.english:startswith('Suiton') or spell.english:startswith('Doton') or spell.english:startswith('Hyoton') or spell.english:startswith('Huton') or spell.english:startswith('Raiton') then
  238.             equipSet = equipSet.Elemental_Ninjutsu
  239.             if (world.day_element == spell.element or world.weather_element == spell.element) and Obi == 'ON' then
  240.                 equipSet = set_combine(equipSet,{waist="Hachirin-no-Obi"})
  241.             end
  242.         elseif equipSet[spell.skill] then
  243.             equipSet = equipSet[spell.skill]
  244.         end
  245.     elseif equipSet[spell.english] then
  246.         equipSet = equipSet[spell.english]
  247.     end
  248.     equip(equipSet)
  249. end
  250.  
  251. function aftercast(spell,action)
  252.     if spell.type == "WeaponSkill" and not spell.interrupted then
  253.         send_command('wait 0.2;gs c TP')
  254.     end
  255.     status_change(player.status)
  256. end
  257.  
  258. function status_change(new,old)
  259.     check_equip_lock()
  260.     if Armor == 'PDT' then
  261.         equip(sets.PDT)
  262.     elseif Armor == 'MDT' then
  263.         equip(sets.MDT)
  264.     elseif Armor == 'EVA' then
  265.         equip(sets.Evasion)
  266.     elseif new == 'Engaged' then
  267.         equipSet = sets.TP
  268.         if Armor == 'Hybrid' and equipSet["Hybrid"] then
  269.             equipSet = equipSet["Hybrid"]
  270.         end
  271.         if equipSet[AccArray[AccIndex]] then
  272.             equipSet = equipSet[AccArray[AccIndex]]
  273.         end
  274.         if (buffactive.Haste and buffactive.March == 2) or (buffactive.Embrava and (buffactive.March == 2 or (buffactive.March and buffactive.Haste))) or (buffactive[580] and (buffactive.March or buffactive.Haste or buffactive.Embrava)) and equipSet["MaxHaste"] then
  275.             equipSet = equipSet["MaxHaste"]
  276.         end
  277.         if buffactive.Embrava and (buffactive.March or buffactive.Haste) and equipSet["EmbravaHaste"] then
  278.             equipSet = equipSet["EmbravaHaste"]
  279.         end
  280.         if ((buffactive.March == 1 and buffactive.Haste and buffactive["Haste Samba"]) or buffactive.March == 2 or buffactive[580]) and equipSet["MidHaste"] then
  281.             equipSet = equipSet["MidHaste"]
  282.         end
  283.         if Rancor == 'ON' then -- Use Rancor Toggle For Rancor Collar --
  284.             equipSet = set_combine(equipSet,sets.TP.Rancor)
  285.         end
  286.         equip(equipSet)
  287.     else
  288.         equipSet = sets.Idle
  289.         if equipSet[IdleArray[IdleIndex]] then
  290.             equipSet = equipSet[IdleArray[IdleIndex]]
  291.         end
  292.         if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  293.             equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  294.         end
  295.         if world.time <= (7*60) or world.time >= (17*60) then -- Equip Hachi. Kyahan +1 From Dusk To Dawn --
  296.             equipSet = set_combine(equipSet,{feet="Hachi. Kyahan +1"})
  297.         end
  298.         if world.area:endswith('Adoulin') then
  299.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  300.         end
  301.         equip(equipSet)
  302.     end
  303.     if buffactive.Migawari and Migawari == 'ON' then -- Use Migawari Toggle To Lock Hattori Ningi +1 When You Have Migawari On --
  304.         equip(sets.TP.Migawari)
  305.     end
  306. end
  307.  
  308. function buff_change(buff,gain)
  309.     buff = string.lower(buff)
  310.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  311.         if gain then
  312.             send_command('timers create "Aftermath: Lv.3" 180 down;wait 150;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 15;input /echo Aftermath: Lv.3 [WEARING OFF IN 15 SEC.];wait 5;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
  313.         else
  314.             send_command('timers delete "Aftermath: Lv.3"')
  315.             add_to_chat(123,'AM3: [OFF]')
  316.         end
  317.     elseif buff == 'weakness' then -- Weakness Timer --
  318.         if gain then
  319.             send_command('timers create "Weakness" 300 up')
  320.         else
  321.             send_command('timers delete "Weakness"')
  322.         end
  323.     end
  324.     if not midaction() then
  325.         status_change(player.status)
  326.     end
  327. end
  328.  
  329. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  330. function self_command(command)
  331.     if command == 'C1' then -- Accuracy Toggle --
  332.         AccIndex = (AccIndex % #AccArray) + 1
  333.         status_change(player.status)
  334.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  335.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  336.         status_change(player.status)
  337.         add_to_chat(158,'Auto Update Gear')
  338.     elseif command == 'C2' then -- Hybrid Toggle --
  339.         if Armor == 'Hybrid' then
  340.             Armor = 'None'
  341.             add_to_chat(123,'Hybrid Set: [Unlocked]')
  342.         else
  343.             Armor = 'Hybrid'
  344.             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  345.         end
  346.         status_change(player.status)
  347.     elseif command == 'C7' then -- PDT Toggle --
  348.         if Armor == 'PDT' then
  349.             Armor = 'None'
  350.             add_to_chat(123,'PDT Set: [Unlocked]')
  351.         else
  352.             Armor = 'PDT'
  353.             add_to_chat(158,'PDT Set: [Locked]')
  354.         end
  355.         status_change(player.status)
  356.     elseif command == 'C15' then -- MDT Toggle --
  357.         if Armor == 'MDT' then
  358.             Armor = 'None'
  359.             add_to_chat(123,'MDT Set: [Unlocked]')
  360.         else
  361.             Armor = 'MDT'
  362.             add_to_chat(158,'MDT Set: [Locked]')
  363.         end
  364.         status_change(player.status)
  365.     elseif command == 'C10' then -- Migawari Set Toggle --
  366.         if Migawari == 'ON' then
  367.             Migawari = 'OFF'
  368.             add_to_chat(123,'Migawari Set: [Unlocked]')
  369.         else
  370.             Migawari = 'ON'
  371.             add_to_chat(158,'Migawari Set: [Locked]')
  372.         end
  373.         status_change(player.status)
  374.     elseif command == 'C3' then -- Evasion Toggle --
  375.         if Armor == 'EVA' then
  376.             Armor = 'None'
  377.             add_to_chat(123,'Evasion Set: [Unlocked]')
  378.         else
  379.             Armor = 'EVA'
  380.             add_to_chat(158,'Evasion Set: [Locked]')
  381.         end
  382.         status_change(player.status)
  383.     elseif command == 'C16' then -- Rancor Toggle --
  384.         if Rancor == 'ON' then
  385.             Rancor = 'OFF'
  386.             add_to_chat(123,'Rancor: [OFF]')
  387.         else
  388.             Rancor = 'ON'
  389.             add_to_chat(158,'Rancor: [ON]')
  390.         end
  391.         status_change(player.status)
  392.     elseif command == 'C9' then -- Attack Toggle --
  393.         if Attack == 'ON' then
  394.             Attack = 'OFF'
  395.             add_to_chat(123,'Attack: [OFF]')
  396.         else
  397.             Attack = 'ON'
  398.             add_to_chat(158,'Attack: [ON]')
  399.         end
  400.         status_change(player.status)
  401.     elseif command == 'C11' then -- Obi Toggle --
  402.         if Obi == 'ON' then
  403.             Obi = 'OFF'
  404.             add_to_chat(123,'Obi: [OFF]')
  405.         else
  406.             Obi = 'ON'
  407.             add_to_chat(158,'Obi: [ON]')
  408.         end
  409.         status_change(player.status)
  410.     elseif command == 'C8' then -- Distance Toggle --
  411.         if player.target.distance then
  412.             target_distance = math.floor(player.target.distance*10)/10
  413.             add_to_chat(158,'Distance: '..target_distance)
  414.         else
  415.             add_to_chat(123,'No Target Selected')
  416.         end
  417.     elseif command == 'C6' then -- Idle Toggle --
  418.         IdleIndex = (IdleIndex % #IdleArray) + 1
  419.         status_change(player.status)
  420.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  421.     elseif command == 'TP' then
  422.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  423.     elseif command:match('^SC%d$') then
  424.         send_command('//' .. sc_map[command])
  425.     end
  426. end
  427.  
  428. function check_equip_lock() -- Lock Equipment Here --
  429.     if player.equipment.range ~= 'empty' then
  430.         disable('range','ammo')
  431.     elseif player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" or player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
  432.         disable('ring1','ring2')
  433.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  434.         disable('back')
  435.     else
  436.         enable('range','ammo','ring1','ring2','back')
  437.     end
  438. end
  439.  
  440. function refine_waltz(spell,action)
  441.     if spell.type ~= 'Waltz' then
  442.         return
  443.     end
  444.  
  445.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  446.         return
  447.     end
  448.  
  449.     local newWaltz = spell.english
  450.     local waltzID
  451.  
  452.     local missingHP
  453.  
  454.     if spell.target.type == "SELF" then
  455.         missingHP = player.max_hp - player.hp
  456.     elseif spell.target.isallymember then
  457.         local target = find_player_in_alliance(spell.target.name)
  458.         local est_max_hp = target.hp / (target.hpp/100)
  459.         missingHP = math.floor(est_max_hp - target.hp)
  460.     end
  461.  
  462.     if missingHP ~= nil then
  463.         if player.sub_job == 'DNC' then
  464.             if missingHP < 40 and spell.target.name == player.name then
  465.                 add_to_chat(123,'Full HP!')
  466.                 cancel_spell()
  467.                 return
  468.             elseif missingHP < 150 then
  469.                 newWaltz = 'Curing Waltz'
  470.                 waltzID = 190
  471.             elseif missingHP < 300 then
  472.                 newWaltz = 'Curing Waltz II'
  473.                 waltzID = 191
  474.             else
  475.                 newWaltz = 'Curing Waltz III'
  476.                 waltzID = 192
  477.             end
  478.         else
  479.             return
  480.         end
  481.     end
  482.  
  483.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50}
  484.     local tpCost = waltzTPCost[newWaltz]
  485.  
  486.     local downgrade
  487.  
  488.     if player.tp < tpCost and not buffactive.trance then
  489.  
  490.         if player.tp < 20 then
  491.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  492.             cancel_spell()
  493.             return
  494.         elseif player.tp < 35 then
  495.             newWaltz = 'Curing Waltz'
  496.         elseif player.tp < 50 then
  497.             newWaltz = 'Curing Waltz II'
  498.         end
  499.  
  500.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  501.     end
  502.  
  503.     if newWaltz ~= spell.english then
  504.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  505.         if downgrade then
  506.             add_to_chat(158, downgrade)
  507.         end
  508.         cancel_spell()
  509.         return
  510.     end
  511.  
  512.     if missingHP > 0 then
  513.         add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  514.     end
  515. end
  516.  
  517. function find_player_in_alliance(name)
  518.     for i,v in ipairs(alliance) do
  519.         for k,p in ipairs(v) do
  520.             if p.name == name then
  521.                 return p
  522.             end
  523.         end
  524.     end
  525. end
  526.  
  527. function sub_job_change(newSubjob, oldSubjob)
  528.     select_default_macro_book()
  529. end
  530.  
  531. function set_macro_page(set,book)
  532.     if not tonumber(set) then
  533.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  534.         return
  535.     end
  536.     if set < 1 or set > 10 then
  537.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  538.         return
  539.     end
  540.  
  541.     if book then
  542.         if not tonumber(book) then
  543.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  544.             return
  545.         end
  546.         if book < 1 or book > 20 then
  547.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  548.             return
  549.         end
  550.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  551.     else
  552.         send_command('@input /macro set '..tostring(set))
  553.     end
  554. end
  555.  
  556. function select_default_macro_book()
  557.     -- Default macro set/book
  558.     if player.sub_job == 'WAR' then
  559.         set_macro_page(1, 8)
  560.     elseif player.sub_job == 'DNC' then
  561.         set_macro_page(2, 8)
  562.     else
  563.         set_macro_page(1, 8)
  564.     end
  565. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement