Advertisement
Guest User

Mozhat SMN

a guest
Dec 4th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.86 KB | None | 0 0
  1.  include('SMN_Gearsets.lua')
  2.  -- Blood Pacts Groupings: 
  3. --[[
  4.      Put: /console gs c pact [PactType] as your macro
  5.      
  6.         PactType can be one of:
  7.             cure
  8.             curaga
  9.             buffOffense
  10.             buffDefense
  11.             buffSpecial
  12.             debuff1
  13.             debuff2
  14.             sleep
  15.             nuke2
  16.             nuke4
  17.             bp70
  18.             bp75 (merits and lvl 75-80 pacts)
  19.             bp99
  20.             astralflow
  21. --]]
  22.  
  23.     pacts = {}
  24.     pacts.cure = {['Carbuncle']='Healing Ruby'}
  25.     pacts.curaga = {['Carbuncle']='Healing Ruby II', ['Garuda']='Whispering Wind', ['Leviathan']='Spring Water'}
  26.     pacts.buffoffense = {['Carbuncle']='Glittering Ruby', ['Ifrit']='Crimson Howl', ['Garuda']='Hastega II', ['Ramuh']='Rolling Thunder',
  27.         ['Fenrir']='Ecliptic Growl', ['Shiva']='Crystal Blessing'}
  28.     pacts.buffdefense = {['Carbuncle']='Shining Ruby', ['Shiva']='Frost Armor', ['Garuda']='Aerial Armor', ['Titan']='Earthen Ward',
  29.         ['Ramuh']='Lightning Armor', ['Fenrir']='Ecliptic Howl', ['Diabolos']='Noctoshield', ['Cait Sith']='Reraise II'}
  30.     pacts.buffspecial = {['Ifrit']=' <staff_and_grip Howl', ['Garuda']='Fleet Wind', ['Titan']='Earthen Armor', ['Diabolos']='Dream Shroud',
  31.         ['Carbuncle']='Soothing Ruby', ['Fenrir']='Heavenward Howl', ['Cait Sith']='Raise II'}
  32.     pacts.debuff1 = {['Shiva']='Diamond Storm', ['Ramuh']='Shock Squall', ['Leviathan']='Tidal Roar', ['Fenrir']='Lunar Cry',
  33.         ['Diabolos']='Pavor Nocturnus', ['Cait Sith']='Eerie Eye'}
  34.     pacts.debuff2 = {['Shiva']='Sleepga', ['Leviathan']='Slowga', ['Fenrir']='Lunar Roar', ['Diabolos']='Somnolence', ['Ramuh']='Thunderspark'}
  35.     pacts.sleep = {['Shiva']='Sleepga', ['Diabolos']='Nightmare', ['Cait Sith']='Mewing Lullaby'}
  36.     pacts.nuke2 = {['Ifrit']='Fire II', ['Shiva']='Blizzard II', ['Garuda']='Aero II', ['Titan']='Stone II',
  37.         ['Ramuh']='Thunder II', ['Leviathan']='Water II'}
  38.     pacts.nuke4 = {['Ifrit']='Fire IV', ['Shiva']='Blizzard IV', ['Garuda']='Aero IV', ['Titan']='Stone IV',
  39.         ['Ramuh']='Thunder IV', ['Leviathan']='Water IV'}
  40.     pacts.bp70 = {['Ifrit']='Flaming Crush', ['Shiva']='Rush', ['Garuda']='Predator Claws', ['Titan']='Mountain Buster',
  41.         ['Ramuh']='Chaotic Strike', ['Leviathan']='Spinning Dive', ['Carbuncle']='Meteorite', ['Fenrir']='Eclipse Bite',
  42.         ['Diabolos']='Nether Blast',['Cait Sith']='Regal Gash'}
  43.     pacts.bp75 = {['Ifrit']='Meteor Strike', ['Shiva']='Heavenly Strike', ['Garuda']='Wind Blade', ['Titan']='Geocrush',
  44.         ['Ramuh']='Thunderstorm', ['Leviathan']='Grand Fall', ['Carbuncle']='Holy Mist', ['Fenrir']='Lunar Bay',
  45.         ['Diabolos']='Night Terror', ['Cait Sith']='Level ? Holy'}
  46.     pacts.bp99 = {['Ifrit']='Conflag Strike', ['Ramuh']='Volt Strike', ['Titan']='Crag Throw', ['Fenrir']='Impact', ['Diabolos']='Blindside'}
  47.     pacts.astralflow = {['Ifrit']='Inferno', ['Shiva']='Diamond Dust', ['Garuda']='Aerial Blast', ['Titan']='Earthen Fury',
  48.         ['Ramuh']='Judgment Bolt', ['Leviathan']='Tidal Wave', ['Carbuncle']='Searing Light', ['Fenrir']='Howling Moon',
  49.         ['Diabolos']='Ruinous Omen', ['Cait Sith']="Altana's Favor"}
  50.  
  51. --     
  52.        
  53. bp_physical=S{  'Punch','Rock Throw','Barracuda Dive','Claw','Axe Kick','Shock Strike','Camisado','Regal Scratch','Poison Nails',
  54.                 'Moonlit Charge','Crescent Fang','Rock Buster','Tail Whip','Double Punch','Megalith Throw','Double Slap','Eclipse Bite',
  55.                 'Mountain Buster','Spinning Dive','Predator Claws','Rush','Chaotic Strike','Crag Throw','Volt Strike'}
  56.  
  57. bp_hybrid=S{    'Burning Strike','Flaming Crush'}
  58.  
  59. bp_magical=S{   'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgment Bolt','Searing Light','Howling Moon',
  60.                 'Ruinous Omen','Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II','Thunderspark','Somnolence',
  61.                 'Meteorite','Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV','Nether Blast','Meteor Strike',
  62.                 'Geocrush','Grand Fall','Wind Blade','Heavenly Strike','Thunderstorm','Level ? Holy','Holy Mist','Lunar Bay',
  63.                 'Night Terror','Conflagration Strike', 'Zantetsuken'}
  64.                
  65. bp_debuff=S{    'Lunar Cry','Mewing Lullaby','Nightmare','Lunar Roar','Slowga','Ultimate Terror','Sleepga','Eerie Eye','Tidal Roar',
  66.                 'Diamond Storm','Shock Squall','Pavor Nocturnus'}
  67.                
  68. bp_buff=S{      'Shining Ruby','Frost Armor','Rolling Thunder','Crimson Howl','Lightning Armor','Ecliptic Growl','Hastega','Noctoshield',
  69.                 'Ecliptic Howl','Dream Shroud','Earthen Armor','Fleet Wind','Inferno Howl','Soothing Ruby','Heavenward Howl',
  70.                 'Soothing Current','Hastega II','Crystal Blessing'}
  71.  
  72. bp_other=S{     'Healing Ruby','Raise II','Aerial Armor','Reraise II','Whispering Wind','Glittering Ruby','Earthen Ward','Spring Water','Healing Ruby II'}
  73.  
  74. AvatarList=S{   'Shiva','Ramuh','Garuda','Leviathan','Diabolos','Titan','Fenrir','Ifrit','Carbuncle','Fire Spirit','Air Spirit','Ice Spirit',
  75.                 'Thunder Spirit','Light Spirit','Dark Spirit','Earth Spirit','Water Spirit','Cait Sith','Alexander','Odin','Atomos'}
  76.                
  77. spirit_element={Fire='Fire Spirit',Earth='Earth Spirit',Water='Water Spirit',Wind='Air Spirit',Ice='Ice Spirit',Lightning='Thunder Spirit',
  78.                 Light='Light Spirit',Dark='Dark Spirit'}spirit_conflict={Fire='Ice',Earth='Lightning',Water='Fire',Wind='Earth',Ice='Wind',
  79.                 Lightning='Water',Light='Dark',Dark='Light'}
  80.                
  81. -- Set Macros for your SMN's macro page, book.
  82. function set_macros(sheet,book)
  83.     if book then
  84.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(sheet))
  85.         return
  86.     end
  87.     send_command('@input /macro set '..tostring(sheet))
  88.  
  89. end
  90. set_macros(1,19) -- Sheet, Book
  91.  
  92. -- Required variables and  their initial value
  93. meleeing = false
  94. autobp = false
  95. favor = false
  96. mBurst = false
  97. macc = false
  98. mode = "perp"
  99. savedMode = "perp"
  100.  
  101.  
  102.  function precast(spell)
  103.  
  104.     -- Don't swap if we're in the middle of something or our pet's doing something
  105.     -- Stops macro spam from interfering with an action GS is already handling
  106.     if midaction() or pet_midaction() then
  107.         return
  108.     end
  109.     if buffactive['Astral Conduit'] then
  110.         return
  111.     end
  112.  
  113.     -- If we're doing a blood pact, equip our delay set IF Apogee or Astral Conduit are not active
  114.     if (spell.type == 'BloodPactRage' or spell.type == 'BloodPactWard') and not (buffactive['Astral Conduit'] or buffactive['Apogee']) then
  115.      
  116.         equip(sets.precast.bp)
  117.          
  118.     elseif spell.type == 'SummonerPact' then
  119.      
  120.         -- This chunk of code handles Elemental Siphon. It will look at the current day and weather and cancel the spell to summon
  121.         -- the right elemental. Your elemental siphon macro should summon a Dark Spirit to trigger this check
  122.          
  123.         -- These use the included lists in global.lua to determine the right spirit to summon
  124.              
  125.         if spell.name == 'Dark Spirit' then
  126.             if world.weather_element == 'Dark' then
  127.              
  128.                 -- Dark Weather is active, lets the spell go ahead and equips summoning precast
  129.                 equip(sets.precast.summoning)
  130.                  
  131.             elseif world.weather_element ~= 'None' and spirit_conflict[world.day_element] ~= world.weather_element then
  132.              
  133.                 -- It's not dark weather but there is some weather up, cancels dark and summons the right spirit
  134.                 cancel_spell()
  135.                 send_command('input /ma "%s" <me>':format(spirit_element[world.weather_element]))
  136.                 equip(sets.precast.summoning)
  137.                  
  138.             elseif world.day_element == 'Dark' then
  139.              
  140.                 -- It's darksday so allow the dark spirit to go ahead and equip summoning
  141.                 equip(sets.precast.summoning)
  142.                  
  143.             else
  144.              
  145.                 -- There is no weather up and it's not darksday, so summon the current day's spirit
  146.                 cancel_spell()              
  147.                 send_command('input /ma "%s" <me>':format(spirit_element[world.day_element]))
  148.                 equip(sets.precast.summoning)
  149.                  
  150.             end
  151.         else
  152.          
  153.             -- We're not summoning Dark Spirit, so we don't want to Siphon, which means we're summoning an avatar
  154.             equip(sets.precast.summoning)
  155.              
  156.         end
  157.          
  158.     -- Moving on to other types of magic
  159.     elseif spell.type == 'WhiteMagic' or spell.type == 'BlackMagic' or spell.name == AvatarList:contains(spell.name) then
  160.      
  161.         -- Stoneskin Precast
  162.         if spell.name == 'Stoneskin' then
  163.          
  164.             windower.ffxi.cancel_buff(37)--[[Cancels stoneskin, not delayed incase you get a Quick Cast]]
  165.             equip(sets.precast.stoneskin)
  166.              
  167.         -- Cure Precast
  168.         elseif spell.name:match('Cure') or spell.name:match('Cura') then
  169.          
  170.             equip(sets.precast.cure)
  171.              
  172.         -- Enhancing Magic
  173.         elseif spell.skill == 'Magic' then
  174.          
  175.             equip(sets.precast.enhancing)
  176.              
  177.             if spell.name == 'Sneak' then
  178.                 windower.ffxi.cancel_buff(71)--[[Cancels Sneak]]
  179.             end
  180.         else
  181.          
  182.             -- For everything else we go with max fastcast
  183.             equip(sets.precast.casting)
  184.              
  185.         end
  186.          
  187.     -- Summoner Abilities
  188.     -- We use a catch all here, if the set exists for an ability, use it
  189.     -- This way we don't need to write a load of different code for different abilities, just make a set
  190.      
  191.     elseif sets.precast[spell.name] then
  192.         equip(sets.precast[spell.name])
  193.     end
  194.      
  195. end
  196.  
  197. function midcast(spell)
  198.      
  199.     -- No need to annotate all this, it's fairly logical. Just equips the relevant sets for the relevant magic
  200.     if spell.type == 'WhiteMagic' or spell.type == 'BlackMagic' then
  201.         if spell.name == 'Stoneskin' then
  202.             equip(sets.midcast.stoneskin)
  203.         elseif spell.name:match('Cure') or spell.name:match('Cura') or spell.name:match('Regen')then
  204.             equip(sets.midcast.cure)
  205.         elseif spell.skill == 'Enhancing Magic' then
  206.             equip(sets.midcast.enhancing)
  207.             if spell.name:match('Protect') or spell.name:match('Shell') then
  208.                 equip({rring="Sheltered Ring"})
  209.             end
  210.         else
  211.             equip(sets.midcast.casting)
  212.         end
  213.     elseif spell.name == 'Elemental Siphon' then
  214.      
  215.         -- Siphon Set
  216.         equip(sets.midcast.siphon)
  217.          
  218.         -- Checks if pet matches weather
  219.         --if pet.element == world.weather_element then
  220.         --    equip(sets.midcast.siphon,{main="Chatoyant Staff"--[[Take advantage of the weather boost]]})
  221.         --end
  222.          
  223.     -- And our catch all, if a set exists for this spell use it
  224.     elseif sets.midcast[spell.name] then
  225.         equip(sets.midcast[spell.name])
  226.          
  227.     -- Remember those WS Sets we defined? :)
  228.     elseif sets.me[spell.name] then
  229.         equip(sets.me[spell.name])
  230.     end
  231. end
  232.  
  233. function aftercast(spell)
  234.  
  235.     -- If our pet is doing something, prevents us swapping equipment too early
  236.     if midaction() or pet_midaction() then
  237.         return
  238.     end
  239.     if buffactive['Astral Conduit'] then
  240.         return
  241.     end
  242.      
  243.     -- If not a blood pact or summon
  244.     if spell and (not spell.type or not string.find(spell.type,'BloodPact') and not AvatarList:contains(spell.name) or spell.interrupted) then
  245.      
  246.         -- Then initiate idle function to check which set should be equipped
  247.         idle(pet)
  248.          
  249.     end
  250. end
  251.  
  252. function pet_midcast(spell)
  253.  
  254.     -- Our pet is doing something
  255.     if (spell.type == 'BloodPactRage' or spell.type == 'BloodPactWard') then
  256.      
  257.         -- We're going to check the lists in global.lua for matches and equip the relevant sets
  258.          
  259.         if bp_physical:contains(spell.name) then
  260.             if mode == 'acc' then
  261.                 equip(sets.avatar.pacc)    
  262.             else
  263.                 equip(sets.avatar.atk)
  264.             end
  265.         elseif bp_hybrid:contains(spell.name) then
  266.          
  267.             equip(sets.avatar.hybrid)
  268.             if pet.name == 'Ifrit' then
  269.                 equip({rring="Fervor Ring"})--[[Change rring to lring if you put Evoker's on your right hand]]
  270.             end
  271.              
  272.         elseif bp_magical:contains(spell.name) then
  273.          
  274.             if mode == 'acc' then
  275.                 equip(sets.avatar.macc)
  276.             elseif mBurst then
  277.                 equip(sets.avatar.mb)          
  278.             else
  279.                 equip(sets.avatar.mab)
  280.             end
  281.  
  282.         elseif bp_debuff:contains(spell.name) then
  283.          
  284.             equip(sets.avatar.macc)
  285.              
  286.         elseif bp_buff:contains(spell.name) then
  287.          
  288.             equip(sets.avatar.buff)
  289.              
  290.         elseif bp_other:contains(spell.name) then
  291.          
  292.             equip(sets.avatar.other)
  293.              
  294.         elseif spell.name == 'Perfect Defense' then
  295.          
  296.             equip(sets.avatar.skill)
  297.              
  298.         else
  299.          
  300.             equip(sets.avatar.skill)
  301.              
  302.         end
  303.         if pet.name == 'Carbuncle' or pet.name == 'Cait Sith' then
  304.             equip(sets.avatar[pet.name])
  305.         end
  306.     end
  307. end
  308.  
  309. function pet_aftercast(spell)
  310.      
  311.     -- Pet aftercast is simply a check for whether Conduit and Apogee are up, and then a call to our aftercast function
  312.     -- We have a variable called autobp that we set to true or false with commands to auto repeat BPs for us
  313.     if (buffactive['Apogee'] or buffactive['Astral Conduit']) and autobp then
  314.         send_command('input /pet "%s" <t>':format(spell.name))
  315.         return
  316.     end
  317.    
  318.     idle(pet)
  319.     -- Add to Chat rules for buffs with variable values.
  320.     if (spell.english=="Ecliptic Howl") then
  321.         if (world.moon_pct>89) then
  322.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 25 - Evasion 1")
  323.         elseif (world.moon_pct>74) then
  324.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 21 - Evasion 5")
  325.         elseif (world.moon_pct>59) then
  326.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 17 - Evasion 9")
  327.         elseif (world.moon_pct>39) then
  328.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 13 - Evasion 13")
  329.         elseif (world.moon_pct>24) then
  330.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 9 - Evasion 17")
  331.         elseif (world.moon_pct>9) then
  332.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 5 - Evasion 21")
  333.         else
  334.                 add_to_chat(104,"[Ecliptic Howl] Accuracy 1 - Evasion 25")
  335.         end
  336.     elseif (spell.english=="Ecliptic Growl") then
  337.         if (world.moon_pct>89) then
  338.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 7 - INT/MND/CHR/AGI 1")
  339.         elseif (world.moon_pct>74) then
  340.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 6 - INT/MND/CHR/AGI 2")
  341.         elseif (world.moon_pct>59) then
  342.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 5 - INT/MND/CHR/AGI 3")
  343.         elseif (world.moon_pct>39) then
  344.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 4 - INT/MND/CHR/AGI 4")
  345.         elseif (world.moon_pct>24) then
  346.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 3 - INT/MND/CHR/AGI 5")
  347.         elseif (world.moon_pct>9) then
  348.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 2 - INT/MND/CHR/AGI 6")
  349.         else
  350.                 add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 1 - INT/MND/CHR/AGI 7")
  351.         end
  352.     elseif (spell.english=="Lunar Cry") then
  353.         if (world.moon_pct>89) then
  354.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 31 - Enemy Eva Down 1")
  355.         elseif (world.moon_pct>74) then
  356.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 26 - Enemy Eva Down 6")
  357.         elseif (world.moon_pct>59) then
  358.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 21 - Enemy Eva Down 11")
  359.         elseif (world.moon_pct>39) then
  360.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 16 - Enemy Eva Down 16")
  361.         elseif (world.moon_pct>24) then
  362.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 11 - Enemy Eva Down 21")
  363.         elseif (world.moon_pct>9) then
  364.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 6 - Enemy Eva Down 26")
  365.         else
  366.                 add_to_chat(104,"[Lunar Cry] Enemy Acc Down 1 - Enemy Eva Down 31")
  367.         end
  368.     elseif (spell.english=="Heavenward Howl") then
  369.         if (world.moon_pct>89) then
  370.                 add_to_chat(104,"[Heavenward Howl] Moon Phase Full moon - Endrain 15%")
  371.         elseif (world.moon_pct>73) then
  372.                 add_to_chat(104,"[Heavenward Howl] Moon phase 74~90% {Endrain 12%")
  373.         elseif (world.moon_pct>56) then
  374.                 add_to_chat(104,"[Heavenward Howl] Moon phase 57~73% {Endrain 8%}")
  375.         elseif (world.moon_pct>39) then
  376.                 add_to_chat(104,"[Heavenward Howl] Moon phase 40~56% {First Quarter Moon - Endrain 5% | Last Quarter - moon Enaspir 1%}" )
  377.         elseif (world.moon_pct>24) then
  378.                 add_to_chat(104,"[Heavenward Howl] Moon phase 25~39% {Enaspir 2%}")
  379.         elseif (world.moon_pct>9) then
  380.                 add_to_chat(104,"[Heavenward Howl] Moon phase 10~24% {Enaspir 4%}")
  381.         else
  382.                 add_to_chat(104,"[Heavenward Howl] Moon Phase New Moon - Enaspir 5%")
  383.         end    
  384.     elseif (spell.english=="Dream Shroud") then
  385.         if (world.time >= 0 and world.time < 1*60) then
  386.                 add_to_chat(104,"[Dream Shroud] MAB 13 - MDB 1")
  387.         elseif (world.time >= 1*60 and world.time < 2*60) or (world.time >= 23*60 and world.time <= 23*60+59) then
  388.                 add_to_chat(104,"[Dream Shroud] MAB 12 - MDB 2")
  389.         elseif (world.time >= 2*60 and world.time < 3*60) or (world.time >= 22*60 and world.time < 23*60) then
  390.                 add_to_chat(104,"[Dream Shroud] MAB 11 - MDB 3")
  391.         elseif (world.time >= 3*60 and world.time < 4*60) or (world.time >= 21*60 and world.time < 22*60) then
  392.                 add_to_chat(104,"[Dream Shroud] MAB 10 - MDB 4")
  393.         elseif (world.time >= 4*60 and world.time < 5*60) or (world.time >= 20*60 and world.time < 21*60) then
  394.                 add_to_chat(104,"[Dream Shroud] MAB 9 - MDB 5")
  395.         elseif (world.time >= 5*60 and world.time < 6*60) or (world.time >= 19*60 and world.time < 20*60) then
  396.                 add_to_chat(104,"[Dream Shroud] MAB 8 - MDB 6")
  397.         elseif (world.time >= 6*60 and world.time < 7*60) or (world.time >= 18*60 and world.time < 19*60) then
  398.                 add_to_chat(104,"[Dream Shroud] MAB 7 - MDB 7")
  399.         elseif (world.time >= 7*60 and world.time < 8*60) or (world.time >= 17*60 and world.time < 18*60) then
  400.                 add_to_chat(104,"[Dream Shroud] MAB 6 - MDB 8")
  401.         elseif (world.time >= 8*60 and world.time < 9*60) or (world.time >= 16*60 and world.time < 17*60) then
  402.                 add_to_chat(104,"[Dream Shroud] MAB 5 - MDB 9")
  403.         elseif (world.time >= 9*60 and world.time < 10*60) or (world.time >= 15*60 and world.time < 16*60) then
  404.                 add_to_chat(104,"[Dream Shroud] MAB 4 - MDB 10")
  405.         elseif (world.time >= 10*60 and world.time < 11*60) or (world.time >= 14*60 and world.time < 15*60) then
  406.                 add_to_chat(104,"[Dream Shroud] MAB 3 - MDB 11")
  407.         elseif (world.time >= 11*60 and world.time < 12*60) or (world.time >= 13*60 and world.time < 14*60) then
  408.                 add_to_chat(104,"[Dream Shroud] MAB 2 - MDB 12")
  409.         else
  410.                 add_to_chat(104,"[Dream Shroud] MAB 1 - MDB 13")
  411.         end
  412.     end
  413. end
  414.  
  415. function idle(pet)
  416.  
  417.     -- This function is called after every action, and handles which set to equip depending on what we're doing
  418.     -- We check if we're meleeing because we don't want to idle in melee gear when we're only engaged for trusts
  419.      
  420.     if favor and pet.isvalid then  
  421.         -- Avatar's favor takes priority!
  422.         equip(sets.avatar.favor)      
  423.     elseif meleeing and player.status=='Engaged' then  
  424.         -- We're both engaged and meleeing
  425.         equip(sets.me.melee)        
  426.     elseif pet.isvalid then        
  427.         -- We have a pet out but we're not meleeing, set the right idle set
  428.         equip(sets.avatar[mode])
  429.     elseif pet.name == 'Alexander' then      
  430.         -- We have a pet out but we're not meleeing, set the right idle set
  431.         equip(sets.avatar.skill)   
  432.     else
  433.         -- We're not meleeing and we have no pet out
  434.         equip(sets.me.idle)    
  435.     end
  436.     -- If we have cait or carbie  we switch to hands.
  437.     if pet.name == 'Carbuncle' or pet.name == 'Cait Sith' then
  438.             equip(sets.avatar[pet.name])
  439.     end
  440. end
  441.  
  442. function status_change(new,old)
  443.     if new == 'Engaged' then
  444.      
  445.         -- If we engage check our meleeing status
  446.         idle(pet)
  447.          
  448.     elseif new=='Resting' then
  449.      
  450.         -- We're resting
  451.         equip(sets.me.resting)
  452.     else
  453.         idle(pet)
  454.     end
  455. end
  456.  
  457. function pet_change(pet,gain)
  458.  
  459.     -- When we summon or release an avatar
  460.     idle(pet)
  461.     windower.add_to_chat(8,'----- Avatar set to '..mode..' mode! -----')
  462. end
  463.  
  464.  
  465. function self_command(command)
  466.  
  467.     local commandArgs = command
  468.      
  469.     -- This command takes //gs c avatar mode, where mode is what you want, eg, tank, acc, melee, etc
  470.     if #commandArgs:split(' ') >= 2 then
  471.         commandArgs = T(commandArgs:split(' '))
  472.         if commandArgs[1] == 'avatar' and pet.isvalid then
  473.             if commandArgs[2] then
  474.                 mode = tostring(commandArgs[2])
  475.                 if mode == 'mode' then
  476.                     if savedMode == 'perp' then
  477.                        mode = 'tank'
  478.                        savedMode = 'tank'
  479.                     elseif savedMode == 'tank' then
  480.                        mode = 'melee'
  481.                        savedMode = 'melee'
  482.                     elseif savedMode == 'melee' then
  483.                        mode = 'acc'
  484.                        savedMode = 'acc'
  485.                     elseif savedMode == 'acc' then
  486.                        mode = 'th'
  487.                        savedMode = 'th'
  488.                     elseif savedMode == 'th' then
  489.                        mode = 'favor'
  490.                        savedMode = 'favor'
  491.                     elseif savedMode == 'favor' then
  492.                        mode = 'perp'
  493.                        savedMode = 'perp'
  494.                     end
  495.                 end    
  496.                 equip(sets.avatar[mode])
  497.                 windower.add_to_chat(8,'----- Avatar set to '..mode..' mode! -----')
  498.             end
  499.         elseif commandArgs[1] == 'toggle' then
  500.             if commandArgs[2] == 'auto' then
  501.              
  502.                 -- //gs c toggle auto will toggle auto blood pacts on and off. Auto blood pact will make your GS repeat BPs under Apogee or Conduit
  503.                 -- And by repeat I mean repeat. If Conduit is up, it will SPAM the BP until Conduit is down
  504.                 if autobp then
  505.                     autobp = false
  506.                     windower.add_to_chat(8,'----- Auto BP mode Disabled -----')
  507.                 else
  508.                     autobp = true
  509.                     windower.add_to_chat(8,'----- Auto BP mode Enabled -----')
  510.                 end
  511.             elseif commandArgs[2] == 'melee' then
  512.              
  513.                 -- //gs c toggle melee will toggle melee mode on and off.
  514.                 -- This basically locks the slots that will cause you to lose TP if changing them,
  515.                 -- As well as equip your melee set if you're engaged
  516.  
  517.                 if meleeing then
  518.                     meleeing = false
  519.                     enable('main','sub','ranged')
  520.                     windower.add_to_chat(8,'----- Weapons Unlocked, WILL LOSE TP -----')
  521.                     idle(pet)
  522.                 else
  523.                     meleeing=true
  524.                     disable('main','sub','ranged')
  525.                     windower.add_to_chat(8,'----- Weapons Locked, WILL NOT LOSE TP -----')
  526.                     idle(pet)
  527.                 end
  528.                  
  529.             elseif commandArgs[2] == 'favor' then
  530.                      
  531.                 -- //gs c toggle favor will toggle Favor mode on and off.
  532.                 -- It won't automatically toggle, as some people like having favor active without the gear swaps for maximum effectiveness
  533.                 -- You need to toggle prioritisation yourself
  534.                 if favor then
  535.                     favor = false
  536.                     windower.add_to_chat(8,"----- Avatar's Favor Mode OFF -----")
  537.                 else
  538.                     favor = true
  539.                     windower.add_to_chat(8,"----- Avatar's Favor Mode ON -----")
  540.                 end
  541.             elseif commandArgs[2] == 'mb' then
  542.                      
  543.                 -- //gs c toggle mb will toggle mb mode on and off.
  544.                 -- You need to toggle prioritisation yourself
  545.                 if mBurst then
  546.                     mBurst = false
  547.                     windower.add_to_chat(8,"----- Avatar's MB Mode OFF -----")
  548.                 else
  549.                     mBurst = true
  550.                     windower.add_to_chat(8,"----- Avatar's MB Mode ON -----")
  551.                 end
  552.             end
  553.         -- Handles executing blood pacts in a generic, avatar-agnostic way.
  554.         -- //gs c pact [pacttype]
  555.         elseif commandArgs[1]:lower() == 'pact' then
  556.             if not pet.isvalid then
  557.                     windower.add_to_chat(122,'No avatar currently available. Returning to default macro set.')
  558.                     set_macros(1,2)
  559.                 return
  560.             end
  561.          
  562.             if not commandArgs[2] then
  563.                 windower.add_to_chat(123,'No pact type given.')
  564.                 return
  565.             end
  566.          
  567.             local pact = commandArgs[2]:lower()
  568.          
  569.             if not pacts[pact] then
  570.                 windower.add_to_chat(123,'Unknown pact type: '..tostring(pact))
  571.                 return
  572.             end
  573.          
  574.             if pacts[pact][pet.name] then
  575.                 if pact == 'astralflow' and not buffactive['astral flow'] then
  576.                     windower.add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
  577.                     return
  578.                 end
  579.          
  580.                 -- Leave out target; let Shortcuts auto-determine it.
  581.                 send_command('@input /pet "'..pacts[pact][pet.name]..'"')
  582.             else
  583.                 windower.add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
  584.             end
  585.         end
  586.     end
  587. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement