Advertisement
Bokura

Bokura_THF

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