Advertisement
Bokura

Bokura_BRD

Jan 19th, 2014
2,195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.16 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Byrth & Motenten's Functions ** --
  3.  
  4. function get_sets()
  5.     AccIndex = 1
  6.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For TP/WS. First 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.     timer_reg = {}
  11.     pianissimo_cycle = false
  12.     Daurdabla = 'OFF' -- Set Default Lock Daurdabla ON or OFF Here --
  13.     Elemental_Staff = 'ON' -- Set Default Precast Elemental Staves ON or OFF Here --
  14.     Lock_Main = 'OFF' -- Set Default Lock Main Weapon 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.     -- Daurdabla Trigger Songs: Use The Following Songs or Daurdabla Toggle To Equip Daurdabla, Add or Remove Daurdabla Songs --
  19.     DaurdSongs = S{"Army's Paeon","Army's Paeon II","Shining Fantasia","Herb Pastoral","Goblin Gavotte"}
  20.  
  21.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  22.     Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  23.     sc_map = {SC1 = "ChocoboMazurka", SC2 = "HerbPastoral", SC3 = "GoblinGavotte"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  24.  
  25.     sets.Idle = {}
  26.     -- Idle Sets --
  27.     sets.Idle.Refresh = {}
  28.     sets.Idle.Movement = set_combine(sets.Idle.Refresh,{
  29.             feet="Fili Cothurnes +1"})
  30.     sets.Resting = set_combine(sets.Idle.Movement,{})
  31.  
  32.     -- PDT Set --
  33.     sets.PDT = {}
  34.  
  35.     sets.Precast = {}
  36.     -- Song Precast Set (empty = To Fix Club/Staff Issue) --
  37.     sets.Precast.SongCast = {
  38.             sub=empty,
  39.             range=empty,
  40.             ammo="Impatiens"}
  41.  
  42.     -- Elemental Staves --
  43.     sets.Precast.Lightning = {main='Apamajas I'}
  44.     sets.Precast.Water = {main='Haoma I'}
  45.     sets.Precast.Fire = {main='Atar I'}
  46.     sets.Precast.Ice = {main='Vourukasha I'}
  47.     sets.Precast.Wind = {main='Vayuvata I'}
  48.     sets.Precast.Earth = {main='Vishrava I'}
  49.     sets.Precast.Light = {main='Arka I'}
  50.     sets.Precast.Dark = {main='Xsaeta I'}
  51.  
  52.     -- Precast Daurdabla Set --
  53.     sets.Precast.Daurdabla = {
  54.             range="Daurdabla",
  55.             ammo=empty}
  56.  
  57.     -- Fastcast Set --
  58.     sets.Precast.FastCast = {}
  59.  
  60.     -- Cure Precast Set --
  61.     sets.Precast.Cure = {}
  62.  
  63.     -- Midcast Base Set --
  64.     sets.Midcast = {}
  65.  
  66.     -- Song Debuff Set --
  67.     sets.Midcast.Wind = {
  68.             main="Carnwenhan",
  69.             sub="Genbu's Shield",
  70.             range="Gjallarhorn",
  71.             ammo=empty}
  72.  
  73.     -- Song Buff Set --
  74.     sets.Midcast.WindBuff = {
  75.             main="Carnwenhan",
  76.             sub="Genbu's Shield",
  77.             range="Gjallarhorn",
  78.             ammo=empty}
  79.  
  80.     sets.Midcast.March = {hands="Fili Manchettes +1"}
  81.     sets.Midcast.Minuet = {body="Fili Hongreline +1"}
  82.     sets.Midcast.Madrigal = {head="Fili Calot +1"}
  83.     sets.Midcast.Ballad = {legs="Fili Rhingrave +1"}
  84.     sets.Midcast.Scherzo = {feet="Fili Cothurnes +1"}
  85.     sets.Midcast.Mazurka = {head="Nahtirah Hat"}
  86.     sets.Midcast.Paeon = {head="Brioso Roundlet +1"}
  87.     sets.Midcast.Finale = {}
  88.     sets.Midcast.Lullaby = {}
  89.  
  90.     -- Cure Set --
  91.     sets.Midcast.Cure = {}
  92.  
  93.     -- Curaga Set --
  94.     sets.Midcast.Curaga = {}
  95.  
  96.     -- Haste Set --
  97.     sets.Midcast.Haste = set_combine(sets.Precast.FastCast,{})
  98.  
  99.     -- Cursna Set --
  100.     sets.Midcast.Cursna = set_combine(sets.Midcast.Haste,{})
  101.  
  102.     -- Stoneskin Set --
  103.     sets.Midcast.Stoneskin = set_combine(sets.Midcast.Haste)
  104.  
  105.     -- JA Sets --
  106.     sets.JA = {}
  107.     sets.JA.Nightingale = {feet="Bihu Slippers +1"}
  108.     sets.JA.Troubadour = {body="Bihu Jstcorps +1"}
  109.     sets.JA["Soul Voice"] = {legs="Bihu Cannions +1"}
  110.  
  111.     -- Waltz --
  112.     sets.Waltz = {}
  113.  
  114.     -- Melee Sets --
  115.     sets.Melee = {}
  116.     sets.Melee.MidACC = set_combine(sets.Melee,{})
  117.     sets.Melee.HighACC = set_combine(sets.Melee.MidACC,{})
  118.  
  119.     -- WS Base Set --
  120.     sets.WS = {}
  121.  
  122.     sets.WS.Exenterator = {}
  123.     sets.WS.Exenterator.MidACC = set_combine(sets.WS.Exenterator,{})
  124.     sets.WS.Exenterator.HighACC = set_combine(sets.WS.Exenterator.MidACC,{})
  125.  
  126.     sets.WS.Evisceration = {}
  127.     sets.WS.Evisceration.MidACC = set_combine(sets.WS.Evisceration,{})
  128.     sets.WS.Evisceration.HighACC = set_combine(sets.WS.Evisceration.MidACC,{})
  129.  
  130.     sets.WS["Mercy Stroke"] = {}
  131.     sets.WS["Mercy Stroke"].MidACC = set_combine(sets.WS["Mercy Stroke"],{})
  132.     sets.WS["Mercy Stroke"].HighACC = set_combine(sets.WS["Mercy Stroke"].MidACC,{})
  133.  
  134.     sets.WS["Rudra's Storm"] = {}
  135.     sets.WS["Rudra's Storm"].MidACC = set_combine(sets.WS["Rudra's Storm"],{})
  136.     sets.WS["Rudra's Storm"].HighACC = set_combine(sets.WS["Rudra's Storm"].MidACC,{})
  137.  
  138.     sets.WS["Mordant Rime"] = {}
  139. end
  140.  
  141. function pretarget(spell,action)
  142.     if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  143.         cancel_spell()
  144.         send_command('input /item "Echo Drops" <me>')
  145.     elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
  146.         cancel_spell()
  147.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  148.         return
  149.     elseif spell.type == "BardSong" and spell.target.name == player.name and buffactive.Pianissimo then -- Change Target From <me> To <t> When Pianissimo Is Active --
  150.         change_target('<t>')
  151.     elseif spell.type == 'BardSong' and spell.target.type and spell.target.type == 'PLAYER' and not buffactive.Pianissimo and not spell.target.charmed and not pianissimo_cycle then -- Auto Pianoissimo When You Cast A Song On A Player --
  152.         cancel_spell()
  153.         pianissimo_cycle = true
  154.         send_command('input /ja "Pianissimo" <me>;wait 1.5;input /ma "'..spell.name..'" '..spell.target.name..';')
  155.         return
  156.     elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  157.         degrade_spell(spell,Cure_Spells)
  158.     elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  159.         degrade_spell(spell,Curaga_Spells)
  160.     end
  161.     if spell.name ~= 'Pianissimo' then
  162.         pianissimo_cycle = false
  163.     end
  164. end
  165.  
  166. function precast(spell,action)
  167.     if spell.action_type == 'Magic' then
  168.         if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu or BardSong If You Are Silenced or Out of Range --
  169.             cancel_spell()
  170.             add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  171.             return
  172.         else
  173.             if spell.type == 'BardSong' then
  174.                 if Daurdabla == 'ON' then
  175.                     equip(sets.Precast.Daurdabla)
  176.                 else
  177.                     if buffactive.Nightingale then
  178.                         equip_song_gear(spell)
  179.                         return
  180.                     else
  181.                         equip_song_gear(spell)
  182.                         equip(sets.Precast.SongCast)
  183.                     end
  184.                 end
  185.             elseif spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  186.                 equip(sets.Precast.Cure)
  187.             elseif spell.english == 'Utsusemi: Ni' then
  188.                 if buffactive['Copy Image (3)'] then
  189.                     cancel_spell()
  190.                     add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  191.                     return
  192.                 else
  193.                     equip(sets.Precast.FastCast)
  194.                 end
  195.             else
  196.                 equip(sets.Precast.FastCast)
  197.             end
  198.         end
  199.     elseif spell.type == "WeaponSkill" then
  200.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  201.             cancel_spell()
  202.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  203.             return
  204.         else
  205.             equipSet = sets.WS
  206.             if equipSet[spell.english] then
  207.                 equipSet = equipSet[spell.english]
  208.             end
  209.             if equipSet[AccArray[AccIndex]] then
  210.                 equipSet = equipSet[AccArray[AccIndex]]
  211.             end
  212.             if spell.english == "Evisceration" and player.tp > 2990 then
  213.                 equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"})
  214.             end
  215.             equip(equipSet)
  216.         end
  217.     elseif spell.type == "JobAbility" then
  218.         if sets.JA[spell.english] then
  219.             equip(sets.JA[spell.english])
  220.         end
  221.     elseif spell.type == "Waltz" then
  222.         refine_waltz(spell,action)
  223.         equip(sets.Waltz)
  224.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  225.         cast_delay(0.2)
  226.         send_command('cancel Sneak')
  227.     end
  228.     if sets.Precast[spell.element] and not buffactive.Nightingale and Elemental_Staff == 'ON' then
  229.         equip(sets.Precast[spell.element])
  230.     end
  231. end
  232.  
  233. function midcast(spell,action)
  234.     equipSet = {}
  235.     if spell.action_type == 'Magic' then
  236.         equipSet = sets.Midcast
  237.         if equipSet[spell.english] then
  238.             equipSet = equipSet[spell.english]
  239.         elseif spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  240.             if spell.english:startswith('Cure') then
  241.                 equipSet = equipSet.Cure
  242.             elseif spell.english:startswith('Cura') then
  243.                 equipSet = equipSet.Curaga
  244.             end
  245.             if world.day_element == spell.element or world.weather_element == spell.element then
  246.                 equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
  247.             end
  248.         elseif spell.english == "Stoneskin" then
  249.             if buffactive.Stoneskin then
  250.                 send_command('@wait 2.8;cancel stoneskin')
  251.             end
  252.             equipSet = equipSet.Stoneskin
  253.         elseif spell.english == "Sneak" then
  254.             if spell.target.name == player.name and buffactive['Sneak'] then
  255.                 send_command('cancel sneak')
  256.             end
  257.             equipSet = equipSet.Haste
  258.         elseif spell.english:startswith('Utsusemi') then
  259.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
  260.                 send_command('@wait 1.7;cancel Copy Image*')
  261.             end
  262.             equipSet = equipSet.Haste
  263.         elseif spell.english == 'Monomi: Ichi' then
  264.             if buffactive['Sneak'] then
  265.                 send_command('@wait 1.7;cancel sneak')
  266.             end
  267.             equipSet = equipSet.Haste
  268.         elseif spell.type == 'BardSong' then
  269.             if Daurdabla == 'ON' then
  270.                 equip(sets.Precast.Daurdabla)
  271.             else
  272.                 equip_song_gear(spell)
  273.             end
  274.         end
  275.     end
  276.     equip(equipSet)
  277. end
  278.  
  279. function aftercast(spell,action)
  280.     if midaction() then
  281.         return
  282.     else
  283.         status_change(player.status)
  284.     end
  285. end
  286.  
  287. function status_change(new,old)
  288.     check_equip_lock()
  289.     if Armor == 'PDT' then
  290.         equip(sets.PDT)
  291.     elseif new == 'Engaged' then
  292.         equipSet = sets.Melee
  293.         if equipSet[AccArray[AccIndex]] then
  294.             equipSet = equipSet[AccArray[AccIndex]]
  295.         end
  296.         equip(equipSet)
  297.     elseif new == 'Idle' then
  298.         equipSet = sets.Idle
  299.         if equipSet[IdleArray[IdleIndex]] then
  300.             equipSet = equipSet[IdleArray[IdleIndex]]
  301.         end
  302.         if buffactive['Reive Mark'] then -- Equip Arciela's Grace +1 During Reive --
  303.             equipSet = set_combine(equipSet,{neck="Arciela's Grace +1"})
  304.         end
  305.         if world.area:endswith('Adoulin') then
  306.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  307.         end
  308.         equip(equipSet)
  309.     elseif new == 'Resting' then
  310.         equip(sets.Resting)
  311.     end
  312. end
  313.  
  314. function buff_change(buff,gain)
  315.     buff = string.lower(buff)
  316.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  317.         if gain then
  318.             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.]')
  319.         else
  320.             send_command('timers delete "Aftermath: Lv.3"')
  321.             add_to_chat(123,'AM3: [OFF]')
  322.         end
  323.     elseif buff == 'weakness' then -- Weakness Timer --
  324.         if gain then
  325.             send_command('timers create "Weakness" 300 up')
  326.         else
  327.             send_command('timers delete "Weakness"')
  328.         end
  329.     end
  330.     if not midaction() then
  331.         status_change(player.status)
  332.     end
  333. end
  334.  
  335. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  336. function self_command(command)
  337.     if command == 'C1' then
  338.         send_command('input /ma "Victory March" <me>')
  339.         add_to_chat(158,'Melee Speed II: [Victory March]')
  340.     elseif command == 'C2' then
  341.         send_command('input /ma "Advancing March" <me>')
  342.         add_to_chat(158,'Melee Speed: [Advancing March]')
  343.     elseif command == 'C3' then
  344.         send_command('input /ma "Valor Minuet V" <me>')
  345.         add_to_chat(158,'Melee Attack: [Valor Minuet V]')
  346.     elseif command == 'C5' then
  347.         send_command('input /ma "Valor Minuet IV" <me>')
  348.         add_to_chat(158,'Melee Attack: [Valor Minuet IV]')
  349.     elseif command == 'C9' then
  350.         send_command('input /ma "Blade Madrigal" <me>')
  351.         add_to_chat(158,'Melee Accuracy II: [Blade Madrigal]')
  352.     elseif command == 'C10' then
  353.         send_command('input /ma "Sword Madrigal" <me>')
  354.         add_to_chat(158,'Melee Accuracy: [Sword Madrigal]')
  355.     elseif command == 'C15' then -- PDT Toggle --
  356.         if Armor == 'PDT' then
  357.             Armor = 'None'
  358.             add_to_chat(123,'PDT Set: [Unlocked]')
  359.         else
  360.             Armor = 'PDT'
  361.             add_to_chat(158,'PDT Set: [Locked]')
  362.         end
  363.         status_change(player.status)
  364.     elseif command == 'C17' then -- Lock Main Weapon Toggle --
  365.         if Lock_Main == 'ON' then
  366.             Lock_Main = 'OFF'
  367.             add_to_chat(123,'Main Weapon: [Unlocked]')
  368.         else
  369.             Lock_Main = 'ON'
  370.             add_to_chat(158,'Main Weapon: [Locked]')
  371.         end
  372.         status_change(player.status)
  373.     elseif command == 'C7' then -- Daurdabla Toggle --
  374.         if Daurdabla == 'ON' then
  375.             Daurdabla = 'OFF'
  376.             add_to_chat(123,'Daurdabla: [OFF]')
  377.         else
  378.             Daurdabla = 'ON'
  379.             add_to_chat(158,'Daurdabla: [ON]')
  380.         end
  381.         status_change(player.status)
  382.     elseif command == 'C16' then -- Accuracy Level Toggle --
  383.         AccIndex = (AccIndex % #AccArray) + 1
  384.         status_change(player.status)
  385.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  386.     elseif command == 'C12' then -- Auto Update Gear Toggle --
  387.         status_change(player.status)
  388.         add_to_chat(158,'Auto Update Gear')
  389.     elseif command == 'C8' then -- Distance Toggle --
  390.         if player.target.distance then
  391.             target_distance = math.floor(player.target.distance*10)/10
  392.             add_to_chat(158,'Distance: '..target_distance)
  393.         else
  394.             add_to_chat(123,'No Target Selected')
  395.         end
  396.     elseif command == 'C6' then -- Idle Toggle --
  397.         IdleIndex = (IdleIndex % #IdleArray) + 1
  398.         add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
  399.         status_change(player.status)
  400.     elseif command:match('^SC%d$') then
  401.         send_command('//' .. sc_map[command])
  402.     end
  403. end
  404.  
  405. function check_equip_lock() -- Lock Equipment Here --
  406.     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
  407.         disable('ring1','ring2')
  408.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  409.         disable('back')
  410.     elseif Lock_Main == 'ON' then
  411.         disable('main','sub')
  412.     else
  413.         enable('main','sub','ring1','ring2','back')
  414.     end
  415. end
  416.  
  417. function equip_song_gear(spell)
  418.     if DaurdSongs:contains(spell.english) then
  419.         equip(sets.Precast.Daurdabla)
  420.         add_to_chat(158,'Daurdabla: [ON]')
  421.     else
  422.         if spell.target.type == 'MONSTER' then
  423.             equip(sets.Midcast.Wind)
  424.             if string.find(spell.english,'Finale') then equip(sets.Midcast.Finale) end
  425.             if string.find(spell.english,'Lullaby') then equip(sets.Midcast.Lullaby) end
  426.         else
  427.             equip(sets.Midcast.WindBuff)
  428.             if string.find(spell.english,'March') then equip(sets.Midcast.March) end
  429.             if string.find(spell.english,'Minuet') then equip(sets.Midcast.Minuet) end
  430.             if string.find(spell.english,'Madrigal') then equip(sets.Midcast.Madrigal) end
  431.             if string.find(spell.english,'Ballad') then equip(sets.Midcast.Ballad) end
  432.             if string.find(spell.english,'Scherzo') then equip(sets.Midcast.Scherzo) end
  433.             if string.find(spell.english,'Mazurka') then equip(sets.Midcast.Mazurka) end
  434.             if string.find(spell.english,'Paeon') then equip(sets.Midcast.Paeon) end
  435.         end
  436.     end
  437. end
  438.  
  439. function actualCost(originalCost)
  440.     if buffactive["Penury"] then
  441.         return originalCost*.5
  442.     elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
  443.         return originalCost*.9
  444.     elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
  445.         return originalCost*1.1
  446.     else
  447.         return originalCost
  448.     end
  449. end
  450.  
  451. function degrade_spell(spell,degrade_array)
  452.     spell_index = table.find(degrade_array,spell.name)
  453.     if spell_index > 1 then
  454.         new_spell = degrade_array[spell_index - 1]
  455.         change_spell(new_spell,spell.target.raw)
  456.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  457.     end
  458. end
  459.  
  460. function change_spell(spell_name,target)
  461.     cancel_spell()
  462.     send_command('//'..spell_name..' '..target)
  463. end
  464.  
  465. function refine_waltz(spell,action)
  466.     if spell.type ~= 'Waltz' then
  467.         return
  468.     end
  469.  
  470.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" then
  471.         return
  472.     end
  473.  
  474.     local newWaltz = spell.english
  475.     local waltzID
  476.  
  477.     local missingHP
  478.  
  479.     if spell.target.type == "SELF" then
  480.         missingHP = player.max_hp - player.hp
  481.     elseif spell.target.isallymember then
  482.         local target = find_player_in_alliance(spell.target.name)
  483.         local est_max_hp = target.hp / (target.hpp/100)
  484.         missingHP = math.floor(est_max_hp - target.hp)
  485.     end
  486.  
  487.     if missingHP ~= nil then
  488.         if player.sub_job == 'DNC' then
  489.             if missingHP < 40 and spell.target.name == player.name then
  490.                 add_to_chat(123,'Full HP!')
  491.                 cancel_spell()
  492.                 return
  493.             elseif missingHP < 150 then
  494.                 newWaltz = 'Curing Waltz'
  495.                 waltzID = 190
  496.             elseif missingHP < 300 then
  497.                 newWaltz = 'Curing Waltz II'
  498.                 waltzID = 191
  499.             else
  500.                 newWaltz = 'Curing Waltz III'
  501.                 waltzID = 192
  502.             end
  503.         else
  504.             return
  505.         end
  506.     end
  507.  
  508.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50}
  509.     local tpCost = waltzTPCost[newWaltz]
  510.  
  511.     local downgrade
  512.  
  513.     if player.tp < tpCost then
  514.  
  515.         if player.tp < 20 then
  516.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  517.             cancel_spell()
  518.             return
  519.         elseif player.tp < 35 then
  520.             newWaltz = 'Curing Waltz'
  521.         elseif player.tp < 50 then
  522.             newWaltz = 'Curing Waltz II'
  523.         end
  524.  
  525.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  526.     end
  527.  
  528.     if newWaltz ~= spell.english then
  529.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  530.         if downgrade then
  531.             add_to_chat(8, downgrade)
  532.         end
  533.         cancel_spell()
  534.         return
  535.     end
  536.  
  537.     if missingHP > 0 then
  538.         add_to_chat(8,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  539.     end
  540. end
  541.  
  542. function find_player_in_alliance(name)
  543.     for i,v in ipairs(alliance) do
  544.         for k,p in ipairs(v) do
  545.             if p.name == name then
  546.                 return p
  547.             end
  548.         end
  549.     end
  550. end
  551.  
  552. function sub_job_change(newSubjob, oldSubjob)
  553.     select_default_macro_book()
  554. end
  555.  
  556. function set_macro_page(set,book)
  557.     if not tonumber(set) then
  558.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  559.         return
  560.     end
  561.     if set < 1 or set > 10 then
  562.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  563.         return
  564.     end
  565.  
  566.     if book then
  567.         if not tonumber(book) then
  568.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  569.             return
  570.         end
  571.         if book < 1 or book > 20 then
  572.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  573.             return
  574.         end
  575.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  576.     else
  577.         send_command('@input /macro set '..tostring(set))
  578.     end
  579. end
  580.  
  581. function select_default_macro_book()
  582.     -- Default macro set/book
  583.     if player.sub_job == 'WHM' then
  584.         set_macro_page(1, 3)
  585.     elseif player.sub_job == 'BLM' then
  586.         set_macro_page(2, 3)
  587.     elseif player.sub_job == 'DNC' then
  588.         set_macro_page(3, 3)
  589.     elseif player.sub_job == 'NIN' then
  590.         set_macro_page(5, 3)
  591.     elseif player.sub_job == 'WAR' then
  592.         set_macro_page(10, 3)
  593.     else
  594.         set_macro_page(1, 3)
  595.     end
  596. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement