Advertisement
Jomiru

New_SMN.lua

Sep 23rd, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 32.22 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Some of Motenten's Functions ** --
  3. -- Last Updated: 05/05/14 12:00 AM *Fixed Magic Sets & Added Precast Elemental Staff Toggle* --
  4.  
  5.  
  6. -- Jomiru:  please see my comments below in the aftercast(), status_change(), and pet_change() functions for changes. --JW 8/23/2014
  7.  
  8.  
  9. function get_sets()
  10.         IdleIndex = 1
  11.         IdleArray = {"Movement","Refresh"} -- Default Idle Set Is Movement --
  12.         Armor = 'None'
  13.         Kiting = 'OFF' -- Set Default Avatar/Sublimation Kiting Set ON or OFF Here --
  14.         ElementalStaff = 'ON' -- Set Default Precast Elemental Staff ON or OFF Here --
  15.         target_distance = 5 -- Set Default Distance Here --
  16.  
  17.         Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  18.         Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  19.         sc_map = {SC1 = "Garuda", SC2 = "Ramuh", SC3 = "Fenrir"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  20.  
  21.         Cities = S{
  22.                         "Ru'lude Gardens","Upper Jeuno","Lower Jeuno","Port Jeuno",
  23.                         "Port Windurst","Windurst Waters","Windurst Woods","Windurst Walls","Heavens Tower",
  24.                         "Port San d'Oria","Northern San d'Oria","Southern San d'Oria",
  25.                         "Port Bastok","Bastok Markets","Bastok Mines","Metalworks",
  26.                         "Aht Urhgan Whitegate","Nashmau","Tavanazian Safehold",
  27.                         "Selbina","Mhaura","Norg","Eastern Adoulin","Western Adoulin","Kazham"}
  28.  
  29.         Avatars = S{
  30.                         "Ramuh","Garuda","Alexander","Fenrir","Titan","Shiva","Ifrit","Diabolos",
  31.                         "Leviathan","Carbuncle","Odin","Cait Sith"}
  32.  
  33.         -- Use The Following Spirit Spells Again To Trigger Auto Elemental Siphon --
  34.         Spirits = S{
  35.                         "Fire Spirit","Ice Spirit","Air Spirit","Earth Spirit","Thunder Spirit",
  36.                         "Water Spirit","Light Spirit","Dark Spirit"}
  37.  
  38.         SpiritPacts = S{
  39.                         "FireSpirit","IceSpirit","AirSpirit","EarthSpirit","ThunderSpirit",
  40.                         "WaterSpirit","LightSpirit","DarkSpirit"}
  41.  
  42.         MagicalRagePacts = S{
  43.                         'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgement Bolt',
  44.                         'Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II',
  45.                         'Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV',
  46.                         'Thunderspark','Burning Strike','Meteorite','Nether Blast','Flaming Crush',
  47.                         'Meteor Strike','Heavenly Strike','Wind Blade','Geocrush','Grand Fall','Thunderstorm',
  48.                         'Holy Mist','Searing Light','Howling Moon','Ruinous Omen','Lunar Bay','Night Terror'}
  49.  
  50.         -- The Following BPs Can Be Triggered By Using The Avatar Spells Again --
  51.         -- Can Replace Whatever BPs You Like For Each Listed Avatars --
  52.         BloodPactWard = {
  53.                         Garuda = "Fleet Wind", Ifrit = "Inferno Howl", Fenrir = "Ecliptic Growl",
  54.                         Titan = "Earthen Armor", Leviathan = "Spring Water", Carbuncle = "Soothing Ruby",
  55.                         Diabolos = "Noctoshield"}
  56.  
  57.         DebuffBloodPactWard = S{
  58.                         'Diamond Storm','Sleepga','Slowga','Tidal Roar','Nightmare','Pavor Nocturnus',
  59.                         'Ultimate Terror','Somnolence','Lunar Cry','Lunar Roar'}
  60.  
  61.         durations = {}
  62.         durations['Earthen Armor'] = 232
  63.         durations['Shining Ruby'] = 340
  64.         durations['Dream Shroud'] = 352
  65.         durations['Noctoshield'] = 352
  66.         durations['Inferno Howl'] = 232
  67.         durations['Hastega'] = 352
  68.  
  69.         timer_icons = {}
  70.         -- 00054 for stoneskin, or 00299 for Titan
  71.         timer_icons['Earthen Armor'] = 'spells/00299.png'
  72.         -- 00043 for protect, or 00296 for Carby
  73.         timer_icons['Shining Ruby'] = 'spells/00043.png'
  74.         -- 00304 for Diabolos
  75.         timer_icons['Dream Shroud'] = 'spells/00304.png'
  76.         -- 00106 for phalanx, or 00304 for Diabolos
  77.         timer_icons['Noctoshield'] = 'spells/00106.png'
  78.         -- 00100 for enfire, or 00298 for Ifrit
  79.         timer_icons['Inferno Howl'] = 'spells/00298.png'
  80.         -- 00358 for hastega, or 00301 for Garuda
  81.         timer_icons['Hastega'] = 'spells/00358.png'
  82.  
  83.         -- Idle Sets --
  84.         sets.Idle = {}
  85.         sets.Idle.Refresh = {
  86.                         main="Bolelabunga",
  87.                         sub="Genbu's Shield",
  88.                         ammo="Seraphicaller",
  89.                         head="Convoker's Horn +1",
  90.                         neck="Twilight Torque",
  91.                         ear1="Ethereal Earring",
  92.                         ear2="Black Earring",
  93.                         body="Hagondes Coat",
  94.                         hands="Serpentes Cuffs",
  95.                         ring1={name="Dark Ring",augments={"Phys. dmg. taken -6%","Breath dmg. taken -4%","Magic dmg. taken -4%"}},
  96.                         ring2={name="Dark Ring",augments={"Enemy crit. hit rate -2","Phys. dmg. taken -5%","Magic dmg. taken -6%"}},
  97.                         back="Repulse Mantle",
  98.                         waist="Fucho-no-Obi",
  99.                         legs="Nares Trews",
  100.                         feet="Serpentes Sabots"}
  101.         sets.Idle.Movement = set_combine(sets.Idle.Refresh,{
  102.                         feet="Herald's Gaiters"})
  103.         sets.Resting = set_combine(sets.Idle.Refresh,{
  104.                         main="Boonwell Staff",
  105.                         sub="Vox Grip",
  106.                         ammo="Clarus Stone",
  107.                         head="Orvail Corona",
  108.                         neck="Eidolon Pendant",
  109.                         ear2="Antivenom Earring",
  110.                         hands="Nares Cuffs",
  111.                         ring1="Angha Ring",
  112.                         ring2="Star Ring",
  113.                         back="Felicitas Cape",
  114.                         waist="Austerity Belt",
  115.                         legs="Nisse Slacks",
  116.                         feet="Chelona Boots"})
  117.  
  118.         -- PDT Set --
  119.         sets.PDT = {}
  120.  
  121.         sets.Sublimation = {}
  122.  
  123.         sets.Precast = {}
  124.         -- Fastcast Set --
  125.         sets.Precast.FastCast = {
  126.                         main="Plenitas Virga",
  127.                         sub="Vox Grip",
  128.                         ammo="Seraphicaller",
  129.                         head="Nahtirah Hat",
  130.                         ear2="Loquac. Earring",
  131.                         body="Hagondes Coat",
  132.                         hands="Repartie Gloves",
  133.                         ring1="Prolix Ring",
  134.                         ring2="Veneficium Ring",
  135.                         back="Ogapepo Cape",
  136.                         waist="Witful Belt",
  137.                         legs="Mes'yohi Slacks",
  138.                         feet="Chelona Boots"}
  139.  
  140.         -- Precast BloodPact --
  141.         sets.Precast.BloodPact = {
  142.                         ammo="Seraphicaller",
  143.                         head="Convoker's Horn +1",
  144.                         body="Glyphic Doublet +1",
  145.                         ear1="Caller's Earring",
  146.                         hands="Convoker's bracers +1",
  147.                         feet="Glyphic Pigaches +1"
  148.                         }
  149.  
  150.         -- Elemental Staves --
  151.         sets.Precast.Thunder = {}
  152.         sets.Precast.Water = {}
  153.         sets.Precast.Fire = {}
  154.         sets.Precast.Ice = {}
  155.         sets.Precast.Wind = {}
  156.         sets.Precast.Earth = {}
  157.         sets.Precast.Light = {}
  158.         sets.Precast.Dark = {}
  159.  
  160.         sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{waist="Siegel Sash"})
  161.  
  162.         -- Precast Cure Set --
  163.         sets.Precast.Cure = {
  164.                         main="Tamaxchi",
  165.                         sub="Genbu's Shield",
  166.                         head="Nahtirah Hat",
  167.                         ear2="Loquac. Earring",
  168.                         body="Heka's Kalasiris",
  169.                         ring1="Prolix Ring",
  170.                         ring2="Veneficium Ring",
  171.                         back="Pahtli Cape",
  172.                         waist="Witful Belt",
  173.                         feet="Chelona Boots"}
  174.  
  175.         -- Midcast Base Set --
  176.         sets.Midcast = {
  177.                         main="Plenitas Virga",
  178.                         head="Nahtirah Hat",
  179.                         ear2="Loquac. Earring",
  180.                         body="Hagondes Coat",
  181.                         hands="Repartie Gloves",
  182.                         ring1="Prolix Ring",
  183.                         ring2="Veneficium Ring",
  184.                         back="Ogapepo Cape",
  185.                         waist="Witful Belt",
  186.                         legs="Mes'yohi Slacks",
  187.                         feet="Chelona Boots"}
  188.  
  189.         -- Haste Set --
  190.         sets.Midcast.Haste = {
  191.                         main="Plenitas Virga",
  192.                         head="Nahtirah Hat",
  193.                         ear2="Loquac. Earring",
  194.                         body="Hagondes Coat",
  195.                         hands="Repartie Gloves",
  196.                         ring1="Prolix Ring",
  197.                         ring2="Veneficium Ring",
  198.                         back="Ogapepo Cape",
  199.                         waist="Witful Belt",
  200.                         legs="Mes'yohi Slacks",
  201.                         feet="Chelona Boots"}
  202.  
  203.         -- Cure Set --
  204.         sets.Midcast.Cure = {
  205.                         main="Tamaxchi",
  206.                         sub="Genbu's Shield",
  207.                         head="Nahtirah Hat",
  208.                         ear1="Lifestorm Earring",
  209.                         ear2="Loquac. Earring",
  210.                         body="Heka's Kalasiris",
  211.                         hands="Bokwus Gloves",
  212.                         ring1="Sirona's Ring",
  213.                         ring2="Ephedra Ring",
  214.                         back="Pahtli Cape",
  215.                         waist="Witful Belt",
  216.                         legs="Mes'yohi Slacks",
  217.                         feet="Hagondes Sabots"}
  218.  
  219.         -- Curaga Set --
  220.         sets.Midcast.Curaga = {
  221.                         main="Tamaxchi",
  222.                         sub="Genbu's Shield",
  223.                         head="Nahtirah Hat",
  224.                         ear1="Lifestorm Earring",
  225.                         ear2="Loquac. Earring",
  226.                         body="Heka's Kalasiris",
  227.                         hands="Bokwus Gloves",
  228.                         ring1="Sirona's Ring",
  229.                         ring2="Ephedra Ring",
  230.                         back="Pahtli Cape",
  231.                         waist="Witful Belt",
  232.                         legs="Mes'yohi Slacks",
  233.                         feet="Hagondes Sabots"}
  234.  
  235.         -- Enhancing Magic Set --
  236.         sets.Midcast['Enhancing Magic'] = {
  237.                         neck="Colossus's Torque"}
  238.  
  239.         -- Stoneskin Set --
  240.         sets.Midcast.Stoneskin = set_combine(sets.Midcast['Enhancing Magic'],{neck="Stone Gorget",waist="Siegel Sash"})
  241.  
  242.         -- Avatars Sets
  243.         sets.Avatars = {
  244.                         main="Gridarvor",
  245.                         sub="Vox Grip",
  246.                         ammo="Seraphicaller",
  247.                         head="Convoker's Horn +1",
  248.                         neck="Caller's Pendant",
  249.                         ear1="Andoaa Earring",
  250.                         ear2="Gifted Earring",
  251.                         body="Glyphic Doublet +1",
  252.                         hands="Regimen Mittens",
  253.                         ring2="Fervor Ring",
  254.                         ring1="Evoker's Ring",
  255.                         back="Conveyance Cape",
  256.                         waist="Fucho-no-Obi",
  257.                         legs="Nares Trews",
  258.                         feet="Convoker's Pigaches +1"}
  259.         sets.Avatars['Carbuncle'] = {
  260.                         main="Gridarvor",
  261.                         sub="Vox Grip",
  262.                         ammo="Seraphicaller",
  263.                         head="Convoker's Horn +1",
  264.                         neck="Caller's Pendant",
  265.                         ear1="Andoaa Earring",
  266.                         ear2="Gifted Earring",
  267.                         body="Hagondes Coat",
  268.                         hands="Carbuncle Mitts",
  269.                         ring2="Fervor Ring",
  270.                         ring1="Evoker's Ring",
  271.                         back="Conveyance Cape",
  272.                         waist="Fucho-no-Obi",
  273.                         legs="Nares Trews",
  274.                         feet="Herald's Gaiters"}
  275.                        
  276.         -- Avatar's Favor Set --
  277.         sets.Favor = {}
  278.  
  279.         -- Spirits Set --
  280.         sets.Spirits = set_combine(sets.Avatars,{})
  281.  
  282.         sets.Midcast.Pet = {}
  283.         -- Normal BloodPactWard/PD Set --
  284.         sets.Midcast.Pet.BloodPactWard = {
  285.                         main="Eminent Pole",
  286.                         sub="Vox Grip",
  287.                         ammo="Seraphicaller",
  288.                         head="Convoker's Horn +1",
  289.                         neck="Caller's Pendant",
  290.                         ear1="Andoaa Earring",
  291.                         ear2="Gifted Earring",
  292.                         body="Caller's Doublet +2",
  293.                         hands="Summoner's Bracers",
  294.                         ring1="Evoker's Ring",
  295.                         ring2="Fervor Ring",
  296.                         back="Conveyance Cape",
  297.                         waist="Diabolos's Rope",
  298.                         legs="Ngen Seraweels",
  299.                         feet="Caller's Pgch. +2"}
  300.  
  301.         -- Magic Accuracy BloodPactWard Set --
  302.         sets.Midcast.Pet.BloodPactWard_MACC = set_combine(sets.Midcast.Pet.BloodPactWard,{
  303.                         legs="Summoner's Spats +2",
  304.                         feet="Caller's Pgch. +2"})
  305.  
  306.         -- Physical BloodPactRage Set --
  307.         sets.Midcast.Pet.PhysicalBloodPactRage = {
  308.                         main="Gridarvor",
  309.                         sub="Vox Grip",
  310.                         ammo="Seraphicaller",
  311.                         head="Hagondes Hat",
  312.                         neck="Caller's Pendant",
  313.                         ear1="Andoaa Earring",
  314.                         ear2="Gifted Earring",
  315.                         body="Convoker's Doublet +1",
  316.                         hands="Regimen Mittens",
  317.                         ring1="Evoker's Ring",
  318.                         ring2="Fervor Ring",
  319.                         back="Samanisi Cape",
  320.                         waist="Diabolos's Rope",
  321.                         legs="Ngen Seraweels",
  322.                         feet="Convoker's Pigaches +1"}
  323.  
  324.         -- Magical BloodPactRage Set --
  325.         sets.Midcast.Pet.MagicalBloodPactRage = set_combine(sets.Midcast.Pet.PhysicalBloodPactRage,{
  326.                         main="Eminent Pole",
  327.                         head="Bokwus Circlet",
  328.                         neck="Eidolon Pendant",
  329.                         back="Altius Mantle",
  330.                         waist="Caller's Sash",
  331.                         legs="Caller's Spats +2",
  332.                         feet="Hagondes Sabots"})
  333.  
  334.         -- Shock Squall Set --
  335.         sets.Midcast.Pet['Shock Squall'] = {
  336.                         main="Eminent Pole",
  337.                         sub="Vox Grip",
  338.                         ammo="Seraphicaller",
  339.                         head="Bokwus Circlet",
  340.                         neck="Eidolon Pendant",
  341.                         ear1="Andoaa Earring",
  342.                         ear2="Gifted Earring",
  343.                         body="Convoker's Doublet +1",
  344.                         hands="Caller's Bracers +2",
  345.                         ring1="Evoker's Ring",
  346.                         ring2="Fervor Ring",
  347.                         back="Conveyance Cape",
  348.                         waist="Caller's Sash",
  349.                         legs="Caller's Spats +2",
  350.                         feet="Caller's Pigaches +2"}
  351.  
  352.         -- JA Sets --
  353.         sets.JA = {}
  354.         sets.JA['Mana Cede'] = {hands="Call. Bracers +2"}
  355.         sets.JA['Elemental Siphon'] = set_combine(sets.Midcast.Pet.BloodPactWard,{main="Soulscourge",sub="Vox Grip",back="Conveyance Cape",feet="Caller's Pgch. +2"})
  356.         sets.JA['Astral Flow'] = {head="Summoner's Horn +2"}
  357.  
  358.         -- Melee Set --
  359.         sets.Melee = set_combine(sets.Midcast.Haste,{})
  360.  
  361.         -- WS Base Set --
  362.         sets.WS = {}
  363.         sets.WS.Shattersoul = {}
  364.         sets.WS.Myrkr = {}
  365.         sets.WS["Garland of Bliss"] = {}
  366. end
  367.  
  368. function pretarget(spell,action)
  369.         if (spell.type:endswith('Magic') or spell.type == "SummonerPact" or spell.type == "Ninjutsu") and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  370.                 cancel_spell()
  371.                 send_command('input /echo use echos!')
  372.         elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  373.                 degrade_spell(spell,Cure_Spells)
  374.         elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  375.                 degrade_spell(spell,Curaga_Spells)
  376.         elseif Spirits:contains(spell.english) and pet.isvalid then
  377.                 cancel_spell()
  378.                 send_command('ElementalSiphon;wait 1;Release')
  379.         elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
  380.                 if spell.english == "Light Arts" and not buffactive['Addendum: White'] then
  381.                         cancel_spell()
  382.                         send_command('input /ja Addendum: White <me>')
  383.                 elseif spell.english == "Manifestation" then
  384.                         cancel_spell()
  385.                         send_command('input /ja Accession <me>')
  386.                 elseif spell.english == "Alacrity" then
  387.                         cancel_spell()
  388.                         send_command('input /ja Celerity <me>')
  389.                 elseif spell.english == "Parsimony" then
  390.                         cancel_spell()
  391.                         send_command('input /ja Penury <me>')
  392.                 end
  393.         elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  394.                 if spell.english == "Dark Arts" and not buffactive['Addendum: Black'] then
  395.                         cancel_spell()
  396.                         send_command('input /ja Addendum: Black <me>')
  397.                 elseif spell.english == "Accession" then
  398.                         cancel_spell()
  399.                         send_command('input /ja Manifestation <me>')
  400.                 elseif spell.english == "Celerity" then
  401.                         cancel_spell()
  402.                         send_command('input /ja Alacrity <me>')
  403.                 elseif spell.english == "Penury" then
  404.                         cancel_spell()
  405.                         send_command('input /ja Parsimony <me>')
  406.                 end
  407.         end
  408. end
  409.  
  410. function precast(spell,action)
  411.         if spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  412.                 if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
  413.                         cancel_spell()
  414.                         add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  415.                         return
  416.                 else
  417.                         if string.find(spell.english,'Cur') and spell.english ~= "Cursna" then
  418.                                 equip(sets.Precast.Cure)
  419.                         elseif string.find(spell.english,'Utsusemi') then
  420.                                 if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  421.                                         cancel_spell()
  422.                                         add_to_chat(123, spell.english .. ' Canceled: [3+ Images]')
  423.                                         return
  424.                                 else
  425.                                         equip(sets.Precast.FastCast)
  426.                                 end
  427.                         elseif sets.Precast[spell.skill] then
  428.                                 equip(sets.Precast[spell.skill])
  429.                         else
  430.                                 equip(sets.Precast.FastCast)
  431.                         end
  432.                 end
  433.         elseif spell.type == "SummonerPact" then
  434.                 if (Avatars:contains(spell.english) or Spirits:contains(spell.english)) then
  435.                         if Cities:contains(world.area) then
  436.                                 cancel_spell()
  437.                                 add_to_chat(123,'Unable To Summon Pacts In Town')
  438.                                 return
  439.                         else
  440.                                 if buffactive.silence then -- Cancel SummoningMagic If You Are Silenced --
  441.                                         cancel_spell()
  442.                                         add_to_chat(123, spell.name..' Canceled: [Silenced]')
  443.                                         return
  444.                                 else
  445.                                         equip(sets.Precast.FastCast)
  446.                                 end
  447.                         end
  448.                 end
  449.         elseif spell.type == "WeaponSkill" then
  450.                 if player.status ~= 'Engaged' then
  451.                         cancel_spell()
  452.                         add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  453.                         return
  454.                 elseif sets.WS[spell.english] then
  455.                         equip(sets.WS[spell.english])
  456.                 end
  457.         elseif spell.type == "JobAbility" then
  458.                 if sets.JA[spell.english] then
  459.                         equip(sets.JA[spell.english])
  460.                 end
  461.         elseif string.find(spell.type,'BloodPact') then
  462.                 equip(sets.Precast.BloodPact)
  463.         elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  464.                 cast_delay(0.2)
  465.                 send_command('cancel Sneak')
  466.         end
  467.         if sets.Precast[spell.element] and ElementalStaff == 'ON' then
  468.                 equip(sets.Precast[spell.element])
  469.         end
  470. end
  471.  
  472. function midcast(spell,action)
  473.         equipSet = {}
  474.         if spell.type:endswith('Magic') or spell.type == 'Ninjutsu' then
  475.                 equipSet = sets.Midcast
  476.                 if equipSet[spell.english] then
  477.                         equipSet = equipSet[spell.english]
  478.                 elseif string.find(spell.english,'Cure') then
  479.                         equipSet = equipSet.Cure
  480.                 elseif string.find(spell.english,'Cura') then
  481.                         equipSet = equipSet.Curaga
  482.                 elseif spell.english == "Stoneskin" then
  483.                         if buffactive.Stoneskin then
  484.                                 send_command('@wait 2.8;cancel stoneskin')
  485.                         end
  486.                         equipSet = equipSet.Stoneskin
  487.                 elseif spell.english == "Sneak" then
  488.                         if spell.target.name == player.name and buffactive['Sneak'] then
  489.                                 send_command('cancel sneak')
  490.                         end
  491.                         equipSet = equipSet.Haste
  492.                 elseif string.find(spell.english,'Utsusemi') then
  493.                         if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  494.                                 send_command('@wait 1.7;cancel Copy Image*')
  495.                         end
  496.                         equipSet = equipSet.Haste
  497.                 elseif spell.english == 'Monomi: Ichi' then
  498.                         if buffactive['Sneak'] then
  499.                                 send_command('@wait 1.7;cancel sneak')
  500.                         end
  501.                         equipSet = equipSet.Haste
  502.                 elseif equipSet[spell.skill] then
  503.                         equipSet = equipSet[spell.skill]
  504.                 end
  505.         elseif equipSet[spell.english] then
  506.                 equipSet = equipSet[spell.english]
  507.         end
  508.         equip(equipSet)
  509. end
  510.  
  511. function aftercast(spell,action)
  512.        
  513.         --[[ Since pet_change() is a function that processes on pet gain/loss completely separate from aftercast(),
  514.                 it behooves us to force aftercast() to ignore Release and let the status_change() be handled by
  515.                 pet_change() instead.  Keeps the code simple.
  516.                
  517.         This is the original statement:
  518.        
  519.         if not string.find(spell.type,'BloodPact') and not Avatars:contains(spell.english) and not Spirits:contains(spell.english) then
  520.                 status_change(player.status)
  521.        
  522.         Basically this was saying "anything that isn't a bp, isn't an avatar, isn't a spirit, go ahead and hit status_change()."
  523.         The system can't handle this...it's looking for the wrong stuff.
  524.        
  525.         However, this also suggests we need to leave BP gear on for the duration of the BP and let pet_aftercast() handle the status_change().
  526.         This probably makes sense if it is something that needs MAB or something.
  527.         I'll take this as read; I'm not 100% certain how summoner works, unfortunately.
  528.        
  529.         One more thing -- we want this to ignore when we summon something.  We don't want aftercast() and pet_change() colliding.
  530.                 -JW
  531.         ]]--
  532.        
  533.         if spell.english == "Release" or spell.type =='BloodPactWard' or spell.type == 'BloodPactRage' or spell.type == 'SummonerPact' then
  534.                 --add_to_chat(158,'Release or BP or summon, skipping aftercast()')
  535.                 return      -- Get ouuuuutttt get ouuuttt
  536.         end
  537.        
  538.         status_change(player.status)
  539.                
  540.         if spell.english == "Sleepga" and not spell.interrupted then -- Sleepga Countdown --
  541.                 send_command('wait 30;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
  542.         end
  543. end
  544.  
  545. function status_change(new,old)
  546.         if Armor == 'PDT' then
  547.                 equip(sets.PDT)
  548.  
  549.         elseif pet.isvalid then
  550.                 if SpiritPacts:contains(pet.name) then
  551.                         equip(sets.Spirits)
  552.                 elseif buffactive["Avatar's Favor"] then
  553.                         equip(sets.Favor)
  554.                 else
  555.                         equip(sets.Avatars)
  556.                         --add_to_chat(158,'Generic Avatar Gear Activated')
  557.                        
  558.                         --[[ I have found the problem with Carbuncle is not endemic to gearswap; rather
  559.                                 it is a problem with the game itself.  When first summoned, Carbuncle may
  560.                                 spawn nameless (briefly), therefore not allowing the set to properly activate.
  561.                                 I thoroughly tested that this was the case.  I have not seen it happen
  562.                                 with any other avatars.  Therefore, I added a check to see if there is
  563.                                 a pet out, but it has no "name" at the time of this activation.  It
  564.                                 will automatically apply the Carbuncle gear.  This is a clunky clause,
  565.                                 assuming this will only ever happen with Carbuncle, so I have left
  566.                                 the test chat in it in case this ever occurs with another avatar. -JW
  567.                         ]]--
  568.                        
  569.                         if pet.name == nil then                 -- THE CARBY CLAUSE!
  570.                                 equip(sets.Avatars['Carbuncle'])
  571.                                 add_to_chat(123,'<< Nil Avatar Detected:  Carbuncle Gear Applied >>')
  572.                         end
  573.                         if sets.Avatars[pet.name] then
  574.                                 equip(sets.Avatars[pet.name])
  575.                                 --add_to_chat(158,'Avatar-specific Gear Activated')
  576.                         end
  577.                 end
  578.            
  579.                 if Kiting == 'ON' then
  580.                         equip({feet="Herald's Gaiters"})
  581.                 end
  582.         elseif buffactive["Sublimation: Activated"] then
  583.                 equip(sets.Sublimation)
  584.                 if Kiting == 'ON' then
  585.                         equip({feet="Herald's Gaiters"})
  586.                 end
  587.         elseif new == 'Engaged' then
  588.                 equip(sets.Melee)
  589.         elseif new == 'Idle' then
  590.                 equip(sets.Idle[IdleArray[IdleIndex]])
  591.         elseif new == 'Resting' then
  592.                 equip(sets.Resting)
  593.         end
  594. end
  595.  
  596. function pet_midcast(spell)
  597.         if spell.english == 'Perfect Defense' then
  598.                 equip(sets.Midcast.Pet.BloodPactWard)
  599.         elseif spell.type == 'BloodPactWard' then
  600.                 if DebuffBloodPactWard:contains(spell.english) then
  601.                         equip(sets.Midcast.Pet.BloodPactWard_MACC)
  602.                 elseif sets.Midcast.Pet[spell.english] then
  603.                         equip(sets.Midcast.Pet[spell.english])
  604.                 else
  605.                         equip(sets.Midcast.Pet.BloodPactWard)
  606.                 end
  607.         elseif spell.type == 'BloodPactRage' then
  608.                 if MagicalRagePacts:contains(spell.english) then
  609.                         equip(sets.Midcast.Pet.MagicalBloodPactRage)
  610.                 else
  611.                         equip(sets.Midcast.Pet.PhysicalBloodPactRage)
  612.                 end
  613.         end
  614. end
  615.  
  616. function pet_aftercast(spell)
  617.         if not spell.interrupted then
  618.                 -- Create custom timers for ward pacts.
  619.                 if durations[spell.english] then
  620.                         local timer_cmd = 'timers c "'..spell.english..'" '..tostring(durations[spell.english])..' down'
  621.  
  622.                         if timer_icons[spell.english] then
  623.                                 timer_cmd = timer_cmd..' '..timer_icons[spell.english]
  624.                         end
  625.  
  626.                         send_command(timer_cmd)
  627.                 end
  628.         end
  629.         add_to_chat(158,'pet_aftercast() activated!')
  630.         if not midaction() then
  631.                 status_change(player.status)
  632.         end
  633. end
  634.  
  635.  
  636. function pet_change(pet,gain)
  637.         --[[ This needs to have a separate check to make sure you're not in the process of doing something else
  638.                 when your pet is gained or lost.  This is a separate check from your aftercast(), so this will
  639.                 goober you up if you cast too quickly after releasing without a midaction() check.  --JW ]]--
  640.                
  641.         if not midaction() then
  642.                 status_change(player.status)
  643.         end
  644. end
  645.  
  646.  
  647. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  648. function self_command(command)
  649.         if command == 'C1' then -- Kiting Toggle --
  650.                 if Kiting == 'ON' then
  651.                         Kiting = 'OFF'
  652.                         add_to_chat(123,'Kiting Set: [Unlocked]')
  653.                 else
  654.                         Kiting = 'ON'
  655.                         add_to_chat(158,'Kiting Set: [Locked]')
  656.                 end
  657.                 status_change(player.status)
  658.         elseif command == 'C5' then -- Auto Update Gear Toggle --
  659.                 status_change(player.status)
  660.                 add_to_chat(158,'Auto Update Gear')
  661.         elseif command == 'C7' then
  662.                 if Armor == 'PDT' then -- PDT Toggle --
  663.                         Armor = 'None'
  664.                         add_to_chat(123,'PDT Set: [Unlocked]')
  665.                 else
  666.                         Armor = 'PDT'
  667.                         add_to_chat(158,'PDT Set: [Locked]')
  668.                 end
  669.                 status_change(player.status)
  670.         elseif command == 'C8' then -- Distance Toggle --
  671.                 if player.target.distance then
  672.                         target_distance = math.floor(player.target.distance*10)/10
  673.                         add_to_chat(158,'Distance: '..target_distance)
  674.                 else
  675.                         add_to_chat(123,'No Target Selected')
  676.                 end
  677.         elseif command == 'C6' then -- Idle Toggle --
  678.                 IdleIndex = (IdleIndex % #IdleArray) + 1
  679.                 add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
  680.                 status_change(player.status)
  681.         elseif command:match('^SC%d$') then
  682.                 send_command('//' .. sc_map[command])
  683.         end
  684. end
  685.  
  686. function actualCost(originalCost)
  687.         if buffactive["Penury"] then
  688.                 return originalCost*.5
  689.         elseif buffactive["Light Arts"] then
  690.                 return originalCost*.9
  691.         else
  692.                 return originalCost
  693.         end
  694. end
  695.  
  696. function degrade_spell(spell,degrade_array)
  697.         spell_index = table.find(degrade_array,spell.name)
  698.         if spell_index > 1 then
  699.                 new_spell = degrade_array[spell_index - 1]
  700.                 change_spell(new_spell,spell.target.raw)
  701.                 add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  702.         end
  703. end
  704.  
  705. function change_spell(spell_name,target)
  706.         cancel_spell()
  707.         send_command('//'..spell_name..' '..target)
  708. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement