backstab

XXXTHF LUAxxx

Feb 9th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 33.37 KB | None | 0 0
  1.    
  2.  
  3.     -- *** Credit goes to Flippant for helping me with Gearswap *** --
  4.     -- ** I Use Some of Motenten's Functions ** --
  5.     -- Last Updated: 05/02/14 10:00 PM *Added Feint Set* --
  6.      
  7.     function get_sets()
  8.             AccIndex = 1
  9.             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 --
  10.             WeaponIndex = 1
  11.             WeaponArray = {"Izhiikoh","Sandung"} -- Default Sub Weapon Is Izhiikoh. Can Delete Any Weapons/Sets That You Don't Need Or Replace/Add The New Weapons That You Want To Use. --
  12.             IdleIndex = 1
  13.             IdleArray = {"Movement","Regen"} -- Default Idle Set Is Movement --
  14.             SA = false
  15.             TA = false
  16.             TH = 'OFF' -- Set Default Full TH ON or OFF Here --
  17.             Rancor = 'OFF' -- Set Default Rancor ON or OFF Here --
  18.             target_distance = 5 -- Set Default Distance Here --
  19.             select_default_macro_book() -- Change Default Macro Book At The End --
  20.      
  21.             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. --
  22.      
  23.             -- Idle/Town Sets --
  24.             sets.Idle = {}
  25.             sets.Idle.Regen = {
  26.                             neck="Wiglen Gorget",
  27.                             ear1="Black Earring",
  28.                             ear2="Dawn Earring",
  29.                             body="Mekosu. Harness",
  30.                             hands="Nilas Gloves",
  31.                             ring1="Karieyh Ring",
  32.                             ring2="Sheltered Ring",
  33.                             back="Repulse Mantle",
  34.                             waist="Flume Belt",
  35.                             legs="Pill. Culottes +1",
  36.                             feet="Qaaxo Leggings"}
  37.             sets.Idle.Regen.Izhiikoh = set_combine(sets.Idle.Regen,{
  38.                             main="Izhiikoh",
  39.                             sub="Jugo Kukri +1"})
  40.             sets.Idle.Regen.Sandung = set_combine(sets.Idle.Regen,{
  41.                             main="Izhiikoh",
  42.                             sub="Sandung"})
  43.      
  44.             sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  45.                             head="Felistris Mask"})
  46.             sets.Idle.Movement.Izhiikoh = set_combine(sets.Idle.Movement,{
  47.                             main="Izhiikoh",
  48.                             sub="Jugo Kukri +1"})
  49.             sets.Idle.Movement.Sandung = set_combine(sets.Idle.Movement,{
  50.                             main="Izhiikoh",
  51.                             sub="Sandung"})
  52.      
  53.             -- Normal TP Sets --
  54.             sets.TP = {
  55.                             ammo="Ginsen",
  56.                             head="Felistris Mask",
  57.                             neck="Asperity Necklace",
  58.                             ear1="Dudgeon Earring",
  59.                             ear2="Heartseeker Earring",
  60.                             body="Thaumas Coat",
  61.                             hands="Nilas Gloves",
  62.                             ring1="Epona's Ring",
  63.                             ring2="Rajas Ring",
  64.                             back="Canny cape",
  65.                             waist="Shetal stone",
  66.                             legs="Quiahuiz Trousers",
  67.                             feet="Plun. Poulaines +1"}
  68.             sets.TP.MidACC = set_combine(sets.TP,{
  69.                             neck="Ej necklace",
  70.                             head="Whirlpool Mask",
  71.                             body="Plunderer's Vest +1",
  72.                             ring2="Ramuh ring +1",
  73.                             hands="Qaaxo Mitaines",
  74.                             back="Canny Cape"})
  75.             sets.TP.HighACC = set_combine(sets.TP.MidACC,{
  76.                             ammo="Honed Tathlum",
  77.                             head="Whirlpool Mask",
  78.                             feet="Qaaxo Leggings",
  79.                             back="Letalis Mantle",
  80.                             body="Pillager's Vest +1",
  81.                             legs="Ighwa Trousers",
  82.                             ring1="Mars's Ring",
  83.                             waist="Anguinus belt"})
  84.      
  85.             -- March x2 + Haste --
  86.             sets.TP.MidHaste = set_combine(sets.TP,{
  87.                             ammo="Ginsen",
  88.                             head="Felistris Mask",
  89.                             neck="Asperity Necklace",
  90.                             ear1="Dudgeon Earring",
  91.                             ear2="Heartseeker Earring",
  92.                             body="Thaumas Coat",
  93.                             hands="Nilas Gloves",
  94.                             ring1="Epona's Ring",
  95.                             ring2="Rajas Ring",
  96.                             back="Canny cape",
  97.                             waist="Windbuffet Belt +1",
  98.                             legs="Quiahuiz Trousers",
  99.                             feet="Plun. Poulaines +1"})
  100.             sets.TP.MidACC.MidHaste = set_combine(sets.TP.MidHaste,{
  101.                             neck="Ej necklace",
  102.                             ring2="Ramuh ring +1",
  103.                             body="Plunderer's Vest +1",
  104.                             head="Whirlpool Mask",
  105.                             hands="Qaaxo Mitaines",
  106.                             back="Canny Cape"})
  107.             sets.TP.HighACC.MidHaste = set_combine(sets.TP.MidACC.MidHaste,{
  108.                             ammo="Honed Tathlum",
  109.                             head="Whirlpool Mask",
  110.                             body="Pillager's Vest +1",
  111.                             feet="Qaaxo Leggings",
  112.                             legs="Ighwa Trousers",
  113.                             ring1="Mars's Ring",
  114.                             waist="Anguinus belt"})
  115.      
  116.             -- March x2 + Haste + Samba --
  117.             sets.TP.HighHaste = set_combine(sets.TP.MidHaste,{
  118.                             ammo="Ginsen",
  119.                             ear1="Trux Earring",
  120.                             ear2="Brutal Earring",
  121.                             body="Thaumas coat",
  122.                             waist="Windbuffet Belt +1"})
  123.             sets.TP.MidACC.HighHaste = set_combine(sets.TP.HighHaste,{
  124.                             neck="Ej necklace",
  125.                             hands="Qaaxo Mitaines",
  126.                             ear1="Steelflash Earring",
  127.                             body="Plunderer's Vest +1",
  128.                             ear2="Bladeborn Earring",
  129.                             back="Letalis Mantle"})
  130.             sets.TP.HighACC.MidHaste = set_combine(sets.TP.MidACC.MidHaste,{
  131.                             ammo="Honed Tathlum",
  132.                             head="Whirlpool Mask",
  133.                             feet="Qaaxo Leggings",
  134.                             waist="Anguinus belt",
  135.                             legs="Ighwa Trousers",
  136.                             body="Pillager's Vest +1",
  137.                             ring1="Mars's Ring"})
  138.      
  139.             -- Full TH TP Set --
  140.             sets.TP.TH = {
  141.                             hands="Plun. Armlets +1",
  142.                             waist="Chaac Belt",
  143.                             feet="Raid. Poulaines +2"}
  144.      
  145.             -- TP Rancor ON Neck --
  146.             sets.TP.Rancor = {neck="Rancor Collar"}
  147.      
  148.             -- TP Feint Set --
  149.             sets.TP.Feint = {legs="Plun. Culottes +1"}
  150.      
  151.             -- PDT/MDT Sets --
  152.             sets.PDT = {
  153.                             head="Lithelimb Cap",
  154.                             neck="Twilight Torque",
  155.                             ear1="Black Earring",
  156.                             ear2="Brutal Earring",
  157.                             body="Mekosu. Harness",
  158.                             hands="Qaaxo Mitaines",
  159.                             ring2="Dark Ring",
  160.                             ring1="Defending Ring",
  161.                             back="Mollusca Mantle",
  162.                             waist="Flume Belt",
  163.                             legs="Ighwa Trousers",
  164.                             feet="Qaaxo Leggings"}
  165.      
  166.             sets.MDT = set_combine(sets.PDT,{
  167.                             ear1="Merman's Earring",
  168.                             ear2="Sanare Earring",
  169.                             ring1="Shadow Ring",
  170.                             back="Engulfer Cape",
  171.                             waist="Resolute Belt"})
  172.      
  173.             -- Hybrid/Evasion Sets --
  174.             sets.TP.Hybrid = set_combine(sets.PDT,{
  175.                             head="Felistris Mask",
  176.                             ear1="Heartseeker Earring",
  177.                             ear2="Dudgeon Earring",
  178.                             body="Thaumas Coat",
  179.                             hands="Pill. Armlets +1",
  180.                             waist="Shetal stone",
  181.                             legs="Pill. Culottes +1",
  182.                             feet="Plun. Poulaines +1"})
  183.             sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  184.             sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  185.      
  186.             sets.Evasion = set_combine(sets.PDT,{})
  187.      
  188.             -- WS Base Set --
  189.             sets.WS = {}
  190.      
  191.             -- WS Sets --
  192.             sets.WS["Mercy Stroke"] = {
  193.                             head="Whirlpool Mask",
  194.                             neck="Justiciar's Torque",
  195.                             ear1="Steelflash Earring",
  196.                             ear2="Bladeborn Earring",
  197.                             body="Khepri Jacket",
  198.                             hands="Pill. Armlets +1",
  199.                             ring1="Epona's Ring",
  200.                             ring2="Pyrosoul Ring",
  201.                             back="Buquwik Cape",
  202.                             waist="Wanion Belt",
  203.                             legs="Nahtirah Trousers",
  204.                             feet="Plun. Poulaines +1"}
  205.             sets.WS["Mercy Stroke"].SA = {
  206.                             head="Pill. Bonnet +1",
  207.                             neck="Soil Gorget",
  208.                             ear1="Vulcan's Pearl",
  209.                             ear2="Vulcan's Pearl",
  210.                             body="Pillager's Vest +1",
  211.                             hands="Raider's Armlets +2",
  212.                             ring1="Pyrosoul Ring",
  213.                             ring2="Rajas Ring",
  214.                             back="Buquwik Cape",
  215.                             waist="Wanion Belt",
  216.                             legs="Pill. Culottes +1",
  217.                             feet="Plun. Poulaines +1"}
  218.             sets.WS["Mercy Stroke"].TA = {
  219.                             head="Pill. Bonnet +1",
  220.                             neck="Soil Gorget",
  221.                             ear1="Vulcan's Pearl",
  222.                             ear2="Vulcan's Pearl",
  223.                             body="Pillager's Vest +1",
  224.                             hands="Pill. Armlets +1",
  225.                             ring1="Pyrosoul Ring",
  226.                             ring2="Rajas Ring",
  227.                             back="Buquwik Cape",
  228.                             waist="Soil Belt",
  229.                             legs="Pill. Culottes +1",
  230.                             feet="Plun. Poulaines +1"}
  231.      
  232.             sets.WS.Exenterator = {
  233.                             head="Felistris Mask",
  234.                             neck="Justiciar's Torque",
  235.                             ear1="Steelflash Earring",
  236.                             ear2="Bladeborn Earring",
  237.                             body="Pillager's Vest +1",
  238.                             hands="Pill. Armlets +1",
  239.                             ring1="Stormsoul Ring",
  240.                             ring2="Epona's Ring",
  241.                             back="Canny Cape",
  242.                             waist="Elanid Belt",
  243.                             legs="Nahtirah Trousers",
  244.                             feet="Plun. Poulaines +1"}
  245.             sets.WS.Exenterator.SA = set_combine(sets.WS.Exenterator,{head="Pill. Bonnet +1",legs="Pill. Culottes +1"})
  246.             sets.WS.Exenterator.TA = set_combine(sets.WS.Exenterator,{head="Pill. Bonnet +1",legs="Pill. Culottes +1"})
  247.      
  248.             sets.WS.Evisceration = {
  249.                             ammo="Yetshila",
  250.                             head="Uk'uxkaj cap",
  251.                             neck="Shadow gorget",
  252.                             ear1="Moonshade Earring",
  253.                             ear2="Brutal Earring",
  254.                             body="Plunderer's Vest +1",
  255.                             hands="Pill. Armlets +1",
  256.                             ring1="Epona's Ring",
  257.                             ring2="Rajas Ring",
  258.                             back="Rancorous Mantle",
  259.                             waist="Wanion Belt",
  260.                             legs="Quiahuiz Trousers",
  261.                             feet="Plun. Poulaines +1"}
  262.             sets.WS.Evisceration.SA = set_combine(sets.WS.Evisceration,{hands="Raider's Armlets +2"})
  263.             sets.WS.Evisceration.TA = set_combine(sets.WS.Evisceration,{})
  264.      
  265.             sets.WS["Rudra's Storm"] = {
  266.                             ammo="Jukukik Feather",
  267.                             head="Whirlpool mask",
  268.                             neck="Moepapa Medal",
  269.                             ear1="Moonshade Earring",
  270.                             ear2="Dawn Earring",
  271.                             body="Dread Jupon",
  272.                             hands="Nilas Gloves",
  273.                             ring2="Ramuh Ring +1",
  274.                             ring1="Karieyh Ring",
  275.                             back="Kayapa Cape",
  276.                             waist="Wanion Belt",
  277.                             legs="Manibozho brais",
  278.                             feet="Plun. Poulaines +1"}
  279.             sets.WS["Rudra's Storm"].SA = set_combine(sets.WS["Rudra's Storm"],{hands="Pill. Armlets +1",ammo="Yetshila",body="Pillager's Vest +1",legs="Pill. Culottes +1",waist="Artful Belt +1",head="Pill. Bonnet +1"})
  280.             sets.WS["Rudra's Storm"].TA = set_combine(sets.WS["Rudra's Storm"],{hands="Pill. Armlets +1",body="Plunderer's Vest +1",ammo="Yetshila",legs="Pill. Culottes +1",waist="Artful Belt +1",head="Pill. Bonnet +1"})
  281.      
  282.             sets.WS["Aeolian Edge"] = {}
  283.      
  284.             sets.WS["Mandalic Stab"] = {}
  285.      
  286.             -- JA Sets --
  287.             sets.JA = {}
  288.             TH_Gear = {hands="Plun. Armlets +1",waist="Chaac Belt",feet="Raid. Poulaines +2"}
  289.             sets.JA.Conspirator = {body="Raider's Vest +2"}
  290.             sets.JA.Accomplice = {head="Raid. Bonnet +2"}
  291.             sets.JA.Collaborator = {head="Raid. Bonnet +2"}
  292.             sets.JA["Perfect Dodge"] = {hands="Plun. Armlets +1"}
  293.             sets.JA.Steal = {hands="Pill. Armlets +1",legs="Pill. Culottes +1",feet="Pill. Poulaines +1"}
  294.             sets.JA.Flee = {feet="Pill. Poulaines +1"}
  295.             sets.JA.Despoil = {legs="Raid. Culottes +2",feet="Raid. Poulaines +2"}
  296.             sets.JA.Mug = {head="Plun. Bonnet +1"}
  297.             sets.JA.Hide = {body="Pillager's Vest +1"}
  298.             sets.JA.Provoke = TH_Gear
  299.             sets.JA["Sneak Attack"] = {}
  300.             sets.JA["Trick Attack"] = set_combine(sets.JA["Sneak Attack"],{})
  301.      
  302.             -- Step Set --
  303.             sets.Step = set_combine({},TH_Gear)
  304.      
  305.             -- Flourish Set --
  306.             sets.Flourish = set_combine({},TH_Gear)
  307.      
  308.             -- Waltz Set --
  309.             sets.Waltz = {}
  310.      
  311.             sets.Precast = {}
  312.             -- Fastcast Set --
  313.             sets.Precast.FastCast = {
  314.                             head="Haruspex Hat +1",
  315.                             neck="Orunmila's Torque",
  316.                             body="Dread Jupon",
  317.                             ear1="Loquac. Earring",
  318.                             ammo="Impatiens",
  319.                             hands="Thaumas Gloves",
  320.                             ring1="Prolix Ring",
  321.                             ring2="Veneficium Ring",
  322.                             legs="Enif Cosciales"}
  323.             -- Utsusemi Precast Set --
  324.             sets.Precast.Utsusemi = set_combine(sets.Precast.FastCast,{neck="Magoraga Beads"})
  325.      
  326.             sets.Midcast = {}
  327.             -- Magic Haste Set --
  328.             sets.Midcast.Haste = set_combine(sets.PDT,{})
  329.     end
  330.      
  331.     function pretarget(spell,action)
  332.             if (spell.type:endswith('Magic') or spell.type == "Ninjutsu") and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  333.                     cancel_spell()
  334.                     send_command('input /item "Echo Drops" <me>')
  335.             elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On --
  336.                     cancel_spell()
  337.                     send_command('Aggressor')
  338.             elseif (spell.english == 'Ranged' and spell.target.distance > 24.9) or (spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged') then -- Cancel Ranged Attack or WS If You Are Out Of Range --
  339.                     cancel_spell()
  340.                     add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  341.                     return
  342.             end
  343.     end
  344.      
  345.     function precast(spell,action)
  346.             if spell.type == "WeaponSkill" then
  347.                     if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  348.                             cancel_spell()
  349.                             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  350.                             return
  351.                     else
  352.                             equipSet = sets.WS
  353.                             if equipSet[spell.english] then
  354.                                     equipSet = equipSet[spell.english]
  355.                             end
  356.                             if SA and equipSet["SA"] then
  357.                                     equipSet = equipSet["SA"]
  358.                             end
  359.                             if TA and equipSet["TA"] then
  360.                                     equipSet = equipSet["TA"]
  361.                             end
  362.                             if spell.english == "Evisceration" and player.tp > 299 then -- Equip Jupiter's Pearl When You Have 300 TP --
  363.                                     equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"})
  364.                             end
  365.                             equip(equipSet)
  366.                     end
  367.             elseif spell.type=="JobAbility" then
  368.                     if sets.JA[spell.english] then
  369.                             equip(sets.JA[spell.english])
  370.                     end
  371.                     if spell.english=="Sneak Attack" then
  372.                             SA = true
  373.                     end
  374.                     if spell.english=="Trick Attack" then
  375.                             TA = true
  376.                     end
  377.             elseif spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  378.                     if string.find(spell.english,'Utsusemi') then
  379.                             if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  380.                                     cancel_spell()
  381.                                     add_to_chat(123, spell.name .. ' Canceled: [3+ Images]')
  382.                                     return
  383.                             else
  384.                                     equip(sets.Precast.Utsusemi)
  385.                             end
  386.                     else
  387.                             equip(sets.Precast.FastCast)
  388.                     end
  389.             elseif spell.type == 'Step' then
  390.                     equip(sets.Step)
  391.             elseif string.find(spell.type,'Flourish') then
  392.                     equip(sets.Flourish)
  393.             elseif spell.type == "Waltz" then
  394.                     refine_waltz(spell,action)
  395.                     equip(sets.Waltz)
  396.             elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  397.                     cast_delay(0.2)
  398.                     send_command('cancel Sneak')
  399.             end
  400.     end
  401.      
  402.     function midcast(spell,action)
  403.             if spell.english == 'Ranged' then
  404.                     equip(TH_Gear)
  405.             elseif spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  406.                     if string.find(spell.english,'Utsusemi') then
  407.                             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  408.                                     send_command('@wait 1.7;cancel Copy Image*')
  409.                             end
  410.                             equip(sets.Midcast.Haste)
  411.                     elseif spell.english == 'Monomi: Ichi' then
  412.                             if buffactive['Sneak'] then
  413.                                     send_command('@wait 1.7;cancel sneak')
  414.                             end
  415.                             equip(sets.Midcast.Haste)
  416.                     else
  417.                             equip(sets.Midcast.Haste)
  418.                     end
  419.             end
  420.     end
  421.      
  422.     function aftercast(spell,action)
  423.             if spell.type == "WeaponSkill" and not spell.interrupted then
  424.                     send_command('wait 0.2;gs c TP')
  425.             end
  426.             status_change(player.status)
  427.     end
  428.      
  429.     function status_change(new,old)
  430.             if player.equipment.range ~= 'empty' then
  431.                     disable('range','ammo')
  432.             else
  433.                     enable('range','ammo')
  434.             end
  435.             if Armor == 'PDT' then
  436.                     equip(sets.PDT)
  437.             elseif Armor == 'MDT' then
  438.                     equip(sets.MDT)
  439.             elseif Armor == 'EVA' then
  440.                     equip(sets.Evasion)
  441.             elseif new == 'Engaged' then
  442.                     equipSet = sets.TP
  443.                     if Armor == 'Hybrid' and equipSet["Hybrid"] then
  444.                             equipSet = equipSet["Hybrid"]
  445.                     end
  446.                     if equipSet[AccArray[AccIndex]] then
  447.                             equipSet = equipSet[AccArray[AccIndex]]
  448.                     end
  449.                     if (buffactive.Embrava and (buffactive.Haste or buffactive.March) and buffactive['Haste Samba']) or (buffactive.March == 2 and buffactive.Haste and buffactive['Haste Samba']) and equipSet["HighHaste"] then
  450.                             equipSet = equipSet["HighHaste"]
  451.                     end
  452.                     if (buffactive.Embrava and (buffactive.Haste or buffactive.March or buffactive['Haste Samba'])) or (buffactive.March == 1 and buffactive.Haste and buffactive['Haste Samba'] and equipSet["MidHaste"]) or (buffactive.March == 2 and (buffactive.Haste or buffactive['Haste Samba'])) and equipSet["MidHaste"] then
  453.                             equipSet = equipSet["MidHaste"]
  454.                     end
  455.                     if SA then
  456.                             equipSet = set_combine(equipSet,sets.JA["Sneak Attack"])
  457.                     end
  458.                     if TA then
  459.                             equipSet = set_combine(equipSet,sets.JA["Trick Attack"])
  460.                     end
  461.                     if buffactive.Feint then
  462.                             equipSet = set_combine(equipSet,sets.TP.Feint)
  463.                     end
  464.                     if Rancor == 'ON' then -- Use Rancor Toggle For Rancor Collar --
  465.                             equipSet = set_combine(equipSet,sets.TP.Rancor)
  466.                     end
  467.                     if TH == 'ON' then -- Use TH Toggle To Lock Full TH Set --
  468.                             equipSet = set_combine(equipSet,sets.TP.TH)
  469.                     end
  470.                     equip(equipSet)
  471.             else
  472.                     equipSet = sets.Idle
  473.                     if equipSet[IdleArray[IdleIndex]] then
  474.                             equipSet = equipSet[IdleArray[IdleIndex]]
  475.                     end
  476.                     if equipSet[WeaponArray[WeaponIndex]] then
  477.                             equipSet = equipSet[WeaponArray[WeaponIndex]]
  478.                     end
  479.                     equip(equipSet)
  480.             end
  481.     end
  482.      
  483.     function buff_change(buff,gain)
  484.             buff = string.lower(buff)
  485.             if buff == "sneak attack" then
  486.                     SA = gain
  487.             elseif buff == "trick attack" then
  488.                     TA = gain
  489.             elseif buff == 'weakness' then -- Weakness Timer --
  490.                     if gain then
  491.                             send_command('timers create "Weakness" 300 up')
  492.                     else
  493.                             send_command('timers delete "Weakness"')
  494.                     end
  495.             end
  496.             if not midaction() then
  497.                     status_change(player.status)
  498.             end
  499.     end
  500.      
  501.     -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  502.     function self_command(command)
  503.             if command == 'C1' then -- Accuracy Level Toggle --
  504.                     AccIndex = (AccIndex % #AccArray) + 1
  505.                     status_change(player.status)
  506.                     add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  507.             elseif command == 'C17' then -- Main Weapon Toggle --
  508.                     WeaponIndex = (WeaponIndex % #WeaponArray) + 1
  509.                     add_to_chat(158,'Main Weapon: '..WeaponArray[WeaponIndex])
  510.                     status_change(player.status)
  511.             elseif command == 'C5' then -- Auto Update Gear Toggle --
  512.                     status_change(player.status)
  513.                     add_to_chat(158,'Auto Update Gear')
  514.             elseif command == 'C2' then -- Hybrid Toggle --
  515.                     if Armor == 'Hybrid' then
  516.                             Armor = 'None'
  517.                             add_to_chat(123,'Hybrid Set: [Unlocked]')
  518.                     else
  519.                             Armor = 'Hybrid'
  520.                             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  521.                     end
  522.                     status_change(player.status)
  523.             elseif command == 'C9' then -- Full TH Set Toggle --
  524.                     if TH == 'ON' then
  525.                             TH = 'OFF'
  526.                             add_to_chat(123,'Full TH Set: [Unlocked]')
  527.                     else
  528.                             TH = 'ON'
  529.                             add_to_chat(158,'Full TH Set: [Locked]')
  530.                     end
  531.                     status_change(player.status)
  532.             elseif command == 'C7' then -- PDT Toggle --
  533.                     if Armor == 'PDT' then
  534.                             Armor = 'None'
  535.                             add_to_chat(123,'PDT Set: [Unlocked]')
  536.                     else
  537.                             Armor = 'PDT'
  538.                             add_to_chat(158,'PDT Set: [Locked]')
  539.                     end
  540.                     status_change(player.status)
  541.             elseif command == 'C15' then -- MDT Toggle --
  542.                     if Armor == 'MDT' then
  543.                             Armor = 'None'
  544.                             add_to_chat(123,'MDT Set: [Unlocked]')
  545.                     else
  546.                             Armor = 'MDT'
  547.                             add_to_chat(158,'MDT Set: [Locked]')
  548.                     end
  549.                     status_change(player.status)
  550.             elseif command == 'C3' then -- Evasion Toggle --
  551.                     if Armor == 'EVA' then
  552.                             Armor = 'None'
  553.                             add_to_chat(123,'Evasion Set: [Unlocked]')
  554.                     else
  555.                             Armor = 'EVA'
  556.                             add_to_chat(158,'Evasion Set: [Locked]')
  557.                     end
  558.                     status_change(player.status)
  559.             elseif command == 'C16' then -- Rancor Toggle --
  560.                     if Rancor == 'ON' then
  561.                             Rancor = 'OFF'
  562.                             add_to_chat(123,'Rancor: [OFF]')
  563.                     else
  564.                             Rancor = 'ON'
  565.                             add_to_chat(158,'Rancor: [ON]')
  566.                     end
  567.                     status_change(player.status)
  568.             elseif command == 'C8' then -- Distance Toggle --
  569.                     if player.target.distance then
  570.                             target_distance = math.floor(player.target.distance*10)/10
  571.                             add_to_chat(158,'Distance: '..target_distance)
  572.                     else
  573.                             add_to_chat(123,'No Target Selected')
  574.                     end
  575.             elseif command == 'C6' then -- Idle Toggle --
  576.                     IdleIndex = (IdleIndex % #IdleArray) + 1
  577.                     status_change(player.status)
  578.                     add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  579.             elseif command == 'TP' then
  580.                     add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  581.             elseif command:match('^SC%d$') then
  582.                     send_command('//' .. sc_map[command])
  583.             end
  584.     end
  585.      
  586.     function refine_waltz(spell,action)
  587.             if spell.type ~= 'Waltz' then
  588.                     return
  589.             end
  590.      
  591.             if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  592.                     return
  593.             end
  594.      
  595.             local newWaltz = spell.english
  596.             local waltzID
  597.      
  598.             local missingHP
  599.      
  600.             if spell.target.type == "SELF" then
  601.                     missingHP = player.max_hp - player.hp
  602.             elseif spell.target.isallymember then
  603.                     local target = find_player_in_alliance(spell.target.name)
  604.                     local est_max_hp = target.hp / (target.hpp/100)
  605.                     missingHP = math.floor(est_max_hp - target.hp)
  606.             end
  607.      
  608.             if missingHP ~= nil then
  609.                     if player.sub_job == 'DNC' then
  610.                             if missingHP < 40 and spell.target.name == player.name then
  611.                                     add_to_chat(123,'Full HP!')
  612.                                     cancel_spell()
  613.                                     return
  614.                             elseif missingHP < 150 then
  615.                                     newWaltz = 'Curing Waltz'
  616.                                     waltzID = 190
  617.                             elseif missingHP < 300 then
  618.                                     newWaltz = 'Curing Waltz II'
  619.                                     waltzID = 191
  620.                             else
  621.                                     newWaltz = 'Curing Waltz III'
  622.                                     waltzID = 192
  623.                             end
  624.                     else
  625.                             return
  626.                     end
  627.             end
  628.      
  629.             local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50}
  630.             local tpCost = waltzTPCost[newWaltz]
  631.      
  632.             local downgrade
  633.      
  634.             if player.tp < tpCost and not buffactive.trance then
  635.      
  636.                     if player.tp < 20 then
  637.                             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  638.                             cancel_spell()
  639.                             return
  640.                     elseif player.tp < 35 then
  641.                             newWaltz = 'Curing Waltz'
  642.                     elseif player.tp < 50 then
  643.                             newWaltz = 'Curing Waltz II'
  644.                     end
  645.      
  646.                     downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  647.             end
  648.      
  649.             if newWaltz ~= spell.english then
  650.                     send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  651.                     if downgrade then
  652.                             add_to_chat(158, downgrade)
  653.                     end
  654.                     cancel_spell()
  655.                     return
  656.             end
  657.      
  658.             if missingHP > 0 then
  659.                     add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  660.             end
  661.     end
  662.      
  663.     function find_player_in_alliance(name)
  664.             for i,v in ipairs(alliance) do
  665.                     for k,p in ipairs(v) do
  666.                             if p.name == name then
  667.                                     return p
  668.                             end
  669.                     end
  670.             end
  671.     end
  672.      
  673.     function sub_job_change(newSubjob, oldSubjob)
  674.             select_default_macro_book()
  675.     end
  676.      
  677.     function set_macro_page(set,book)
  678.             if not tonumber(set) then
  679.                     add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  680.                     return
  681.             end
  682.             if set < 1 or set > 10 then
  683.                     add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  684.                     return
  685.             end
  686.      
  687.             if book then
  688.                     if not tonumber(book) then
  689.                             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  690.                             return
  691.                     end
  692.                     if book < 1 or book > 20 then
  693.                             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  694.                             return
  695.                     end
  696.                     send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  697.             else
  698.                     send_command('@input /macro set '..tostring(set))
  699.             end
  700.     end
  701.      
  702.     function select_default_macro_book()
  703.             -- Default macro set/book
  704.             if player.sub_job == 'WAR' then
  705.                     set_macro_page(4, 3)
  706.             elseif player.sub_job == 'DNC' then
  707.                     set_macro_page(4, 3)
  708.             elseif player.sub_job == 'NIN' then
  709.                     set_macro_page(4, 3)
  710.             else
  711.                     set_macro_page(4, 3)
  712.             end
  713.     end
Advertisement
Add Comment
Please, Sign In to add comment