Advertisement
Bokura

Bokura_BLU

Feb 8th, 2014
1,847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.51 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","Refresh"} -- Default Idle Set Is Movement --
  9.     Armor = 'None'
  10.     target_distance = 5 -- Set Default Distance Here --
  11.  
  12.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  13.     Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  14.     select_default_macro_book() -- Change Default Macro Book At The End --
  15.  
  16.     sc_map = {SC1="ChantduCygne", SC2="Berserk", SC3="HeadButt"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  17.  
  18.     -- Physical Type BlueMagic --
  19.     Physical_BlueMagic = S{
  20.             'Asuran Claws','Bludgeon','Body Slam','Feather Storm','Mandibular Bite',
  21.             'Queasyshroom','Power Attack','Ram Charge','Screwdriver','Sickle Slash',
  22.             'Smite of Rage','Spinal Cleave','Spiral Spin','Sweeping Gouge','Terror Touch'}
  23.  
  24.     -- Physical Type BlueMagic: STR Modifier --
  25.     Physical_BlueMagic_STR = S{
  26.             'Battle Dance','Bloodrake','Death Scissors','Dimensional Death','Empty Thrash',
  27.             'Heavy Strike','Quadrastrike','Uppercut','Tourbillion','Vertical Cleave',
  28.             'Whirl of Rage'}
  29.  
  30.     -- Physical Type BlueMagic: STR + DEX Modifiers --
  31.     Physical_BlueMagic_DEX = S{
  32.             'Amorphic Spikes','Barbed Crescent','Claw Cyclone','Disseverment','Foot Kick',
  33.             'Frenetic Rip','Goblin Rush','Hysteric Barrage','Paralyzing Triad','Seedspray',
  34.             'Sinker Drill','Thrashing Assault','Vanity Dive'}
  35.  
  36.     -- Physical Type BlueMagic: STR + VIT Modifiers --
  37.     Physical_BlueMagic_VIT = S{
  38.             'Cannonball','Delta Thrust','Glutinous Dart','Grand Slam','Quad. Continuum',
  39.             'Sprout Smack'}
  40.  
  41.     -- Physical Type BlueMagic: STR + AGI Modifiers --
  42.     Physical_BlueMagic_AGI = S{
  43.             'Benthic Typhoon','Helldive','Hydro Shot','Jet Stream','Pinecone Bomb',
  44.             'Wild Oats'}
  45.  
  46.     -- Magical Type BlueMagic --
  47.     Magical_BlueMagic = S{
  48.             'Acrid Stream','Atra. Libations','Dark Orb','Droning Whirlwind','Embalming Earth',
  49.             'Evryone. Grudge','Firespit','Foul Waters','Gates of Hades','Leafstorm',
  50.             'Magic Hammer','Molting Plumage','Nectarous Deluge','Rail Cannon','Regurgitation',
  51.             'Rending Deluge','Self-Destruct','Tem. Upheaval','Thermal Pulse','Water Bomb'}
  52.  
  53.     -- Low Accuracy Type BlueMagic --
  54.     BlueMagic_Accuracy = S{
  55.             '1000 Needles','Absolute Terror','Actinic Burst','Auroral Drape','Awful Eye',
  56.             'Blank Gaze','Blistering Roar','Blood Drain','Blood Saber','Chaotic Eye',
  57.             'Cimicine Discharge','Cold Wave','Digest','Corrosive Ooze','Demoralizing Roar',
  58.             'Dream Flower','Enervation','Feather Tickle','Filamented Hold','Frightful Roar',
  59.             'Geist Wall','Hecatomb Wave','Infrasonics','Jettatura','Light of Penance','Lowing',
  60.             'Mind Blast','Mortal Ray','MP Drainkiss','Osmosis','Reaving Wind','Sandspin',
  61.             'Sandspray','Sheep Song','Soporific','Sound Blast','Stinking Gas','Sub-zero Smash',
  62.             'Subduction','Triumphant Roar','Venom Shell','Voracious Trunk','Yawn'}
  63.  
  64.     -- Breath Type BlueMagic --
  65.     BlueMagic_Breath = S{
  66.             'Bad Breath','Diffusion Ray','Flying Hip Press','Final Sting','Frost Breath',
  67.             'Heat Breath','Magnetite Cloud','Poison Breath','Radiant Breath','Thunder Breath',
  68.             'Vapor Spray','Wind Breath'}
  69.  
  70.     -- Buff Type BlueMagic --
  71.     BlueMagic_Buff = S{
  72.             'Barrier Tusk','Carcharian Verve','Diamondhide','Metallic Body','Magic Barrier',
  73.             "Occultation",'Orcish Counterstance','Nature\'s Meditation','Plasma Charge',
  74.             'Pyric Bulwark','Reactor Cool'}
  75.  
  76.     -- Diffusion Compatible Type BlueMagic --
  77.     BlueMagic_Diffusion = S{
  78.             'Amplification','Cocoon','Erratic Flutter','Exuviation','Feather Barrier',
  79.             'Harden Shell','Memento Mori','Metallic Body','Plasma Charge','Reactor Cool',
  80.             'Refueling','Saline Coat','Warm-Up','Zephyr Mantle'}
  81.  
  82.     -- Healing Type BlueMagic --
  83.     BlueMagic_Healing = S{
  84.             'Healing Breeze','Magic Fruit','Plenilune Embrace','Pollen','Restoral','White Wind',
  85.             'Wild Carrot'}
  86.  
  87.     -- Stun Type BlueMagic --
  88.     BlueMagic_Stun = S{
  89.             'Blitzstrahl','Frypan','Head Butt','Sudden Lunge','Tail slap','Temporal Shift',
  90.             'Thunderbolt','Whirl of Rage'}
  91.  
  92.     -- Unbridled Learning Type BlueMagic --
  93.     BlueMagic_Unbridled = S{
  94.             'Absolute Terror','Bilgestorm','Blistering Roar','Bloodrake','Carcharian Verve',
  95.             'Crashing Thunder','Droning Whirlwind','Gates of Hades','Harden Shell','Polar Roar',
  96.             'Pyric Bulwark','Thunderbolt','Tourbillion','Uproot'}
  97.  
  98.     sets.Idle = {}
  99.     -- Idle/Town Sets --
  100.     sets.Idle.Regen = {}
  101.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  102.             legs="Blood Cuisses"})
  103.     sets.Idle.Refresh = set_combine(sets.Idle.Regen,{
  104.             head="Spurrina Coif",
  105.             body="Assim. Jubbah +1",
  106.             hands="Serpentes Cuffs",
  107.             feet="Serpentes Sabots"})
  108.     sets.Resting = set_combine(sets.Idle.Regen)
  109.  
  110.     -- Normal TP Sets --
  111.     sets.TP = {}
  112.     sets.TP.MidACC = set_combine(sets.TP,{})
  113.     sets.TP.HighACC = set_combine(sets.TP.MidACC,{})
  114.  
  115.     -- March x2 + Haste --
  116.     -- Embrava + (March or Haste) --
  117.     -- Geo Haste + (March or Haste or Embrava) --
  118.     sets.TP.HighHaste =  set_combine(sets.TP,{})
  119.     sets.TP.MidACC.HighHaste = set_combine(sets.TP.HighHaste,{})
  120.     sets.TP.HighACC.HighHaste = set_combine(sets.TP.MidACC.HighHaste,{})
  121.  
  122.     -- PDT/MDT Sets --
  123.     sets.PDT = {}
  124.  
  125.     sets.MDT = set_combine(sets.PDT,{})
  126.  
  127.     -- Hybrid Sets --
  128.     sets.TP.Hybrid = set_combine(sets.PDT,{})
  129.     sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid.LowACC,{})
  130.     sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  131.  
  132.     -- WS Base Set --
  133.     sets.WS = {}
  134.  
  135.     -- WS Sets --
  136.     sets.WS["Chant du Cygne"] = {}
  137.     sets.WS["Chant du Cygne"].MidACC = set_combine(sets.WS["Chant du Cygne"],{})
  138.     sets.WS["Chant du Cygne"].HighACC = set_combine(sets.WS["Chant du Cygne"].MidACC,{})
  139.  
  140.     sets.WS.Requiescat = {}
  141.     sets.WS.Requiescat.MidACC = set_combine(sets.WS.Requiescat,{})
  142.     sets.WS.Requiescat.HighACC = set_combine(sets.WS.Requiescat.MidACC,{})
  143.  
  144.     sets.WS.Expiacion = {}
  145.     sets.WS.Expiacion.MidACC = set_combine(sets.WS.Expiacion,{})
  146.     sets.WS.Expiacion.HighACC = set_combine(sets.WS.Expiacion.MidACC,{})
  147.  
  148.     sets.JA = {}
  149.     -- JA Sets --
  150.     sets.JA['Azure Lore'] = {hands="Luh. Bazubands +1"}
  151.  
  152.     sets['Chain Affinity'] = {body="Hashishin Kavuk +1"}
  153.  
  154.     sets.Efflux = {legs="Hashishin Tayt +1"}
  155.  
  156.     sets['Burst Affinity'] = {feet="Hashi. Basmak +1"}
  157.  
  158.     sets.Convergence = {head="Luh. Keffiyeh +1"}
  159.  
  160.     sets.Diffusion = {feet="Luhlaza Charuqs +1"}
  161.  
  162.     -- Waltz Set --
  163.     sets.Waltz = {}
  164.  
  165.     sets.Precast = {}
  166.     -- Fastcast Set --
  167.     sets.Precast.FastCast = {}
  168.  
  169.     -- Precast Enhancing Magic --
  170.     sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{waist="Siegel Sash"})
  171.  
  172.     -- Midcast Base Set --
  173.     sets.Midcast = {}
  174.  
  175.     -- Magic Haste Set --
  176.     sets.Midcast.Haste = set_combine(sets.Precast.FastCast,{})
  177.  
  178.     -- Enhancing Magic Base Set --
  179.     sets.Midcast['Enhancing Magic'] = {}
  180.  
  181.     -- Stoneskin Set --
  182.     sets.Midcast.Stoneskin = set_combine(sets.Midcast['Enhancing Magic'],{})
  183.  
  184.     -- Cure/Curaga Spells & Healing Type BlueMagic --
  185.     sets.Midcast.Cure = {}
  186.  
  187.     -- Physical Type BlueMagic --
  188.     sets.Midcast.Physical_BlueMagic = {}
  189.  
  190.     -- Physical Type BlueMagic: STR Modifier --
  191.     sets.Midcast.Physical_BlueMagic_STR = set_combine(sets.Midcast.Physical_BlueMagic,{})
  192.  
  193.     -- Physical Type BlueMagic: STR/DEX Modifiers --
  194.     sets.Midcast.Physical_BlueMagic_DEX = set_combine(sets.Midcast.Physical_BlueMagic,{})
  195.  
  196.     -- Physical Type BlueMagic: STR/VIT Modifiers --
  197.     sets.Midcast.Physical_BlueMagic_VIT = set_combine(sets.Midcast.Physical_BlueMagic,{})
  198.  
  199.     -- Physical Type BlueMagic: STR/AGI Modifiers --
  200.     sets.Midcast.Physical_BlueMagic_AGI = set_combine(sets.Midcast.Physical_BlueMagic,{})
  201.  
  202.     -- Magical Type BlueMagic --
  203.     sets.Midcast.Magical_BlueMagic = {}
  204.  
  205.     -- Low Accuracy Type BlueMagic --
  206.     sets.Midcast.BlueMagic_Accuracy = {}
  207.  
  208.     -- Stun Type BlueMagic --
  209.     sets.Midcast.BlueMagic_Stun = set_combine(sets.Midcast.BlueMagic_Accuracy,{})
  210.  
  211.     -- Buff Type BlueMagic --
  212.     sets.Midcast.BlueMagic_Buff = {}
  213.  
  214.     -- Breath Type BlueMagic --
  215.     sets.Midcast.BlueMagic_Breath = {}
  216.  
  217.     -- BlueMagic Base Set For Any Non Listed BlueMagic --
  218.     sets.Midcast['Blue Magic'] = {}
  219.  
  220.     -- Charged Whisker --
  221.     sets.Midcast['Charged Whisker'] = set_combine(sets.Midcast.Magical_BlueMagic,{})
  222. end
  223.  
  224. function pretarget(spell,action)
  225.     if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  226.         cancel_spell()
  227.         send_command('input /item "Echo Drops" <me>')
  228.     elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On --
  229.         cancel_spell()
  230.         send_command('Aggressor')
  231.     elseif BlueMagic_Unbridled:contains(spell.english) and not buffactive['Unbridled Learning'] then
  232.         if windower.ffxi.get_ability_recasts()[81] < 1 and not buffactive.amnesia and not buffactive.charm then -- Auto Use Unbridled Learning When You Cast One of The Unbridled Spells.
  233.             cancel_spell()
  234.             send_command('input /ja "Unbridled Learning" <me>;wait 1.5;input /ma "'..spell.english..'" '..spell.target.name)
  235.         end
  236.     elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  237.         degrade_spell(spell,Cure_Spells)
  238.     elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  239.         degrade_spell(spell,Curaga_Spells)
  240.     elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
  241.         cancel_spell()
  242.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  243.         return
  244.     end
  245. end
  246.  
  247. function precast(spell,action)
  248.     if spell.type == "WeaponSkill" then
  249.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  250.             cancel_spell()
  251.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  252.             return
  253.         else
  254.             equipSet = sets.WS
  255.             if equipSet[spell.english] then
  256.                 equipSet = equipSet[spell.english]
  257.             end
  258.             if equipSet[AccArray[AccIndex]] then
  259.                 equipSet = equipSet[AccArray[AccIndex]]
  260.             end
  261.             if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  262.                 equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  263.             end
  264.             if spell.english == "Chant du Cygne" and player.tp > 2990 then
  265.                 equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"})
  266.             end
  267.             equip(equipSet)
  268.         end
  269.     elseif spell.type == "JobAbility" then
  270.         if sets.JA[spell.english] then
  271.             equip(sets.JA[spell.english])
  272.         end
  273.     elseif spell.action_type == 'Magic' then
  274.         if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
  275.             cancel_spell()
  276.             add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  277.             return
  278.         else
  279.             if spell.english:startswith('Utsusemi') then
  280.                 if spell.english == 'Utsusemi: Ni' then
  281.                     if buffactive['Copy Image (3)'] then
  282.                         cancel_spell()
  283.                         add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  284.                         return
  285.                     else
  286.                         equip(sets.Precast.Utsusemi)
  287.                     end
  288.                 else
  289.                     equip(sets.Precast.Utsusemi)
  290.                 end
  291.             elseif sets.Precast[spell.skill] then
  292.                 equip(sets.Precast[spell.skill])
  293.             else
  294.                 equip(sets.Precast.FastCast)
  295.             end
  296.         end
  297.     elseif spell.type == "Waltz" then
  298.         refine_waltz(spell,action)
  299.         equip(sets.Waltz)
  300.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  301.         cast_delay(0.2)
  302.         send_command('cancel Sneak')
  303.     end
  304. end
  305.  
  306. function midcast(spell,action)
  307.     equipSet = {}
  308.     if spell.action_type == 'Magic' then
  309.         equipSet = sets.Midcast
  310.         if equipSet[spell.english] then
  311.             equipSet = equipSet[spell.english]
  312.         elseif (spell.english:startswith('Cur') or BlueMagic_Healing:contains(spell.english)) and spell.english ~= "Cursna" then
  313.             if spell.english:startswith('Cure') or BlueMagic_Healing:contains(spell.english) then
  314.                 equipSet = equipSet.Cure
  315.             elseif spell.english:startswith('Cura') then
  316.                 equipSet = equipSet.Curaga
  317.             end
  318.             if world.day_element == spell.element or world.weather_element == spell.element then
  319.                 equipSet = set_combine(equipSet,{back="Twilight Cape",waist='Hachirin-no-Obi'})
  320.             end
  321.         elseif Physical_BlueMagic:contains(spell.english) or Physical_BlueMagic_STR:contains(spell.english) or Physical_BlueMagic_DEX:contains(spell.english) or Physical_BlueMagic_VIT:contains(spell.english) or Physical_BlueMagic_AGI:contains(spell.english) then
  322.             if Physical_BlueMagic_STR:contains(spell.english) then
  323.                 equipSet = equipSet.PhysicalBlueMagic_STR
  324.             elseif Physical_BlueMagic_DEX:contains(spell.english) then
  325.                 equipSet = equipSet.PhysicalBlueMagic_DEX
  326.             elseif Physical_BlueMagic_VIT:contains(spell.english) then
  327.                 equipSet = equipSet.PhysicalBlueMagic_VIT
  328.             elseif Physical_BlueMagic_AGI:contains(spell.english) then
  329.                 equipSet = equipSet.PhysicalBlueMagic_AGI
  330.             elseif Physical_BlueMagic:contains(spell.english) then
  331.                 equipSet = equipSet.Physical_BlueMagic
  332.             end
  333.             if buffactive['Chain Affinity'] then
  334.                 equipSet = set_combine(equipSet,sets['Chain Affinity'])
  335.             end
  336.             if buffactive.Efflux then
  337.                 equipSet = set_combine(equipSet,sets.Efflux)
  338.             end
  339.         elseif Magical_BlueMagic:contains(spell.english) or spell.english == "Charged Whisker" then
  340.             if Magical_BlueMagic:contains(spell.english) then
  341.                 equipSet = equipSet.Magical_BlueMagic
  342.             elseif spell.english == "Charged Whisker" then
  343.                 equipSet = equipSet[spell.name]
  344.             end
  345.             if buffactive['Burst Affinity'] then
  346.                 equipSet = set_combine(equipSet,sets['Burst Affinity'])
  347.             end
  348.             if buffactive.Convergence then
  349.                 equipSet = set_combine(equipSet,sets.Convergence)
  350.             end
  351.         elseif BlueMagic_Accuracy:contains(spell.english) then
  352.             equipSet = equipSet.BlueMagic_Accuracy
  353.         elseif BlueMagic_Stun:contains(spell.english) then
  354.             equipSet = equipSet.BlueMagic_Stun
  355.         elseif BlueMagic_Buff:contains(spell.english) then
  356.             equipSet = equipSet.BlueMagic_Buff
  357.         elseif BlueMagic_Diffusion:contains(spell.english) and buffactive.Diffusion then
  358.             equipSet = set_combine(equipSet,sets.Diffusion)
  359.         elseif BlueMagic_Breath:contains(spell.english) then
  360.             equipSet = equipSet.BlueMagic_Breath
  361.         elseif spell.english == "Stoneskin" then
  362.             if buffactive.Stoneskin then
  363.                 send_command('@wait 2.8;cancel stoneskin')
  364.             end
  365.             equipSet = equipSet.Stoneskin
  366.         elseif spell.english == "Sneak" then
  367.             if spell.target.name == player.name and buffactive['Sneak'] then
  368.                 send_command('cancel sneak')
  369.             end
  370.             equipSet = equipSet.Haste
  371.         elseif spell.english:startswith('Utsusemi') then
  372.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
  373.                 send_command('@wait 1.7;cancel Copy Image*')
  374.             end
  375.             equipSet = equipSet.Haste
  376.         elseif spell.english == 'Monomi: Ichi' then
  377.             if buffactive['Sneak'] then
  378.                 send_command('@wait 1.7;cancel sneak')
  379.             end
  380.             equipSet = equipSet.Haste
  381.         elseif equipSet[spell.skill] then
  382.             equipSet = equipSet[spell.skill]
  383.         end
  384.     elseif equipSet[spell.english] then
  385.         equipSet = equipSet[spell.english]
  386.     end
  387.     equip(equipSet)
  388. end
  389.  
  390. function aftercast(spell,action)
  391.     if spell.type == "WeaponSkill" and not spell.interrupted then
  392.         send_command('wait 0.2;gs c TP')
  393.     end
  394.     status_change(player.status)
  395. end
  396.  
  397. function status_change(new,old)
  398.     check_equip_lock()
  399.     if Armor == 'PDT' then
  400.         equip(sets.PDT)
  401.     elseif Armor == 'MDT' then
  402.         equip(sets.MDT)
  403.     elseif new == 'Engaged' then
  404.         equipSet = sets.TP
  405.         if Armor == 'Hybrid' and equipSet["Hybrid"] then
  406.             equipSet = equipSet["Hybrid"]
  407.         end
  408.         if equipSet[AccArray[AccIndex]] then
  409.             equipSet = equipSet[AccArray[AccIndex]]
  410.         end
  411.         if (buffactive.Embrava and (buffactive.March or buffactive.Haste)) or (buffactive.March == 2 and buffactive.Haste) or (buffactive[580] and (buffactive.March or buffactive.Haste or buffactive.Embrava)) and equipSet["HighHaste"] then
  412.             equipSet = equipSet["HighHaste"]
  413.         end
  414.         equip(equipSet)
  415.     elseif new == 'Idle' then
  416.         equipSet = sets.Idle
  417.         if equipSet[IdleArray[IdleIndex]] then
  418.             equipSet = equipSet[IdleArray[IdleIndex]]
  419.         end
  420.         if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  421.             equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  422.         end
  423.         if world.area:endswith('Adoulin') then
  424.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  425.         end
  426.         equip(equipSet)
  427.     elseif new == 'Resting' then
  428.         equip(sets.Resting)
  429.     end
  430. end
  431.  
  432. function buff_change(buff,gain)
  433.     buff = string.lower(buff)
  434.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  435.         if gain then
  436.             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.]')
  437.         else
  438.             send_command('timers delete "Aftermath: Lv.3"')
  439.             add_to_chat(123,'AM3: [OFF]')
  440.         end
  441.     elseif buff == 'weakness' then -- Weakness Timer --
  442.         if gain then
  443.             send_command('timers create "Weakness" 300 up')
  444.         else
  445.             send_command('timers delete "Weakness"')
  446.         end
  447.     end
  448.     if not midaction() then
  449.         status_change(player.status)
  450.     end
  451. end
  452.  
  453. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  454. function self_command(command)
  455.     if command == 'C1' then -- Accuracy Level Toggle --
  456.         AccIndex = (AccIndex % #AccArray) + 1
  457.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  458.         status_change(player.status)
  459.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  460.         status_change(player.status)
  461.         add_to_chat(158,'Auto Update Gear')
  462.     elseif command == 'C2' then -- Hybrid Toggle --
  463.         if Armor == 'Hybrid' then
  464.             Armor = 'None'
  465.             add_to_chat(123,'Hybrid Set: [Unlocked]')
  466.         else
  467.             Armor = 'Hybrid'
  468.             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  469.         end
  470.         status_change(player.status)
  471.     elseif command == 'C7' then -- PDT Toggle --
  472.         if Armor == 'PDT' then
  473.             Armor = 'None'
  474.             add_to_chat(123,'PDT Set: [Unlocked]')
  475.         else
  476.             Armor = 'PDT'
  477.             add_to_chat(158,'PDT Set: [Locked]')
  478.         end
  479.         status_change(player.status)
  480.     elseif command == 'C15' then -- MDT Toggle --
  481.         if Armor == 'MDT' then
  482.             Armor = 'None'
  483.             add_to_chat(123,'MDT Set: [Unlocked]')
  484.         else
  485.             Armor = 'MDT'
  486.             add_to_chat(158,'MDT Set: [Locked]')
  487.         end
  488.         status_change(player.status)
  489.     elseif command == 'C8' then -- Distance Toggle --
  490.         if player.target.distance then
  491.             target_distance = math.floor(player.target.distance*10)/10
  492.             add_to_chat(158,'Distance: '..target_distance)
  493.         else
  494.             add_to_chat(123,'No Target Selected')
  495.         end
  496.     elseif command == 'C6' then -- Idle Toggle --
  497.         IdleIndex = (IdleIndex % #IdleArray) + 1
  498.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  499.         status_change(player.status)
  500.     elseif command == 'TP' then
  501.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  502.     elseif command:match('^SC%d$') then
  503.         send_command('//' .. sc_map[command])
  504.     end
  505. end
  506.  
  507. function check_equip_lock() -- Lock Equipment Here --
  508.     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
  509.         disable('ring1','ring2')
  510.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  511.         disable('back')
  512.     else
  513.         enable('ring1','ring2','back')
  514.     end
  515. end
  516.  
  517. function actualCost(originalCost)
  518.     if buffactive["Penury"] then
  519.         return originalCost*.5
  520.     elseif buffactive["Light Arts"] then
  521.         return originalCost*.9
  522.     else
  523.         return originalCost
  524.     end
  525. end
  526.  
  527. function degrade_spell(spell,degrade_array)
  528.     spell_index = table.find(degrade_array,spell.name)
  529.     if spell_index > 1 then
  530.         new_spell = degrade_array[spell_index - 1]
  531.         change_spell(new_spell,spell.target.raw)
  532.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  533.     end
  534. end
  535.  
  536. function change_spell(spell_name,target)
  537.     cancel_spell()
  538.     send_command('//'..spell_name..' '..target)
  539. end
  540.  
  541. function refine_waltz(spell,action)
  542.     if spell.type ~= 'Waltz' then
  543.         return
  544.     end
  545.  
  546.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  547.         return
  548.     end
  549.  
  550.     local newWaltz = spell.english
  551.     local waltzID
  552.  
  553.     local missingHP
  554.  
  555.     if spell.target.type == "SELF" then
  556.         missingHP = player.max_hp - player.hp
  557.     elseif spell.target.isallymember then
  558.         local target = find_player_in_alliance(spell.target.name)
  559.         local est_max_hp = target.hp / (target.hpp/100)
  560.         missingHP = math.floor(est_max_hp - target.hp)
  561.     end
  562.  
  563.     if missingHP ~= nil then
  564.         if player.sub_job == 'DNC' then
  565.             if missingHP < 40 and spell.target.name == player.name then
  566.                 add_to_chat(123,'Full HP!')
  567.                 cancel_spell()
  568.                 return
  569.             elseif missingHP < 150 then
  570.                 newWaltz = 'Curing Waltz'
  571.                 waltzID = 190
  572.             elseif missingHP < 300 then
  573.                 newWaltz = 'Curing Waltz II'
  574.                 waltzID = 191
  575.             else
  576.                 newWaltz = 'Curing Waltz III'
  577.                 waltzID = 192
  578.             end
  579.         else
  580.             return
  581.         end
  582.     end
  583.  
  584.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50}
  585.     local tpCost = waltzTPCost[newWaltz]
  586.  
  587.     local downgrade
  588.  
  589.     if player.tp < tpCost and not buffactive.trance then
  590.  
  591.         if player.tp < 20 then
  592.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  593.             cancel_spell()
  594.             return
  595.         elseif player.tp < 35 then
  596.             newWaltz = 'Curing Waltz'
  597.         elseif player.tp < 50 then
  598.             newWaltz = 'Curing Waltz II'
  599.         end
  600.  
  601.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  602.     end
  603.  
  604.     if newWaltz ~= spell.english then
  605.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  606.         if downgrade then
  607.             add_to_chat(158, downgrade)
  608.         end
  609.         cancel_spell()
  610.         return
  611.     end
  612.  
  613.     if missingHP > 0 then
  614.         add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  615.     end
  616. end
  617.  
  618. function find_player_in_alliance(name)
  619.     for i,v in ipairs(alliance) do
  620.         for k,p in ipairs(v) do
  621.             if p.name == name then
  622.                 return p
  623.             end
  624.         end
  625.     end
  626. end
  627.  
  628. function sub_job_change(newSubjob, oldSubjob)
  629.     select_default_macro_book()
  630. end
  631.  
  632. function set_macro_page(set,book)
  633.     if not tonumber(set) then
  634.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  635.         return
  636.     end
  637.     if set < 1 or set > 10 then
  638.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  639.         return
  640.     end
  641.  
  642.     if book then
  643.         if not tonumber(book) then
  644.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  645.             return
  646.         end
  647.         if book < 1 or book > 20 then
  648.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  649.             return
  650.         end
  651.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  652.     else
  653.         send_command('@input /macro set '..tostring(set))
  654.     end
  655. end
  656.  
  657. function select_default_macro_book()
  658.     -- Default macro set/book
  659.     if player.sub_job == 'WAR' then
  660.         set_macro_page(1, 2)
  661.     elseif player.sub_job == 'RDM' then
  662.         set_macro_page(2, 2)
  663.     elseif player.sub_job == 'WHM' then
  664.         set_macro_page(3, 2)
  665.     elseif player.sub_job == 'NIN' then
  666.         set_macro_page(5, 2)
  667.     elseif player.sub_job == 'DNC' then
  668.         set_macro_page(9, 2)
  669.     elseif player.sub_job == 'BLM' then
  670.         set_macro_page(10, 2)
  671.     else
  672.         set_macro_page(1, 2)
  673.     end
  674. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement