Advertisement
Bokura

Bokura_PLD

Jan 28th, 2014
7,345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.77 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. First Set Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  7.     ShieldIndex = 1
  8.     ShieldArray = {"Ochain","Aegis","Priwen"} -- Default Shield Type Is Ochain. Set Default Shield Type Here. --
  9.     IdleIndex = 1
  10.     IdleArray = {"Movement","Regen","Refresh"} -- Default Idle Set Is Movement --
  11.     TypeIndex = 1
  12.     Armor = 'None'
  13.     canceled = false
  14.     Twilight = 'None'
  15.     Repulse = 'OFF' -- Set Default Repulse ON or OFF Here --
  16.     Cover = 'ON' -- Set Default Cover ON or OFF Here --
  17.     target_distance = 5 -- Set Default Distance Here --
  18.     select_default_macro_book() -- Change Default Macro Book At The End --
  19.  
  20.     -- Gavialis Helm --
  21.     elements = {}
  22.     elements.equip = {head="Gavialis Helm"}
  23.     elements["Chant du Cygne"] = S{"Light","Ice","Water","Wind","Fire","Lightning"}
  24.     elements.Requiescat = S{"Dark","Earth"}
  25.     elements.Resolution = S{"Lightning","Wind","Earth"}
  26.  
  27.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  28.     sc_map = {SC1="Flash", SC2="UtsusemiNi", SC3="UtsusemiIchi"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  29.     Enmity_BlueMagic = S{"Jettatura","Sheep Song","Soporific","Blank Gaze","Geist Wall"} -- Add or Remove Enmity BlueMagic Here --
  30.  
  31.     sets.Idle = {}
  32.     -- Idle/Town Sets --
  33.     sets.Idle.Regen = {}
  34.     sets.Idle.Regen.Ochain = set_combine(sets.Idle.Regen,{
  35.             main="Burtgang",
  36.             sub="Ochain"})
  37.     sets.Idle.Regen.Aegis = set_combine(sets.Idle.Regen,{
  38.             main="Burtgang",
  39.             sub="Aegis"})
  40.     sets.Idle.Regen.Priwen = set_combine(sets.Idle.Regen,{
  41.             main="Burtgang",
  42.             sub="Priwen"})
  43.  
  44.     -- Movement/Refresh Sets --
  45.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  46.             legs="Blood Cuisses"})
  47.     sets.Idle.Movement.Ochain = set_combine(sets.Idle.Movement,{
  48.             main="Burtgang",
  49.             sub="Ochain"})
  50.     sets.Idle.Movement.Aegis = set_combine(sets.Idle.Movement,{
  51.             main="Burtgang",
  52.             sub="Aegis"})
  53.     sets.Idle.Movement.Priwen = set_combine(sets.Idle.Movement,{
  54.             main="Burtgang",
  55.             sub="Priwen"})
  56.  
  57.     sets.Idle.Refresh = set_combine(sets.Idle.Regen,{
  58.             head="Wivre Hairpin",
  59.             body="Twilight Mail",
  60.             hands="Ogier's Gauntlets",
  61.             feet="Ogier's Leggings"})
  62.     sets.Idle.Refresh.Ochain = set_combine(sets.Idle.Refresh,{
  63.             main="Burtgang",
  64.             sub="Ochain"})
  65.     sets.Idle.Refresh.Aegis = set_combine(sets.Idle.Refresh,{
  66.             main="Burtgang",
  67.             sub="Aegis"})
  68.     sets.Idle.Refresh.Priwen = set_combine(sets.Idle.Refresh,{
  69.             main="Burtgang",
  70.             sub="Priwen"})
  71.  
  72.     -- Resting Set --
  73.     sets.Resting = set_combine(sets.Idle.Regen,{})
  74.  
  75.     -- Twilight Set --
  76.     sets.Twilight = {head="Twilight Helm",body="Twilight Mail"}
  77.  
  78.     -- TP Base Set --
  79.     sets.TP = {}
  80.  
  81.     -- Ochain TP Sets --
  82.     sets.TP.Ochain = {
  83.             main="Burtgang",
  84.             sub="Ochain"}
  85.     sets.TP.Ochain.MidACC = set_combine(sets.TP.Ochain,{})
  86.     sets.TP.Ochain.HighACC = set_combine(sets.TP.Ochain.MidACC,{})
  87.  
  88.     -- Aegis TP Sets --
  89.     sets.TP.Aegis = {
  90.             main="Burtgang",
  91.             sub="Aegis"}
  92.     sets.TP.Aegis.MidACC = set_combine(sets.TP.Aegis,{})
  93.     sets.TP.Aegis.HighACC = set_combine(sets.TP.Aegis.MidACC,{})
  94.  
  95.     -- Priwen TP Sets --
  96.     sets.TP.Priwen = {
  97.             main="Burtgang",
  98.             sub="Priwen"}
  99.     sets.TP.Priwen.MidACC = set_combine(sets.TP.Priwen,{})
  100.     sets.TP.Priwen.HighACC = set_combine(sets.TP.Priwen.MidACC,{})
  101.  
  102.     -- Ragnarok TP Sets --
  103.     sets.TP.Ragnarok = {}
  104.     sets.TP.Ragnarok.MidACC = set_combine(sets.TP.Ragnarok,{})
  105.     sets.TP.Ragnarok.HighACC = set_combine(sets.TP.Ragnarok.MidACC,{})
  106.  
  107.     -- Ragnarok(Ionis) TP Sets --
  108.     sets.TP.Ragnarok.Ionis = set_combine(sets.TP.Ragnarok,{})
  109.     sets.TP.Ragnarok.MidACC.Ionis = set_combine(sets.TP.Ragnarok.Ionis,{})
  110.     sets.TP.Ragnarok.HighACC.Ionis = set_combine(sets.TP.Ragnarok.MidACC.Ionis,{})
  111.  
  112.     -- PDT/MDT/DT Sets --
  113.     sets.PDT = {}
  114.     sets.PDT.Ochain = {
  115.             sub="Ochain"}
  116.     sets.PDT.Aegis = {
  117.             sub="Aegis"}
  118.     sets.PDT.Priwen = {
  119.             sub="Priwen"}
  120.  
  121.     sets.MDT = {}
  122.     sets.MDT.Ochain = set_combine(sets.PDT.Ochain,{})
  123.     sets.MDT.Aegis = set_combine(sets.PDT.Aegis,{})
  124.     sets.MDT.Priwen = set_combine(sets.PDT.Priwen,{})
  125.  
  126.     sets.DT = {}
  127.     sets.DT.Ochain = set_combine(sets.PDT.Ochain,{})
  128.     sets.DT.Aegis = set_combine(sets.PDT.Aegis,{})
  129.     sets.DT.Priwen = set_combine(sets.PDT.Priwen,{})
  130.  
  131.     -- Weakness/Kiting/Repulse Sets --
  132.     sets.Weakness = {}
  133.     sets.Weakness.Ochain = set_combine(sets.PDT.Ochain,{})
  134.     sets.Weakness.Aegis = set_combine(sets.PDT.Aegis,{})
  135.     sets.Weakness.Priwen = set_combine(sets.PDT.Priwen,{})
  136.  
  137.     sets.Kiting = {}
  138.     sets.Kiting.Ochain = set_combine(sets.PDT.Ochain,{legs="Blood Cuisses"})
  139.     sets.Kiting.Aegis = set_combine(sets.PDT.Aegis,{legs="Blood Cuisses"})
  140.     sets.Kiting.Priwen = set_combine(sets.PDT.Priwen,{legs="Blood Cuisses"})
  141.  
  142.     sets.Repulse = {}
  143.     sets.Repulse.Ochain = {sub="Ochain",back="Repulse Mantle"}
  144.     sets.Repulse.Aegis = {sub="Aegis",back="Repulse Mantle"}
  145.     sets.Repulse.Priwen = {sub="Priwen",back="Repulse Mantle"}
  146.  
  147.     -- Hybrid/Shield Skill Sets --
  148.     sets.TP.Hybrid = {}
  149.     sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  150.     sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  151.  
  152.     sets.TP.ShieldSkill = {}
  153.  
  154.     -- WS Base Set --
  155.     sets.WS = {}
  156.  
  157.     -- Chant du Cygne Sets --
  158.     sets.WS["Chant du Cygne"] = {}
  159.     sets.WS["Chant du Cygne"].MidACC = set_combine(sets.WS["Chant du Cygne"],{})
  160.     sets.WS["Chant du Cygne"].HighACC = set_combine(sets.WS["Chant du Cygne"].MidACC,{})
  161.  
  162.     -- Requiescat Sets --
  163.     sets.WS.Requiescat = {}
  164.     sets.WS.Requiescat.MidACC = set_combine(sets.WS.Requiescat,{})
  165.     sets.WS.Requiescat.HighACC = set_combine(sets.WS.Requiescat.MidACC,{})
  166.  
  167.     -- Resolution Sets --
  168.     sets.WS.Resolution = {}
  169.     sets.WS.Resolution.MidACC = set_combine(sets.WS.Resolution,{})
  170.     sets.WS.Resolution.HighACC = set_combine(sets.WS.Resolution.MidACC,{})
  171.  
  172.     -- Atonement Set --
  173.     sets.WS.Atonement = {}
  174.  
  175.     -- Knights of Round Set --
  176.     sets.WS["Knights of Round"] = {}
  177.  
  178.     -- Sanguine Blade Set --
  179.     sets.WS["Sanguine Blade"] = {}
  180.  
  181.     -- Aeolian Edge Set --
  182.     sets.WS["Aeolian Edge"] = {}
  183.  
  184.     -- Enmity Set --
  185.     sets.Enmity = {}
  186.  
  187.     -- JA Sets --
  188.     sets.JA = {}
  189.     sets.JA["Shield Bash"] = set_combine(sets.Enmity,{ear1="Knightly earring",ring2="Fenian Ring"})
  190.     sets.JA.Sentinel = set_combine(sets.Enmity,{feet="Cab. Leggings +1"})
  191.     sets.JA["Holy Circle"] = set_combine(sets.Enmity,{feet="Rev. Leggings +1"})
  192.     sets.JA["Divine Emblem"] = set_combine(sets.Enmity,{feet="Chev. Sabatons +1"})
  193.     sets.JA.Fealty = set_combine(sets.Enmity,{body="Cab. Surcoat +1"})
  194.     sets.JA.Invincible = set_combine(sets.Enmity,{legs="Cab. Breeches +1"})
  195.     sets.JA.Palisade = set_combine(sets.Enmity)
  196.     sets.JA.Provoke = set_combine(sets.Enmity)
  197.     sets.JA.Warcry = set_combine(sets.Enmity)
  198.     sets.JA.Souleater = set_combine(sets.Enmity)
  199.     sets.JA["Last Resort"] = set_combine(sets.Enmity)
  200.     sets.JA.Vallation = set_combine(sets.Enmity)
  201.     sets.JA.Swordplay = set_combine(sets.Enmity)
  202.     sets.JA.Pflug = set_combine(sets.Enmity)
  203.  
  204.     -- Chivalry Set --
  205.     sets.JA.Chivalry = {
  206.             hands="Cab. Gauntlets +1"}
  207.  
  208.     -- Rampart Set --
  209.     sets.JA.Rampart = {
  210.             head="Cab. Coronet +1"}
  211.  
  212.     -- Precast Cover Set: Add Gear To Increase Duration --
  213.     sets.JA.Cover = {
  214.             head="Rev. Coronet +1"}
  215.  
  216.     -- Gear Worn During Cover: Set ON or OFF At The Top --
  217.     sets.Cover = {
  218.             head="Rev. Coronet +1",
  219.             body="Cab. Surcoat +1"}
  220.  
  221.     -- Sublimation --
  222.     sets.Sublimation = {}
  223.  
  224.     -- Flourish --
  225.     sets.Flourish = {}
  226.  
  227.     -- Step --
  228.     sets.Step = {}
  229.  
  230.     -- Waltz --
  231.     sets.Waltz = {}
  232.  
  233.     sets.Precast = {}
  234.     --Fastcast Set --
  235.     sets.Precast.FastCast = {}
  236.  
  237.     -- Precast Enhancing Magic --
  238.     sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{waist="Siegel Sash"})
  239.  
  240.     -- Precast Cure Set --
  241.     sets.Precast.Cure = set_combine(sets.Precast.FastCast,{})
  242.  
  243.     -- Precast Self Cure Set: Use -HP Gear For Cure Cheat --
  244.     sets.Precast.SelfCure = set_combine(sets.Precast.FastCast,{})
  245.  
  246.     -- Midcast Base Set --
  247.     sets.Midcast = {}
  248.  
  249.     -- Spells Recast --
  250.     sets.Midcast.Recast = {}
  251.  
  252.     -- Divine Magic --
  253.     sets.Midcast['Divine Magic'] = set_combine(sets.Midcast.Recast,{
  254.             ear2="Divine Earring",
  255.             neck="Divine Torque",
  256.             body="Rev. Surcoat +1",
  257.             back="Altruistic Cape",
  258.             waist="Bishop's Sash"})
  259.  
  260.     -- Enlight Set --
  261.     sets.Midcast.Enlight = set_combine(sets.Midcast['Divine Magic'],{})
  262.  
  263.     -- Banish Set --
  264.     sets.Midcast.Banish = set_combine(sets.Midcast['Divine Magic'],{
  265.             ring1="Fenian Ring"})
  266.  
  267.     -- Holy Set --
  268.     sets.Midcast.Holy = set_combine(sets.Midcast['Divine Magic'],{})
  269.  
  270.     -- Cure Set --
  271.     sets.Midcast.Cure = {
  272.             neck="Phalaina Locket",
  273.             ear1="Nourish. Earring +1",
  274.             ear2="Nourish. Earring",
  275.             hands="Macabre Gaunt. +1",
  276.             back="Fierabras's Mantle"}
  277.  
  278.     -- Self Cure Set: Use +HP Gear For Cure Cheat --
  279.     sets.Midcast.SelfCure = set_combine(sets.Midcast.Cure,{})
  280.  
  281.     -- Flash Set --
  282.     sets.Midcast.Flash = {}
  283.  
  284.     -- Enhancing Magic --
  285.     sets.Midcast['Enhancing Magic'] = {
  286.             neck="Colossus's Torque",
  287.             back="Merciful Cape",
  288.             waist="Olympus Sash",
  289.             legs="Rev. Breeches +1"}
  290.  
  291.     -- Stoneskin --
  292.     sets.Midcast.Stoneskin =  set_combine(sets.Midcast['Enhancing Magic'],{
  293.             neck="Stone Gorget",
  294.             ear2="Earthcry Earring",
  295.             hands="Stone Mufflers",
  296.             waist="Siegel Sash",
  297.             legs="Haven Hose"})
  298.  
  299.     -- Phalanx --
  300.     sets.Midcast.Phalanx =  set_combine(sets.Midcast['Enhancing Magic'],{})
  301.  
  302.     -- Reprisal --
  303.     sets.Midcast.Reprisal = {}
  304. end
  305.  
  306. function pretarget(spell,action)
  307.     if midaction() then
  308.         canceled = true
  309.         return
  310.     elseif spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  311.         cancel_spell()
  312.         send_command('input /item "Echo Drops" <me>')
  313.     elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
  314.         cancel_spell()
  315.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  316.         return
  317.     elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  318.         degrade_spell(spell,Cure_Spells)
  319.     elseif spell.english == "Berserk" and buffactive.Berserk then -- Cancel Berserk If Berserk Is On --
  320.         send_command('cancel Berserk')
  321.     elseif spell.english == "Defender" and buffactive.Defender then -- Cancel Defender If Defender Is On --
  322.         send_command('cancel Defender')
  323.     elseif spell.english == "Souleater" and buffactive.Souleater then -- Cancel Souleater If Souleater Is On --
  324.         send_command('cancel Souleater')
  325.     elseif spell.english == "Last Resort" and buffactive["Last Resort"] then -- Cancel Last Resort If Last Resort Is On --
  326.         send_command('cancel Last Resort')
  327.     elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
  328.         if spell.english == "Light Arts" and not buffactive['Addendum: White'] then
  329.             cancel_spell()
  330.             send_command('input /ja Addendum: White <me>')
  331.         elseif spell.english == "Manifestation" then
  332.             cancel_spell()
  333.             send_command('input /ja Accession <me>')
  334.         elseif spell.english == "Alacrity" then
  335.             cancel_spell()
  336.             send_command('input /ja Celerity <me>')
  337.         elseif spell.english == "Parsimony" then
  338.             cancel_spell()
  339.             send_command('input /ja Penury <me>')
  340.         end
  341.     elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  342.         if spell.english == "Dark Arts" and not buffactive['Addendum: Black'] then
  343.             cancel_spell()
  344.             send_command('input /ja Addendum: Black <me>')
  345.         elseif spell.english == "Accession" then
  346.             cancel_spell()
  347.             send_command('input /ja Manifestation <me>')
  348.         elseif spell.english == "Celerity" then
  349.             cancel_spell()
  350.             send_command('input /ja Alacrity <me>')
  351.         elseif spell.english == "Penury" then
  352.             cancel_spell()
  353.             send_command('input /ja Parsimony <me>')
  354.         end
  355.     end
  356. end
  357.  
  358. function precast(spell,action)
  359.     if canceled then
  360.         return
  361.     elseif spell.type == "WeaponSkill" then
  362.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  363.             cancel_spell()
  364.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  365.             return
  366.         else
  367.             equipSet = sets.WS
  368.             if equipSet[spell.english] then
  369.                 equipSet = equipSet[spell.english]
  370.             end
  371.             if equipSet[AccArray[AccIndex]] then
  372.                 equipSet = equipSet[AccArray[AccIndex]]
  373.             end
  374.             if elements[spell.name] and elements[spell.name]:contains(world.day_element) then
  375.                 equipSet = set_combine(equipSet,elements.equip)
  376.             end
  377.             if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  378.                 equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  379.             end
  380.             if TypeIndex == 1 and spell.english == "Chant du Cygne" then
  381.                 if world.time <= (7*60) or world.time >= (17*60) then -- Equip Lugra Earring +1 & Lugra Earring From Dusk To Dawn --
  382.                     equipSet = set_combine(equipSet,{ear1="Lugra Earring +1",ear2="Lugra Earring"})
  383.                 elseif player.tp > 2990 then -- Equip Jupiter's Pearl When You Have 3000 TP --
  384.                     equipSet = set_combine(equipSet,{ear1="Jupiter's Pearl"})
  385.                 end
  386.             end
  387.             if TypeIndex == 1 and spell.english == "Resolution" and player.tp > 2990 then
  388.                 if world.time <= (7*60) or world.time >= (17*60) then -- Equip Lugra Earring +1 From Dusk To Dawn --
  389.                     equipSet = set_combine(equipSet,{ear1="Lugra Earring +1"})
  390.                 else
  391.                     equipSet = set_combine(equipSet,{ear1="Kokou's Earring"}) -- Equip Kokou's Earring When You Have 3000 TP --
  392.                 end
  393.             end
  394.             equip(equipSet)
  395.         end
  396.     elseif spell.type == "JobAbility" or spell.type == "Ward" or spell.type == "Effusion" then
  397.         if sets.JA[spell.english] then
  398.             equip(sets.JA[spell.english])
  399.         end
  400.     elseif spell.type == "Rune" then
  401.         equip(sets.Enmity)
  402.     elseif spell.action_type == 'Magic' then
  403.         if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
  404.             cancel_spell()
  405.             add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  406.             return
  407.         else
  408.             if (spell.english:startswith('Cur') or spell.english == "Wild Carrot" or spell.english == "Healing Breeze") and spell.english ~= "Cursna" then
  409.                 if spell.target.name == player.name then
  410.                     equip(sets.Precast.SelfCure)
  411.                 else
  412.                     equip(sets.Precast.Cure)
  413.                 end
  414.             elseif spell.english == "Reprisal" then
  415.                 if buffactive['Blaze Spikes'] or buffactive['Ice Spikes'] or buffactive['Shock Spikes'] then -- Cancel Blaze Spikes, Ice Spikes or Shock Spikes When You Cast Reprisal --
  416.                     cast_delay(0.2)
  417.                     send_command('cancel Blaze Spikes,Ice Spikes,Shock Spikes')
  418.                 end
  419.                 equip(sets.Precast.FastCast)
  420.             elseif spell.english == 'Utsusemi: Ni' then
  421.                 if buffactive['Copy Image (3)'] then
  422.                     cancel_spell()
  423.                     add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  424.                     return
  425.                 else
  426.                     equip(sets.Precast.FastCast)
  427.                 end
  428.             elseif sets.Precast[spell.skill] then
  429.                 equip(sets.Precast[spell.skill])
  430.             else
  431.                 equip(sets.Precast.FastCast)
  432.             end
  433.         end
  434.     elseif spell.type:endswith('Flourish') then
  435.         if spell.english == "Animated Flourish" then
  436.             equip(sets.Enmity)
  437.         else
  438.             equip(sets.Flourish)
  439.         end
  440.     elseif spell.type == "Step" then
  441.         equip(sets.Step)
  442.     elseif spell.type == "Waltz" then
  443.         refine_waltz(spell,action)
  444.         equip(sets.Waltz)
  445.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  446.         cast_delay(0.2)
  447.         send_command('cancel Sneak')
  448.     end
  449.     if Twilight == 'Twilight' then
  450.         equip(sets.Twilight)
  451.     end
  452. end
  453.  
  454. function midcast(spell,action)
  455.     equipSet = {}
  456.     if spell.action_type == 'Magic' then
  457.         equipSet = sets.Midcast
  458.         if equipSet[spell.english] then
  459.             equipSet = equipSet[spell.english]
  460.         elseif (spell.english:startswith('Cur') or spell.english == "Wild Carrot" or spell.english == "Healing Breeze") and spell.english ~= "Cursna" then
  461.             if spell.target.name == player.name then
  462.                 equipSet = equipSet.SelfCure
  463.             else
  464.                 equipSet = equipSet.Cure
  465.             end
  466.             if world.day_element == spell.element or world.weather_element == spell.element then
  467.                 equipSet = set_combine(equipSet,{waist="Hachirin-no-Obi"})
  468.             end
  469.         elseif spell.english:startswith('Protect') or spell.english:startswith('Shell') then
  470.             if spell.target.name == player.name then
  471.                 equipSet = set_combine(equipSet,{ring2="Sheltered Ring"})
  472.             end
  473.         elseif spell.english == "Stoneskin" then
  474.             if buffactive.Stoneskin then
  475.                 send_command('@wait 1.7;cancel stoneskin')
  476.             end
  477.             equipSet = equipSet.Stoneskin
  478.         elseif spell.english == "Sneak" then
  479.             if spell.target.name == player.name and buffactive['Sneak'] then
  480.                 send_command('cancel sneak')
  481.             end
  482.             equipSet = equipSet.Recast
  483.         elseif spell.english:startswith('Enlight') then
  484.             equipSet = equipSet.Enlight
  485.         elseif spell.english:startswith('Banish') then
  486.             equipSet = equipSet.Banish
  487.             if world.day_element == spell.element or world.weather_element == spell.element then
  488.                 equipSet = set_combine(equipSet,{waist="Hachirin-no-Obi"})
  489.             end
  490.         elseif spell.english:startswith('Holy') then
  491.             equipSet = equipSet.Holy
  492.             if world.day_element == spell.element or world.weather_element == spell.element then
  493.                 equipSet = set_combine(equipSet,{waist="Hachirin-no-Obi"})
  494.             end
  495.         elseif Enmity_BlueMagic:contains(spell.english) or spell.english == "Stun" or spell.english:startswith('Absorb') or spell.english == 'Aspir' or spell.english == 'Drain' then
  496.             if buffactive.Sentinel then
  497.                 equipSet = equipSet.Recast
  498.             else
  499.                 equipSet = equipSet.Flash
  500.             end
  501.         elseif spell.english:endswith('Spikes') then
  502.             equipSet = equipSet.Recast
  503.         elseif spell.english:startswith('Utsusemi') then
  504.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
  505.                 send_command('@wait 1.7;cancel Copy Image*')
  506.             end
  507.             equipSet = equipSet.Recast
  508.         elseif spell.english == 'Monomi: Ichi' then
  509.             if buffactive['Sneak'] then
  510.                 send_command('@wait 1.7;cancel sneak')
  511.             end
  512.             equipSet = equipSet.Recast
  513.         elseif equipSet[spell.skill] then
  514.             equipSet = equipSet[spell.skill]
  515.         end
  516.     elseif equipSet[spell.english] then
  517.         equipSet = equipSet[spell.english]
  518.     end
  519.     equip(equipSet)
  520. end
  521.  
  522. function aftercast(spell,action)
  523.     if canceled then
  524.         canceled = false
  525.         return
  526.     else
  527.         if not spell.interrupted then
  528.             if spell.type == "WeaponSkill" then
  529.                 send_command('wait 0.2;gs c TP')
  530.             elseif spell.english == "Banish II" then -- Banish II Countdown --
  531.                 send_command('@wait 20;input /echo Banish Effect: [WEARING OFF IN 10 SEC.]')
  532.             elseif spell.english == "Holy Circle" then -- Holy Circle Countdown --
  533.                 send_command('wait 260;input /echo '..spell.name..': [WEARING OFF IN 10 SEC.];wait 10;input /echo '..spell.name..': [OFF]')
  534.             end
  535.         end
  536.         status_change(player.status)
  537.     end
  538. end
  539.  
  540. function status_change(new,old)
  541.     check_equip_lock()
  542.     if Armor == 'PDT' then
  543.         equip(sets.PDT[ShieldArray[ShieldIndex]])
  544.     elseif Armor == 'MDT' then
  545.         equip(sets.MDT[ShieldArray[ShieldIndex]])
  546.     elseif Armor == 'Kiting' then
  547.         equip(sets.Kiting[ShieldArray[ShieldIndex]])
  548.     elseif Armor == 'Weakness' then
  549.         equip(sets.Weakness[ShieldArray[ShieldIndex]])
  550.     elseif Armor == 'DT' then
  551.         equip(sets.DT[ShieldArray[ShieldIndex]])
  552.     elseif buffactive.Cover and Cover == 'ON' then
  553.         equip(sets.Cover)
  554.     elseif buffactive["Sublimation: Activated"] then
  555.         equip(sets.Sublimation)
  556.     elseif new == 'Engaged' then
  557.         equipSet = sets.TP
  558.         if Armor == 'Hybrid' and equipSet["Hybrid"] then
  559.             equipSet = equipSet["Hybrid"]
  560.         end
  561.         if equipSet[player.equipment.main] then
  562.             equipSet = equipSet[player.equipment.main]
  563.         end
  564.         if equipSet[ShieldArray[ShieldIndex]] then
  565.             equipSet = equipSet[ShieldArray[ShieldIndex]]
  566.         end
  567.         if equipSet[AccArray[AccIndex]] then
  568.             equipSet = equipSet[AccArray[AccIndex]]
  569.         end
  570.         if buffactive.Ionis and equipSet["Ionis"] then
  571.             equipSet = equipSet["Ionis"]
  572.         end
  573.         if Armor == 'ShieldSkill' then
  574.             equipSet = set_combine(equipSet,sets.TP.ShieldSkill)
  575.         end
  576.         equip(equipSet)
  577.     elseif new == 'Idle' then
  578.         equipSet = sets.Idle
  579.         if equipSet[IdleArray[IdleIndex]] then
  580.             equipSet = equipSet[IdleArray[IdleIndex]]
  581.         end
  582.         if equipSet[ShieldArray[ShieldIndex]] then
  583.             equipSet = equipSet[ShieldArray[ShieldIndex]]
  584.         end
  585.         if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  586.             equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  587.         end
  588.         if world.area:endswith('Adoulin') then
  589.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  590.         end
  591.         equip(equipSet)
  592.     elseif new == 'Resting' then
  593.         equip(sets.Resting)
  594.     end
  595.     if Repulse == 'ON' then -- Use Repulse Toggle To Lock Repulse Mantle --
  596.         equip(sets.Repulse[ShieldArray[ShieldIndex]])
  597.     end
  598.     if Twilight == 'Twilight' then
  599.         equip(sets.Twilight)
  600.     end
  601. end
  602.  
  603. function buff_change(buff,gain)
  604.     buff = string.lower(buff)
  605.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  606.         if gain then
  607.             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.]')
  608.         else
  609.             send_command('timers delete "Aftermath: Lv.3"')
  610.             add_to_chat(123,'AM3: [OFF]')
  611.         end
  612.     elseif buff == 'weakness' then -- Weakness Timer --
  613.         if gain then
  614.             send_command('timers create "Weakness" 300 up')
  615.         else
  616.             send_command('timers delete "Weakness"')
  617.         end
  618.     end
  619.     if buff == "sleep" and gain and player.hp > 200 and player.status == "Engaged" then -- Equip Berserker's Torque When You Are Asleep & Have 200+ HP --
  620.         equip({neck="Berserker's Torque"})
  621.     else
  622.         if not midaction() then
  623.             status_change(player.status)
  624.         end
  625.     end
  626. end
  627.  
  628. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  629. function self_command(command)
  630.     if command == 'C1' then -- Accuracy Level Toggle --
  631.         AccIndex = (AccIndex % #AccArray) + 1
  632.         status_change(player.status)
  633.         add_to_chat(158,'Accuracy Level: '..AccArray[AccIndex])
  634.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  635.         status_change(player.status)
  636.         add_to_chat(158,'Auto Update Gear')
  637.     elseif command == 'C2' then -- Shield Type Toggle --
  638.         ShieldIndex = (ShieldIndex % #ShieldArray) + 1
  639.         status_change(player.status)
  640.         add_to_chat(158,'Shield Type: '..ShieldArray[ShieldIndex])
  641.     elseif command == 'C9' then -- Hybrid Toggle --
  642.         if Armor == 'Hybrid' then
  643.             Armor = 'None'
  644.             add_to_chat(123,'Hybrid Set: [Unlocked]')
  645.         else
  646.             Armor = 'Hybrid'
  647.             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  648.         end
  649.         status_change(player.status)
  650.     elseif command == 'C7' then -- PDT Toggle --
  651.         if Armor == 'PDT' then
  652.             Armor = 'None'
  653.             add_to_chat(123,'PDT Set: [Unlocked]')
  654.         else
  655.             Armor = 'PDT'
  656.             add_to_chat(158,'PDT Set: [Locked]')
  657.         end
  658.         status_change(player.status)
  659.     elseif command == 'C15' then -- MDT Toggle --
  660.         if Armor == 'MDT' then
  661.             Armor = 'None'
  662.             add_to_chat(123,'MDT Set: [Unlocked]')
  663.         else
  664.             Armor = 'MDT'
  665.             add_to_chat(158,'MDT Set: [Locked]')
  666.         end
  667.         status_change(player.status)
  668.     elseif command == 'C12' then -- Kiting Toggle --
  669.         if Armor == 'Kiting' then
  670.             Armor = 'None'
  671.             add_to_chat(123,'Kiting Set: [Unlocked]')
  672.         else
  673.             Armor = 'Kiting'
  674.             add_to_chat(158,'Kiting Set: [Locked]')
  675.         end
  676.         status_change(player.status)
  677.     elseif command == 'C10' then -- Weakness Set Toggle --
  678.         if Armor == 'Weakness' then
  679.             Armor = 'None'
  680.             add_to_chat(123,'Weakness Set: [Unlocked]')
  681.         else
  682.             Armor = 'Weakness'
  683.             add_to_chat(158,'Weakness Set: [Locked]')
  684.         end
  685.         status_change(player.status)
  686.     elseif command == 'C17' then -- DT Toggle --
  687.         if Armor == 'DT' then
  688.             Armor = 'None'
  689.             add_to_chat(123,'DT Set: [Unlocked]')
  690.         else
  691.             Armor = 'DT'
  692.             add_to_chat(158,'DT Set: [Locked]')
  693.         end
  694.         status_change(player.status)
  695.     elseif command == 'C16' then -- Repulse Mantle Toggle --
  696.         if Repulse == 'ON' then
  697.             Repulse = 'OFF'
  698.             add_to_chat(123,'Repulse Mantle: [Unlocked]')
  699.         else
  700.             Repulse = 'ON'
  701.             add_to_chat(158,'Repulse Mantle: [Locked]')
  702.         end
  703.         status_change(player.status)
  704.     elseif command == 'C11' then -- Shield Skill Toggle --
  705.         if Armor == 'ShieldSkill' then
  706.             Armor = 'None'
  707.             add_to_chat(123,'Shield Skill Set: [Unlocked]')
  708.         else
  709.             Armor = 'ShieldSkill'
  710.             add_to_chat(158,'Shield Skill Set: [Locked]')
  711.         end
  712.         status_change(player.status)
  713.     elseif command == 'C3' then -- Twilight Toggle --
  714.         if Twilight == 'Twilight' then
  715.             Twilight = 'None'
  716.             add_to_chat(123,'Twilight Set: [Unlocked]')
  717.         else
  718.             Twilight = 'Twilight'
  719.             add_to_chat(158,'Twilight Set: [locked]')
  720.         end
  721.         status_change(player.status)
  722.     elseif command == 'C8' then -- Distance Toggle --
  723.         if player.target.distance then
  724.             target_distance = math.floor(player.target.distance*10)/10
  725.             add_to_chat(158,'Distance: '..target_distance)
  726.         else
  727.             add_to_chat(123,'No Target Selected')
  728.         end
  729.     elseif command == 'C6' then -- Idle Toggle --
  730.         IdleIndex = (IdleIndex % #IdleArray) + 1
  731.         status_change(player.status)
  732.         add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
  733.     elseif command == 'TP' then
  734.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  735.     elseif command:match('^SC%d$') then
  736.         send_command('//' .. sc_map[command])
  737.     end
  738. end
  739.  
  740. function check_equip_lock() -- Lock Equipment Here --
  741.     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
  742.         disable('ring1','ring2')
  743.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  744.         disable('back')
  745.     elseif player.equipment.main == "Ragnarok" then
  746.         disable('main','sub')
  747.     else
  748.         enable('main','sub','ring1','ring2','back')
  749.     end
  750. end
  751.  
  752. function actualCost(originalCost)
  753.     if buffactive["Penury"] then
  754.         return originalCost*.5
  755.     elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
  756.         return originalCost*.9
  757.     elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
  758.         return originalCost*1.1
  759.     else
  760.         return originalCost
  761.     end
  762. end
  763.  
  764. function degrade_spell(spell,degrade_array)
  765.     spell_index = table.find(degrade_array,spell.name)
  766.     if spell_index > 1 then
  767.         new_spell = degrade_array[spell_index - 1]
  768.         change_spell(new_spell,spell.target.raw)
  769.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  770.     end
  771. end
  772.  
  773. function change_spell(spell_name,target)
  774.     cancel_spell()
  775.     send_command('//'..spell_name..' '..target)
  776. end
  777.  
  778. function refine_waltz(spell,action)
  779.     if spell.type ~= 'Waltz' then
  780.         return
  781.     end
  782.  
  783.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" then
  784.         return
  785.     end
  786.  
  787.     local newWaltz = spell.english
  788.     local waltzID
  789.  
  790.     local missingHP
  791.  
  792.     if spell.target.type == "SELF" then
  793.         missingHP = player.max_hp - player.hp
  794.     elseif spell.target.isallymember then
  795.         local target = find_player_in_alliance(spell.target.name)
  796.         local est_max_hp = target.hp / (target.hpp/100)
  797.         missingHP = math.floor(est_max_hp - target.hp)
  798.     end
  799.  
  800.     if missingHP ~= nil then
  801.         if player.sub_job == 'DNC' then
  802.             if missingHP < 40 and spell.target.name == player.name then
  803.                 add_to_chat(123,'Full HP!')
  804.                 cancel_spell()
  805.                 return
  806.             elseif missingHP < 150 then
  807.                 newWaltz = 'Curing Waltz'
  808.                 waltzID = 190
  809.             elseif missingHP < 300 then
  810.                 newWaltz = 'Curing Waltz II'
  811.                 waltzID = 191
  812.             else
  813.                 newWaltz = 'Curing Waltz III'
  814.                 waltzID = 192
  815.             end
  816.         else
  817.             return
  818.         end
  819.     end
  820.  
  821.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50}
  822.     local tpCost = waltzTPCost[newWaltz]
  823.  
  824.     local downgrade
  825.  
  826.     if player.tp < tpCost then
  827.  
  828.         if player.tp < 20 then
  829.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  830.             cancel_spell()
  831.             return
  832.         elseif player.tp < 35 then
  833.             newWaltz = 'Curing Waltz'
  834.         elseif player.tp < 50 then
  835.             newWaltz = 'Curing Waltz II'
  836.         end
  837.  
  838.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  839.     end
  840.  
  841.     if newWaltz ~= spell.english then
  842.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  843.         if downgrade then
  844.             add_to_chat(8, downgrade)
  845.         end
  846.         cancel_spell()
  847.         return
  848.     end
  849.  
  850.     if missingHP > 0 then
  851.         add_to_chat(8,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  852.     end
  853. end
  854.  
  855. function find_player_in_alliance(name)
  856.     for i,v in ipairs(alliance) do
  857.         for k,p in ipairs(v) do
  858.             if p.name == name then
  859.                 return p
  860.             end
  861.         end
  862.     end
  863. end
  864.  
  865. function sub_job_change(newSubjob, oldSubjob)
  866.     select_default_macro_book()
  867. end
  868.  
  869. function set_macro_page(set,book)
  870.     if not tonumber(set) then
  871.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  872.         return
  873.     end
  874.     if set < 1 or set > 10 then
  875.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  876.         return
  877.     end
  878.  
  879.     if book then
  880.         if not tonumber(book) then
  881.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  882.             return
  883.         end
  884.         if book < 1 or book > 20 then
  885.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  886.             return
  887.         end
  888.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  889.     else
  890.         send_command('@input /macro set '..tostring(set))
  891.     end
  892. end
  893.  
  894. function select_default_macro_book()
  895.     -- Default macro set/book
  896.     if player.sub_job == 'WAR' then
  897.         set_macro_page(1, 9)
  898.     elseif player.sub_job == 'DRK' then
  899.         set_macro_page(9, 9)
  900.     elseif player.sub_job == 'NIN' then
  901.         set_macro_page(10, 9)
  902.     elseif player.sub_job == 'BLU' then
  903.         set_macro_page(2, 9)
  904.     elseif player.sub_job == 'DNC' then
  905.         set_macro_page(3, 9)
  906.     elseif player.sub_job == 'RDM' then
  907.         set_macro_page(8, 9)
  908.     elseif player.sub_job == 'WHM' then
  909.         set_macro_page(7, 9)
  910.     else
  911.         set_macro_page(1, 9)
  912.     end
  913. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement