Gearswap Support Thread

Eorzea Time
 
 
 
言語: JP EN FR DE
日本語版のFFXIVPRO利用したい場合は、上記の"JP"を設定して、又はjp.ffxivpro.comを直接に利用してもいいです
users online
フォーラム » Windower » Support » Gearswap Support Thread
Gearswap Support Thread
First Page 2 3 ... 166 167 168 ... 183 184 185
 Bahamut.Mizuharu
Offline
サーバ: Bahamut
Game: FFXI
user: Mizuharu
Posts: 1988
By Bahamut.Mizuharu 2022-02-27 16:23:39  
Is there a way to add a function where if a party/trust/automaton casts Protect/Shell, it swaps in Sheltered Ring momentarily?
 Asura.Nalfey
Offline
サーバ: Asura
Game: FFXI
user: Nalf
Posts: 104
By Asura.Nalfey 2022-02-27 21:55:45  
There is already an addon that can do this, it's called "React".

You can go in and change the react_<JOB>.lua file and add something like this :
Code
return {

    ["Nalfey"]={
		["Phalanx"]={
			["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.midcast.Phalanx"
		},
		["Phalanx II"]={
			["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.midcast.Phalanx"
		},
        ["Protect"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
        ["Protect II"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
        ["Protect III"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
        ["Protect IV"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
        ["Protect V"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
        ["Shell"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        },
		  ["Shell II"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
		  ["Shell III"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
		  ["Shell IV"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }, 
		 ["Shell V"]={
            ["complete_reaction"]="", 
            ["ready_reaction"]="gs equip sets.Protect"
        }
    }, 
}



You will also need to create those sets ( sets.Protect, sets.midcast.Phalanx ...etc) in your Gearswap JOB.lua
 Asura.Zidaner
Offline
サーバ: Asura
Game: FFXI
user: Xavierr
Posts: 171
By Asura.Zidaner 2022-03-05 09:53:59  
Anyone know of a way to make react or GS equip a holy water set when using holy water?

Thanks
 Asura.Nalfey
Offline
サーバ: Asura
Game: FFXI
user: Nalf
Posts: 104
By Asura.Nalfey 2022-03-05 11:41:38  
You're kinda looking at it from the wrong angle, think of it more like this: if you were about to use a holy water then it means that you're doomed.
So you can create a set in your .lua for when the doom buff is on. This also means that you can add cursna potency items to that set as well, so that a WHM casting cursna on you has a better chance of removing it.

Like so:

Add a Doom set:
Code
    sets.buff.Doom = {
        neck="Nicander's Necklace", --20
        ring1={name="Eshmun's Ring", bag="wardrobe5"}, --20
        ring2={name="Eshmun's Ring", bag="wardrobe6"}, --20
        waist="Gishdubar Sash", --10
        }


Add this to your job_buff_change(buff,gain) function:
(in this example I also have something for when I'm engaged + slept, you can add both or just the doom part at the bottom)
Code
function job_buff_change(buff,gain)
	local name = buff:lower()
    
    if state.Buff[buff] then
        state.Buff[buff] = gain
    end

	if name == 'sleep' then
		if name == 'sleep' then
			if gain and player.hp > 200 and player.status == 'Engaged' then -- Equip Vim Torque When You Are Asleep
				equip({neck="Vim Torque +1"})
				disable('neck')
			elseif not gain then 
				enable('neck')
				handle_equipping_gear(player.status)
			end
		end
	end

    if buff == "doom" then
        if gain then
            equip(sets.buff.Doom)
            send_command('@input /p Doomed, please Cursna.')
             disable('neck','ring1','ring2','waist')
        else
            enable('neck','ring1','ring2','waist')
            handle_equipping_gear(player.status)
        end
    end

    if not midaction() then
        handle_equipping_gear(player.status)
    end
end


And make sure you have this function as well:
Code
function job_update(cmdParams, eventArgs)
    equip(sets[state.WeaponSet.current])
    handle_equipping_gear(player.status)
    th_update(cmdParams, eventArgs)
end
 Asura.Nalfey
Offline
サーバ: Asura
Game: FFXI
user: Nalf
Posts: 104
By Asura.Nalfey 2022-03-05 11:52:58  
Maybe react can work with items I've never actually tried.

Add that doom set to your lua from my post above and then in game try typing this:

//react add Zidaner "Holy water" ready "gs equip sets.buff.Doom"

And try using a holy water to see if it equips that set.
Offline
Posts: 40
By quelthos 2022-03-12 16:51:25  
I am meleeing on rdm, i cast an enhancing spell which containers enhancing skills + weapon and shield, after casting is done, it does not swap back to my melee weapons, pls help
Code
-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2

    -- Load and initialize the include file.
    include('Mote-Include.lua')
end


-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()

    -- state.CP = M(false, "Capacity Points Mode")
    state.Buff.Composure = buffactive.Composure or false
    state.Buff.Saboteur = buffactive.Saboteur or false
    state.Buff.Stymie = buffactive.Stymie or false

    no_swap_gear = S{"Warp Ring", "Dim. Ring (Dem)", "Dim. Ring (Holla)", "Dim. Ring (Mea)",
              "Trizek Ring", "Echad Ring", "Facility Ring", "Capacity Ring"}

    enfeebling_magic_acc = S{'Bind', 'Break', 'Dispel', 'Distract', 'Distract II', 'Frazzle',
        'Frazzle II',  'Gravity', 'Gravity II', 'Silence'}
    enfeebling_magic_skill = S{'Distract III', 'Frazzle III', 'Poison II'}
    enfeebling_magic_effect = S{'Dia', 'Dia II', 'Dia III', 'Diaga', 'Blind', 'Blind II'}
    enfeebling_magic_sleep = S{'Sleep', 'Sleep II', 'Sleepga'}

    skill_spells = S{
        'Temper', 'Temper II', 'Enfire', 'Enfire II', 'Enblizzard', 'Enblizzard II', 'Enaero', 'Enaero II',
        'Enstone', 'Enstone II', 'Enthunder', 'Enthunder II', 'Enwater', 'Enwater II'}

    --include('Mote-TreasureHunter')

    -- For th_action_check():
    -- JA IDs for actions that always have TH: Provoke, Animated Flourish
    info.default_ja_ids = S{35, 204}
    -- Unblinkable JA IDs for actions that always have TH: Quick/Box/Stutter Step, Desperate/Violent Flourish
    info.default_u_ja_ids = S{201, 202, 203, 205, 207}

    lockstyleset = 60
end


-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------

-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    state.OffenseMode:options('Normal', 'Acc', 'Haste')
    state.HybridMode:options('Normal')
    state.WeaponskillMode:options('Normal')
    state.CastingMode:options('Normal', 'Resistant')
    state.IdleMode:options('Normal')

    state.EnSpell = M{['description']='EnSpell', 'Enfire', 'Enblizzard', 'Enaero', 'Enstone', 'Enthunder', 'Enwater'}
    state.BarElement = M{['description']='BarElement', 'Barfire', 'Barblizzard', 'Baraero', 'Barstone', 'Barthunder', 'Barwater'}
    state.BarStatus = M{['description']='BarStatus', 'Baramnesia', 'Barvirus', 'Barparalyze', 'Barsilence', 'Barpetrify', 'Barpoison', 'Barblind', 'Barsleep'}
    state.GainSpell = M{['description']='GainSpell', 'Gain-STR', 'Gain-INT', 'Gain-AGI', 'Gain-VIT', 'Gain-DEX', 'Gain-MND', 'Gain-CHR'}

    state.WeaponSet = M{['description']='Weapon Set', 'macc', 'sb', 'mws', 'ae', 'cdc', 'blunt', 'nuke'}
    state.WeaponLock = M(false, 'Weapon Lock')
    state.MagicBurst = M(false, 'Magic Burst')
    state.SleepMode = M{['description']='Sleep Mode', 'Normal', 'MaxDuration'}
    state.EnspellMode = M(false, 'Enspell Melee Mode')
    state.NM = M(false, 'NM?')
    -- state.CP = M(false, "Capacity Points Mode")

    -- Additional local binds
    --include('Global-Binds.lua') -- OK to remove this line
    --include('Global-GEO-Binds.lua') -- OK to remove this line

    --send_command('bind ^` input /ja "Composure" <me>')
    --send_command('bind @t gs c cycle treasuremode')
    send_command('bind ^` gs c toggle MagicBurst')
    send_command('bind @` gs c cycle SleepMode')

    --if player.sub_job == 'SCH' then
        --send_command('bind ^- gs c scholar light')
        --send_command('bind ^= gs c scholar dark')
        --send_command('bind !- gs c scholar addendum')
        --send_command('bind != gs c scholar addendum')
        --send_command('bind ^; gs c scholar speed')
        --send_command('bind ![ gs c scholar aoe')
        --send_command('bind !; gs c scholar cost')
    --end

    --send_command('bind !q input /ma "Temper II" <me>')
    --send_command('bind !w input /ma "Flurry II" <stpc>')
    --send_command('bind !e input /ma "Haste II" <stpc>')
    --send_command('bind !r input /ma "Refresh III" <stpc>')
    --send_command('bind !y input /ma "Phalanx II" <stpc>')
    --send_command('bind !o input /ma "Regen II" <stpc>')
    --send_command('bind !p input /ma "Shock Spikes" <me>')

    --send_command('bind ~numpad7 input /ma "Paralyze II" <t>')
    --send_command('bind ~numpad8 input /ma "Silence" <t>')
    --send_command('bind ~numpad9 input /ma "Blind II" <t>')
    --send_command('bind ~numpad4 input /ma "Poison II" <t>')
    --send_command('bind ~numpad5 input /ma "Slow II" <t>')
    --send_command('bind ~numpad6 input /ma "Addle II" <t>')
    --send_command('bind ~numpad1 input /ma "Distract III" <t>')
    --send_command('bind ~numpad2 input /ma "Frazzle III" <t>')
    --send_command('bind ~numpad3 input /ma "Inundation" <t>')
    --send_command('bind ~numpad0 input /ma "Dia III" <t>')

    --send_command('bind !insert gs c cycleback EnSpell')
    --send_command('bind !delete gs c cycle EnSpell')
    --send_command('bind ^insert gs c cycleback GainSpell')
    --send_command('bind ^delete gs c cycle GainSpell')
    --send_command('bind ^home gs c cycleback BarElement')
    --send_command('bind ^end gs c cycle BarElement')
    --send_command('bind ^pageup gs c cycleback BarStatus')
    --send_command('bind ^pagedown gs c cycle BarStatus')

    --send_command('bind @e gs c cycle EnspellMode')
    --send_command('bind @d gs c toggle NM')
    send_command('bind @w gs c toggle WeaponLock')
    -- send_command('bind @c gs c toggle CP')
    send_command('bind @e gs c cycleback WeaponSet')
    send_command('bind @r gs c cycle WeaponSet')

    --send_command('bind ^numpad7 input /ws "Savage Blade" <t>')
    --send_command('bind ^numpad9 input /ws "Chant du Cygne" <t>')
    --send_command('bind ^numpad4 input /ws "Requiescat" <t>')
    --send_command('bind ^numpad1 input /ws "Sanguine Blade" <t>')
    --send_command('bind ^numpad2 input /ws "Seraph Blade" <t>')

    select_default_macro_book()
    set_lockstyle()

    state.Auto_Kite = M(false, 'Auto_Kite')
    Haste = 0
    DW_needed = 0
    DW = false
    moving = false
    update_combat_form()
end

-- Called when this job file is unloaded (eg: job change)
function user_unload()
    send_command('unbind ^`')
    send_command('unbind @`')
    send_command('unbind !`')
    send_command('unbind ^-')
    send_command('unbind ^=')
    send_command('unbind !-')
    send_command('unbind !=')
    send_command('unbind ^;')
    send_command('unbind ![')
    send_command('unbind !;')
    send_command('unbind !q')
    send_command('unbind !w')
    send_command('unbind !e')
    send_command('unbind !r')
    send_command('unbind !y')
    send_command('unbind !o')
    send_command('unbind !p')
    send_command('unbind @s')
    send_command('unbind @d')
    send_command('unbind @t')

    send_command('unbind ~numpad7')
    send_command('unbind ~numpad8')
    send_command('unbind ~numpad9')
    send_command('unbind ~numpad4')
    send_command('unbind ~numpad5')
    send_command('unbind ~numpad6')
    send_command('unbind ~numpad1')
    send_command('unbind ~numpad2')
    send_command('unbind ~numpad3')
    send_command('unbind ~numpad0')

    send_command('unbind @w')
    send_command('unbind @c')
    send_command('unbind @e')
    send_command('unbind @r')
    send_command('unbind !insert')
    send_command('unbind !delete')
    send_command('unbind ^insert')
    send_command('unbind ^delete')
    send_command('unbind ^home')
    send_command('unbind ^end')
    send_command('unbind ^pageup')
    send_command('unbind ^pagedown')
    send_command('unbind ^numpad7')
    send_command('unbind ^numpad9')
    send_command('unbind ^numpad4')
    send_command('unbind ^numpad1')
    send_command('unbind ^numpad2')

    send_command('unbind #`')
    send_command('unbind #1')
    send_command('unbind #2')
    send_command('unbind #3')
    send_command('unbind #4')
    send_command('unbind #5')
    send_command('unbind #6')
    send_command('unbind #7')
    send_command('unbind #8')
    send_command('unbind #9')
    send_command('unbind #0')
end

-- Define sets and vars used by this job file.
function init_gear_sets()

    ------------------------------------------------------------------------------------------------
    ---------------------------------------- Precast Sets ------------------------------------------
    ------------------------------------------------------------------------------------------------

    -- Precast sets to enhance JAs
    sets.precast.JA['Chainspell'] = {body="Viti. Tabard +3"}

    -- Fast cast sets for spells
    sets.precast.FC = {
    ammo="Staunch Tathlum",
	head="Atrophy Chapeau +3", --16
    body={ name="Viti. Tabard +3", augments={'Enhances "Chainspell" effect',}}, --15
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Loricate Torque +1",
    --neck={ name="Dls. Torque +2", augments={'Path: A',}},
    waist="Flume Belt",
    left_ear="Etiolation Earring", --1
    right_ear="Genmei Earring",
    left_ring="Defending Ring",
    right_ring="Gelatinous Ring +1",
    back="Fi Follet Cape +1", --10
        }

    sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})

    sets.precast.FC.Cure = set_combine(sets.precast.FC, {
        })

    sets.precast.FC.Curaga = sets.precast.FC.Cure
    sets.precast.FC['Healing Magic'] = sets.precast.FC.Cure
    sets.precast.FC['Elemental Magic'] = set_combine(sets.precast.FC, {})

    sets.precast.FC.Impact = set_combine(sets.precast.FC, {
    ammo="Sapience Orb",
	head=empty,
    body="Twilight Cloak",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Baetyl Pendant",
    waist="Embla Sash",
    left_ear="Loquac. Earring",
    right_ear="Malignance Earring",
    left_ring="Weather. Ring",
    right_ring="Kishar Ring",
    back="Fi Follet Cape +1",
        })

    sets.precast.FC.Dispelga = set_combine(sets.precast.FC, {main="Daybreak"})
    sets.precast.Storm = set_combine(sets.precast.FC, {})
    sets.precast.FC.Utsusemi = sets.precast.FC.Cure


    ------------------------------------------------------------------------------------------------
    ------------------------------------- Weapon Skill Sets ----------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.precast.WS = {
    ammo="Aurgelmir Orb",
    head={ name="Viti. Chapeau +3", augments={'Enfeebling Magic duration','Magic Accuracy',}},
    body={ name="Viti. Tabard +3", augments={'Enhances "Chainspell" effect',}},
    hands="Atrophy Gloves +3",
    legs="Jhakri Slops +2",
    feet="Jhakri Pigaches +2",
    neck={ name="Dls. Torque +2", augments={'Path: A',}},
    waist={ name="Sailfi Belt +1", augments={'Path: A',}},
    left_ear="Regal Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
    right_ring="Epaminondas's Ring",
    back={ name="Sucellos's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},
        }

    sets.precast.WS.Acc = set_combine(sets.precast.WS, {
        })

    sets.precast.WS['Chant du Cygne'] = set_combine(sets.precast.WS, {
    ammo="Yetshila",
    head={ name="Blistering Sallet +1", augments={'Path: A',}},
    body="Ayanmo Corazza +2",
    hands="Malignance Gloves",
    legs={ name="Zoar Subligar +1", augments={'Path: A',}},
    feet="Thereoid Greaves",
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear="Mache Earring +1",
    right_ear="Sherida Earring",
    left_ring="Begrudging Ring",
    right_ring="Ilabrat Ring",
    back={ name="Sucellos's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Crit.hit rate+10',}},
        })

    sets.precast.WS['Chant du Cygne'].Acc = set_combine(sets.precast.WS['Chant du Cygne'], {
        })


    sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS, {
        })

    sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'], {
        })

    sets.precast.WS['Death Blossom'] = sets.precast.WS['Savage Blade']
    sets.precast.WS['Death Blossom'].Acc = sets.precast.WS['Savage Blade'].Acc

    sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS, {
    ammo="Regal Gem",
    head={ name="Viti. Chapeau +3", augments={'Enfeebling Magic duration','Magic Accuracy',}},
    body={ name="Viti. Tabard +3", augments={'Enhances "Chainspell" effect',}},
    hands="Atrophy Gloves +3",
    legs="Jhakri Slops +2",
    feet="Jhakri Pigaches +2",
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear="Regal Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
    right_ring="Rufescent Ring",
    back={ name="Sucellos's Cape", augments={'MND+20','Accuracy+20 Attack+20','MND+10','Weapon skill damage +10%',}},
        })

    sets.precast.WS['Requiescat'].Acc = set_combine(sets.precast.WS['Requiescat'], {
        })

    sets.precast.WS['Sanguine Blade'] = {
    ammo		=	"Pemphredo Tathlum",
    head="Pixie Hairpin +1",
    body={ name="Amalric Doublet +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    hands="Jhakri Cuffs +2",
    legs={ name="Amalric Slops +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    feet={ name="Amalric Nails +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    neck="Baetyl Pendant",
    waist="Orpheus's Sash",
    left_ear="Regal Earring",
    right_ear="Malignance Earring",
    left_ring="Archon Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Sucellos's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','Weapon skill damage +10%',}},
        }

    sets.precast.WS['Seraph Blade'] = set_combine(sets.precast.WS['Sanguine Blade'], {
    ammo		=	"Regal Gem",
    head="C. Palug Crown",
    body={ name="Amalric Doublet +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    hands="Jhakri Cuffs +2",
    legs={ name="Amalric Slops +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    feet={ name="Amalric Nails +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    neck="Baetyl Pendant",
    waist="Orpheus's Sash",
    left_ear="Regal Earring",
    right_ear="Malignance Earring",
    left_ring="Weather. Ring",
    right_ring="Freke Ring",
    back={ name="Sucellos's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','MND+10','Weapon skill damage +10%',}},
        })

    sets.precast.WS['Aeolian Edge'] = set_combine(sets.precast.WS['Seraph Dlade'], {
    ammo		=	"Pemphredo Tathlum",
    head="C. Palug Crown",
    body={ name="Amalric Doublet +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    hands="Jhakri Cuffs +2",
    legs={ name="Amalric Slops +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    feet={ name="Amalric Nails +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    neck="Baetyl Pendant",
    waist="Orpheus's Sash",
    left_ear="Regal Earring",
    right_ear="Malignance Earring",
    left_ring="Freke Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Sucellos's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','Weapon skill damage +10%',}},
        })

    sets.precast.WS['Black Halo'] = set_combine(sets.precast.WS, {
	    back={ name="Sucellos's Cape", augments={'MND+20','Accuracy+20 Attack+20','MND+10','Weapon skill damage +10%',}},
        })

    sets.precast.WS['Black Halo'].Acc = set_combine(sets.precast.WS['Black Halo'], {
        })


    ------------------------------------------------------------------------------------------------
    ---------------------------------------- Midcast Sets ------------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.midcast.FastRecast = sets.precast.FC

    sets.midcast.SpellInterrupt = {
        }

    sets.midcast.Utsusemi = sets.midcast.SpellInterrupt

    sets.midcast.Cure = {
    ammo="Regal Gem",
    head={ name="Vanya Hood", augments={'MP+50','"Cure" potency +7%','Enmity-6',}},
    body={ name="Kaykaus Bliaut", augments={'MP+60','"Cure" potency +5%','"Conserve MP"+6',}},
    hands={ name="Kaykaus Cuffs +1", augments={'MP+80','MND+12','Mag. Acc.+20',}},
    legs="Atrophy Tights +3",
    feet={ name="Vanya Clogs", augments={'"Cure" potency +5%','"Cure" spellcasting time -15%','"Conserve MP"+6',}},
    neck="Incanter's Torque",
    waist="Luminary Sash",
    left_ear="Mendi. Earring",
    right_ear="Meili Earring",
    left_ring="Haoma's Ring",
    right_ring="Sirona's Ring",
    back={ name="Sucellos's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','"Cure" potency +10%',}},
        }

    sets.midcast.CureWeather = set_combine(sets.midcast.Cure, {
        waist="Hachirin-no-Obi",
        })

    sets.midcast.CureSelf = set_combine(sets.midcast.Cure, {
        waist="Gishdubar Sash", -- (10)
        })

    sets.midcast.Curaga = set_combine(sets.midcast.Cure, {
        ammo="Regal Gem",
        ring1={name="Stikini Ring +1", bag="wardrobe2"},
        ring2={name="Stikini Ring +1", bag="wardrobe3"},
        waist="Luminary Sash",
        })

    sets.midcast.StatusRemoval = {
        head="Vanya Hood",
        body="Vanya Robe",
        legs="Atrophy Tights +3",
        feet="Vanya Clogs",
        neck="Incanter's Torque",
        ear2="Meili Earring",
        ring1="Haoma's Ring",
        ring2="Menelaus's Ring",
        back="Perimede Cape",
        waist="Bishop's Sash",
        }

    sets.midcast.Cursna = set_combine(sets.midcast.StatusRemoval, {
        hands="Hieros Mittens",
        body="Viti. Tabard +3",
        neck="Debilis Medallion",
        ear1="Beatific Earring",
        ring2="Menelaus's Ring",
        back="Oretan. Cape +1",
        })

    sets.midcast['Enhancing Magic'] = {
        main		=	"Pukulatmuj +1",
        sub			=	"Forfend +1",
		ammo="Staunch Tathlum",
		head="Befouled Crown",
		body={ name="Viti. Tabard +3", augments={'Enhances "Chainspell" effect',}},
		hands={ name="Viti. Gloves +3", augments={'Enhancing Magic duration',}},
		legs="Atrophy Tights +3",
		feet="Leth. Houseaux +1",
		neck="Incanter's Torque",
		waist="Olympus Sash",
		left_ear="Andoaa Earring",
		right_ear="Mimir Earring",
        left_ring	=	{name="Stikini Ring +1", bag="wardrobe2"},
        right_ring	=	{name="Stikini Ring +1", bag="wardrobe3"},
		back={ name="Ghostfyre Cape", augments={'Enfb.mag. skill +3','Enha.mag. skill +9','Enh. Mag. eff. dur. +20',}},
        }

    sets.midcast.EnhancingDuration = {
        sub		=	"Ammurapi Shield",
		ammo="Staunch Tathlum",
		head="Leth. Chappel +1",
		body={ name="Viti. Tabard +3", augments={'Enhances "Chainspell" effect',}},
		hands="Atrophy Gloves +3",
		legs="Leth. Fuseau +1",
		feet="Leth. Houseaux +1",
		neck={ name="Dls. Torque +2", augments={'Path: A',}},
        waist		=	"Embla Sash",
        left_ear	=	"Andoaa Earring",
        right_ear	=	"Mimir Earring",
        left_ring	=	{name="Stikini Ring +1", bag="wardrobe2"},
        right_ring	=	{name="Stikini Ring +1", bag="wardrobe3"},
		back={ name="Ghostfyre Cape", augments={'Enfb.mag. skill +3','Enha.mag. skill +9','Enh. Mag. eff. dur. +20',}},
        }

    sets.midcast.EnhancingSkill = {
        main="Pukulatmuj +1",
        sub			=	"Forfend +1",
        hands="Viti. Gloves +3",
        }

    sets.midcast.Regen = set_combine(sets.midcast.EnhancingDuration, {
        --main="Bolelabunga",
        --sub="Ammurapi Shield",
        --head=gear.Telchine_ENH_head,
        --body=gear.Telchine_ENH_body,
        --hands=gear.Telchine_ENH_hands,
        --legs=gear.Telchine_ENH_legs,
        --feet=gear.Telchine_ENH_feet,
        })

    sets.midcast.Refresh = set_combine(sets.midcast.EnhancingDuration, {
        --head="Amalric Coif +1", -- +1
        body="Atrophy Tabard +3", -- +3
        legs="Leth. Fuseau +1", -- +2
        })

    sets.midcast.RefreshSelf = {
        waist="Gishdubar Sash",
        back="Grapevine Cape"
        }

    sets.midcast.Stoneskin = set_combine(sets.midcast.EnhancingDuration, {
		hands="Stone Mufflers",
		legs="Shedir Seraweels",
		neck="Nodens Gorget",
		waist="Siegel Sash",
		left_ear="Earthcry Earring",
        })

    sets.midcast['Phalanx'] = set_combine(sets.midcast.EnhancingDuration, {
	main="Sakpata's Sword",
    head={ name="Taeon Chapeau", augments={'Crit.hit rate+3','Phalanx +3',}},
    body={ name="Taeon Tabard", augments={'"Fast Cast"+4','Phalanx +3',}},
    hands={ name="Taeon Gloves", augments={'Rng.Acc.+20','Crit.hit rate+1','Phalanx +3',}},
    legs={ name="Taeon Tights", augments={'Crit.hit rate+2','Phalanx +3',}},
    feet={ name="Taeon Boots", augments={'Accuracy+24','"Dual Wield"+5','Phalanx +3',}},
        })

    sets.midcast.Aquaveil = set_combine(sets.midcast.EnhancingDuration, {
		legs="Shedir Seraweels",
        })

    sets.midcast.Storm = sets.midcast.EnhancingDuration
    sets.midcast.GainSpell = {hands="Viti. Gloves +3"}
    sets.midcast.SpikesSpell = {legs="Viti. Tights +3"}

    sets.midcast.Protect = set_combine(sets.midcast.EnhancingDuration, {ring2="Sheltered Ring"})
    sets.midcast.Protectra = sets.midcast.Protect
    sets.midcast.Shell = sets.midcast.Protect
    sets.midcast.Shellra = sets.midcast.Shell


     -- Custom spell classes

    sets.midcast.MndEnfeebles = {
	ammo="Regal Gem",
    head={ name="Viti. Chapeau +3", augments={'Enfeebling Magic duration','Magic Accuracy',}},
    body="Lethargy Sayon +1",
    hands={ name="Kaykaus Cuffs +1", augments={'MP+80','MND+12','Mag. Acc.+20',}},
    legs={ name="Chironic Hose", augments={'Mag. Acc.+21 "Mag.Atk.Bns."+21','Enmity-4','Mag. Acc.+15','"Mag.Atk.Bns."+10',}},
    feet={ name="Vitiation Boots +3", augments={'Immunobreak Chance',}},
    neck={ name="Dls. Torque +2", augments={'Path: A',}},
    waist="Luminary Sash",
    left_ear="Regal Earring",
    right_ear="Snotra Earring",
    left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
    right_ring={name="Stikini Ring +1", bag="wardrobe3"},	
    back={ name="Sucellos's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','"Cure" potency +10%',}},
        }

    sets.midcast.MndEnfeeblesAcc = set_combine(sets.midcast.MndEnfeebles, {
        --main="Crocea Mors",
        --sub="Ammurapi Shield",
        range="Ullr",
        ammo=empty,
        head="Atrophy Chapeau +3",
        body="Atrophy Tabard +3",
        waist="Acuity Belt +1",
        })

    sets.midcast.MndEnfeeblesEffect = set_combine(sets.midcast.MndEnfeebles, {
        })

    sets.midcast.IntEnfeebles = set_combine(sets.midcast.MndEnfeebles, {
        })

    sets.midcast.IntEnfeeblesAcc = set_combine(sets.midcast.IntEnfeebles, {
        range="Ullr",
        ammo=empty,
        body="Atrophy Tabard +3",
        })

    sets.midcast.IntEnfeeblesEffect = set_combine(sets.midcast.IntEnfeebles, {
        })

    sets.midcast.SkillEnfeebles = set_combine(sets.midcast.MndEnfeebles, {
	ammo="Regal Gem",
    head={ name="Viti. Chapeau +3", augments={'Enfeebling Magic duration','Magic Accuracy',}},
    body="Atrophy Tabard +3",
    hands="Leth. Gantherots +1",
    legs={ name="Psycloth Lappas", augments={'Mag. Acc.+10','Spell interruption rate down +15%','MND+7',}},
    feet={ name="Vitiation Boots +3", augments={'Immunobreak Chance',}},
    neck="Incanter's Torque",
    waist="Rumination Sash",
    left_ear="Regal Earring",
    right_ear="Vor Earring",
    left_ring	=	{name="Stikini Ring +1", bag="wardrobe2"},
    right_ring	=	{name="Stikini Ring +1", bag="wardrobe3"},
    back={ name="Sucellos's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','"Cure" potency +10%',}},
        })

    sets.midcast.Sleep = set_combine(sets.midcast.IntEnfeeblesAcc, {
        head="Viti. Chapeau +3",
        neck="Dls. Torque +2",
        ear2="Snotra Earring",
        ring2="Kishar Ring",
        })

    sets.midcast.SleepMaxDuration = set_combine(sets.midcast.Sleep, {
        head="Leth. Chappel +1",
        body="Lethargy Sayon +1",
        hands="Regal Cuffs",
        legs="Leth. Fuseau +1",
        feet="Leth. Houseaux +1",
        })

    sets.midcast.ElementalEnfeeble = sets.midcast.IntEnfeebles
    sets.midcast.Dispelga = set_combine(sets.midcast.IntEnfeeblesAcc, {main="Daybreak"})

    sets.midcast['Dark Magic'] = set_combine(sets.midcast.IntEnfeeblesAcc, {

        })

    sets.midcast.Drain = set_combine(sets.midcast['Dark Magic'], {
        head="Pixie Hairpin +1",
        --feet="Merlinic Crackows",
        --ear1="Hirudinea Earring",
        ring1="Archon Ring",
        ring2="Evanescence Ring",
        --back="Perimede Cape",
        waist="Fucho-no-obi",
        })

    sets.midcast.Aspir = sets.midcast.Drain
    sets.midcast.Stun = set_combine(sets.midcast['Dark Magic'], {waist="Luminary Sash"})
    sets.midcast['Bio III'] = set_combine(sets.midcast['Dark Magic'], {legs="Viti. Tights +3"})

    sets.midcast['Elemental Magic'] = {
    ammo		=	"Pemphredo Tathlum",
    head="C. Palug Crown",
    body={ name="Amalric Doublet +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    hands="Amalric Gages +1",
    legs={ name="Amalric Slops +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    feet={ name="Amalric Nails +1", augments={'MP+80','Mag. Acc.+20','"Mag.Atk.Bns."+20',}},
    neck="Baetyl Pendant",
    waist="Sacro Cord",
    left_ear="Regal Earring",
    right_ear="Malignance Earring",
    left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
    right_ring="Freke Ring",
    back={ name="Sucellos's Cape", augments={'INT+20','Mag. Acc+20 /Mag. Dmg.+20','INT+10','"Mag.Atk.Bns."+10',}},
        }

    sets.midcast['Elemental Magic'].Resistant = set_combine(sets.midcast['Elemental Magic'], {
        range="Ullr",
        ammo=empty,
		neck="Sanctity Necklace",
		feet={ name="Vitiation Boots +3", augments={'Immunobreak Chance',}},
        })

    sets.midcast.Impact = set_combine(sets.midcast['Elemental Magic'], {
	head="empty",
    body="Twilight Cloak",
    hands={ name="Kaykaus Cuffs +1", augments={'MP+80','MND+12','Mag. Acc.+20',}},
    legs={ name="Chironic Hose", augments={'Mag. Acc.+21 "Mag.Atk.Bns."+21','Enmity-4','Mag. Acc.+15','"Mag.Atk.Bns."+10',}},
    feet={ name="Vitiation Boots +3", augments={'Immunobreak Chance',}},
    neck={ name="Dls. Torque +2", augments={'Path: A',}},
    waist="Acuity Belt +1",
    right_ear="Snotra Earring",
    left_ear="Malignance Earring",
    left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
    right_ring="Stikini Ring +1",
    back="Aurist's Cape +1",
        })

    sets.midcast.Utsusemi = sets.midcast.SpellInterrupt

    -- Initializes trusts at iLvl 119
    sets.midcast.Trust = sets.precast.FC

    -- Job-specific buff sets
    sets.buff.ComposureOther = {
		head="Leth. Chappel +1",
		body="Lethargy Sayon +1",
		hands="Atrophy Gloves +3",
		legs="Leth. Fuseau +1",
		waist="Embla Sash",
        }

    sets.buff.Saboteur = {hands="Leth. Gantherots +1"}


    ------------------------------------------------------------------------------------------------
    ----------------------------------------- Idle Sets --------------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.idle = {
    ammo="Homiliary",
    head={ name="Viti. Chapeau +3", augments={'Enfeebling Magic duration','Magic Accuracy',}},
    body="Bunzi's Robe",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Loricate Torque +1",
    --neck={ name="Dls. Torque +2", augments={'Path: A',}},
    waist="Flume Belt",
    left_ear="Etiolation Earring",
    right_ear="Genmei Earring",
    left_ring={name="Stikini Ring +1", bag="wardrobe2"},
    right_ring={name="Stikini Ring +1", bag="wardrobe3"},
    back={ name="Sucellos's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Phys. dmg. taken-10%',}},
        }

    ------------------------------------------------------------------------------------------------
    ---------------------------------------- Defense Sets ------------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.defense.PDT = sets.idle.DT
    sets.defense.MDT = sets.idle.DT

    sets.magic_burst = {
    head="Ea Hat",
    body="Ea Houppelande",
    hands="Amalric Gages +1", --(6)
    legs="Ea Slops",
    feet="Jhakri Pigaches +2",
    neck="Mizu. Kubikazari",
    left_ring="Mujin Band",
        }

    sets.Kiting = {legs="Carmine Cuisses +1"}
    sets.latent_refresh = {waist="Fucho-no-obi"}


    ------------------------------------------------------------------------------------------------
    ---------------------------------------- Engaged Sets ------------------------------------------
    ------------------------------------------------------------------------------------------------

    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion

    sets.engaged = {
    ammo="Aurgelmir Orb",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Anu Torque",
    right_ear	=	"Sherida Earring",
    waist="Kentarch Belt +1",
    left_ear="Telos Earring",
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Sucellos's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Phys. dmg. taken-10%',}},
        }

    sets.engaged.Acc = set_combine(sets.engaged, {
        neck="Combatant's Torque",
        })

    sets.engaged.Haste = set_combine(sets.engaged.Acc, {
        })


    -- No Magic Haste (74% DW to cap)
    sets.engaged.DW = {
    ammo="Aurgelmir Orb",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Anu Torque",
    waist="Reiki Yotai",
    left_ear="Telos Earring",
    right_ear="Eabani Earring",
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Sucellos's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Phys. dmg. taken-10%',}},
        } --41

    sets.engaged.DW.Acc = set_combine(sets.engaged.DW, {
        neck="Combatant's Torque",
        })

    sets.engaged.DW.Haste = set_combine(sets.engaged.DW.Acc, {
    right_ear="Suppanomimi",
    feet={ name="Taeon Boots", augments={'Accuracy+24','"Dual Wield"+5','Phalanx +3',}},
    back={ name="Sucellos's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dual Wield"+10','Phys. dmg. taken-10%',}},
        })



    ------------------------------------------------------------------------------------------------
    ---------------------------------------- Hybrid Sets -------------------------------------------
    ------------------------------------------------------------------------------------------------




    ------------------------------------------------------------------------------------------------
    ---------------------------------------- Special Sets ------------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.buff.Doom = {
        neck="Nicander's Necklace", --20
        ring1={name="Eshmun's Ring", bag="wardrobe3"}, --20
        ring2={name="Eshmun's Ring", bag="wardrobe4"}, --20
        waist="Gishdubar Sash", --10
        }

    sets.Obi = {waist="Hachirin-no-Obi"}
    -- sets.CP = {back="Mecisto. Mantle"}


	sets.macc = {main="Crocea Mors", sub="Ammurapi Shield"}
	sets.sb = {main="Naegling", sub="Machaera +2"}
    sets.mws = {main="Crocea Mors", sub="Daybreak"}
	sets.ae = {main="Tauret", sub="Machaera +2"}
	sets.cdc = {main="Crocea Mors", sub="Demers. Degen +1"}
	sets.blunt = {main="Maxentius", sub="Machaera +2"}
	sets.nuke = {main="Bunzi's Rod", sub="Daybreak"}
	
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------

function job_precast(spell, action, spellMap, eventArgs)
    if spellMap == 'Utsusemi' then
        if buffactive['Copy Image (3)'] or buffactive['Copy Image (4+)'] then
            cancel_spell()
            add_to_chat(123, '**!! '..spell.english..' Canceled: [3+ IMAGES] !!**')
            eventArgs.handled = true
            return
        elseif buffactive['Copy Image'] or buffactive['Copy Image (2)'] then
            send_command('cancel 66; cancel 444; cancel Copy Image; cancel Copy Image (2)')
        end
    end
end

function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.name == 'Impact' then
        equip(sets.precast.FC.Impact)
    end
    if spell.english == "Phalanx II" and spell.target.type == 'SELF' then
        cancel_spell()
        send_command('@input /ma "Phalanx" <me>')
    end
end

-- Run after the default midcast() is done.
-- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
function job_post_midcast(spell, action, spellMap, eventArgs)
    if spell.skill == 'Enhancing Magic' then
        if classes.NoSkillSpells:contains(spell.english) then
            equip(sets.midcast.EnhancingDuration)
            if spellMap == 'Refresh' then
                equip(sets.midcast.Refresh)
                if spell.target.type == 'SELF' then
                    equip (sets.midcast.RefreshSelf)
              end
            end
        elseif skill_spells:contains(spell.english) then
            equip(sets.midcast.EnhancingSkill)
        elseif spell.english:startswith('Gain') then
            equip(sets.midcast.GainSpell)
        elseif spell.english:contains('Spikes') then
            equip(sets.midcast.SpikesSpell)
        end
        if (spell.target.type == 'PLAYER' or spell.target.type == 'NPC') and buffactive.Composure then
            equip(sets.buff.ComposureOther)
        end
    end
    if spellMap == 'Cure' and spell.target.type == 'SELF' then
        equip(sets.midcast.CureSelf)
    end
    if spell.skill == 'Elemental Magic' then
        if state.MagicBurst.value and spell.english ~= 'Death' then
            equip(sets.magic_burst)
            if spell.english == "Impact" then
                equip(sets.midcast.Impact)
            end
        end
        if spell.skill == 'Elemental Magic' or spell.english == "Kaustra" then
            if spell.element == world.weather_element and (get_weather_intensity() == 2 and spell.element ~= elements.weak_to[world.day_element]) then
                equip(sets.Obi)
            -- Target distance under 1.7 yalms.
            elseif spell.target.distance < (1.7 + spell.target.model_size) then
                equip({waist="Orpheus's Sash"})
            -- Matching day and weather.
            elseif spell.element == world.day_element and spell.element == world.weather_element then
                equip(sets.Obi)
            -- Target distance under 8 yalms.
            elseif spell.target.distance < (8 + spell.target.model_size) then
                equip({waist="Orpheus's Sash"})
            -- Match day or weather.
            elseif spell.element == world.day_element or spell.element == world.weather_element then
                equip(sets.Obi)
            end
        end
    end
end

function job_aftercast(spell, action, spellMap, eventArgs)
    if spell.english:contains('Sleep') and not spell.interrupted then
        set_sleep_timer(spell)
    end
    if player.status ~= 'Engaged' and state.WeaponLock.value == false then
        check_weaponset()
    end
end

-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for non-casting events.
-------------------------------------------------------------------------------------------------------------------

function job_buff_change(buff,gain)
    if buff == "doom" then
        if gain then
            equip(sets.buff.Doom)
            send_command('@input /p Doomed.')
             disable('ring1','ring2','waist')
        else
            enable('ring1','ring2','waist')
            handle_equipping_gear(player.status)
        end
    end
end

-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
    if state.WeaponLock.value == true then
        disable('main','sub','range')
    else
        enable('main','sub','range')
    end

    check_weaponset()
end

-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------

-- Called by the 'update' self-command, for common needs.
-- Set eventArgs.handled to true if we don't want automatic equipping of gear.
function job_handle_equipping_gear(playerStatus, eventArgs)
    check_gear()
    update_combat_form()
    check_moving()
end

function job_update(cmdParams, eventArgs)
    handle_equipping_gear(player.status)
end

function update_combat_form()
    if DW == true then
        state.CombatForm:set('DW')
    elseif DW == false then
        state.CombatForm:reset()
    end
end

-- Custom spell mapping.
function job_get_spell_map(spell, default_spell_map)
    if spell.action_type == 'Magic' then
        if default_spell_map == 'Cure' or default_spell_map == 'Curaga' then
            if (world.weather_element == 'Light' or world.day_element == 'Light') then
                return 'CureWeather'
            end
        end
        if spell.skill == 'Enfeebling Magic' then
            if enfeebling_magic_skill:contains(spell.english) then
                return "SkillEnfeebles"
            elseif spell.type == "WhiteMagic" then
                if enfeebling_magic_acc:contains(spell.english) and not buffactive.Stymie then
                    return "MndEnfeeblesAcc"
                elseif enfeebling_magic_effect:contains(spell.english) then
                    return "MndEnfeeblesEffect"
                else
                    return "MndEnfeebles"
              end
            elseif spell.type == "BlackMagic" then
                if enfeebling_magic_acc:contains(spell.english) and not buffactive.Stymie then
                    return "IntEnfeeblesAcc"
                elseif enfeebling_magic_effect:contains(spell.english) then
                    return "IntEnfeeblesEffect"
                elseif enfeebling_magic_sleep:contains(spell.english) and ((buffactive.Stymie and buffactive.Composure) or state.SleepMode.value == 'MaxDuration') then
                    return "SleepMaxDuration"
                elseif enfeebling_magic_sleep:contains(spell.english) then
                    return "Sleep"
                else
                    return "IntEnfeebles"
                end
            else
                return "MndEnfeebles"
            end
        end
    end
end

function get_custom_wsmode(spell, action, spellMap)
    local wsmode
    if state.OffenseMode.value == 'MidAcc' or state.OffenseMode.value == 'HighAcc' then
        wsmode = 'Acc'
    end

    return wsmode
end

-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
    if player.mpp < 51 then
        idleSet = set_combine(idleSet, sets.latent_refresh)
    end
    -- if state.CP.current == 'on' then
    --     equip(sets.CP)
    --     disable('back')
    -- else
    --     enable('back')
    -- end

    if state.Auto_Kite.value == true then
       idleSet = set_combine(idleSet, sets.Kiting)
    end

    return idleSet
end

function customize_melee_set(meleeSet)
    if state.EnspellMode.value == true then
        meleeSet = set_combine(meleeSet, sets.engaged.Enspell)
    end
    if state.EnspellMode.value == true and player.hpp <= 75 and player.tp < 1000 then
        meleeSet = set_combine(meleeSet, sets.engaged.Enspell.Fencer)
    end
    if state.TreasureMode.value == 'Fulltime' then
        meleeSet = set_combine(meleeSet, sets.TreasureHunter)
    end

    check_weaponset()

    return meleeSet
end

-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)


    return meleeSet
end

-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)
    display_current_caster_state()
    eventArgs.handled = true
end

-- Function to display the current relevant user state when doing an update.
-- Return true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
    local cf_msg = ''
    if state.CombatForm.has_value then
        cf_msg = ' (' ..state.CombatForm.value.. ')'
    end

    local m_msg = state.OffenseMode.value
    if state.HybridMode.value ~= 'Normal' then
        m_msg = m_msg .. '/' ..state.HybridMode.value
    end

    local ws_msg = state.WeaponskillMode.value

    local c_msg = state.CastingMode.value

    local d_msg = 'None'
    if state.DefenseMode.value ~= 'None' then
        d_msg = state.DefenseMode.value .. state[state.DefenseMode.value .. 'DefenseMode'].value
    end

    local i_msg = state.IdleMode.value

    local msg = ''
    if state.MagicBurst.value then
        msg = ' Burst: On |'
    end
    if state.Kiting.value then
        msg = msg .. ' Kiting: On |'
    end

    add_to_chat(002, '| ' ..string.char(31,210).. 'Melee' ..cf_msg.. ': ' ..string.char(31,001)..m_msg.. string.char(31,002)..  ' |'
        ..string.char(31,207).. ' WS: ' ..string.char(31,001)..ws_msg.. string.char(31,002)..  ' |'
        ..string.char(31,060).. ' Magic: ' ..string.char(31,001)..c_msg.. string.char(31,002)..  ' |'
        ..string.char(31,004).. ' Defense: ' ..string.char(31,001)..d_msg.. string.char(31,002)..  ' |'
        ..string.char(31,008).. ' Idle: ' ..string.char(31,001)..i_msg.. string.char(31,002)..  ' |'
        ..string.char(31,002)..msg)

    eventArgs.handled = true
end

-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------


function gearinfo(cmdParams, eventArgs)
    if cmdParams[1] == 'gearinfo' then
        if type(tonumber(cmdParams[2])) == 'number' then
            if tonumber(cmdParams[2]) ~= DW_needed then
            DW_needed = tonumber(cmdParams[2])
            DW = true
            end
        elseif type(cmdParams[2]) == 'string' then
            if cmdParams[2] == 'false' then
                DW_needed = 0
                DW = false
            end
        end
        if type(tonumber(cmdParams[3])) == 'number' then
            if tonumber(cmdParams[3]) ~= Haste then
                Haste = tonumber(cmdParams[3])
            end
        end
        if type(cmdParams[4]) == 'string' then
            if cmdParams[4] == 'true' then
                moving = true
            elseif cmdParams[4] == 'false' then
                moving = false
            end
        end
        if not midaction() then
            job_update()
        end
    end
end

function job_self_command(cmdParams, eventArgs)
    if cmdParams[1]:lower() == 'scholar' then
        handle_strategems(cmdParams)
        eventArgs.handled = true
    elseif cmdParams[1]:lower() == 'nuke' then
        handle_nuking(cmdParams)
        eventArgs.handled = true
    elseif cmdParams[1]:lower() == 'enspell' then
        send_command('@input /ma '..state.EnSpell.value..' <me>')
    elseif cmdParams[1]:lower() == 'barelement' then
        send_command('@input /ma '..state.BarElement.value..' <me>')
    elseif cmdParams[1]:lower() == 'barstatus' then
        send_command('@input /ma '..state.BarStatus.value..' <me>')
    elseif cmdParams[1]:lower() == 'gainspell' then
        send_command('@input /ma '..state.GainSpell.value..' <me>')
    end

    gearinfo(cmdParams, eventArgs)
end

-- General handling of strategems in an Arts-agnostic way.
-- Format: gs c scholar <strategem>

function handle_strategems(cmdParams)
    -- cmdParams[1] == 'scholar'
    -- cmdParams[2] == strategem to use

    if not cmdParams[2] then
        add_to_chat(123,'Error: No strategem command given.')
        return
    end
    local strategem = cmdParams[2]:lower()

    if strategem == 'light' then
        if buffactive['light arts'] then
            send_command('input /ja "Addendum: White" <me>')
        elseif buffactive['addendum: white'] then
            add_to_chat(122,'Error: Addendum: White is already active.')
        else
            send_command('input /ja "Light Arts" <me>')
        end
    elseif strategem == 'dark' then
        if buffactive['dark arts'] then
            send_command('input /ja "Addendum: Black" <me>')
        elseif buffactive['addendum: black'] then
            add_to_chat(122,'Error: Addendum: Black is already active.')
        else
            send_command('input /ja "Dark Arts" <me>')
        end
    elseif buffactive['light arts'] or buffactive['addendum: white'] then
        if strategem == 'cost' then
            send_command('input /ja Penury <me>')
        elseif strategem == 'speed' then
            send_command('input /ja Celerity <me>')
        elseif strategem == 'aoe' then
            send_command('input /ja Accession <me>')
        elseif strategem == 'addendum' then
            send_command('input /ja "Addendum: White" <me>')
        else
            add_to_chat(123,'Error: Unknown strategem ['..strategem..']')
        end
    elseif buffactive['dark arts']  or buffactive['addendum: black'] then
        if strategem == 'cost' then
            send_command('input /ja Parsimony <me>')
        elseif strategem == 'speed' then
            send_command('input /ja Alacrity <me>')
        elseif strategem == 'aoe' then
            send_command('input /ja Manifestation <me>')
        elseif strategem == 'addendum' then
            send_command('input /ja "Addendum: Black" <me>')
        else
            add_to_chat(123,'Error: Unknown strategem ['..strategem..']')
        end
    else
        add_to_chat(123,'No arts has been activated yet.')
    end
end

function set_sleep_timer(spell)
    local self = windower.ffxi.get_player()

    if spell.en == "Sleep II" then
        base = 90
    elseif spell.en == "Sleep" or spell.en == "Sleepga" then
        base = 60
    end

    if state.Buff.Saboteur then
        if state.NM.value then
            base = base * 1.25
        else
            base = base * 2
        end
    end

    -- Merit Points Duration Bonus
    base = base + self.merits.enfeebling_magic_duration*6

    -- Relic Head Duration Bonus
    if not ((buffactive.Stymie and buffactive.Composure) or state.SleepMode.value == 'MaxDuration') then
        base = base + self.merits.enfeebling_magic_duration*3
    end

    -- Job Points Duration Bonus
    base = base + self.job_points.rdm.enfeebling_magic_duration

    --Enfeebling duration non-augmented gear total
    gear_mult = 1.40
    --Enfeebling duration augmented gear total
    aug_mult = 1.25
    --Estoquer/Lethargy Composure set bonus
    --2pc = 1.1 / 3pc = 1.2 / 4pc = 1.35 / 5pc = 1.5
    empy_mult = 1 --from sets.midcast.Sleep

    if ((buffactive.Stymie and buffactive.Composure) or state.SleepMode.value == 'MaxDuration') then
        if buffactive.Stymie then
            base = base + self.job_points.rdm.stymie_effect
        end
        empy_mult = 1.35 --from sets.midcast.SleepMaxDuration
    end

    totalDuration = math.floor(base * gear_mult * aug_mult * empy_mult)

    -- Create the custom timer
    if spell.english == "Sleep II" then
        send_command('@timers c "Sleep II ['..spell.target.name..']" ' ..totalDuration.. ' down spells/00259.png')
    elseif spell.english == "Sleep" or spell.english == "Sleepga" then
        send_command('@timers c "Sleep ['..spell.target.name..']" ' ..totalDuration.. ' down spells/00253.png')
    end
    add_to_chat(1, 'Base: ' ..base.. ' Merits: ' ..self.merits.enfeebling_magic_duration.. ' Job Points: ' ..self.job_points.rdm.stymie_effect.. ' Set Bonus: ' ..empy_mult)

end

-- Check for various actions that we've specified in user code as being used with TH gear.
-- This will only ever be called if TreasureMode is not 'None'.
-- Category and Param are as specified in the action event packet.
function th_action_check(category, param)
    if category == 2 or -- any ranged attack
        --category == 4 or -- any magic action
        (category == 3 and param == 30) or -- Aeolian Edge
        (category == 6 and info.default_ja_ids:contains(param)) or -- Provoke, Animated Flourish
        (category == 14 and info.default_u_ja_ids:contains(param)) -- Quick/Box/Stutter Step, Desperate/Violent Flourish
        then return true
    end
end

function check_moving()
    if state.DefenseMode.value == 'None'  and state.Kiting.value == false then
        if state.Auto_Kite.value == false and moving then
            state.Auto_Kite:set(true)
        elseif state.Auto_Kite.value == true and moving == false then
            state.Auto_Kite:set(false)
        end
    end
end

function check_gear()
    if no_swap_gear:contains(player.equipment.left_ring) then
        disable("ring1")
    else
        enable("ring1")
    end
    if no_swap_gear:contains(player.equipment.right_ring) then
        disable("ring2")
    else
        enable("ring2")
    end
end

function check_weaponset()
    equip(sets[state.WeaponSet.current])
    if player.sub_job ~= 'NIN' and player.sub_job ~= 'DNC' then
       equip(sets.DefaultShield)
    end
end

windower.register_event('zone change',
    function()
        if no_swap_gear:contains(player.equipment.left_ring) then
            enable("ring1")
            equip(sets.idle)
        end
        if no_swap_gear:contains(player.equipment.right_ring) then
            enable("ring2")
            equip(sets.idle)
        end
    end
)

-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    -- Default macro set/book
    set_macro_page(3, 11)
end

function set_lockstyle()
    send_command('wait 2; input /lockstyleset ' .. lockstyleset)
end


	
 Carbuncle.Gabvanstronger
Offline
サーバ: Carbuncle
Game: FFXI
Posts: 48
By Carbuncle.Gabvanstronger 2022-03-12 17:05:09  
The only thing I see is that your job_aftercast checks for weapon if you're anything BUT engaged.
And you have two customize_melee_set(meleeSet) functions, one with code, one without.
Offline
Posts: 40
By quelthos 2022-03-12 18:01:08  
ok i fixed it by changing it to
if state.WeaponLock.value == false then

Thanks
[+]
 Leviathan.Andret
Offline
サーバ: Leviathan
Game: FFXI
user: Andret
Posts: 1008
By Leviathan.Andret 2022-03-17 16:54:24  
I got the skillup.lua from smd111 but I can't skillup geomancy with it. It keeps telling me my character can't use geomancy but managed to use Geo-Refresh just fine before starting Healing skill up.

https://github.com/smd111/Gearswap-Skillup
 Asura.Sechs
Offline
サーバ: Asura
Game: FFXI
user: Akumasama
Posts: 10136
By Asura.Sechs 2022-03-22 06:49:46  
Got an advanced question for Gearswap.
Let's imagine a scenario where I want GS to launch "Spell2" whenever "Spell1" gets requested from the client.

For instance think about a macro "/ma Fire <t>"
I want GS to catch that and actually execute "/ma Stone <t>".

I put a custom code with send_command("ma stone <t>") and some checks in the precast. The code gets executed correctly but it gets injected after, not before.
The result is that Fire still gets executed, and I get an additional message "cannot cast the spell at this moment" which likely refers to GS's attempt to cast Stone right after Fire.

This leads me to believe that my code is fine but gets executed too late in the priority order of GS actions that get injected into the packets sent from client to server.
How would I go to "fix" this situation and correctly launch "Stone" when the macro actually requested "Fire"?
 Quetzalcoatl.Khajit
Offline
サーバ: Quetzalcoatl
Game: FFXI
user: Khajit
Posts: 441
By Quetzalcoatl.Khajit 2022-03-22 11:38:01  
I use what I believe to be a slightly modified mote thf lua. (has tp sets based on haste levels)

https://github.com/KhajitFFXI/FFXI/blob/main/Khajit_THF.lua

There are 3 main changes I want to try and execute.

1: A mighty strikes set for all of my ws (Larceny exists)
2:An AM3 set for Vjara only.
3: To make an alias/command that queues up sneak attack, trick attack, and hide. This should free up 8- macro slots for SA/TA WS alone

EG. I use command (Sneak attack), (Trick attack) and (hide). When I use any ws afterwards it will use sneak attack, wait 1,hide, wait 1,trick attack, "WS I was going to use" and returns to normal ws mode.

EG2: (Sneak attack), (Hide) mode enabled.
The next ws does sneak attack,wait 1, hide,wait1, ws

eg3: (Sneak attack) (trick attack) enabled
Sneak attack: wait 1, trick attack, wait 1, ws

eg4 (Sneak attack)
Sneak attack, Wait 1, WS
 Cerberus.Shadowmeld
Offline
サーバ: Cerberus
Game: FFXI
Posts: 1809
By Cerberus.Shadowmeld 2022-03-22 12:03:26  
Are you sending a cancel_spell() to cancel fire and then recast the correct spell? or are you just injecting the stone spell?
Code
function precast(spell)
  if spell.english:lower() == 'fire' then
    cancel_spell()
    windower.chat.input('/ma "Stone" <t>') -- option 1
    windower.send_command('/ma "Stone" ' .. spell.target.raw) -- option 2
  end
end


Edit: Precast should work, I think pretarget is only for spells that you try to cast that you actually can't (but could be wrong about that)
[+]
 Asura.Sechs
Offline
サーバ: Asura
Game: FFXI
user: Akumasama
Posts: 10136
By Asura.Sechs 2022-03-22 13:16:33  
Yeaaaaah! Was missing cancel_spell(), how dumb of me.
Everything works fine now thanks Shadow <3

Any noticeable difference I should know about between "windower.chat.input('')" and "send_command('')"?
'cause I've always used the latter, not sure if one of these two is supposed to be more efficient or anything else.
 Cerberus.Shadowmeld
Offline
サーバ: Cerberus
Game: FFXI
Posts: 1809
By Cerberus.Shadowmeld 2022-03-22 14:04:17  
windower chat input is just like if you were typing in game. send command is basically console, so if you were doing chat input with an addon command you would need the // in front of the text
 Siren.Demetreos
Offline
サーバ: Siren
Game: FFXI
user: Riggy
Posts: 1028
By Siren.Demetreos 2022-03-22 17:53:20  
EDIT

Nvm, figured it out about 45s after posting.
Offline
Posts: 503
By Vaerix 2022-03-23 00:39:41  
Had a strange question/query,

Is it possible to set up (in the beginning of a Lua) your offense modes to be dictated by what your weapon set value is, or by a separate toggle.

IE
offense modes if weaponset is X (lowacc, midacc, high acc)
offense modes if weaponset is Y (ylowacc, ymidacc, yhigh acc)
offense modes if weaponset is Z (zlowacc, zmidacc, zhigh acc)

Most of my wondering is because there are some really nice builds out there for drk based on their primary weapon and the presence or lack thereof of Sam roll, I was wondering if I could keep my current button layout/memory and modify it as needed based on internal code. Just curious if it's possible and/or how to write it if it is possible.

The goal would be to establish something like this:

If weaponset = anguta then offensemodes = S(A5hit, A6hit, Ahighacc)
If weaponset = liberator then offensemodes = S(L5hit, L6hit, Lhighacc)
If weaponset = apocalypse then offensemodes = S(5hit, 6hit, apocacc)
If weaponset = naeglingsw then offensemodes = S(lowacc, midacc, highacc)
If weaponset = naeglingdw then offensemodes = S(lowacc, midacc, highacc)
 
Offline
Posts:
By 2022-03-23 01:01:58
 Undelete | Edit  | Link | 引用 | 返事
 
Post deleted by User.
[+]
Offline
Posts: 503
By Vaerix 2022-03-24 07:45:02  
Asura.Jyubeii said: »
this lua is an example of how you can do that

https://pastebin.com/bG3yZh61

Thank you! Looks like a lot of work ahead to understand arrays to be able to build anything similar. Follow-up question though, I was messing around in my file and got something akin to what I was hoping to build to marginally function.

So basically I added a toggle which enables me to manually cycle weapon types, in the hopes that this function would modify state.OffenseModes:options

It modifies the state, insofar as the first entry returns the correct new value, cycling OffenseMode just returns the same value. So as I toggle through (Scythe, Greatsword, Greataxe, Other), my Offense mode readout after toggles read (Scy3Hit) (GS5Hit) (GA5Hit) (Normal). It's clear to me the function is overwriting at least but does not complete the entry.

Is there any way to have the table overwrite all entries? I've been trying to read everything I could about tables in Lua literature but none of it mentioned a command to overwrite a defined set of variables with another.
 Bahamut.Leonero
Offline
サーバ: Bahamut
Game: FFXI
user: Leonero
Posts: 68
By Bahamut.Leonero 2022-03-26 15:55:58  
Vaerix said: »
Is there any way to have the table overwrite all entries? I've been trying to read everything I could about tables in Lua literature but none of it mentioned a command to overwrite a defined set of variables with another.

Those aren't normal lua tables. Those are Mote's "Modes". Which are custom defined metatables. You need to use them as they are designed or just write your own "state" tables.

I don't use Mote's stuff. It's so dang bloated and it's very primitive lua. In his defense the community didn't know much about lua when he wrote those includes.

Redefining a normal lua table is as simple as it seems.
Code
local t = {
    a = 1,
    b = 2,
}

print(t.a) -- 1

t = {
    [1] = 'a',
    [2] = 'b',
}

print(t.a, t.b) -- nil, nil
print(t[1], t[2]) -- a, b

t[1] = 'z'

print(t[1], t[2]) -- z, b

You can also define an array(the second declaration of t) this way, like the way mote's modes do.
Code
t = {
    'a',
    'b',
    'c',
}

print(t[1], t[2], t[3]) -- a, b, c


It's not a set. They are not variables. The only variable there is t, the value of which is a table. Specifically an array of strings or a table of indices containing string values. In the first case it's a table of keys with number values.

A table can contain a mix of indices and keys. the values can be a mix of any lua type.

state is the variable in your case. With the value of a table containing...

OffenseMode a key in state with the value of a "Modes" metatable and the table you define with options... options being a function(maybe metamethod) defined in the __index table of the metatable.

https://www.lua.org/pil/2.5.html

 Carbuncle.Yiazmaat
Offline
サーバ: Carbuncle
Game: FFXI
user: Rudra
Posts: 166
By Carbuncle.Yiazmaat 2022-03-27 15:38:32  
I constantly get a sel-utility lua error today on blu and it doesnt swap to ws gear for savage blade or black halo, it act as if i was fencing (it work if i use a shield, but not when i dw weapons) and not dw. I tried to copy past the original from github but its useless as ive never modified it. Someone got an idea ?

It says sel utility 2275 attempt to index ? a nil value
 Asura.Cebera
Offline
サーバ: Asura
Game: FFXI
Posts: 9
By Asura.Cebera 2022-03-31 02:32:36  
Would someone mind checking my COR lua as I have 2 issues;

1. Melee sets are not triggering - defaults to my RA
2. Bullets have to be in my inventory and not my mog wardrobe 2 (with the rest of my COR stuff)

Sorry if these are simple, first time using GS, my google-fu is rubbish and returning from years away (also why my gear is atrocious).

Anyway, this is the lua I'm using, it's from here as might have mucked with it abit accidentally (but didn't think I deleted anything).
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------
 
--[[
    gs c toggle LuzafRing -- Toggles use of Luzaf Ring on and off
     
    Offense mode is melee or ranged.  Used ranged offense mode if you are engaged
    for ranged weaponskills, but not actually meleeing.
     
    Weaponskill mode, if set to 'Normal', is handled separately for melee and ranged weaponskills.
--]]
 
 
-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2
     
    -- Load and initialize the include file.
    include('Mote-Include.lua')
end
 
-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()
    -- Whether to use Luzaf's Ring
    state.LuzafRing = M(false, "Luzaf's Ring")
    -- Whether a warning has been given for low ammo
    state.warned = M(false)
     
        define_roll_values()
end
 
-------------------------------------------------------------------------------------------------------------------
-- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
-------------------------------------------------------------------------------------------------------------------
 
-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    state.OffenseMode:options('Ranged', 'Melee', 'Acc')
    state.RangedMode:options('Normal', 'Acc')
    state.WeaponskillMode:options('Normal', 'Acc', 'Att', 'Mod')
    state.CastingMode:options('Normal', 'Resistant')
    state.IdleMode:options('Normal', 'PDT', 'Refresh')
 
    gear.RAbullet = "Decimating bullet"
    gear.WSbullet = "Orichalcum bullet"
    gear.MAbullet = "Orichalcum bullet"
    gear.QDbullet = "Animikii bullet"
    options.ammo_warning_limit = 15
 
    -- Additional local binds
    send_command('bind ^` input /ja "Double-up" <me>')
    send_command('bind !` input /ja "Bolter\'s Roll" <me>')
 
    select_default_macro_book()
end
 
--
-- Called when this job file is unloaded (eg: job change)
function user_unload()
    send_command('unbind ^`')
    send_command('unbind !`')
end
 
-- Define sets and vars used by this job file.
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
     
    -- Precast Sets
 
    -- Precast sets to enhance JAs
     
    sets.precast.JA['Triple Shot'] = {body="Navarch's Frac +2"}
    sets.precast.JA['Snake Eye'] = {legs="Lanun Trews"}
    sets.precast.JA['Wild Card'] = {feet="Lanun Bottes"}
    sets.precast.JA['Random Deal'] = {body="Lanun Frac"}
     
 
     
    sets.precast.JA.CorsairRoll = {
    head="Lanun Tricorne",
    hands="Navarch's Gants +2",
    neck="Regal Necklace",
    ring1="Merirosvo Ring",
    ring2="Luzaf's Ring",
     
    }
     
    sets.precast.JA.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Navarch's Culottes +2"})
    sets.precast.JA.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Navarch's Bottes +2"})
    sets.precast.JA.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Navarch's Tricorne +2"})
    sets.precast.JA.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Navarch's Frac +2"})
    sets.precast.JA.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Navarch's Gants +2"})
     
    sets.precast.LuzafRing = {ring1="Merirosvo Ring",ring2="Luzaf's Ring"}
    sets.precast.FoldDoubleBust = {hands="Lanun Gants"}
     
    sets.precast.CorsairShot = {
	ammo=gear.RAbullet,
    head="Nvrch. Tricorne +2",
    body="Laksa. Frac",
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs="Nvrch. Culottes +2",
    feet="Laksa. Bottes",
    neck="Marked Gorget",
    waist="Dynamic Belt",
    left_ear="Clearview Earring",
    right_ear="Volley Earring",
    left_ring="Paqichikaji Ring",
    right_ring="Longshot Ring",
    back="Gunslinger's Cape",}
     
 
    -- Waltz set (chr and vit)
    sets.precast.Waltz = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Taeon Tabard", augments={'"Subtle Blow"+5',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Wiglen Gorget",
    waist="Dynamic Belt",
    left_ear="Ethereal Earring",
    right_ear="Brutal Earring",
    left_ring="Asklepian Ring",
    right_ring="Spiral Ring",
    back="Letalis Mantle",}
         
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}
 
    -- Fast cast sets for spells
     
    sets.precast.FC = {head="Haruspex Hat",ear2="Loquacious Earring",hands="Thaumas Gloves",ring1="Prolix Ring"}
 
    sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {neck="Magoraga Beads"})
 
 
    sets.precast.RA = {
	ammo=gear.RAbullet,
    head="Nvrch. Tricorne +2",
    body="Laksa. Frac",
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs="Nvrch. Culottes +2",
    feet="Laksa. Bottes",
    neck="Marked Gorget",
    waist="Dynamic Belt",
    left_ear="Clearview Earring",
    right_ear="Volley Earring",
    left_ring="Paqichikaji Ring",
    right_ring="Longshot Ring",
    back="Gunslinger's Cape",}
 
     
    -- Weaponskill sets
    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {
	ammo=gear.WSbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Lanun Frac", augments={'Enhances "Loaded Deck" effect',}},
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs={ name="Lanun Trews", augments={'Enhances "Snake Eye" effect',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Bladeborn Earring",
    left_ring="Adoulin Ring",
    right_ring="Iota Ring",
    back="Atheling Mantle"}
 
 
    -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
    sets.precast.WS['Leaden Salute'] = sets.precast.WS
 
    sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS['Requiescat'], {right_ring="Chirich Ring +1"})
     
    sets.precast.WS['Shining Blade'] = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Bladeborn Earring",
    left_ring="Epona's Ring",
    right_ring="Ifrit Ring +1",
    back="Atheling Mantle",}
 
    sets.precast.WS['Requiescat'] = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Bladeborn Earring",
    left_ring="Epona's Ring",
    right_ring="Ifrit Ring +1",
    back="Atheling Mantle",}

 
    sets.precast.WS['Last Stand'] = {
	ammo=gear.WSbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Lanun Frac", augments={'Enhances "Loaded Deck" effect',}},
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs={ name="Lanun Trews", augments={'Enhances "Snake Eye" effect',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Bladeborn Earring",
    left_ring="Adoulin Ring",
    right_ring="Iota Ring",
    back="Atheling Mantle"}
     
    sets.precast.WS['Savage Blade'] = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Lanun Frac", augments={'Enhances "Loaded Deck" effect',}},
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs={ name="Lanun Trews", augments={'Enhances "Snake Eye" effect',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Bladeborn Earring",
    left_ring="Adoulin Ring",
    right_ring="Iota Ring",
    back="Atheling Mantle"}
 
    sets.precast.WS['Shining Blade'] = sets.precast.WS['Savage Blade']
     
    sets.precast.WS['Wildfire'] = sets.precast.WS
     
    sets.precast.WS['Leaden Salute'] = sets.precast.WS['Wildfire']
     
     
    -- Midcast Sets
    sets.midcast.FastRecast = {
        head="Whirlpool Mask",}
         
    -- Specific spells
    sets.midcast.Utsusemi = sets.midcast.FastRecast
 
    sets.midcast.CorsairShot = {
    ammo=gear.QDbullet,
    head="Laksa. Tricorne",
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Nvrch. Gants +2",
    legs="Laksa. Trews",
    feet="Nvrch. Bottes +2",
    neck="Nefarious Collar +1",
    waist="Dynamic Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Hecate's Earring",
    left_ring="Adoulin Ring",
    right_ring="Spiral Ring",
    back="Gunslinger's Cape"}
 
    sets.midcast.CorsairShot.Acc = {ammo=gear.QDbullet,
    head="Laksa. Tricorne",
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Nvrch. Gants +2",
    legs="Laksa. Trews",
    feet="Nvrch. Bottes +2",
    neck="Nefarious Collar +1",
    waist="Dynamic Belt",
    left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    right_ear="Hecate's Earring",
    left_ring="Adoulin Ring",
    right_ring="Spiral Ring",
    back="Gunslinger's Cape"}
 
    sets.midcast.CorsairShot['Light Shot'] = sets.midcast.CorsairShot.Acc
 
    sets.midcast.CorsairShot['Dark Shot'] = sets.midcast.CorsairShot['Light Shot']
 
 
    -- Ranged gear
    sets.midcast.RA = {ammo=gear.RAbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body="Laksa. Frac",
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs={ name="Lanun Trews", augments={'Enhances "Snake Eye" effect',}},
    feet="Laksa. Bottes",
    neck="Marked Gorget",
    waist="Dynamic Belt",
    left_ear="Clearview Earring",
    right_ear="Volley Earring",
    left_ring="Paqichikaji Ring",
    right_ring="Longshot Ring",
    back="Gunslinger's Cape",}
 
    sets.midcast.RA.Acc = {ammo=gear.RAbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body="Laksa. Frac",
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs={ name="Lanun Trews", augments={'Enhances "Snake Eye" effect',}},
    feet="Laksa. Bottes",
    neck="Marked Gorget",
    waist="Dynamic Belt",
    left_ear="Clearview Earring",
    right_ear="Volley Earring",
    left_ring="Paqichikaji Ring",
    right_ring="Longshot Ring",
    back="Gunslinger's Cape",}
 
     
    -- Sets to return to when not performing an action.
     
    -- Resting sets
    sets.resting = {neck="Wiglen Gorget",ring1="Sheltered Ring",ring2="Paguroidea Ring"}
     
 
    -- Idle sets
    sets.idle = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs="Crimson Cuisses",
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Wiglen Gorget",
    waist="Cetl Belt",
    left_ear="Suppanomimi",
    right_ear="Brutal Earring",
    left_ring="Defending Ring",
    right_ring="Sheltered Ring",
    back="Repulse Mantle",}
 
    sets.idle.Town = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs="Crimson Cuisses",
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Wiglen Gorget",
    waist="Cetl Belt",
    left_ear="Suppanomimi",
    right_ear="Brutal Earring",
    left_ring="Defending Ring",
    right_ring="Sheltered Ring",
    back="Repulse Mantle",}
     
    -- Defense sets
    sets.defense.PDT = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Lanun Frac", augments={'Enhances "Loaded Deck" effect',}},
    hands="Buremte Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Twilight Torque",
    waist="Dynamic Belt",
    left_ear="Ethereal Earring",
    right_ear="Brutal Earring",
    left_ring="Defending Ring",
    right_ring={ name="Dark Ring", augments={'Breath dmg. taken -3%','Phys. dmg. taken -5%',}}}
 
    sets.defense.MDT = {
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Lanun Frac", augments={'Enhances "Loaded Deck" effect',}},
    hands="Buremte Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Twilight Torque",
    waist="Dynamic Belt",
    left_ear="Ethereal Earring",
    right_ear="Brutal Earring",
    left_ring="Defending Ring",
    right_ring={ name="Dark Ring", augments={'Breath dmg. taken -3%','Phys. dmg. taken -5%',}}}
     
 
    sets.Kiting = {feet="Skadi's Jambeaux +1"}
 
    -- Engaged sets
 
    -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
    -- sets if more refined versions aren't defined.
    -- If you create a set with both offense and defense modes, the offense mode should be first.
    -- EG: sets.engaged.Dagger.Accuracy.Evasion
     
    -- Normal melee group
    sets.engaged.Melee = {
	main="Surcouf's jambiya",
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Asperity Necklace",
    waist="Windbuffet Belt +1",
    left_ear="Suppanomimi",
    right_ear="Brutal Earring",
    left_ring="Epona's Ring",
    right_ring="Chirich Ring",
    back="Letalis Mantle",}
     
    sets.engaged.Acc = {
    main="Surcouf's jambiya",
    ammo=gear.RAbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Asperity Necklace",
    waist="Windbuffet Belt +1",
    left_ear="Suppanomimi",
    right_ear="Brutal Earring",
    left_ring="Epona's Ring",
    right_ring="Chirich Ring",
    back="Letalis Mantle"}
 
    sets.engaged.Melee.DW = {
    ammo=gear.RAbullet,
	main="Surcouf's jambiya",
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Asperity Necklace",
    waist="Windbuffet Belt +1",
    left_ear="Suppanomimi",
    right_ear="Brutal Earring",
    left_ring="Epona's Ring",
    right_ring="Chirich Ring",
    back="Letalis Mantle",}
     
    sets.engaged.Acc.DW = {
    ammo=gear.RAbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body={ name="Rawhide Vest", augments={'HP+50','Accuracy+15','Evasion+20',}},
    hands="Rawhide Gloves",
    legs={ name="Taeon Tights", augments={'Attack+22','"Subtle Blow"+3',}},
    feet={ name="Taeon Boots", augments={'Rng.Acc.+1','"Triple Atk."+1',}},
    neck="Asperity Necklace",
    waist="Windbuffet Belt +1",
    left_ear="Suppanomimi",
    right_ear="Brutal Earring",
    left_ring="Epona's Ring",
    right_ring="Chirich Ring",
    back="Letalis Mantle"}
 
 
    sets.engaged.Ranged = {
	ammo=gear.RAbullet,
    head={ name="Taeon Chapeau", augments={'Weapon Skill Acc.+11',}},
    body="Laksa. Frac",
    hands={ name="Lanun Gants", augments={'Enhances "Fold" effect',}},
    legs={ name="Lanun Trews", augments={'Enhances "Snake Eye" effect',}},
    feet="Laksa. Bottes",
    neck="Marked Gorget",
    waist="Dynamic Belt",
    left_ear="Clearview Earring",
    right_ear="Volley Earring",
    left_ring="Paqichikaji Ring",
    right_ring="Longshot Ring",
    back="Gunslinger's Cape",}
end
 
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------
 
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
-- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
function job_precast(spell, action, spellMap, eventArgs)
    -- Check that proper ammo is available if we're using ranged attacks or similar.
    if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
        do_bullet_checks(spell, spellMap, eventArgs)
    end
 
    -- gear sets
    if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and state.LuzafRing.value then
        equip(sets.precast.LuzafRing)
    elseif spell.type == 'CorsairShot' and state.CastingMode.value == 'Resistant' then
        classes.CustomClass = 'Acc'
    elseif spell.english == 'Fold' and buffactive['Bust'] == 2 then
        if sets.precast.FoldDoubleBust then
            equip(sets.precast.FoldDoubleBust)
            eventArgs.handled = true
        end
    end
end
 
 
-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
    if spell.type == 'CorsairRoll' and not spell.interrupted then
        display_roll_info(spell)
    end
end
 
-------------------------------------------------------------------------------------------------------------------
-- User code that supplements standard library decisions.
-------------------------------------------------------------------------------------------------------------------
 
-- Return a customized weaponskill mode to use for weaponskill sets.
-- Don't return anything if you're not overriding the default value.
 
function get_custom_wsmode(spell, spellMap, default_wsmode)
    if buffactive['Transcendancy'] then
        return 'Brew'
    end
end
 
 
-- Called by the 'update' self-command, for common needs.
-- Set eventArgs.handled to true if we don't want automatic equipping of gear.
function job_update(cmdParams, eventArgs)
    if newStatus == 'Engaged' and player.equipment.main == 'Chatoyant Staff' then
        state.OffenseMode:set('Ranged')
    end
end
 
 
-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)
    local msg = ''
     
    msg = msg .. 'Off.: '..state.OffenseMode.current
    msg = msg .. ', Rng.: '..state.RangedMode.current
    msg = msg .. ', WS.: '..state.WeaponskillMode.current
    msg = msg .. ', QD.: '..state.CastingMode.current
 
    if state.DefenseMode.value ~= 'None' then
        local defMode = state[state.DefenseMode.value ..'DefenseMode'].current
        msg = msg .. ', Defense: '..state.DefenseMode.value..' '..defMode
    end
     
    if state.Kiting.value then
        msg = msg .. ', Kiting'
    end
     
    if state.PCTargetMode.value ~= 'default' then
        msg = msg .. ', Target PC: '..state.PCTargetMode.value
    end
 
    if state.SelectNPCTargets.value then
        msg = msg .. ', Target NPCs'
    end
 
    msg = msg .. ', Roll Size: ' .. ((state.LuzafRing.value and 'Large') or 'Small')
     
    add_to_chat(122, msg)
 
    eventArgs.handled = true
end
 
 
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------
 
function define_roll_values()
    rolls = {
        ["Corsair's Roll"]   = {lucky=5, unlucky=9, bonus="Experience Points"},
        ["Ninja Roll"]       = {lucky=4, unlucky=8, bonus="Evasion"},
        ["Hunter's Roll"]    = {lucky=4, unlucky=8, bonus="Accuracy"},
        ["Chaos Roll"]       = {lucky=4, unlucky=8, bonus="Attack"},
        ["Magus's Roll"]     = {lucky=2, unlucky=6, bonus="Magic Defense"},
        ["Healer's Roll"]    = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
        ["Puppet Roll"]      = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
        ["Choral Roll"]      = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
        ["Monk's Roll"]      = {lucky=3, unlucky=7, bonus="Subtle Blow"},
        ["Beast Roll"]       = {lucky=4, unlucky=8, bonus="Pet Attack"},
        ["Samurai Roll"]     = {lucky=2, unlucky=6, bonus="Store TP"},
        ["Evoker's Roll"]    = {lucky=5, unlucky=9, bonus="Refresh"},
        ["Rogue's Roll"]     = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
        ["Warlock's Roll"]   = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
        ["Fighter's Roll"]   = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
        ["Drachen Roll"]     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
        ["Gallant's Roll"]   = {lucky=3, unlucky=7, bonus="Defense"},
        ["Wizard's Roll"]    = {lucky=5, unlucky=9, bonus="Magic Attack"},
        ["Dancer's Roll"]    = {lucky=3, unlucky=7, bonus="Regen"},
        ["Scholar's Roll"]   = {lucky=2, unlucky=6, bonus="Conserve MP"},
        ["Bolter's Roll"]    = {lucky=3, unlucky=9, bonus="Movement Speed"},
        ["Caster's Roll"]    = {lucky=2, unlucky=7, bonus="Fast Cast"},
        ["Courser's Roll"]   = {lucky=3, unlucky=9, bonus="Snapshot"},
        ["Blitzer's Roll"]   = {lucky=4, unlucky=9, bonus="Attack Delay"},
        ["Tactician's Roll"] = {lucky=5, unlucky=8, bonus="Regain"},
        ["Allies's Roll"]    = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
        ["Miser's Roll"]     = {lucky=5, unlucky=7, bonus="Save TP"},
        ["Companion's Roll"] = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
        ["Avenger's Roll"]   = {lucky=4, unlucky=8, bonus="Counter Rate"},
    }
end
 
function idle_town_values ()
    sets.idle.Town = S{
    "Ru'Lude Gardens",
    "Upper Jeuno",
    "Lower Jeuno",
    "Port Jeuno",
    "Port Windurst",
    "Windurst Waters",
    "Windurst Woods",
    "Windurst Walls",
    "Heavens Tower",
    "Port San d'Oria",
    "Northern San d'Oria",
    "Southern San d'Oria",
    "Port Bastok",
    "Bastok Markets",
    "Bastok Mines",
    "Metalworks",
    "Aht Urhgan Whitegate",
    "Al Zahbi",
    "South Sandoria [S]",
    "Bastok Markets [S]",
    "Windurst Waters [S]",
    "Tavnazian Safehold",
    "Nashmau",
    "Selbina",
    "Mhaura",
    "Rabao",
    "Norg",
    "Eastern Adoulin",
    "Western Adoulin",
    "Kazham"
    }
end
 
function display_roll_info(spell)
    rollinfo = rolls[spell.english]
    local rollsize = (state.LuzafRing.value and 'Large') or 'Small'
 
    if rollinfo then
        add_to_chat(104, spell.english..' provides a bonus to '..rollinfo.bonus..'.  Roll size: '..rollsize)
        add_to_chat(104, 'Lucky roll is '..tostring(rollinfo.lucky)..', Unlucky roll is '..tostring(rollinfo.unlucky)..'.')
    end
end
 
 
-- Determine whether we have sufficient ammo for the action being attempted.
function do_bullet_checks(spell, spellMap, eventArgs)
    local bullet_name
    local bullet_min_count = 1
     
    if spell.type == 'WeaponSkill' then
        if spell.skill == "Marksmanship" then
            if spell.element == 'None' then
                -- physical weaponskills
                bullet_name = gear.WSbullet
            else
                -- magical weaponskills
                bullet_name = gear.MAbullet
            end
        else
            -- Ignore non-ranged weaponskills
            return
        end
    elseif spell.type == 'CorsairShot' then
        bullet_name = gear.QDbullet
    elseif spell.action_type == 'Ranged Attack' then
        bullet_name = gear.RAbullet
        if buffactive['Triple Shot'] then
            bullet_min_count = 3
        end
    end
     
    if spell.action_type == 'Ranged Attack' and buffactive['Triple Shot'] 
    then sets.precast.JA['Triple Shot'] = sets.midcast.RA
    end
     
    local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]
     
    -- If no ammo is available, give appropriate warning and end.
    if not available_bullets then
        if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
            add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
            return
        elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
            add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
            return
        else
            add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
            eventArgs.cancel = true
            return
        end
    end
     
    -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
    if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
        add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
        eventArgs.cancel = true
        return
    end
     
    -- Low ammo warning.
    if spell.type ~= 'CorsairShot' and state.warned.value == false
        and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
        local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
        --local border = string.repeat("*", #msg)
        local border = ""
        for i = 1, #msg do
            border = border .. "*"
        end
         
        add_to_chat(104, border)
        add_to_chat(104, msg)
        add_to_chat(104, border)
 
        state.warned:set()
    elseif available_bullets.count > options.ammo_warning_limit and state.warned then
        state.warned:reset()
    end
end
 
-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    set_macro_page(1,7)
end
Offline
Posts: 503
By Vaerix 2022-03-31 11:32:55  
Line 673
Asura.Cebera said: »
Would someone mind checking my COR lua as I have 2 issues;

1. Melee sets are not triggering - defaults to my RA
2. Bullets have to be in my inventory and not my mog wardrobe 2 (with the rest of my COR stuff)

Sorry if these are simple, first time using GS, my google-fu is rubbish and returning from years away (also why my gear is atrocious).

Anyway, this is the lua I'm using, it's from here as might have mucked with it abit accidentally (but didn't think I deleted anything).

So for your first issue, I would say are you pressing F9 to switch your Offense Mode, because the default is Ranged in line 39
If the above does not fix this problem for you, I'd advise using Arislan's combat forms base and removing the superfluous "engaged.ranged" set, because defining midcast ranged means no matter what your default equipment is currently defined as "Idle" or "Engaged" you will use the correct ranged equipment.

For your second issue the problem lies in line 673:

I hope this helps.
[+]
 Asura.Cebera
Offline
サーバ: Asura
Game: FFXI
Posts: 9
By Asura.Cebera 2022-03-31 13:36:12  
That all works perfectly, thank you kindly for your help!
Offline
Posts: 514
By Aerison 2022-04-02 17:28:04  
Not strictly gearswap, but does anyone know a way to exclude a bag in organizer to pull/dump from?
Offline
By Shichishito 2022-04-02 17:39:20  
i'd look in the organizer.lua within
Code
_static = {
}

"usable_bags"

and/or
Code
default_settings = {
}

"dump_bags"

but that's just me guessing so don't blame me if it suddenly drops all your REMA, also make backups befor tinkering with it.

*edit*
or maybe a entry in
Code
_ignore_list = {}

does the job, although i'm not sure how the format would look like, i assume strings like 'Safe','Safe2','Locker' ... not dictionaries but again, just guessing.
 Phoenix.Felonius
Offline
サーバ: Phoenix
Game: FFXI
user: felonius
Posts: 71
By Phoenix.Felonius 2022-04-06 09:06:27  
Hi, I'm not seeing any errors in my files but I noticed that none of my gear is swapping for sets if that gear is in Mog Wardrobe 5 or 6. If I move the gear anywhere else it swaps just fine. I checked the res.bags and all the mog wardrobes are listed. Has anyone else run into this? Resolution?
First Page 2 3 ... 166 167 168 ... 183 184 185