Bokura

Bokura_BLM

Jan 28th, 2014
2,047
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.83 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Motenten's Macro Book Function ** --
  3.  
  4. function get_sets()
  5.     AccIndex = 1
  6.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For Magic. Default ACC Set Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  7.     IdleIndex = 1
  8.     IdleArray = {"Movement","Refresh"} -- Default Idle Set Is Movement --
  9.     Armor = 'None'
  10.     StunIndex = 0
  11.     Lock_Main = 'OFF' -- Set Default Lock Main Weapon ON or OFF Here --
  12.     Obi = 'ON' -- Turn Default Obi ON or OFF Here --
  13.     LowNuke = 'ON' -- Set Default Low Tier Nuke ON or OFF Here --
  14.     MB = 'OFF' -- Set Default MB ON or OFF Here --
  15.     Elemental_Staff = 'ON' -- Set Default Precast Elemental Staff ON or OFF Here --
  16.     target_distance = 5 -- Set Default Distance Here --
  17.     select_default_macro_book() -- Change Default Macro Book At The End --
  18.  
  19.     Low_Tier_Spells = S{
  20.             'Fire','Aero','Water','Blizzard','Stone','Thunder','Fire II','Aero II','Water II',
  21.             'Blizzard II','Stone II','Thunder II'}
  22.  
  23.     Non_Obi_Spells = S{
  24.             'Burn','Choke','Drown','Frost','Rasp','Shock','Impact','Anemohelix','Cryohelix',
  25.             'Geohelix','Hydrohelix','Ionohelix','Luminohelix','Noctohelix','Pyrohelix'}
  26.  
  27.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  28.     Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  29.     sc_map = {SC1 = "Stun", SC2 = "ThunderVI", SC3 = "BlizzardVI"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  30.  
  31.     sets.Idle = {}
  32.     -- Idle Sets --
  33.     sets.Idle.Refresh = {}
  34.     sets.Idle.Movement = set_combine(sets.Idle.Refresh,{
  35.             feet="Herald's Gaiters"})
  36.     sets.Resting = set_combine(sets.Idle.Movement,{})
  37.  
  38.     -- PDT Set --
  39.     sets.PDT = {}
  40.  
  41.     -- Sublimation Set --
  42.     sets.Sublimation = {}
  43.  
  44.     sets.Precast = {}
  45.  
  46.     -- Fastcast Set (empty = To Fix Club/Staff Issue) --
  47.     sets.Precast.FastCast = {
  48.             sub=empty}
  49.  
  50.     -- Elemental Staves --
  51.     sets.Precast.Lightning = {main='Apamajas I'}
  52.     sets.Precast.Water = {main='Haoma I'}
  53.     sets.Precast.Fire = {main='Atar I'}
  54.     sets.Precast.Ice = {main='Vourukasha I'}
  55.     sets.Precast.Wind = {main='Vayuvata I'}
  56.     sets.Precast.Earth = {main='Vishrava I'}
  57.     sets.Precast.Light = {main='Arka I'}
  58.     sets.Precast.Dark = {main='Xsaeta I'}
  59.  
  60.     -- Precast Stoneskin
  61.     sets.Precast.Stoneskin = set_combine(sets.Precast.FastCast,{head="Umuthi Hat",waist="Siegel Sash"})
  62.  
  63.     -- Precast Enhancing Magic
  64.     sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{waist="Siegel Sash"})
  65.  
  66.     -- Precast Elemental Magic
  67.     sets.Precast['Elemental Magic'] = set_combine(sets.Precast.FastCast,{})
  68.  
  69.     -- Precast Cure Set --
  70.     sets.Precast.Cure = {
  71.             sub=empty}
  72.  
  73.     -- Midcast Base Set --
  74.     sets.Midcast = {}
  75.  
  76.     -- Haste Set --
  77.     sets.Midcast.Haste = {}
  78.  
  79.     -- Cure Set --
  80.     sets.Midcast.Cure = {}
  81.  
  82.     -- Curaga Set --
  83.     sets.Midcast.Curaga = {}
  84.  
  85.     -- Enhancing Magic Set --
  86.     sets.Midcast['Enhancing Magic'] = {}
  87.  
  88.     -- Stoneskin Set --
  89.     sets.Midcast.Stoneskin = set_combine(sets.Midcast['Enhancing Magic'],{})
  90.  
  91.     -- Cursna Set --
  92.     sets.Midcast.Cursna = set_combine(sets.Midcast.Haste,{})
  93.  
  94.     -- Stun Sets --
  95.     sets.Midcast.Stun = {}
  96.     sets.Midcast.Stun.MidACC = set_combine(sets.Midcast.Stun,{})
  97.     sets.Midcast.Stun.HighACC = set_combine(sets.Midcast.Stun.MidACC,{})
  98.  
  99.     -- Dark Magic Sets --
  100.     sets.Midcast['Dark Magic'] = {}
  101.     sets.Midcast['Dark Magic'].MidACC = set_combine(sets.Midcast['Dark Magic'],{})
  102.     sets.Midcast['Dark Magic'].HighACC = set_combine(sets.Midcast['Dark Magic'].MidACC,{})
  103.  
  104.     -- Low Tier Set --
  105.     sets.LowNuke = {}
  106.  
  107.     -- MB Set --
  108.     sets.MB = {}
  109.  
  110.     -- Elemental Sets --
  111.     sets.Midcast['Elemental Magic'] = {}
  112.     sets.Midcast['Elemental Magic'].MidACC = set_combine(sets.Midcast['Elemental Magic'],{})
  113.     sets.Midcast['Elemental Magic'].HighACC = set_combine(sets.Midcast['Elemental Magic'].MidACC,{})
  114.  
  115.     -- Enfeebling Sets --
  116.     sets.Midcast['Enfeebling Magic'] = {}
  117.     sets.Midcast['Enfeebling Magic'].MidACC =  set_combine(sets.Midcast['Enfeebling Magic'],{})
  118.     sets.Midcast['Enfeebling Magic'].HighACC = set_combine(sets.Midcast['Enfeebling Magic'].MidACC,{})
  119.  
  120.     -- Impact Set --
  121.     sets.Midcast.Impact = {
  122.             body="Twilight Cloak"}
  123.  
  124.     -- Meteor Set --
  125.     sets.Midcast.Meteor = {}
  126.  
  127.     -- Elemental Obi/Twilight Cape --
  128.     sets.Obi = {}
  129.     sets.Obi.Lightning = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  130.     sets.Obi.Water = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  131.     sets.Obi.Fire = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  132.     sets.Obi.Ice = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  133.     sets.Obi.Wind = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  134.     sets.Obi.Earth = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  135.     sets.Obi.Light = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  136.     sets.Obi.Dark = {back="Twilight Cape",waist='Hachirin-no-Obi'}
  137.  
  138.     sets.JA = {}
  139.     -- JA Sets --
  140.     sets.JA.Manafont = {body="Arch. Coat +1"}
  141.     sets.JA['Mana Wall'] = {feet="Wicce Sabots +1"}
  142.  
  143.     -- Melee Set --
  144.     sets.Melee = set_combine(sets.Midcast.Haste,{})
  145.  
  146.     -- WS Base Set --
  147.     sets.WS = {}
  148.  
  149.     sets.WS.Shattersoul = {}
  150.     sets.WS.Myrkr = {}
  151.     sets.WS.Vidohunir = {}
  152.     sets.WS["Gate of Tartarus"] = {}
  153.  
  154.     -- Idle Reive Set --
  155.     sets.Reive = {neck="Arciela's Grace +1"}
  156. end
  157.  
  158. function pretarget(spell,action)
  159.     if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  160.         cancel_spell()
  161.         send_command('input /item "Echo Drops" <me>')
  162.     elseif spell.type == 'WeaponSkill' and player.status == 'Engaged' then
  163.         if not spell.english == 'Myrkr' and spell.target.distance > target_distance then -- Cancel WS If You Are Out Of Range --
  164.             cancel_spell()
  165.             add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  166.             return
  167.         end
  168.     elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  169.         degrade_spell(spell,Cure_Spells)
  170.     elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  171.         degrade_spell(spell,Curaga_Spells)
  172.     elseif spell.english == "Meteor" and not buffactive['Elemental Seal'] then -- Auto Elemental Seal When You Use Meteor --
  173.         cancel_spell()
  174.         send_command('input /ja "Elemental Seal" <me>;wait 1.5;input /ma "Meteor" <t>')
  175.     elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
  176.         if spell.english == "Light Arts" and not buffactive['Addendum: White'] then
  177.             cancel_spell()
  178.             send_command('input /ja Addendum: White <me>')
  179.         elseif spell.english == "Manifestation" then
  180.             cancel_spell()
  181.             send_command('input /ja Accession <me>')
  182.         elseif spell.english == "Alacrity" then
  183.             cancel_spell()
  184.             send_command('input /ja Celerity <me>')
  185.         elseif spell.english == "Parsimony" then
  186.             cancel_spell()
  187.             send_command('input /ja Penury <me>')
  188.         end
  189.     elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  190.         if spell.english == "Dark Arts" and not buffactive['Addendum: Black'] then
  191.             cancel_spell()
  192.             send_command('input /ja Addendum: Black <me>')
  193.         elseif spell.english == "Accession" then
  194.             cancel_spell()
  195.             send_command('input /ja Manifestation <me>')
  196.         elseif spell.english == "Celerity" then
  197.             cancel_spell()
  198.             send_command('input /ja Alacrity <me>')
  199.         elseif spell.english == "Penury" then
  200.             cancel_spell()
  201.             send_command('input /ja Parsimony <me>')
  202.         end
  203.     end
  204. end
  205.  
  206. function precast(spell,action)
  207.     if spell.action_type == 'Magic' then
  208.         if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
  209.             cancel_spell()
  210.             add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  211.             return
  212.         else
  213.             if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  214.                 equip(sets.Precast.Cure)
  215.             elseif spell.english == "Stoneskin" then
  216.                 equip(sets.Precast[spell.english])
  217.             elseif spell.english == "Impact" then
  218.                 equip(set_combine(sets.Precast.FastCast,{body="Twilight Cloak"}))
  219.             elseif spell.english == 'Utsusemi: Ni' then
  220.                 if buffactive['Copy Image (3)'] then
  221.                     cancel_spell()
  222.                     add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  223.                     return
  224.                 else
  225.                     equip(sets.Precast.FastCast)
  226.                 end
  227.             elseif sets.Precast[spell.skill] then
  228.                 equip(sets.Precast[spell.skill])
  229.             else
  230.                 equip(sets.Precast.FastCast)
  231.             end
  232.         end
  233.     elseif spell.type == "WeaponSkill" then
  234.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  235.             cancel_spell()
  236.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  237.             return
  238.         else
  239.             if sets.WS[spell.english] then
  240.                 equip(sets.WS[spell.english])
  241.             end
  242.         end
  243.     elseif spell.type == "JobAbility" then
  244.         if sets.JA[spell.english] then
  245.             equip(sets.JA[spell.english])
  246.         end
  247.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  248.         cast_delay(0.2)
  249.         send_command('cancel Sneak')
  250.     end
  251.     if sets.Precast[spell.element] and Elemental_Staff == 'ON' then
  252.         equip(sets.Precast[spell.element])
  253.     end
  254.     if StunIndex == 1 then
  255.         equip(sets.Midcast.Stun)
  256.     end
  257. end
  258.  
  259. function midcast(spell,action)
  260.     equipSet = {}
  261.     if spell.action_type == 'Magic' then
  262.         equipSet = sets.Midcast
  263.         if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  264.             if spell.english:startswith('Cure') then
  265.                 equipSet = equipSet.Cure
  266.             elseif spell.english:startswith('Cura') then
  267.                 equipSet = equipSet.Curaga
  268.             end
  269.             if world.day_element == spell.element or world.weather_element == spell.element then
  270.                 equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
  271.             end
  272.         elseif spell.english:startswith('Banish') then
  273.             equipSet = set_combine(equipSet.Haste,{ring1="Fenian Ring"})
  274.         elseif spell.english == "Stoneskin" then
  275.             if buffactive.Stoneskin then
  276.                 send_command('@wait 2.8;cancel stoneskin')
  277.             end
  278.             equipSet = equipSet.Stoneskin
  279.         elseif spell.english == "Sneak" then
  280.             if spell.target.name == player.name and buffactive['Sneak'] then
  281.                 send_command('cancel sneak')
  282.             end
  283.             equipSet = equipSet.Haste
  284.         elseif Low_Tier_Spells:contains(spell.english) and LowNuke == 'ON' then
  285.             equipSet = set_combine(equipSet,sets.LowNuke)
  286.         elseif spell.skill == 'Elemental Magic' and MB == 'ON' then
  287.             equipSet = set_combine(equipSet,sets.MB)
  288.         elseif spell.english:startswith('Utsusemi') then
  289.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
  290.                 send_command('@wait 1.7;cancel Copy Image*')
  291.             end
  292.             equipSet = equipSet.Haste
  293.         elseif spell.english == 'Monomi: Ichi' then
  294.             if buffactive['Sneak'] then
  295.                 send_command('@wait 1.7;cancel sneak')
  296.             end
  297.             equipSet = equipSet.Haste
  298.         else
  299.             if equipSet[spell.english] then
  300.                 equipSet = equipSet[spell.english]
  301.             end
  302.             if equipSet[spell.skill] then
  303.                 equipSet = equipSet[spell.skill]
  304.             end
  305.             if equipSet[AccArray[AccIndex]] then
  306.                 equipSet = equipSet[AccArray[AccIndex]]
  307.             end
  308.             if equipSet[spell.type] then
  309.                 equipSet = equipSet[spell.type]
  310.             end
  311.             if (spell.skill == 'Elemental Magic' or spell.english:startswith('Cur') or spell.english:startswith('Bio') or spell.english:startswith('Dia') or spell.english:startswith('Aspir') or spell.english == 'Drain') and not Non_Obi_Spells:contains(spell.english) and (world.day_element == spell.element or world.weather_element == spell.element) and sets.Obi[spell.element] and Obi == 'ON' and spell.english ~= "Cursna" then -- Use Obi Toggle To Equip Normal Waist Gear --
  312.                 equipSet = set_combine(equipSet,sets.Obi[spell.element])
  313.             end
  314.         end
  315.     elseif equipSet[spell.english] then
  316.         equipSet = equipSet[spell.english]
  317.     end
  318.     equip(equipSet)
  319.     if StunIndex == 1 then
  320.         equip(sets.Midcast.Stun)
  321.     end
  322. end
  323.  
  324. function aftercast(spell,action)
  325.     if not spell.interrupted then
  326.         if spell.english == 'Mana Wall' and player.equipment.feet == "Wicce Sabots +1" then
  327.             disable('feet')
  328.         elseif spell.english == "Sleep II" or spell.english == "Sleepga II" then -- Sleep II & Sleepga II Countdown --
  329.             send_command('wait 60;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
  330.         elseif spell.english == "Sleep" or spell.english == "Sleepga" then -- Sleep & Sleepga Countdown --
  331.             send_command('wait 30;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
  332.         elseif spell.english == "Banish II" then -- Banish II Countdown --
  333.             send_command('wait 20;input /echo Banish Effect: [WEARING OFF IN 10 SEC.]')
  334.         end
  335.     end
  336.     status_change(player.status)
  337. end
  338.  
  339. function status_change(new,old)
  340.     check_equip_lock()
  341.     if Armor == 'PDT' then
  342.         equip(sets.PDT)
  343.     elseif buffactive["Sublimation: Activated"] then
  344.         equip(sets.Sublimation)
  345.     elseif new == 'Engaged' then
  346.         equip(sets.Melee)
  347.     elseif new == 'Idle' then
  348.         equipSet = sets.Idle
  349.         if equipSet[IdleArray[IdleIndex]] then
  350.             equipSet = equipSet[IdleArray[IdleIndex]]
  351.         end
  352.         if buffactive['Reive Mark'] then -- Equip Arciela's Grace +1 During Reive --
  353.             equipSet = set_combine(equipSet,sets.Reive)
  354.         end
  355.         equip(equipSet)
  356.     elseif new == 'Resting' then
  357.         equip(sets.Resting)
  358.     end
  359.     if StunIndex == 1 then
  360.         equip(sets.Midcast.Stun)
  361.     end
  362. end
  363.  
  364. function buff_change(buff,gain)
  365.     buff = string.lower(buff)
  366.     if buff == "mana wall" and not gain then
  367.         enable('feet')
  368.     elseif buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  369.         if gain then
  370.             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.]')
  371.         else
  372.             send_command('timers delete "Aftermath: Lv.3"')
  373.             add_to_chat(123,'AM3: [OFF]')
  374.         end
  375.     elseif buff == 'weakness' then -- Weakness Timer --
  376.         if gain then
  377.             send_command('timers create "Weakness" 300 up')
  378.         else
  379.             send_command('timers delete "Weakness"')
  380.         end
  381.     end
  382.     if not midaction() then
  383.         status_change(player.status)
  384.     end
  385. end
  386.  
  387. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  388. function self_command(command)
  389.     if command == 'C1' then -- Magic Accuracy Toggle --
  390.         AccIndex = (AccIndex % #AccArray) + 1
  391.         add_to_chat(158,'Magic Accuracy Level: ' .. AccArray[AccIndex])
  392.         status_change(player.status)
  393.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  394.         status_change(player.status)
  395.         add_to_chat(158,'Auto Update Gear')
  396.     elseif command == 'C2' then -- Stun Toggle --
  397.         if StunIndex == 1 then
  398.             StunIndex = 0
  399.             add_to_chat(123,'Stun Set: [Unlocked]')
  400.         else
  401.             StunIndex = 1
  402.             add_to_chat(158,'Stun Set: [Locked]')
  403.         end
  404.         status_change(player.status)
  405.     elseif command == 'C3' then -- Obi Toggle --
  406.         if Obi == 'ON' then
  407.             Obi = 'OFF'
  408.             add_to_chat(123,'Obi: [OFF]')
  409.         else
  410.             Obi = 'ON'
  411.             add_to_chat(158,'Obi: [ON]')
  412.         end
  413.         status_change(player.status)
  414.     elseif command == 'C7' then -- PDT Toggle --
  415.         if Armor == 'PDT' then
  416.             Armor = 'None'
  417.             add_to_chat(123,'PDT Set: [Unlocked]')
  418.         else
  419.             Armor = 'PDT'
  420.             add_to_chat(158,'PDT Set: [Locked]')
  421.         end
  422.         status_change(player.status)
  423.     elseif command == 'C15' then -- LowNuke Toggle --
  424.         if LowNuke == 'ON' then
  425.             LowNuke = 'OFF'
  426.             add_to_chat(123,'Low Nuke: [OFF]')
  427.         else
  428.             LowNuke = 'ON'
  429.             add_to_chat(158,'Low Nuke: [ON]')
  430.         end
  431.         status_change(player.status)
  432.     elseif command == 'C9' then -- MB Toggle --
  433.         if MB == 'ON' then
  434.             MB = 'OFF'
  435.             add_to_chat(123,'MB: [OFF]')
  436.         else
  437.             MB = 'ON'
  438.             add_to_chat(158,'MB: [ON]')
  439.         end
  440.         status_change(player.status)
  441.     elseif command == 'C17' then -- Lock Main Weapon Toggle --
  442.         if Lock_Main == 'ON' then
  443.             Lock_Main = 'OFF'
  444.             add_to_chat(123,'Main Weapon: [Unlocked]')
  445.         else
  446.             Lock_Main = 'ON'
  447.             add_to_chat(158,'Main Weapon: [Locked]')
  448.         end
  449.         status_change(player.status)
  450.     elseif command == 'C8' then -- Distance Toggle --
  451.         if player.target.distance then
  452.             target_distance = math.floor(player.target.distance*10)/10
  453.             add_to_chat(158,'Distance: '..target_distance)
  454.         else
  455.             add_to_chat(123,'No Target Selected')
  456.         end
  457.     elseif command == 'C6' then -- Idle Toggle --
  458.         IdleIndex = (IdleIndex % #IdleArray) + 1
  459.         add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
  460.         status_change(player.status)
  461.     elseif command:match('^SC%d$') then
  462.         send_command('//' .. sc_map[command])
  463.     end
  464. end
  465.  
  466. function check_equip_lock() -- Lock Equipment Here --
  467.     if 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
  468.         disable('ring1','ring2')
  469.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  470.         disable('back')
  471.     elseif Lock_Main == 'ON' then
  472.         disable('main','sub')
  473.     else
  474.         enable('main','sub','ring1','ring2','back')
  475.     end
  476. end
  477.  
  478. function actualCost(originalCost)
  479.     if buffactive["Penury"] then
  480.         return originalCost*.5
  481.     elseif buffactive["Light Arts"] then
  482.         return originalCost*.9
  483.     else
  484.         return originalCost
  485.     end
  486. end
  487.  
  488. function degrade_spell(spell,degrade_array)
  489.     spell_index = table.find(degrade_array,spell.name)
  490.     if spell_index > 1 then
  491.         new_spell = degrade_array[spell_index - 1]
  492.         change_spell(new_spell,spell.target.raw)
  493.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  494.     end
  495. end
  496.  
  497. function change_spell(spell_name,target)
  498.     cancel_spell()
  499.     send_command('//'..spell_name..' '..target)
  500. end
  501.  
  502. function sub_job_change(newSubjob, oldSubjob)
  503.     select_default_macro_book()
  504. end
  505.  
  506. function set_macro_page(set,book)
  507.     if not tonumber(set) then
  508.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  509.         return
  510.     end
  511.     if set < 1 or set > 10 then
  512.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  513.         return
  514.     end
  515.  
  516.     if book then
  517.         if not tonumber(book) then
  518.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  519.             return
  520.         end
  521.         if book < 1 or book > 20 then
  522.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  523.             return
  524.         end
  525.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  526.     else
  527.         send_command('@input /macro set '..tostring(set))
  528.     end
  529. end
  530.  
  531. function select_default_macro_book()
  532.     -- Default macro set/book
  533.     if player.sub_job == 'WHM' then
  534.         set_macro_page(1, 1)
  535.     elseif player.sub_job == 'RDM' then
  536.         set_macro_page(2, 1)
  537.     elseif player.sub_job == 'SCH' then
  538.         set_macro_page(3, 1)
  539.     elseif player.sub_job == 'DNC' then
  540.         set_macro_page(10, 1)
  541.     elseif player.sub_job == 'NIN' then
  542.         set_macro_page(5, 1)
  543.     else
  544.         set_macro_page(1, 1)
  545.     end
  546. end
Advertisement
Add Comment
Please, Sign In to add comment