doman's ffxi gearswap lua storage

i'm a nerd and i play ffxi on more than one computer. needed a place to store them where i can just grab them on both.

don't judge me

or my current gear shut up

BLU:

function get_sets()

    send_command('bind f9 gs c toggle TP set')
    send_command('bind !f9 gs c toggle weapon lock')
    send_command('bind f10 gs c toggle Idle set')
    send_command('bind f11 gs c toggle CDC set')
    send_command('bind f12 gs c toggle Req set')
    send_command('bind !f12 gs c toggle Rea set')
    send_command('bind ^` gs c toggle MB set')

    function file_unload()

        send_command('unbind ^f9')
        send_command('unbind ^f10')
        send_command('unbind ^f11')
        send_command('unbind ^f12')

        send_command('unbind !f9')
        send_command('unbind !f10')
        send_command('unbind !f11')
        send_command('unbind !f12')

        send_command('unbind f9')
        send_command('unbind f10')
        send_command('unbind f11')
        send_command('unbind f12')

    end    

    --Multiples--

    RosmertasCape = {}
        RosmertasCape.CDC = { name="Rosmerta's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Crit.hit rate+10',} }
        RosmertasCape.SVG = { name="Rosmerta's Cape", augments={'STR+20','Accuracy+20 Attack+20','Weapon skill damage +10%',} }
        RosmertasCape.MAB = { name="Rosmerta's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','"Mag.Atk.Bns."+10',} }
        RosmertasCape.TP = { name="Rosmerta's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10',} }
        --TODO: finish building STR one so total STR is 30, finish building INT/MAB cape--

    TaeonChapeau = {}
        TaeonChapeau.TP = { name="Taeon Chapeau", augments={'Accuracy+17','"Triple Atk."+2','Crit. hit damage +1%',} }
        --TaeonChapeau.FC = { name="Taeon Chapeau", augments={'Fast Cast+5'}}
        TaeonChapeau.SC = { name="Taeon Chapeau", augments={'Potency of "Cure" effect received +6%'}}

    TaeonGloves = {}
        TaeonGloves.TP = { name="Taeon Gloves", augments={'Accuracy+14 Attack+14','"Triple Atk."+2','DEX+8',} }

    TaeonTights = {}
        TaeonTights.TP = { name="Taeon Tights", augments={'Accuracy+19','"Triple Atk."+2','STR+7 DEX+7',} }

    TaeonBoots = {}
        TaeonBoots.TP = { name="Taeon Boots", augments={'Attack+25','"Triple Atk."+2','STR+7 DEX+7',} }

    --TODO: Dark Rings to put in DT sets--
    DarkRings = {}
        DarkRings.PDT = { name="Dark Ring", augments ={"Phys. dmg. taken -3%"}}
        DarkRings.MDT = { name="Dark Ring", augments ={"Magic dmg. taken -3%"}}

    --Idle Sets--    
    sets.Idle = {}

    sets.Idle.index = {'Standard', 'DT'}
    Idle_ind = 1

    sets.Idle.Standard = { ammo="Ginsen",
                          head="Rawhide mask",neck="Sanctity necklace", ear1="Ethereal earring", ear2="Brachyura earring",
                          body="Jhakri robe +2",hands="Ayanmo manopolas +1",ring1="Karieyh ring",ring2="Ayanmo ring",
                          back=RosmertasCape.TP,waist="Flume belt",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    sets.Idle.DT = { ammo="Ginsen",
                          head="Ayanmo zucchetto +2",neck="Twilight torque", ear1="Ethereal earring", ear2="Brachyura earring",
                          body="Ayanmo corazza +2",hands="Ayanmo manopolas +1",ring1=DarkRings.PDT,ring2="Ayanmo ring",
                          back=RosmertasCape.TP,waist="Flume belt",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    --TP Sets--
    sets.TP = {}

    sets.TP.index = {'Standard', 'Accuracy', 'PDT', 'MDT', 'DTAccuracy', 'MDTAccuracy', 'SubNinja', 'SubNinjaDT'}

    TP_ind = 1

    sets.TP.Standard = {
                        ammo="Ginsen",
                        head="Adhemar bonnet",neck="Mirage stole +1", ear1="Suppanomimi", ear2="Cessance earring",
                        body="Adhemar jacket +1",hands="Adhemar wristbands +1",ring1="Epona's ring",ring2="Petrov ring",
                        back=RosmertasCape.TP,waist="Windbuffet belt +1",legs="Samnuha tights",feet="Herculean boots"}

    --most accuracy--
    sets.TP.Accuracy = {
                        ammo="Ginsen",
                            head="Ayanmo zucchetto +2", neck="Mirage stole +1", ear1="Mache earring", ear2="Suppanomimi",
                            body="Ayanmo corazza +2",hands="Adhemar wristbands +1",ring1="Epona's ring",ring2="Petrov ring",
                            back=RosmertasCape.TP,waist="Windbuffet belt +1",legs="Samnuha tights",feet="Ayanmo gambieras +2"}

    sets.TP.PDT = {ammo="Ginsen",
                            head="Ayanmo zucchetto +2", neck="Twilight torque", ear1="Suppanomimi", ear2="Cessance earring",
                            body="Ayanmo corazza +2",hands="Ayanmo manopolas +1",ring1="Epona's ring",ring2="Ayanmo ring",
                            back=RosmertasCape.TP,waist="Flume belt",legs="Ayanmo cosciales +2",feet="Herculean boots"}

    sets.TP.MDT = {ammo="Ginsen",
                            head="Ayanmo zucchetto +2", neck="Twilight torque", ear1="Suppanomimi", ear2="Cessance earring",
                            body="Ayanmo corazza +2",hands="Adhemar wristbands +1",ring1="Epona's ring",ring2="Ayanmo ring",
                            back=RosmertasCape.TP,waist="Shetal stone",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    --less acc but mixed with DT--
    sets.TP.DTAccuracy = {ammo="Honed tathlum",
                            head="Ayanmo zucchetto +2", neck="Ej necklace", ear1="Cessance earring", ear2="Suppanomimi",
                            body="Ayanmo corazza +2",hands="Ayanmo manopolas +1",ring1="Epona's ring",ring2="Ayanmo ring",
                            back=RosmertasCape.TP,waist="Windbuffet belt +1",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    sets.TP.MDTAccuracy = {ammo="Ginsen",
                            head="Ayanmo zucchetto +2", neck="Twilight torque", ear1="Suppanomimi", ear2="Cessance earring",
                            body="Ayanmo corazza +2",hands="Adhemar wristbands +1",ring1="Epona's ring",ring2="Petrov ring",
                            back=RosmertasCape.TP,waist="Shetal stone",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    sets.TP.SubNinja = {
                        ammo="Ginsen",
                        head="Adhemar bonnet",neck="Asperity necklace", ear1="Suppanomimi", ear2="Cessance earring",
                        body="Adhemar jacket +1",hands="Adhemar wristbands +1",ring1="Epona's ring",ring2="Petrov ring",
                        back=RosmertasCape.TP,waist="Windbuffet belt +1",legs="Samnuha tights",feet="Herculean boots"}

    sets.TP.SubNinjaDT =
                    {
                                                                                                                ammo="Ginsen",
                        head="Ayanmo zucchetto +2",    neck="Twilight torque",         ear1="Suppanomimi",            ear2="Cessance earring",
                        body="Ayanmo corazza +2",     hands="Adhemar wristbands +1",        ring1="Epona's ring",         ring2="Ayanmo ring",
                        back=RosmertasCape.TP,         waist="Flume belt",                legs="Ayanmo cosciales +2",    feet="Herculean boots"
                    }

    --Weaponskill Sets--
    sets.WS = {}

    sets.Requiescat = {}

    sets.Requiescat.index = {'Attack','Accuracy'}
    Requiescat_ind = 1

    sets.Requiescat.Attack = {ammo="Quartz Tathlum +1",
                              head="Jhakri coronal +2",neck="Fotia gorget",ear1="Moonshade earring",ear2="Brutal earring",
                               body="Assimilator's jubbah +2",hands="Jhakri cuffs +2",ring1="Epona's ring",ring2="Levia. ring",
                                 back=RosmertasCape.TP,waist="Fotia belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.Requiescat.Accuracy = {ammo="Honed tathlum",
                               head="Jhakri coronal +2",neck="Mirage stole +1",ear1="Moonshade earring",ear2="Brutal earring",
                                body="Assimilator's jubbah +2",hands="Jhakri cuffs +2",ring1="Epona's ring",ring2="Levia. ring",
                                  back=RosmertasCape.TP,waist="Fotia belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.ChantDuCygne = {}

    sets.ChantDuCygne.index = {'Attack','Accuracy'}
    ChantDuCygne_ind = 1

    sets.ChantDuCygne.Attack = {ammo="Jukukik feather",
                                head="Adhemar bonnet",neck="Mirage Stole +1", ear1="Moonshade earring", ear2="Brutal earring",
                                body="Ayanmo corazza +2",hands="Adhemar wristbands +1",ring1="Epona's ring",ring2="Begrudging ring",
                                back=RosmertasCape.CDC,waist="Fotia belt",legs="Samnuha tights",feet="Herculean boots"}

    sets.ChantDuCygne.Accuracy = {ammo="Honed tathlum",
                                  head="Adhemar bonnet", neck="Mirage stole +1", ear1="Moonshade earring", ear2="Mache earring",
                                  body="Ayanmo corazza +2", hands="Adhemar wristbands +1", ring1="Epona's ring", ring2="Begrudging ring",
                                  back=RosmertasCape.CDC, waist="Fotia belt", legs="Samnuha tights", feet="Ayanmo gambieras +2"}

    sets.WS.SanguineBlade = {}

    sets.WS.SanguineBlade = {ammo="Pemphredo tathlum",
                             head="Pixie Hairpin +1",neck="Sanctity necklace",ear1="Friomisi earring",ear2="Hecate's earring",
                             body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Acumen ring",ring2="Shiva ring",
                             back=RosmertasCape.MAB,waist="Eschan stone",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.WS.CircleBlade = {}        

    sets.WS.CircleBlade = {ammo="Cheruski needle",
                           head="Adhemar bonnet",neck="Mirage stole +1", ear1="Moonshade earring", ear2="Brutal earring",
                           body="Assimilator's jubbah +2",hands="Jhakri cuffs +2",ring1="Karieyh ring",ring2="Begrudging ring",
                           back=RosmertasCape.SVG,waist="Fotia belt",legs="Samnuha tights",feet="Herculean boots"}

    sets.WS.SavageBlade = {}        

    sets.WS.SavageBlade = {                                                                                            ammo="Cheruski needle",
                           head="Adhemar bonnet",            neck="Mirage Stole +1",     ear1="Moonshade earring",     ear2="Ishvara earring",
                           body="Assimilator's jubbah +2",    hands="Jhakri cuffs +2",    ring1="Karieyh ring",        ring2="Ifrit ring",
                           back=RosmertasCape.SVG,            waist="Fotia belt",            legs="Luhlaza shalwar +2",    feet="Herculean boots"}

    --totally not indicative of what I have atm, these are the remnants of copy and paste--
    sets.Realmrazer = {}

    sets.Realmrazer.index = {'Attack','Accuracy'}
    Realmrazer_ind = 1

    sets.Realmrazer.Attack = {ammo="Cheruski needle",
                              head="Ayanmo zucchetto +2",neck="Fotia gorget",ear1="Moonshade earring", ear2="Brutal earring",
                               body="Assimilator's jubbah +2",hands="Ayanmo manopolas +1",ring1="Levia. ring",ring2="Ayanmo ring",
                                 back=RosmertasCape.SVG,waist="Fotia belt",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    sets.Realmrazer.Accuracy = {ammo="Honed tathlum",
                                head="Ayanmo zucchetto +2",neck="Fotia gorget",ear1="Moonshade earring", ear2="Brutal earring",
                               body="Assimilator's jubbah +2",hands="Ayanmo manopolas +1",ring1="Levia. ring",ring2="Ayanmo ring",
                                 back=RosmertasCape.SVG,waist="Fotia belt",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}
    --this either lol--
    sets.WS.FlashNova = {}

    sets.WS.FlashNova = {ammo="Pemphredo tathlum",
                             head="Jhakri coronal +2",neck="Sanctity necklace",ear1="Friomisi earring",ear2="Hecate's earring",
                             body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Acumen ring",ring2="Shiva ring",
                             back=RosmertasCape.MAB,waist="Eschan stone",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    --Blue Magic Sets--
    --need to go over these with a fine toothed comb, either fit in what i have or figure out what i'm missing--
    --todo: replace ayanmo here with luhlaza keffiyeh +1, BLU skill is generally better here
    --or in general, go back and figure out if AF pieces are better
    sets.BlueMagic = {}

    sets.BlueMagic.STR = {ammo="Cheruski needle",
                         head="Adhemar bonnet",neck="Mirage stole +1",ear1="Flame pearl",ear2="Flame pearl",
                          body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Ifrit ring",ring2="Apate ring",
                          back=RosmertasCape.SVG,waist="Prosilio belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.STRDEX = {ammo="Cheruski needle",
                         head="Adhemar bonnet",neck="Mirage stole +1",ear1="Flame pearl",ear2="Flame pearl",
                          body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Ifrit ring",ring2="Apate ring",
                          back=RosmertasCape.SVG,waist="Prosilio belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.STRVIT = {ammo="Cheruski needle",
                         head="Adhemar bonnet",neck="Mirage stole +1",ear1="Flame pearl",ear2="Flame pearl",
                          body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Ifrit ring",ring2="Apate ring",
                          back=RosmertasCape.SVG,waist="Prosilio belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.STRMND = {ammo="Cheruski needle",
                         head="Adhemar bonnet",neck="Mirage stole +1",ear1="Flame pearl",ear2="Flame pearl",
                          body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Ifrit ring",ring2="Apate ring",
                          back=RosmertasCape.SVG,waist="Prosilio belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.AGI = {ammo="Cheruski needle",
                         head="Adhemar bonnet",neck="Mirage stole +1",ear1="Flame pearl",ear2="Flame pearl",
                          body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Ifrit ring",ring2="Apate ring",
                          back=RosmertasCape.SVG,waist="Prosilio belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.INT =
    {
                                                                                            ammo="Pemphredo tathlum",
        head="Jhakri coronal +2",    neck="Sanctity necklace",    ear1="Hecate's earring",    ear2="Friomisi earring",
        body="Jhakri robe +2",        hands="Amalric gages",        ring1="Shiva ring",            ring2="Acumen ring",
        back=RosmertasCape.MAB,        waist="Eschan stone",        legs="Luhlaza shalwar +2",    feet="Jhakri pigaches +2"
    }

    sets.Burst = {}
    sets.Burst.index = {'FreeNuke', 'MagicBurst'}
    Burst_ind = 1            

    --priority: Burst Affinity > MB I until cap > MB II
    --need to figure out what armor pieces have burst that i don't fill already
    --can equip head and legs, can put UP TO MB+10% on them
        --might be worth it to replace amalric gloves with helios gloves until close to MB I cap
        --could also get body piece but don't own it currently
        --if BAing, would need to have empyrean boots for BA bonus. can't put on helios boots
        --AF2/3 pants would replace helios pants here eventually, has both BA and MB I

    sets.BlueMagic.Burst = {ring1="Locus ring",ring2="Mujin band"}

    sets.BlueMagic.Cures = { ammo="Quartz Tathlum +1",
                            head="Jhakri coronal +2",neck="Imbodla necklace",ear1="Loquac. earring",ear2="Mendicant's earring",
                            body="Chelona blazer",hands="Telchine gloves",ring1="Levia. ring",ring2="Jhakri ring",
                            back="Solemnity cape",waist="Ovate rope",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.SelfCures = { ammo="Quartz Tathlum +1",
                            head=TaeonChapeau.SC, neck="Imbodla necklace",ear1="Loquac. earring",ear2="Mendicant's earring",
                            body="Chelona blazer",hands="Telchine gloves",ring1="Levia. ring",ring2="Jhakri ring",
                            back="Solemnity cape",waist="Chuq'aba belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.Stun = {                                                                                    ammo="Mavi tathlum",
                           head="Jhakri coronal +2",    neck="Mirage stole +1",
                           body="Jhakri robe +2",        hands="Jhakri cuffs +2",    ring1="Ayanmo ring",    ring2="Jhakri ring",
                           back="Cornflower cape",        waist="Ovate rope",            legs="Jhakri slops +1",    feet="Jhakri pigaches +2"}

    sets.BlueMagic.HeavyStrike = {ammo="Honed tathlum",
                                  head="Ayanmo zucchetto +2",neck="Mirage stole +1",ear1="Flame pearl",ear2="Mache earring",
                                  body="Assim. jubbah +2",hands="Ayanmo manopolas +1",ring1="Ifrit ring",ring2="Apate ring",
                                  back="Cornflower cape",waist="Anguinus belt",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    sets.BlueMagic.WhiteWind = {ammo="Quartz Tathlum +1",
                            head="Jhakri coronal +2",neck="Imbodla necklace",ear1="Loquac. earring",
                            body="Assim. jubbah +2",hands="Jhakri robe +2",ring1="Levia. ring",ring2="Jhakri ring",
                            back="Solemnity cape",waist="Ovate rope",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    sets.BlueMagic.MagicAccuracy = { ammo="Mavi tathlum",
                           head="Jhakri coronal +2",neck="Mirage stole +1",ear1="Lifestorm earring",ear2="Psystorm earring",
                           body="Jhakri robe +2",hands="Jhakri cuffs +2",ring1="Perception ring",ring2="Sangoma ring",
                           back="Cornflower cape",waist="Ovate rope",legs="Ayanmo cosciales +2",feet="Jhakri pigaches +2"} 

    sets.BlueMagic.Skill = { ammo="Mavi tathlum",
                            head="Mirage Keffiyeh", neck="Mirage stole +1",
                            body="Assim. jubbah +2",ring1="Prolix ring",
                            back="Cornflower cape",waist="Twilight belt",legs="Mavi tayt +1",feet="Luhlaza charuqs +1"}

    sets.BlueMagic.SkillRecast = {ammo="Mavi tathlum",
                                  head="Mirage Keffiyeh", neck="Mirage stole +1",
                                  body="Assim. jubbah +2", hands="Mv. Bazubands +1", ring1="Prolix ring",
                                  back="Swith cape",waist="Twilight belt",legs="Mavi tayt +1",feet="Luhlaza charuqs +1"}

    --Job Ability Sets--

    sets.JA = {}

    sets.JA.ChainAffinity = {} --{feet="Assim. charuqs"}

    sets.JA.BurstAffinity = { feet="Hashishin Basmak +1" }

    sets.JA.Efflux = {} --{legs="Mavi tayt +1"}

    sets.JA.AzureLore = {} --{hands="Luh. bazubands"}

    sets.JA.Diffusion = {feet="Luhlaza Charuqs +1"}

    --Precast Sets--
    sets.precast = {}

    sets.precast.FC = {}

    sets.precast.FC.Standard = { --ammo="Impatiens",
                                head="Carmine mask",neck="Voltsurge torque", ear1="Loquac. Earring",
                                body="Luhlaza jubbah",hands="Leyline gloves",ring1="Prolix ring",
                                back="Swith Cape",waist="Witful Belt",legs="Ayanmo cosciales +2",feet="Chelona Boots"}

    sets.precast.FC.Blue = { --ammo="Impatiens",
                            head="Carmine mask",neck="Voltsurge torque", ear1="Loquac. Earring",
                            body="Hashishin Mintan",hands="Leyline gloves",ring1="Prolix ring",
                            back="Swith Cape",waist="Witful Belt",legs="Ayanmo cosciales +2",feet="Chelona Boots"}

    sets.Obi = { waist = "Hachirin-no-obi" }
    sets.ZodiacRing = { ring1 = "Zodiac ring" }
    sets.PixieHairpin = { head = "Pixie hairpin +1" }

    weapon_lock = true;

    if player.sub_job == 'SCH' or player.sub_job == 'RDM' then
        weapon_lock = false
    end

    sets.weapons = {}
    sets.weapons.Melee = { main = "Tanmogayi +1", sub = "Colada" }
    sets.weapons.Nuking = { main = "Nibiru cudgel", sub = "Nibiru cudgel" }
    sets.weapons.Curing = { main = "Tamaxchi", sub = "Nibiru cudgel" }
    sets.weapons.Idle = { main = "Bolelabunga" }
    sets.weapons.FastCast = { main = "Tanmogayi +1", sub = "Colada" }
    sets.weapons.FastCastBlue = { main = "Iris", sub = "Iris" }

end

function sub_job_change(new,old)
    if new == 'SCH' or new == 'RDM' then 
        weapon_lock = false
    else
        weapon_lock = true
        equip(sets.weapons.Melee)
    end
end

function precast(spell)
    if spell.action_type == 'Magic' then
        equip(sets.precast.FC.Standard)
        if weapon_lock == false then
            equip(sets.weapons.FastCast)
        end
        if spell.skill == 'Blue Magic' then
            equip(sets.precast.FC.Blue)
            if weapon_lock == false then
                equip(sets.weapons.FastCastBlue)
            end
        end
    end

    if spell.english == 'Azure Lore' then
        equip(sets.JA.AzureLore)
    end

    if spell.english == 'Requiescat' then
        equip(sets.Requiescat[sets.Requiescat.index[Requiescat_ind]])
    end

    if spell.english == 'Chant du Cygne' then
        equip(sets.ChantDuCygne[sets.ChantDuCygne.index[ChantDuCygne_ind]])
    end

    if spell.english == 'Circle Blade' then
        equip(sets.WS.CircleBlade)
    end

    if spell.english == 'Savage Blade' or spell.english == 'Expiacion' then
        equip(sets.WS.SavageBlade)
    end

    if spell.english == 'Sanguine Blade' then
        equip(sets.WS.SanguineBlade)
    end

    if spell.english == 'Realmrazer' then
        equip(sets.Realmrazer[sets.Realmrazer.index[Realmrazer_ind]])
    end

    if spell.english == 'Flash Nova' then
        equip(sets.WS.FlashNova)
    end
end

blue_spell_names = {}
blue_spell_names.magical = {}
blue_spell_names.physical = {}

blue_spell_names.cures = {'Magic Fruit','Plenilune Embrace','Wild Carrot','Pollen','Cure III','Cure IV','Restoral', 'White Wind'}
blue_spell_names.skill_recast = {'MP Drainkiss','Digest','Blood Saber','Blood Drain','Osmosis','Occultation','Magic Barrier','Diamondhide','Metallic Body'}
blue_spell_names.diffusion_only = {'Cocoon','Harden Shell','Animating Wail','Battery Charge','Nat. Meditation','Carcharian Verve','O. Counterstance','Barrier Tusk','Saline Coat','Regeneration','Erratic Flutter','Mighty Guard'}
blue_spell_names.magic_accuracy = {'Frightful Roar','Infrasonics','Tourbillion','Cimicine Discharge','Sub-zero smash','Filamented Hold','Mind Blast','Sandspin','Hecatomb Wave','Cold Wave','Terror Touch','Sheep Song','Dream Flower','Blistering Roar','Absolute Terror','Droning Whirlwind'}
blue_spell_names.stun = {'Head Butt','Sudden Lunge','Blitzstrahl','Sweeping Gouge','Barbed Crescent',}

blue_spell_names.physical.STR = {'Vertical Cleave', 'Death Scissors', 'Empty Thrash', 'Dimensional Death', 'Quadrastrike', 'Bloodrake'}
blue_spell_names.physical.STRDEX = {'Disseverment','Hysteric Barrage','Frenetic Rip','Seedspray','Vanity Dive','Goblin Rush','Paralyzing Triad','Thrashing Assault'}
blue_spell_names.physical.STRVIT = {'Quad. Continuum','Delta Thrust','Cannonball','Glutinous Dart','Sinker Drill'}
blue_spell_names.physical.STRMND = {'Whirl of Rage'}
blue_spell_names.physical.AGI = {'Benthic Typhoon','Final Sting','Spiral Spin'}

blue_spell_names.magical.INT = {'Retinal Glare','Cursed Sphere','Charged Whisker','Gates of Hades','Leafstorm','Firespit','Acrid Stream','Regurgitation','Corrosive Ooze','Thermal Pulse','Magic Hammer','Evryone. Grudge','Water Bomb','Dark Orb' ,'Thunderbolt','Tem. Upheaval','Embalming Earth' ,'Foul Waters','Rending Deluge','Droning Whirlwind','Spectral Floe','Subduction','Entomb','Tenebral Crush','Scouring Spate','Blinding Fulgor','Anvil Lightning','Searing Tempest','Silent Storm','Molting Plumage','Diffusion Ray','Polar Roar','Crashing Thunder'}

function array_contains(haystack, needle)
    for index, value in ipairs(haystack) do
        if value == needle then
            return true
        end
    end
    return false
end

function midcast(spell,act)
    if array_contains(blue_spell_names.physical.STR, spell.english) then
        equip(sets.BlueMagic.STR)
        if buffactive['Chain Affinity'] then
            equip(sets.JA.ChainAffinity)
        end
        if buffactive['Efflux'] then
            equip(sets.JA.Efflux)
        end
    end

    if array_contains(blue_spell_names.physical.STRDEX, spell.english) then
        equip(sets.BlueMagic.STRDEX)
        if buffactive['Chain Affinity'] then
            equip(sets.JA.ChainAffinity)
        end
        if buffactive['Efflux'] then
            equip(sets.JA.Efflux)
        end
    end

    if array_contains(blue_spell_names.physical.STRVIT, spell.english) then
        equip(sets.BlueMagic.STRVIT)
        if buffactive['Chain Affinity'] then
            equip(sets.JA.ChainAffinity)
        end
        if buffactive['Efflux'] then
            equip(sets.JA.Efflux)
        end                                   
    end

    if array_contains(blue_spell_names.physical.STRMND, spell.english) then
        equip(sets.BlueMagic.STRMND)
        if buffactive['Chain Affinity'] then
            equip(sets.JA.ChainAffinity)
        end
        if buffactive['Efflux'] then
            equip(sets.JA.Efflux)
        end
    end

    if array_contains(blue_spell_names.physical.AGI, spell.english) then
        equip(sets.BlueMagic.AGI)
        if buffactive['Chain Affinity'] then
            equip(sets.JA.ChainAffinity)
        end
        if buffactive['Efflux'] then
            equip(sets.JA.Efflux)
        end
    end

    if array_contains(blue_spell_names.magical.INT, spell.english) then
        equip(sets.BlueMagic.INT)
        if buffactive['Burst Affinity'] then
            equip(sets.JA.BurstAffinity)
            if Burst_ind == 2 then
                equip (sets.BlueMagic.Burst)
            end
        end

        if world.weather_element == spell.element then
            equip(sets.Obi)
        end

        if spell.element == 'Dark' then
            equip (sets.PixieHairpin)
        end

        --TODO: test if this a) works and b) is worth it and c) which ring it should replace in this condition
        --also figure out zodiac cape but early experimentation shows the ambuscade cape is just strictly better
        --if spell.element ~= 'Dark' and spell.element ~= 'Light' and spell.element == world.day_element then
        --    equip (sets.ZodiacRing)
        --end

        if weapon_lock == false then
            equip(sets.weapons.Nuking)
        end
    end

    if array_contains(blue_spell_names.cures, spell.english) then
        equip(sets.BlueMagic.Cures)
        if spell.target.name == player.name then
            equip(sets.BlueMagic.SelfCures)
        end
        if world.weather_element == spell.element then
            equip(sets.Obi)
        end
        if weapon_lock == false then
            equip(sets.weapons.Curing)
        end
    end

    if array_contains(blue_spell_names.stun, spell.english) then
        equip(sets.BlueMagic.Stun)
    end

    if spell.english == 'Heavy Strike' then
        equip(sets.BlueMagic.HeavyStrike)
    end

    if array_contains(blue_spell_names.magic_accuracy, spell.english) then
        equip(sets.BlueMagic.MagicAccuracy)
        if weapon_lock == false then
            equip(sets.weapons.Nuking)
        end
    end

    if array_contains(blue_spell_names.skill_recast, spell.english) then
        equip(sets.BlueMagic.SkillRecast)
        if buffactive['Diffusion'] then
            equip(sets.JA.Diffusion)
        end
    end

    if array_contains(blue_spell_names.diffusion_only, spell.english) then
        if buffactive['Diffusion'] then
            equip(sets.JA.Diffusion)
        end
    end
end

function aftercast(spell)
    if player.status == 'Engaged' then
        equip(sets.TP[sets.TP.index[TP_ind]])
        if weapon_lock == false then
            equip(sets.weapons.Melee)
        end
    else
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
        if weapon_lock == false then
            equip(sets.weapons.Idle)
        end
    end
end

function status_change(new,old)
    if new == 'Engaged' then
        equip(sets.TP[sets.TP.index[TP_ind]])
        if weapon_lock == false then
            equip(sets.weapons.Melee)
        end
    else
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
        if weapon_lock == false then
            equip(sets.weapons.Idle)
        end
    end
end

function self_command(command)
    if command == 'toggle TP set' then
        TP_ind = TP_ind +1
        if TP_ind > #sets.TP.index then TP_ind = 1 end
        send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
    elseif command == 'toggle Idle set' then
        Idle_ind = Idle_ind +1
        if Idle_ind > #sets.Idle.index then Idle_ind = 1 end
        send_command('@input /echo <----- Idle Set changed to '..sets.Idle.index[Idle_ind]..' ----->')
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
        if weapon_lock == false then
            equip(sets.weapons.Idle)
        end
    elseif command == 'toggle Req set' then
        Requiescat_ind = Requiescat_ind +1
        if Requiescat_ind > #sets.Requiescat.index then Requiescat_ind = 1 end
        send_command('@input /echo <----- Requiescat Set changed to '..sets.Requiescat.index[Requiescat_ind]..' ----->')
    elseif command == 'toggle CDC set' then
        ChantDuCygne_ind = ChantDuCygne_ind +1
        if ChantDuCygne_ind > #sets.ChantDuCygne.index then ChantDuCygne_ind = 1 end
        send_command('@input /echo <----- Chant du Cygne Set changed to '..sets.ChantDuCygne.index[ChantDuCygne_ind]..' ----->')
    elseif command == 'toggle Rea set' then
        Realmrazer_ind = Realmrazer_ind +1
        if Realmrazer_ind > #sets.Realmrazer.index then Realmrazer_ind = 1 end
        send_command('@input /echo <----- Realmrazer Set changed to '..sets.Realmrazer.index[Realmrazer_ind]..' ----->')
    elseif command == 'equip TP set' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    elseif command == 'equip Idle set' then
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    elseif command == 'toggle weapon lock' then
        weapon_lock = not weapon_lock
        if weapon_lock == true then result = 'true' else result = 'false' end
        send_command('@input /echo <----- weapon lock set to ' .. result .. ' ----->')
    elseif command == 'toggle MB set' then
        Burst_ind = Burst_ind +1
        if Burst_ind > #sets.Burst.index then
            Burst_ind = 1
        end
        send_command('@input /echo <----- BA Set changed to ' .. sets.Burst.index[Burst_ind] .. ' ----->')
    end
end

DNC:

--improvements to make still:
--    autowaltz, change waltz usage based on tp available and how much hp target is missing
--    auto cancel sneak when casting spectral jig
--    auto cancel saber dance when casting waltzes
--    auto equip doom cursna received
--    when sleeping: frenzy sallet to wake up

function get_sets()

    send_command('bind f9 gs c toggle TP set')
    send_command('bind f10 gs c toggle Idle set')
    send_command('bind f11 gs c toggle Rudra set')
    send_command('bind f12 gs c toggle Evisc set')

    function file_unload()

        send_command('unbind ^f9')
        send_command('unbind ^f10')
        send_command('unbind ^f11')
        send_command('unbind ^f12')

        send_command('unbind !f9')
        send_command('unbind !f10')
        send_command('unbind !f11')
        send_command('unbind !f12')

        send_command('unbind f9')
        send_command('unbind f10')
        send_command('unbind f11')
        send_command('unbind f12')

    end    

    --Multiples--

    --replace with stuff
    SenunasMantle = {}
        SenunasMantle.TP = { name="Senuna's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','"Dbl.Atk."+10',} }
        SenunasMantle.WSD = { name="Senuna's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Weapon skill damage +10%',} }

    TaeonChapeau = {}
        TaeonChapeau.TP = { name="Taeon Chapeau", augments={'Accuracy+17','"Triple Atk."+2','Crit. hit damage +1%',} }

    TaeonGloves = {}
        TaeonGloves.TP = { name="Taeon Gloves", augments={'Accuracy+14 Attack+14','"Triple Atk."+2','DEX+8',} }

    TaeonTights = {}
        TaeonTights.TP = { name="Taeon Tights", augments={'Accuracy+19','"Triple Atk."+2','STR+7 DEX+7',} }

    TaeonBoots = {}
        TaeonBoots.TP = { name="Taeon Boots", augments={'Attack+25','"Triple Atk."+2','STR+7 DEX+7',} }

    --TODO: Dark Rings to put in DT sets--
    DarkRings = {}
        DarkRings.PDT = { name="Dark Ring", augments ={"Phys. dmg. taken -3%"}}
        DarkRings.MDT = { name="Dark Ring", augments ={"Magic dmg. taken -3%"}}

    --Idle Sets--    
    sets.Idle = {}

    sets.Idle.index = {'Standard', 'DT', 'Pulling'}
    Idle_ind = 1

    sets.Idle.Standard = {ammo="Ginsen",
                          head="Meghanada visor +1",neck="Sanctity necklace", ear1="Ethereal earring", ear2="Brachyura earring",
                          body="Meghanada cuirie +2",hands="Meghanada gloves +1",ring1="Karieyh ring",ring2="Meghanada ring",
                          back="Engulfer cape +1",waist="Flume belt",legs="Mummu kecks +2",feet="Herculean boots"}

     sets.Idle.DT = {ammo="Ginsen",
                          head="Meghanada visor +1",neck="Twilight torque", ear1="Ethereal earring", ear2="Brachyura earring",
                          body="Meghanada cuirie +2",hands="Meghanada gloves +1",ring1=DarkRings.PDT,ring2="Meghanada ring",
                          back="Engulfer cape +1",waist="Flume belt",legs="Mummu kecks +2",feet="Herculean boots"}

    sets.Idle.Pulling = {ranged="Albin Bane",
                          head="Meghanada visor +1",neck="Sanctity necklace", ear1="Ethereal earring", ear2="Brachyura earring",
                          body="Meghanada cuirie +2",hands="Meghanada gloves +1",ring1="Karieyh ring",ring2="Meghanada ring",
                          back="Engulfer cape +1",waist="Flume belt",legs="Mummu kecks +2",feet="Herculean boots"}

    --TP Sets--
    sets.TP = {}

    sets.TP.index = {'Standard', 'Accuracy', 'DT', 'HybridDT', 'DTAccuracy', 'Weakened'}
    --1=Standard, 2=AccuracyLite, 3=DT, 4=DTAccuracy--
    TP_ind = 1

    --currently only one TP set, will need to adjust others. things like ej necklace, changing between meghanada and mummu?
    sets.TP.Standard = {
                        ammo="Ginsen",
                        head="Adhemar bonnet",        neck="Anu torque",                 ear1="Brutal Earring",    ear2="Cessance earring",
                        body="Adhemar jacket +1",    hands="Adhemar wristbands +1",    ring1="Petrov ring",    ring2="Epona's ring",
                        back=SenunasMantle.TP,        waist="Windbuffet belt +1",        legs="Samnuha tights",    feet="Herculean boots"}

    --most accuracy--
    sets.TP.Accuracy = {
                        ammo="Honed tathlum",
                        head="Meghanada visor +1", neck="Ej necklace", ear1="Mache earring",ear2="Cessance earring",
                        body="Adhemar jacket +1", hands="Adhemar wristbands +1", ring1="Petrov ring",    ring2="Epona's ring",
                        back=SenunasMantle.TP, waist="Kentarch belt +1", legs="Mummu kecks +2", feet="Herculean boots"}

    sets.TP.DT = {
                        ammo="Ginsen",
                        head="Meghanada visor +1",neck="Twilight torque", ear1="Brutal Earring",    ear2="Cessance earring",
                        body="Meghanada cuirie +2",hands="Meghanada gloves +1",ring1="Meghanada ring",ring2="Epona's ring",
                        back="Solemnity cape",waist="Flume belt",legs="Mummu kecks +2",feet="Herculean boots"}

    sets.TP.HybridDT = {
                        ammo="Ginsen",
                        head="Adhemar bonnet",        neck="Twilight torque",     ear1="Brutal Earring",    ear2="Cessance earring",
                        body="Meghanada cuirie +2",    hands="Adhemar wristbands +1",    ring1="Meghanada ring",ring2="Epona's ring",
                        back=SenunasMantle.TP,        waist="Windbuffet belt +1",    legs="Mummu kecks +2",    feet="Herculean boots"}

    --less acc but mixed with DT--
    sets.TP.DTAccuracy = {
                                                                                                            ammo="Honed tathlum",
                            head="Mummu bonnet +1",        neck="Twilight torque",     ear1="Mache earring",     ear2="Cessance earring",
                            body="Meghanada cuirie +2",    hands="Adhemar wristbands +1",    ring1="Meghanada ring",ring2="Epona's ring",
                            back="Toetapper mantle",    waist="Kentarch belt +1",        legs="Mummu kecks +2",    feet="Herculean boots"
                        }

    --stack dual wield so attacking while slow isn't painful
    --what else do I have? Did I toss my charis necklace?
    sets.TP.Weakened =
    {
                                                                                            ammo="Ginsen",
        head="Adhemar bonnet",        neck="Anu torque",                 ear1="Suppanomimi",        ear2="Cessance earring",
        body="Maculele casaque +1",    hands="Adhemar wristbands +1",    ring1="Petrov ring",    ring2="Epona's ring",
        back=SenunasMantle.TP,        waist="Shetal stone",            legs="Samnuha tights",    feet=TaeonBoots.TP
    }

    --Weaponskill Sets--
    sets.WS = {}

    sets.Evisceration = {}

    sets.Evisceration.index = {'Attack','Accuracy'}
    Evisceration_ind = 1

    sets.Evisceration.Attack =
                            {
                                                                                                                    ammo="Charis Feather",
                                head="Adhemar bonnet",        neck="Fotia gorget",        ear1="Brutal Earring",        ear2="Cessance earring",
                                body="Meghanada cuirie +2",    hands="Mummu wrists +1",    ring1="Mummu ring",            ring2="Epona's ring",
                                back=SenunasMantle.TP,        waist="Fotia belt",            legs="Samnuha tights",        feet="Herculean boots"
                            }

    sets.Evisceration.Accuracy =    
                                    {                                                                                        ammo="Charis Feather",
                                        head="Adhemar bonnet",        neck="Fotia gorget",        ear1="Cessance earring",    ear2="Brutal earring",
                                        body="Meghanada cuirie +2",    hands="Mummu wrists +1",    ring1="Mummu ring",            ring2="Epona's ring",
                                        back=SenunasMantle.TP,        waist="Fotia belt",            legs="Samnuha tights",        feet="Herculean boots"
                                    }

    sets.RudrasStorm = {}

    sets.RudrasStorm.index = {'Attack','Accuracy','Climactic'}
    RudrasStorm_ind = 1

    sets.RudrasStorm.Attack =     {
                                                                                                                            ammo="Charis Feather",
                                    head="Adhemar bonnet",        neck="Caro necklace",            ear1="Moonshade earring",    ear2="Ishvara earring",
                                    body="Adhemar jacket +1",    hands="Adhemar wristbands +1",    ring1="Mummu ring",            ring2="Karieyh ring",
                                    back=SenunasMantle.WSD,        waist="Grunfeld rope",            legs="Mummu kecks +2",        feet="Mummu gamashes +1"
                                }

    sets.RudrasStorm.Accuracy = {                                                                                            ammo="Charis Feather",
                                    head="Adhemar bonnet",        neck="Caro necklace",            ear1="Moonshade earring",    ear2="Ishvara earring",
                                    body="Adhemar jacket +1",    hands="Adhemar wristbands +1",    ring1="Mummu ring",            ring2="Karieyh ring",
                                    back=SenunasMantle.WSD,        waist="Grunfeld rope",            legs="Mummu kecks +2",        feet="Mummu gamashes +1"
                                }

    --Lustratio subligar until relic pants, though they cost about the same
    sets.RudrasStorm.Climactic =    {                                                                                                ammo="Charis Feather",
                                        head="Maculele Tiara +1",        neck="Caro necklace",            ear1="Moonshade earring",    ear2="Ishvara earring",
                                        body="Meghanada cuirie +2",        hands="Meghanada gloves +1",    ring1="Karieyh ring",        ring2="Ramuh ring",
                                        back=SenunasMantle.WSD,            waist="Grunfeld rope",            legs="Samnuha tights",        feet="Herculean boots"
                                    }

    sets.Exenterator =     {                                                                                                    ammo="Charis Feather",
                                head="Adhemar bonnet",        neck="Fotia gorget",            ear1="Moonshade earring",        ear2="Brutal earring",
                                body="Meghanada cuirie +2",    hands="Meghanada gloves +1",    ring1="Begrudging ring",        ring2="Mummu ring",
                                back=SenunasMantle.WSD,        waist="Fotia belt",                legs="Samnuha tights",            feet="Herculean boots"
                        }

    sets.PyrrhicKleos = 
                    {
                                                                                                            ammo="Cheruski needle",
                        head="Adhemar bonnet",        neck="Fotia gorget",        ear1="Brutal Earring",        ear2="Cessance earring",
                        body="Adhemar jacket +1",    hands="Mummu wrists +1",    ring1="Ifrit ring",            ring2="Epona's ring",
                        back=SenunasMantle.TP,        waist="Fotia belt",            legs="Samnuha tights",        feet="Herculean boots"
                    }

    sets.AeolianEdge =
    {
                                                                                                ammo="Pemphredo tathlum",
        head="Adhemar bonnet",             neck="Sanctity necklace",     ear1="Moonshade earring",     ear2="Friomisi earring",
        body="Adhemar jacket +1",         hands="Meghanada gloves +1",     ring1="Karieyh ring",         ring2="Acumen ring",
        back=SenunasMantle.WSD,         waist="Eschan stone",         legs="Samnuha tights",         feet="Herculean boots"
    }

    --Job Ability Sets--

    sets.JA = {}

    --just load up with acc. af+2 and higher should provide better results once you get those. maybe get second mache
    sets.JA.Steps = {                                                                                         ammo="Honed tathlum",
                        head="Meghanada visor +1", neck="Ej necklace", ear1="Mache earring", ear2="Moonshade earring",
                        body="Mummu jacket +1", hands="Maxixi bangles +2", ring1="Mummu ring", ring2="Meghanada ring",
                        back="Senuna's mantle", waist="Anguinus belt", legs="Meghanada chausses +1", feet="Horos toe shoes +1"}

    sets.JA.Jigs = { legs="Etoile tights", feet="Maxixi shoes +1" }

    --can be any senuna's mantle, core to cape
    sets.JA.Sambas = { head = "Maxixi Tiara +1", back = "Senuna's mantle" }

    sets.JA.Waltzes = { ammo="Light sachet",
                        head="Etoile tiara",
                        body="Maxixi casaque +1", hands="Slither gloves +1",
                        back="Toetapper mantle", legs="Dashing subligar", feet="Maxixi toe shoes +1"}

    sets.JA.NoFootRise = { body = "Horos casaque" }

    sets.JA.ReverseFlourish = { hands = "Charis Bangles +1", back="Toetapper mantle" }

    --macc set
    sets.JA.ViolentFlourish = { head = "mummu bonnet +1", neck="Voltsurge torque", ammo="Snow sachet",
                                body = "Mummu Jacket +1", hands = "mummu wrists +1", ring1="Mummu ring", ring2="Shiva ring",
                                legs = "Mummu kecks +2", feet = "mummu gamashes +1"}

    sets.JA.ClimacticFlourish = { head = "Maculele Tiara +1" }

    sets.JA.StrikingFlourish = { body = "Maculele Casaque +1" }

end

job_ability_names = {}

job_ability_names.jigs = {'Spectral Jig', 'Chocobo Jig', 'Chocobo Jig II'}
job_ability_names.waltzes = {'Curing Waltz', 'Curing Waltz II', 'Curing Waltz III', 'Curing Waltz IV', 'Curing Waltz V', 'Divine Waltz', 'Divine Waltz II', 'Healing Waltz'}
job_ability_names.sambas = {'Drain Samba', 'Drain Samba II', 'Drain Samba III', 'Aspir Samba', 'Aspir Samba II', 'Haste Samba'}
job_ability_names.steps = {'Quickstep', 'Box Step', 'Stutter Step', 'Feather Step'}

function array_contains(haystack, needle)
    for index, value in ipairs(haystack) do
        if value == needle then
            return true
        end
    end
    return false
end

--waltz functionality:
--when casting any waltz, or with use of a generic waltz macro, figure out which waltz should be used
--start by determining what waltzes are even available for use atm
--    determine what's available for cast. no point in trying to cast something while it's on cd. will need to do this individually now that waltz timers are unlinked
--    determine what's castable with current TP cost. consider if trance is up or not as well
--if at least one waltz available, cancel saber dance
--figure out a way to estimate how much a particular waltz would heal. just eyeball it at first?
--out of all available waltzes, choose one that restores the most HP out of target's missing HP without overhealing too much

function precast(spell)

    if spell.english == 'Evisceration' then
        equip(sets.Evisceration[sets.Evisceration.index[Evisceration_ind]])
    end

    if spell.english == 'Exenterator' then
        equip(sets.Exenterator)
    end

    if spell.english == 'Shark Bite' then
        equip(sets.RudrasStorm.Attack)
    end

    if spell.english == 'Aeolian Edge' then
        equip(sets.AeolianEdge)
    end

    if spell.english == 'Rudra\'s Storm' then
        if buffactive['Climactic Flourish'] or climactic_hint == true then
            equip(sets.RudrasStorm.Climactic)
            climactic_hint = false
        else
            equip(sets.RudrasStorm[sets.RudrasStorm.index[RudrasStorm_ind]])
        end
    end

    if spell.english == 'Pyrrhic Kleos' then
        if buffactive['Striking Flourish'] then
            equip(set_combine(sets.PyrrhicKleos, sets.JA.StrikingFlourish))
        else
            equip(sets.PyrrhicKleos)
        end
    end

    if array_contains( job_ability_names.jigs, spell.english ) then
        equip(sets.JA.Jigs)
    end

    if array_contains( job_ability_names.steps, spell.english ) then
        equip(sets.JA.Steps)
    end

    if array_contains( job_ability_names.waltzes, spell.english ) then
        equip(sets.JA.Waltzes)
    end

    if array_contains( job_ability_names.sambas, spell.english ) then
        equip(sets.JA.Sambas)
    end

    if spell.english == 'No Foot Rise' then
        equip(sets.JA.NoFootRise)
    end

    --flourishes
    if spell.english == 'Violent Flourish' then
        equip(sets.JA.ViolentFlourish)
    end

    if spell.english == 'Reverse Flourish' then
        equip(sets.JA.ReverseFlourish)
    end

    if spell.english == 'Climactic Flourish' then
        equip(sets.JA.ClimacticFlourish)
        climactic_hint = true
    end

    if spell.english == 'Striking Flourish' then
        equip(sets.JA.StrikingFlourish)
    end
end

function aftercast(spell)
    if player.status == 'Engaged' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    else
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    end
end

function status_change(new,old)
    if new == 'Engaged' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    else
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    end
end

function self_command(command)
    if command == 'toggle TP set' then
        TP_ind = TP_ind +1
        if TP_ind > #sets.TP.index then TP_ind = 1 end
        send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
        equip(sets.TP[sets.TP.index[TP_ind]])
    elseif command == 'toggle Idle set' then
        Idle_ind = Idle_ind +1
        if Idle_ind > #sets.Idle.index then Idle_ind = 1 end
        send_command('@input /echo <----- Idle Set changed to '..sets.Idle.index[Idle_ind]..' ----->')
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    elseif command == 'toggle Evisc set' then
        Evisceration_ind = Evisceration_ind +1
        if Evisceration_ind > #sets.Evisceration.index then Evisceration_ind = 1 end
        send_command('@input /echo <----- Evisceration Set changed to '..sets.Evisceration.index[Evisceration_ind]..' ----->')
    elseif command == 'toggle Rudra set' then
        RudrasStorm_ind = RudrasStorm_ind +1
        if RudrasStorm_ind > #sets.RudrasStorm.index then RudrasStorm_ind = 1 end
        send_command('@input /echo <----- Rudra\'s Storm Set changed to '..sets.RudrasStorm.index[RudrasStorm_ind]..' ----->')
    elseif command == 'equip TP set' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    elseif command == 'equip Idle set' then
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    elseif command == 'climactic hint' then
        climactic_hint = true
    end
end

RDM:

function get_sets()

    --When you load your gearswap lua, you can set keybindings to easily toggle between different sets for different situations
    --a keybinding with ! before it is alt+(that key), e.g. !f11 is alt+f11
    send_command('bind f9 gs c toggle TP set')
    send_command('bind f10 gs c toggle Idle set')
    send_command('bind f11 gs c toggle CDC set')
    send_command('bind !f11 gs c toggle Enfeeble set')
    send_command('bind f12 gs c toggle Req set')
    send_command('bind !f12 gs c toggle Magic set')

    function file_unload()

        --be sure to unbind the keys you bound earlier in this function, otherwise they'll still be bound when your lua unloads
        --like if you change jobs or something, the old keybinds might still be active unless they're unbound here
        --this file_unload function automatically runs when you unload your lua
        send_command('unbind ^f9')
        send_command('unbind ^f10')
        send_command('unbind ^f11')
        send_command('unbind ^f12')

        send_command('unbind !f9')
        send_command('unbind !f10')
        send_command('unbind !f11')
        send_command('unbind !f12')

        send_command('unbind f9')
        send_command('unbind f10')
        send_command('unbind f11')
        send_command('unbind f12')

    end    

    --Multiples--
    --There are some items in the game that you can have multiples of and their augments might differ.
    --A good example are Ambuscade capes. Sucellos's Cape is an Ambuscade cape that can be widely customized and it's
    --    usually best to have multiples for different situations. For red mage, I only have one for magic spells, but eventually,
    --    I should make some for TPing, for different weaponskills, and for magic accuracy and enfeebles.
    --
    --If you want to save yourself the trouble of typing out the exact augments list so gearswap finds a match, you can
    --    equip the item and then type //gs export. This will create a json array of your currently equipped gear in Gearswap'sachet
    --    addon directory. Augments are included in this export, so you can copy the line from export and paste it in your main lua.

    Sucellos = {}
    Sucellos.MAB = { name="Sucellos's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','"Mag.Atk.Bns."+10',} }
    --TODO: More Sucellos capes.

    TaeonChapeau = {}
        TaeonChapeau.TP = { name="Taeon Chapeau", augments={'Accuracy+17','"Triple Atk."+2','Crit. hit damage +1%',} }

    TaeonGloves = {}
        TaeonGloves.TP = { name="Taeon Gloves", augments={'Accuracy+14 Attack+14','"Triple Atk."+2','DEX+8',} }

    TaeonTights = {}
        TaeonTights.TP = { name="Taeon Tights", augments={'Accuracy+19','"Triple Atk."+2','STR+7 DEX+7',} }

    TaeonBoots = {}
        TaeonBoots.TP = { name="Taeon Boots", augments={'Attack+25','"Triple Atk."+2','STR+7 DEX+7',} }

    DarkRings = {}
        DarkRings.PDT = { name="Dark Ring", augments ={"Phys. dmg. taken -3%"}}
        DarkRings.MDT = { name="Dark Ring", augments ={"Magic dmg. taken -3%"}}

    --With that out of the way, let's define some actual sets of gear. You'll see them roughly grouped by context,
    --    then further delineated by a more clear purpose that set serves for the specific situation. There are different
    --    indices defined for us to later define logic to hit a keybind to rotate through sets for a given context
    --    e.g. hitting F10 as defined above will flip my idle set between Standard and DT here.

    --Your gear needs to be in a place you can equip it, like your inventory and your Mog Wardrobe(s).

    --These are suggestions on how to lay things out, but if you come up with something more clever or you're more
    --    comfortable with, by all means, change it up. I'll explain my reasoning behind why I made the sets for RDM
    --  that I did and a rough summary of what's in them.

    --I imagine your attention for your Dark Knight sets are primarily going to be your TP and your Weaponskill sets.
    --You might want to make different sets for different weapon types; I pretty much only have swords or daggers at any
    --    single point, or I'm purely spellcasting and just use clubs, but you might need to make different sets for different
    --    weapon types.
    --A SUPER IMPORTANT THING TO KEEP IN MIND, if you want to switch between scythe and greatsword in the thick of things, is
    --    that equipping a different weapon resets your accumulated TP to 0. I haven't found a good solution yet, though I should
    --    work on one. I need to fix this so this example shouldn't be followed to the letter, basically.
    --        I also don't know if changing grips reduces TP or if that's only for your main weapon.

    --Eventually, you might be able to make gearsets for your spells, like Stun or Absorb-Stat or Drain/Aspir, etc, or
    --    if there's gear that augments your Job Abilities like Last Resort or whatnot, you'll want to make sets for those too.
    --    I don't think I include any of those in here, since I don't have any gear for RDM that does that, but I have some examples
    --    in my BLU and DNC luas. It's likely your AF/Relic/Empyrean gear augments those abilities, if anything does at all.

    --In general, you want to start the bottom up. Just think in terms of what actions you have and what the best piece for
    --    that action would be *that you have*. Sometimes that's super specialized, like in the case of AF/Relic/Empyrean gear,
    --    but other times, you might have a piece lying around that a guide doesn't mention that's still good enough to put in anyway.

    --Idle Sets--

    --These are basically sets for when you aren't engaged directly in combat and don't have your weapons out. This
    --    is often the case for casters, especially backline ones, like BLM and WHM. Depending on the situation, you might
    --    want to focus on your natural regeneration and refresh, or you might want a set to reduce any stray damage.
    --Regen/refresh/regain is nice, and there are times where you may tank without having a weapon drawn.

    sets.Idle = {}

    sets.Idle.index = {'Standard', 'DT'}
    Idle_ind = 1

    --Right now I'm calling it 'standard' because I don't know what else to call it, but this is mainly focused on refresh
    --    and regen where I can get it, and filling in the rest of the slots with -damage taken pieces.
    --I still need to consider if Bolelabunga (a club) is hindering me from combat and figure out a better weapon switching
    --    solution without resetting my TP on accident. Bol is mainly useful for its regen/refresh and increases regen potency,
    --    but it's not good for active casting.
    --Bolelabunga, Befouled crown, Jhakri robe all add to my auto-refresh and natural MP regeneration, on top of any otherwise
    --    Refresh spells I have cast on myself. Brachyura earring increases Protect/Shell potency when they're cast on me,
    --    Ethereal Earring and Flume Belt return MP to me when I take damage, and everything else reduces damage taken.
    --In the future, if I get some of my AF pieces upgraded, I can get more refresh, or I might switch out Stikini Rings +1 for
    --    my rings here, though those are really expensive.
    sets.Idle.Standard =
                        {
                            main="Bolelabunga",                                                                     ammo="Ginsen",
                            head="Befouled crown",    neck="Twilight torque",         ear1="Ethereal earring",         ear2="Brachyura earring",
                            body="Jhakri robe +2",    hands="Ayanmo manopolas +1",    ring1="Karieyh ring",            ring2="Ayanmo ring",
                            back="Umbra cape",        waist="Flume belt",                legs="Ayanmo cosciales +2",        feet="Ayanmo gambieras +2"
                        }

    --Conversely, in this set, I've swapped out Befouled Crown and Jhakri Robe for other pieces that give me more -damage taken.
    --I also swapped my regain Karieyh ring for a PDT dark ring.

    sets.Idle.DT =    {
                                                                                                                    ammo="Ginsen",
                         head="Ayanmo zucchetto +2",    neck="Twilight torque",         ear1="Ethereal earring",     ear2="Brachyura earring",
                         body="Ayanmo corazza +2",        hands="Ayanmo manopolas +1",    ring1=DarkRings.PDT,        ring2="Ayanmo ring",
                         back="Umbra cape",                waist="Flume belt",                legs="Ayanmo cosciales +2",    feet="Ayanmo gambieras +2"
                    }

    --TP Sets--

    --Stats to look for in a TP set are typically Accuracy, Double Attack, Triple Attack, and Store TP. Those ensure you get as much TP
    --    as fast as possible so you can Weaponskill as fast as possible. As Dark Knight, most of your damage is going to come from WSes,
    --    so your autoattacks should be geared for TP first, damage second.
    --Accuracy = if you miss, you don't get TP. Simple as that.
    --Double Attack/Triple Attack = you attack more often and thus get more TP.
    --Store TP = you get more TP per hit.
    --The slower a weapon is, the more TP you get per hit, so it balances out that way. For two-handed weapons, people typically gear
    --    for builds where they have enough Store TP to hit five or six times and be able to weaponskill.
    --The exact number will vary based on the weapon you have and its delay, so you want to plug in your numbers to a weapon delay/TP
    --    calculator like this one http://fadedtwilight.org/storetp-calc.html -- this gets more complicated if you're dual-wielding, but
    --    you're not dual-wielding as a dark knight.
    --Once you've got those down, more Attack is always good until you're attack/defense ratio capped. This is very unlikely to happen though.

    sets.TP = {}

    sets.TP.index = {'Standard', 'Accuracy', 'PDT', 'MDT', 'DTAccuracy'}

    TP_ind = 1

    --Balls to the wall focused on TP, assuming I have enough accuracy without really trying.
    sets.TP.Standard =     {
                            main="Colada",                     sub="Buramenk\'ah",                                        ammo="Ginsen",
                            head="Ayanmo zucchetto +2",        neck="Anu torque",                 ear1="Suppanomimi",        ear2="Brutal earring",
                            body="Ayanmo corazza +2",        hands=TaeonGloves.TP,            ring1="Apate ring",        ring2="Petrov ring",
                            back="Bleating Mantle",            waist="Windbuffet belt +1",        legs=TaeonTights.TP,    feet=TaeonBoots.TP
                        }

    --Accuracy first and TP stats second against evasive enemies, usually for higher level content.
    sets.TP.Accuracy = {
                            main="Colada",                 sub="Buramenk\'ah",                                        ammo="Honed tathlum",
                            head="Ayanmo zucchetto +2",    neck="Ej necklace",             ear1="Suppanomimi",         ear2="Mache earring",
                            body="Ayanmo corazza +2",    hands="Ayanmo manopolas +1",    ring1="Epona's ring",        ring2="Rajas ring",
                            back="Bleating Mantle",        waist="Windbuffet belt +1",        legs="Ayanmo cosciales +2",    feet="Ayanmo gambieras +2"
                        }

    --i need to clean up formatting but don't want to. suffer

    --TPing while reducing physical damage, trying to maximize both.
    sets.TP.PDT = {main="Colada", sub="Buramenk\'ah", ammo="Ginsen",
                            head="Ayanmo zucchetto +2", neck="Twilight torque", ear1="Suppanomimi", ear2="Brutal earring",
                            body="Ayanmo corazza +2",hands="Ayanmo manopolas +1",ring1="Epona's ring",ring2="Ayanmo ring",
                            back="Umbra cape",waist="Flume belt",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    --TPing while reducing magical damage, trying to maximize both.    
    sets.TP.MDT = {main="Colada", sub="Buramenk\'ah", ammo="Ginsen",
                            head="Ayanmo zucchetto +2", neck="Twilight torque", ear1="Suppanomimi", ear2="Brutal earring",
                            body="Ayanmo corazza +2",hands="Ayanmo manopolas +1",ring1=DarkRings.MDT,ring2="Ayanmo ring",
                            back="Engulfer cape +1",waist="Windbuffet belt +1",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    --Something is evasive AND does a lot of damage. Lucky you!--
    sets.TP.DTAccuracy = {main="Colada", sub="Buramenk\'ah", ammo="Honed tathlum",
                            head="Ayanmo zucchetto +2", neck="Ej necklace", ear1="Mache earring", ear2="Suppanomimi",
                            body="Ayanmo corazza +2",hands="Ayanmo manopolas +1",ring1="Epona's ring",ring2="Ayanmo ring",
                            back="Bleating Mantle",waist="Windbuffet belt +1",legs="Ayanmo cosciales +2",feet="Ayanmo gambieras +2"}

    --Weaponskill Sets--

    --So, the way you gear weaponskills depends on the weaponskill. You either want damage or accuracy, depending on how evasive the mob is.
    --You'll want to do some research on your own weaponskills and how they work. I'll try to give some guidelines on the common patterns, though.
    --Every Weaponskill has a stat component called its WSC. This is basically what stat and how much of that stat contributes to the final damage.
    --    Greatsword typically has weaponskills that scale off of STR and VIT, I think Scythes are mostly STR but might have a few utility WSes that
    --    scale off of INT or MND instead.
    --There's a stat on gear called "Weaponskill Damage" -- in most cases, this is just a straight multiplier to the first hit in the weaponskill.
    --    If it's a weaponskill that just does a crapload of damage in one hit, like Torcleaver, this is really good. If not, it's probably better to focus on other stats.
    --Some weaponskills have a property that transfers the fTP multiplier across all hits of the weaponskill, like Resolution, so extra hits are worth more.
    --    There are two stats worth mentioning here, DA/TA and fTP bonuses.
    --    You can only get up to 8 hits per a single attack round, and a WS counts as an attack round. Still, Double/Triple attack is useful for extending a five-hit to
    --      an eight-hit weaponskill, especially for ones that transfer the fTP multiplier across all hits, including ones from a multihit proc.
    --    Fotia Gorget and Fotia belt (and their individual elemental neck/belt ingredient pieces) give a further bonus to the fTP multiplier.
    --        It's worth noting that Fotia gorget and Fotia belt say they have WSD, but testing has shown that this instead refers to a 10% bonus to fTP,
    --        which isn't the same thing. There might be other cases. Do your research on the gear piece, and figure out which it is. afaik this is the only exception though
    --Obviously, more accuracy and attack are also good.

    sets.WS = {}

    --Requiescat's WSC component is 80% MND, so here we want to maximize mind. Additionally, it's a five-hit attack that transfers fTP.
    --    Hence, the equipment here is basically anything that boosts MND (Jhakri gear, Quartz, Leviathan ring), boosts fTP (Fotia gear),
    --    and gets me multi attacks (Brutal earring, Bleating Mantle, Epona's Ring)

    sets.Requiescat = {}

    sets.Requiescat.index = {'Attack','Accuracy'}
    Requiescat_ind = 1

    sets.Requiescat.Attack =
                            {
                                                                                                                    ammo="Quartz Tathlum +1",
                                head="Jhakri coronal +2",    neck="Fotia gorget",        ear1="Moonshade earring",    ear2="Brutal earring",
                                body="Jhakri robe +2",        hands="Jhakri cuffs +1",    ring1="Epona's ring",        ring2="Levia. ring",
                                back="Bleating Mantle",        waist="Fotia belt",            legs="Jhakri slops +1",        feet="Jhakri pigaches +2"
                            }

    sets.Requiescat.Accuracy =
                            {
                                                                                                                    ammo="Honed tathlum",
                               head="Jhakri coronal +2",    neck="Ej necklace",            ear1="Moonshade earring",    ear2="Brutal earring",
                               body="Jhakri robe +2",        hands="Jhakri cuffs +1",    ring1="Epona's ring",        ring2="Levia. ring",
                               back="Bleating Mantle",        waist="Fotia belt",            legs="Jhakri slops +1",        feet="Jhakri pigaches +2"
                            }

    --Chant Du Cygne has a WSC of 80% DEX and is a three-hit weaponskill that transfers its fTP multiplier across all hits.
    --    Again, the gear with the highest DEX I have, Fotia gear, and multihit procs.

    sets.ChantDuCygne = {}

    sets.ChantDuCygne.index = {'Attack','Accuracy'}
    ChantDuCygne_ind = 1

    sets.ChantDuCygne.Attack =
                            {
                                                                                                                    ammo="Jukukik feather",
                                head=TaeonChapeau.TP,        neck="Fotia gorget",         ear1="Moonshade earring",     ear2="Mache earring",
                                body="Ayanmo corazza +2",    hands=TaeonGloves.TP,        ring1="Epona's ring",        ring2="Apate ring",
                                back="Bleating Mantle",        waist="Fotia belt",            legs=TaeonTights.TP,        feet="Thereoid greaves"
                            }

    sets.ChantDuCygne.Accuracy = {ammo="Honed tathlum",
                                  head=TaeonChapeau.TP, neck="Fotia gorget", ear1="Moonshade earring", ear2="Mache earring",
                                  body="Ayanmo corazza +2", hands=TaeonGloves.TP, ring1="Epona's ring", ring2="Apate ring",
                                  back="Bleating Mantle", waist="Fotia belt", legs=TaeonTights.TP, feet="Ayanmo gambieras +2"}

    --Sanguine Blade is weird. It's a magical weaponskill that scales off of INT and benefits from Magic Attack Bonus. It's geared like a spell
    --    more than it is a typical weaponskill.

    sets.WS.SanguineBlade = {}

    sets.WS.SanguineBlade = {ammo="Snow sachet",
                             head="Pixie Hairpin +1",neck="Sanctity necklace",ear1="Friomisi earring",ear2="Hecate's earring",
                             body="Jhakri robe +2",hands="Jhakri cuffs +1",ring1="Acumen ring",ring2="Shiva ring",
                             back=Sucellos.MAB,waist="Salire belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    --Single hit AoE attack that scales by STR. WSD and STR.
    sets.WS.CircleBlade = {}        

    sets.WS.CircleBlade = {ammo="Cheruski needle",
                           head=TaeonChapeau.TP,neck="Lacono necklace +1", ear1="Moonshade earring", ear2="Brutal earring",
                           body="Ayanmo corazza +2",hands="Jhakri cuffs +1",ring1="Karieyh ring",ring2="Apate ring",
                           back="Bleating Mantle",waist="Prosilio belt",legs=TaeonTights.TP,feet=TaeonBoots.TP}

    --Two-hit WS with a WSC of STR 50% + MND 50%. Doesn't transfer fTP multiplier across hits. Thus, mix and match optimal STR/MND and
    --    Weaponskill Damage%.
    sets.WS.SavageBlade = {}        

    sets.WS.SavageBlade = {ammo="Cheruski needle",
                           head=TaeonChapeau.TP,neck="Lacono necklace +1", ear1="Moonshade earring", ear2="Brutal earring",
                           body="Ayanmo corazza +2",hands="Jhakri cuffs +1",ring1="Karieyh ring",ring2="Apate ring",
                           back="Bleating Mantle",waist="Fotia belt",legs=TaeonTights.TP,feet=TaeonBoots.TP}

    --I honestly don't know but I think this is a magical WS like Sanguine Blade. I never use it.                       
    sets.WS.FlashNova = {}

    sets.WS.FlashNova = {ammo="Pemphredo tathlum",
                             head="Jhakri coronal +2",neck="Sanctity necklace",ear1="Friomisi earring",ear2="Hecate's earring",
                             body="Jhakri robe +2",hands="Jhakri cuffs +1",ring1="Acumen ring",ring2="Shiva ring",
                             back=Sucellos.MAB,waist="Salire belt",legs="Jhakri slops +1",feet="Jhakri pigaches +2"}

    --Spells--

    --HEY we're doing something different now. This is for my elemental nukes on RDM. Free nuking is just for spamming elemental spells
    --    without trying to magic burst, and my magic burst set tries to stack as much Magic Burst stat as much as possible.
    --    Probably not relevant for DRK but the example might give you a general idea of how I have two sets for different casting modes
    --    based on what I'm trying to do.

    sets.MagicDamage = {}
    sets.MagicDamage.index = {'FreeNuke','MagicBurst'}
    Magic_ind = 1

    sets.MagicDamage.FreeNuke = 
                            {
                                main="Nibiru Cudgel", sub="Nibiru cudgel", ammo="Pemphredo tathlum",
                                head="Jhakri coronal +2",neck="Sanctity necklace",ear1="Hecate's earring",ear2="Friomisi earring",
                                body="Jhakri robe +2",hands="Amalric gages",ring1="Shiva ring",ring2="Acumen ring",
                                back=Sucellos.MAB,waist="Eschan stone",legs="Jhakri slops +1",feet="Jhakri pigaches +2"
                            }

    --I've left myself notes on what kind of magic burst it is (I or II, they have different caps) and what pieces I can get to improve further.
    --    Stuff that I don't have yet, but can get to make my magic bursts hit even harder. I've got a good basis, but I can try to hit the 50 MBI cap
    --    and then try to get more MBII (uncapped but rarer) on top of that.

    --missing Ea hat, chest, merlinic pants; pigaches +2 most important here. ea is su3 anyway.
    --so currently at:
    --    I: neck=10 feet=5 ring1=5 head=11  = 31 (cap is 40)
    --    II: hands=5 ring2=5 = 10
    --  RDM job trait RDM=7
    -- can potentially augment helios pieces too -- head and legs
    -- RDM inherently has 7 MB, so 48 total
    sets.MagicDamage.MagicBurst = 
                            {
                                main="Nibiru Cudgel", sub="Nibiru cudgel", ammo="Pemphredo tathlum",
                                head="Merlinic hood",neck="Mizu. Kubikazari",ear1="Hecate's earring",ear2="Friomisi earring",
                                body="Jhakri robe +2",hands="Amalric gages",ring1="Locus ring",ring2="Mujin band",
                                back=Sucellos.MAB,waist="Eschan stone",legs="Jhakri slops +1",feet="Jhakri pigaches +2"
                            }

    --Cure potency is a stat. They also scale with Healing Skill and MND. You get the idea.
    sets.Cures =    {        
                            main="Tamaxchi",                                                                            ammo="Quartz Tathlum +1",
                            head="Jhakri coronal +2",    neck="Nodens gorget",                ear1="Loquac. earring",        ear2="Mendicant's earring",
                            body="Chelona blazer",        hands="Weatherspoon cuffs +1",        ring1="Levia. ring",        ring2="Levia. Ring",
                            back="Solemnity cape",        waist="Ovate rope",                    legs="Atrophy tights",        feet="Jhakri pigaches +2"
                    }

    --Regen potency.
    sets.Regen =    { 
                        main = "Bolelabunga"
                    }

    --Enhancement duration and potency. Same as EnhanceOther for now but in the future, RDM empyrean gear will give me massive bonuses to self-cast duration
    sets.EnhanceSelf =
                    {
                            head="Befouled Crown",                                            ear1="Brachyura earring",    ear2="Andoaa earring",
                            body="Telchine chasuble",    hands="Duelist's gloves",
                            back="Sucellos's cape"
                    }

    --"Sword enhancement damage" -- applies at time of casting.
    sets.EnspellSelf =
                    {
                            head="Befouled Crown",                                                                        ear2="Andoaa earring",
                            body="Telchine chasuble",    hands="Ayanmo manopolas +1",
                            back="Sucellos's cape",                                                                        feet="Estoqueur's houseaux +1"
                    }

    --See EnhanceSelf.
    sets.EnhanceOther =
                    {
                            head="Befouled Crown",                                                                        ear2="Andoaa earring",
                            body="Telchine chasuble",    hands="Duelist's gloves",
                            back="Sucellos's cape"
                    }

    --So this is a little weird. I wanted to avoid making too many sets and enfeebles are weird.
    --    Some scale their strength or duration based on some stat, like Mind or Enfeebling skill.
    --    Others simply need to hit and there's no reason not to stack anything other than Magic Accuracy and Enfeebling skill.
    --  Or, I might want to switch to a high MACC set at all times to just try to land stuff, period, without caring about potency.
    sets.Enfeeble = {}
    sets.Enfeeble.index = {'Potency','MagicAccuracy'}
    Enfeeble_ind = 1

    sets.Enfeeble.MagicAccuracy =
                    {
                            main="Nibiru Cudgel",        sub="Nibiru cudgel",                                            ammo="Kalboron stone",
                            head="Jhakri coronal +2",    neck="Voltsurge torque",            ear1="Lifestorm earring",    ear2="Psystorm earring",
                            body="Jhakri robe +2",        hands="Jhakri cuffs +1",            ring1="Sangoma ring",        ring2="Perception Ring",
                            back="Ghostfyre cape",        waist="Ovate rope",                    legs="Jhakri slops +1",        feet="Ayanmo gambieras +2"
                    }

    sets.Enfeeble.PotencySkill =
                    {
                            main="Nibiru Cudgel",        sub="Nibiru cudgel",                                            ammo="Quartz Tathlum +1",
                            head="Befouled crown",        neck="Imbodla necklace",            ear1="Lifestorm earring",    ear2="Psystorm earring",
                            body="Jhakri robe +2",        hands="Jhakri cuffs +1",            ring1="Sangoma ring",        ring2="Perception Ring",
                            back="Sucellos's cape",        waist="Ovate rope",                    legs="Jhakri slops +1",        feet="Ayanmo gambieras +2"
                    }

    sets.Enfeeble.PotencyMND =
                    {
                            main="Nibiru Cudgel",        sub="Nibiru cudgel",                                            ammo="Quartz Tathlum +1",
                            head="Jhakri coronal +2",    neck="Imbodla necklace",            ear1="Lifestorm earring",    ear2="Psystorm earring",
                            body="Jhakri robe +2",        hands="Jhakri cuffs +1",            ring1="Levia. ring",        ring2="Perception Ring",
                            back="Ghostfyre cape",        waist="Ovate rope",                    legs="Jhakri slops +1",        feet="Ayanmo gambieras +2"
                    }

    --Precast Sets--

    --Right now my only real precast set is a Fast Cast set. I'll get into what precast means later, but this just stacks FC
    --    at the 'expense' of everything else since it doesn't actually matter other than casting as fast as possible.

    sets.precast = {}

    sets.precast.FC = {}

    sets.precast.FC.Standard = { main="Colada", --ammo="Impatiens",
                                head="Carmine mask",neck="Voltsurge torque", ear1="Loquac. Earring",
                                body="Duelist's tabard",hands="Sombra mittens",ring1="Prolix ring",
                                back="Swith Cape",waist="Witful Belt",legs="Ayanmo cosciales +2",feet="Chelona Boots"}

    sets.Obi = { waist = "Hachirin-no-obi" }                            

end

--Okay, here, we're done with defining gearsets and what's in them. Now, I'm defining categories of spells and abilities.
--    RDM's spell list is very large, so I figured adding some data here to make it easier to sort through in code will make
--    it more maintainable in the long term. As long as I can just slap another spell into this pre-existing list, I'm okay with it.
--    It's stuff I don't want cluttering my logic below or being hardcoded

spell_names = {}

spell_names.damage = {
                        'Fire','Fire II','Fire III','Fire IV','Fire V',
                        'Blizzard','Blizzard II','Blizzard III','Blizzard IV','Blizzard V',
                        'Water','Water II','Water III','Water IV','Water V',
                        'Thunder','Thunder II','Thunder III','Thunder IV','Thunder V',
                        'Aero','Aero II','Aero III','Aero IV','Aero V',
                        'Stone','Stone II','Stone III','Stone IV','Stone V',
                    }

spell_names.enfeeble = 
                    {
                        'Dia', 'Dia II', 'Dia III', 'Diaga', 'Dispel', 'Poison', 'Poison II',
                        'Blind', 'Slow', 'Slow II', 'Paralyze', 'Paralyze II', 'Sleep', 'Silence', 'Bind', 'Gravity', 'Gravity II', 'Break',
                        'Distract', 'Distract II', 'Distract III', 'Frazzle', 'Frazzle II', 'Frazzle III', 'Addle', 'Addle II', 'Inundation',
                    }

spell_names.enfeeble_mind =
                    {
                        'Slow', 'Slow II', 'Paralyze', 'Paralyze II', 'Addle', 'Addle II',
                    }

spell_names.enfeeble_skill =
                    {
                        'Distract', 'Distract II', 'Distract III', 'Frazzle', 'Frazzle II', 'Frazzle III', 'Poison', 'Poison II',
                    }

spell_names.dark =
                    {
                        'Bio', 'Bio II', 'Bio III', 'Drain', 'Aspir',
                    }

spell_names.drain =
                    {
                        'Drain', 'Aspir',
                    }

spell_names.enhance =
                    {
                        'Protect', 'Protect II', 'Protect III', 'Protect IV', 'Protect V',
                        'Shell', 'Shell II', 'Shell III', 'Shell IV', 'Shell V',
                        'Sneak', 'Invisible', 'Deodorize', 'Aquaveil', 'Blink',
                        'Haste', 'Haste II', 'Regen', 'Regen II', 'Refresh', 'Refresh II', 'Refresh III',
                        'Phalanx', 'Phalanx II', 'Stoneskin',
                        'Temper', 'Temper II', 'Flurry', 'Flurry II',
                        'Gain-STR', 'Gain-DEX', 'Gain-VIT', 'Gain-INT', 'Gain-MND', 'Gain-CHR', 'Gain-AGI',
                        'Shock Spikes', 'Ice Spikes', 'Blaze Spikes',
                        'Enfire', 'Enblizzard', 'Enwater', 'Enthunder', 'Enaero', 'Enstone',
                        'Enfire II', 'Enblizzard II', 'Enwater II', 'Enthunder II', 'Enaero II', 'Enstone II',
                        'Barfire', 'Barblizzard', 'Barwater', 'Barthunder', 'Baraero', 'Barstone',
                        'Barsleep', 'Barpoison', 'Barparalyze', 'Barblind', 'Barsilence', 'Barvirus', 'Barpetrify', 'Baramnesia',
                    }

spell_names.enspell =
                    {
                        'Enfire', 'Enblizzard', 'Enwater', 'Enthunder', 'Enaero', 'Enstone',
                        'Enfire II', 'Enblizzard II', 'Enwater II', 'Enthunder II', 'Enaero II', 'Enstone II',
                    }

spell_names.cure =
                    {
                        'Cure', 'Cure II', 'Cure III', 'Cure IV', 'Raise', 'Raise II',
                    }

--This is a function I wrote to help sort through the above arrays, basically just figuring out if the spell
-- I'm currently casting is in any defined category and which one.
function array_contains(haystack, needle)
    for index, value in ipairs(haystack) do
        if value == needle then
            return true
        end
    end
    return false
end

--So, the 'precast' step is where you equip WS sets and your fast cast set. WSes go off instantly, spells take into account FC but
--  it's possible to swap gear to a set without FC that has stats related to its actual potency or whatnot.

function precast(spell)
    if spell.action_type == 'Magic' then
        equip(sets.precast.FC.Standard)
    end

    if spell.english == 'Requiescat' then
        equip(sets.Requiescat[sets.Requiescat.index[Requiescat_ind]])
    end

    if spell.english == 'Chant du Cygne' then
        equip(sets.ChantDuCygne[sets.ChantDuCygne.index[ChantDuCygne_ind]])
    end

    if spell.english == 'Circle Blade' then
        equip(sets.WS.CircleBlade)
    end

    if spell.english == 'Savage Blade' then
        equip(sets.WS.SavageBlade)
    end

    if spell.english == 'Sanguine Blade' then
        equip(sets.WS.SanguineBlade)
    end

    if spell.english == 'Flash Nova' then
        equip(sets.WS.FlashNova)
    end
end

--This is where I map the spell arrays to their sets.
function midcast(spell,act)
    if array_contains(spell_names.damage, spell.english) then
        equip(sets.MagicDamage[sets.MagicDamage.index[Magic_ind]])
        return
    end

    if array_contains(spell_names.cure, spell.english) then
        equip(sets.Cures)
        return
    end

    if array_contains(spell_names.enspell, spell.english) then
        equip(sets.EnspellSelf)
        return
    end

    if array_contains(spell_names.enhance, spell.english) then
        if spell.target.name == player.name then
            equip(sets.EnhanceSelf)
        else
            equip(sets.EnhanceOther)
        return
        end
    end

    if array_contains(spell_names.enfeeble, spell.english) then
        --branch based on current index and if it even matters, prefer MAcc if not in list of scaling
        if(Enfeeble_ind == 1) then
            if(array_contains(spell_names.enfeeble_mind, spell.english)) then
                equip(sets.Enfeeble.PotencyMND)
                return
            elseif(array_contains(spell_names.enfeeble_skill, spell.english)) then
                equip(sets.Enfeeble.PotencySkill)
                return
            else
                equip(sets.Enfeeble.MagicAccuracy)
                return
            end
        elseif(Enfeeble_ind == 2) then
            equip(sets.Enfeeble.MagicAccuracy)
            return
        end
    end
end

--Once you're done casting, switch back to your TP or Idle set, depending on if you're engaged or not.
function aftercast(spell)
    if player.status == 'Engaged' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    else
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    end
end

--When you draw your weapon, when you're engaged, equip the TP set.
--When you sheathe your weapon, when you're idle, equip the idle set.
function status_change(new,old)
    if new == 'Engaged' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    else
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    end
end

--See keybind section way at the beginning and the indices where these set categories are defined.
--This is the logic for toggling between different set categories and situations.
function self_command(command)
    if command == 'toggle TP set' then
        TP_ind = TP_ind +1
        if TP_ind > #sets.TP.index then TP_ind = 1 end
        send_command('@input /echo <----- TP Set changed to '..sets.TP.index[TP_ind]..' ----->')
        equip(sets.TP[sets.TP.index[TP_ind]])
    elseif command == 'toggle Idle set' then
        Idle_ind = Idle_ind +1
        if Idle_ind > #sets.Idle.index then Idle_ind = 1 end
        send_command('@input /echo <----- Idle Set changed to '..sets.Idle.index[Idle_ind]..' ----->')
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    elseif command == 'toggle Req set' then
        Requiescat_ind = Requiescat_ind +1
        if Requiescat_ind > #sets.Requiescat.index then Requiescat_ind = 1 end
        send_command('@input /echo <----- Requiescat Set changed to '..sets.Requiescat.index[Requiescat_ind]..' ----->')
    elseif command == 'toggle CDC set' then
        ChantDuCygne_ind = ChantDuCygne_ind +1
        if ChantDuCygne_ind > #sets.ChantDuCygne.index then ChantDuCygne_ind = 1 end
        send_command('@input /echo <----- Chant du Cygne Set changed to '..sets.ChantDuCygne.index[ChantDuCygne_ind]..' ----->')
    elseif command == 'toggle Magic set' then
        Magic_ind = Magic_ind +1
        if Magic_ind > #sets.MagicDamage.index then Magic_ind = 1 end
        send_command('@input /echo <----- Magic Set changed to '..sets.MagicDamage.index[Magic_ind]..' ----->')
    elseif command == 'toggle Enfeeble set' then
        Enfeeble_ind = Enfeeble_ind +1
        if Enfeeble_ind > #sets.Enfeeble.index then Enfeeble_ind = 1 end
        send_command('@input /echo <----- Enfeeble Set changed to '..sets.Enfeeble.index[Enfeeble_ind]..' ----->')
    elseif command == 'equip TP set' then
        equip(sets.TP[sets.TP.index[TP_ind]])
    elseif command == 'equip Idle set' then
        equip(sets.Idle[sets.Idle.index[Idle_ind]])
    end
end
<?xml version="1.1" ?>
<settings>
    <global>
        <setmode>PreserveTraits</setmode>
        <setspeed>1</setspeed>
        <spellsets>
            <cleaving>
                <slot01>entomb</slot01>
                <slot02>magic fruit</slot02>
                <slot03>barbed crescent</slot03>
                <slot04>erratic flutter</slot04>
                <slot05>retinal glare</slot05>
                <slot06>sound blast</slot06>
                <slot07>regurgitation</slot07>
                <slot08>cocoon</slot08>
                <slot09>delta thrust</slot09>
                <slot10>cursed sphere</slot10>
                <slot11>magic hammer</slot11>
                <slot12>battery charge</slot12>
                <slot13>blinding fulgor</slot13>
                <slot14>occultation</slot14>
                <slot15>subduction</slot15>
                <slot16>spectral floe</slot16>
                <slot17>dream flower</slot17>
                <slot18>diamondhide</slot18>
                <slot19>tenebral crush</slot19>
                <slot20>barrier tusk</slot20>
            </cleaving>
            <dding>
                <slot01>barbed crescent</slot01>
                <slot02>delta thrust</slot02>
                <slot03>sweeping gouge</slot03>
                <slot04>occultation</slot04>
                <slot05>paralyzing triad</slot05>
                <slot06>nat. meditation</slot06>
                <slot07>empty thrash</slot07>
                <slot08>diffusion ray</slot08>
                <slot09>thrashing assault</slot09>
                <slot10>sickle slash</slot10>
                <slot11>sinker drill</slot11>
                <slot12>fantod</slot12>
                <slot13>glutinous dart</slot13>
                <slot14>sudden lunge</slot14>
                <slot15>erratic flutter</slot15>
                <slot16>tail slap</slot16>
                <slot17>barrier tusk</slot17>
                <slot18>heavy strike</slot18>
                <slot19>cocoon</slot19>
                <slot20>embalming earth</slot20>
            </dding>
            <default>

            </default>
            <ninjacleaving>
                <slot01>cursed sphere</slot01>
                <slot02>battery charge</slot02>
                <slot03>water bomb</slot03>
                <slot04>diamondhide</slot04>
                <slot05>chaotic eye</slot05>
                <slot06>tenebral crush</slot06>
                <slot07>magic fruit</slot07>
                <slot08>entomb</slot08>
                <slot09>sound blast</slot09>
                <slot10>cocoon</slot10>
                <slot11>subduction</slot11>
                <slot12>erratic flutter</slot12>
                <slot13>blinding fulgor</slot13>
                <slot14>barrier tusk</slot14>
                <slot15>retinal glare</slot15>
                <slot16>regurgitation</slot16>
                <slot17>occultation</slot17>
                <slot18>magic hammer</slot18>
                <slot19>spectral floe</slot19>
                <slot20>dream flower</slot20>
            </ninjacleaving>
            <ninjasub>
                <slot01>sickle slash</slot01>
                <slot02>tail slap</slot02>
                <slot03>thrashing assault</slot03>
                <slot04>magic fruit</slot04>
                <slot05>sinker drill</slot05>
                <slot06>battery charge</slot06>
                <slot07>saline coat</slot07>
                <slot08>sweeping gouge</slot08>
                <slot09>diffusion ray</slot09>
                <slot10>fantod</slot10>
                <slot11>glutinous dart</slot11>
                <slot12>heavy strike</slot12>
                <slot13>cocoon</slot13>
                <slot14>sudden lunge</slot14>
                <slot15>erratic flutter</slot15>
                <slot16>occultation</slot16>
                <slot17>paralyzing triad</slot17>
                <slot18>nat. meditation</slot18>
                <slot19>empty thrash</slot19>
                <slot20>barrier tusk</slot20>
            </ninjasub>
            <salvage>
                <slot01>amorphic spikes</slot01>
                <slot02>sudden lunge</slot02>
                <slot03>barbed crescent</slot03>
                <slot04>delta thrust</slot04>
                <slot05>tenebral crush</slot05>
                <slot06>diffusion ray</slot06>
                <slot07>erratic flutter</slot07>
                <slot08>battery charge</slot08>
                <slot09>sinker drill</slot09>
                <slot10>magic fruit</slot10>
                <slot11>barrier tusk</slot11>
                <slot12>cocoon</slot12>
                <slot13>heavy strike</slot13>
                <slot14>subduction</slot14>
                <slot15>occultation</slot15>
                <slot16>charged whisker</slot16>
                <slot17>empty thrash</slot17>
                <slot18>evryone. grudge</slot18>
                <slot19>spectral floe</slot19>
                <slot20>fantod</slot20>
            </salvage>
            <tankydd>
                <slot01>barbed crescent</slot01>
                <slot02>delta thrust</slot02>
                <slot03>saline coat</slot03>
                <slot04>magic fruit</slot04>
                <slot05>paralyzing triad</slot05>
                <slot06>battery charge</slot06>
                <slot07>nat. meditation</slot07>
                <slot08>empty thrash</slot08>
                <slot09>diffusion ray</slot09>
                <slot10>thrashing assault</slot10>
                <slot11>sweeping gouge</slot11>
                <slot12>sinker drill</slot12>
                <slot13>cocoon</slot13>
                <slot14>fantod</slot14>
                <slot15>erratic flutter</slot15>
                <slot16>occultation</slot16>
                <slot17>glutinous dart</slot17>
                <slot18>sudden lunge</slot18>
                <slot19>heavy strike</slot19>
                <slot20>barrier tusk</slot20>
            </tankydd>
        </spellsets>
    </global>
</settings>
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License