Bokura

Bokura_DNC

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