Bokura

Bokura_SCH

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