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 ... 168 169 170 ... 183 184 185
 
Offline
Posts:
By 2022-05-11 00:37:22
 Undelete | Edit  | Link | 引用 | 返事
 
Post deleted by User.
 
Offline
Posts:
By 2022-05-11 00:51:47
 Undelete | Edit  | Link | 引用 | 返事
 
Post deleted by User.
 Asura.Cordyfox
Offline
サーバ: Asura
Game: FFXI
user: Cordyfox
Posts: 71
By Asura.Cordyfox 2022-05-13 10:23:12  
So, I normally use my numpad for weaponskills and it typically works great. But for jobs where I want to be able to use multiple weapons, I'd like to have the keybinds change accordingly. Any suggestions on how to make this actually work? (Attached code is what I currently have and it doesn't work.)
Code
-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
    if state.WeaponLock.value == true then
        disable('ranged','ammo')
    else
        enable('ranged','ammo')
    end

    if state.WeaponSet == 'Damage' then
        send_command('bind ^numpad1 input /ws "Rudra\'s Storm" <t>')
        send_command('bind ^numpad2 input /ws "Evisceration" <t>')
        send_command('bind ^numpad3 input /ws "Mandalic Stab" <t>')
        send_command('bind ^numpad4 input /ws "Exenterator" <t>')
        send_command('bind ^numpad5 input /ws "Dancing Edge" <t>')
        send_command('bind ^numpad6 input /ws "Shark Bite" <t>')
        send_command('bind ^numpad7 input /ws "Shadowstitch" <t>')
        send_command('bind ^numpad8 input /ws "Energy Drain" <t>')
        send_command('bind ^numpad9 input /ws "Aeolian Edge" <t>')
    elseif state.WeaponSet == 'Sword' then
        send_command('bind ^numpad1 input /ws "Savage Blade" <t>')
        send_command('bind ^numpad2 input /ws "Flat Blade" <t>')
        send_command('bind ^numpad3 input /ws "Burning Blade" <t>')
        send_command('bind ^numpad9 input /ws "Circle Blade" <t>')
    elseif state.WeaponSet == 'H2H' then
        send_command('bind ^numpad1 input /ws "Asuran Fists" <t>')
        send_command('bind ^numpad2 input /ws "Shoulder Tackle" <t>')
        send_command('bind ^numpad3 input /ws "Backhand Blow" <t>')
        send_command('bind ^numpad9 input /ws "Spinning Attack" <t>')
    end 

    if state.RangedSet == 'Marksmanship' then
        send_command('bind !numpad1 input /ws "Last Stand" <t>')
        send_command('bind !numpad2 input /ws "Heavy Shot" <t>')
    elseif state.RangedSet == 'Archery' then
        send_command('bind !numpad1 input /ws "Empyreal Arrow" <t>')
        send_command('unbind !numpad2')
    elseif state.RangedSet == 'Throwing' or state.RangedSet == 'Melee' then
        send_command('unbind !numpad1')
        send_command('unbind !numpad2')
    end

    check_weaponset()

end
 Bismarck.Radec
Offline
サーバ: Bismarck
Game: FFXI
user: Radec
Posts: 148
By Bismarck.Radec 2022-05-13 13:00:41  
Probably change "state.WeaponSet" to "state.WeaponSet.value", same for state.RangedSet

Try adding a print(state.WeaponSet) to see what you're comparing to "Damage', 'Sword', etc as a debugging step.
 Asura.Cordyfox
Offline
サーバ: Asura
Game: FFXI
user: Cordyfox
Posts: 71
By Asura.Cordyfox 2022-05-13 15:04:31  
Bismarck.Radec said: »
Probably change "state.WeaponSet" to "state.WeaponSet.value", same for state.RangedSet

Try adding a print(state.WeaponSet) to see what you're comparing to "Damage', 'Sword', etc as a debugging step.

Oh, duh. That should've been more obvious in retrospect. Now the challenge is getting the keys to remap themselves when I switch sets.

EDIT: Figured it out :) Oh I'm happy with this.
 Asura.Cordyfox
Offline
サーバ: Asura
Game: FFXI
user: Cordyfox
Posts: 71
By Asura.Cordyfox 2022-05-13 16:24:59  
New problem: despite having...
Code
    if state.WeaponLock.value == true then
        disable('ranged','ammo')
    else
        enable('ranged','ammo')
    end
...in job_state_change, any time I engage a mob (or try to launch a ranged WS, it throws my melee or TH ammo back on ruining it. I'm baffled.
 Kujata.Tetsuiga
Offline
サーバ: Kujata
Game: FFXI
user: Tetsuiga
Posts: 40
By Kujata.Tetsuiga 2022-05-13 18:45:27  
I'm using Selinrile's GS, I'm trying to set certain songs for a brd to only be cast in dummy mode, would anyone be able to assist me in figuring out how to make this work?

So this line exists, and i figured i could just set like paeon or something to always be those songs

-- Adjust this if using the Terpander (new +song instrument)
info.ExtraSongInstrument = 'Terpander'
-- How many extra songs we can keep from Daurdabla/Terpander
info.ExtraSongs = 1
 Odin.Defiiant
Offline
サーバ: Odin
Game: FFXI
user: legionn
Posts: 22
By Odin.Defiiant 2022-05-13 18:50:20  
not familiar with Selinrile's GS, but maybe just creating a set for that song?

sets.midcast.Ballad = {}
 Bismarck.Radec
Offline
サーバ: Bismarck
Game: FFXI
user: Radec
Posts: 148
By Bismarck.Radec 2022-05-13 19:48:52  
Close - make a set for the song that uses the harp, and possibly doesn't include duration gear. For buff songs, Sel GS automatically layers
sets.midcast.SongEffect then sets.midcast.<song type> or sets.midcast.<song name>, so you need to call out the specific slots you want to use dummy gear on rather than just a blank set.

ie

sets.midcast["Army's Paeon II"] = {range="Daurdabla",neck="Loricate",body="Nyame",legs="Nyame"}

or

sets.midcast.Mazurka = set_combine(sets.idle, {range="Daurdabla"})

Repeat for songs or song classes that you want to be dummy mode.
[+]
 Asura.Xpeacekeeper
Offline
サーバ: Asura
Game: FFXI
Posts: 1
By Asura.Xpeacekeeper 2022-05-15 18:32:59  
hello, is there a rule to equip weapon/shield in the event they are removed, preferably without relying on precast? Sorry if this has been asked already, tried searching first.
 Asura.Yottaxa
Offline
サーバ: Asura
Game: FFXI
user: Yottaxa
Posts: 176
By Asura.Yottaxa 2022-05-16 03:28:30  
Asura.Xpeacekeeper said: »
hello, is there a rule to equip weapon/shield in the event they are removed, preferably without relying on precast? Sorry if this has been asked already, tried searching first.

Not sure as there may be better ways?, but what I have done is custom logic in my aftercast that always just equips selected weapons. In my case this also takes care of weapon swaps for cor rolls etc. You could also make a custom “oh crap” button that just equips current selected weapon and armors. I actually have these buttons setup too, as a fast way to drop into max dt.

I dont do it, but you could probably setup a custom react for all of the encumbrance / armor knock off abilities? And handle it there, but that seems like more work.
 Sylph.Inro
Offline
サーバ: Sylph
Game: FFXI
user: Solusek
Posts: 1
By Sylph.Inro 2022-05-18 02:33:49  
Hello, am multi boxing with another addon SendTarget (Github Link) it can help to capture sub target for alt. character without changing the window (you can do //sta "character name" /ma Cure <stpc> or /ma Silence <stnpc> when you are on main character window ), it work completely fine without Gearswap, but once I load gearswap it will stopped me to do the command (text show: "Abort: You haven't learned [Spell/Ability]"). I tried to find out which function in gearswap doing this so I can disable or amend to avoid this problem but my coding skill really not capable to do so :(

can someone please help

ps: am using Selinrile's Gearswap
 Asura.Iamarealgirl
Offline
サーバ: Asura
Game: FFXI
user: Latravant
Posts: 79
By Asura.Iamarealgirl 2022-05-18 10:27:53  
is there a way to put an auto avatar's favor into my smn
gearswap?
 Asura.Sechs
Offline
サーバ: Asura
Game: FFXI
user: Akumasama
Posts: 10136
By Asura.Sechs 2022-05-24 10:46:49  
I've been having an issue in my luas for the longest time and decided I want to try to fix it.

Check this simplified code:
Code
function status_change(new,old)
	if new == 'Engaged' then
		lock main/sub
	else
		unlock main/sub
	end
end


The code works pretty well if the new status is "Engaged" or "Disengaged".
But I'm getting my char to remain "stuck" (with main/sub locked) if I die instead of disengaging, or if I get warped out of the BC... but this latter event isn't much relevant, the death one is.

So I'm wondering why is it happening?
I'm checking for "engaged". If the new status is engaged then lock, if it's ANYTHING ELSE THAT IS NOT ENGAGED then unlock.
So in theory it should work with every status that's not engaged, and that includes "dead" too.
What am I missing here?
 Bismarck.Radec
Offline
サーバ: Bismarck
Game: FFXI
user: Radec
Posts: 148
By Bismarck.Radec 2022-05-24 12:40:37  
gearswap's status_change filters out dead (status 2), engaged-dead(status 3), and event(status 4) statuses from triggering a function, if they are either the old or new status.

gearswap.lua:
Code
line 321:
windower.register_event('status change',function(new,old)
    windower.debug('status change '..new)
    if gearswap_disabled or T{2,3,4}:contains(old) or T{2,3,4}:contains(new) then return end
    
    refresh_globals()
    equip_sets('status_change',nil,res.statuses[new].english,res.statuses[old].english)
end)
[+]
 Asura.Sechs
Offline
サーバ: Asura
Game: FFXI
user: Akumasama
Posts: 10136
By Asura.Sechs 2022-05-24 12:49:49  
Ahh that's why then.
I could customize Gearswap.lua but then each new update I would be ***.

Any simple way for me to fix my code? Considering that status_change filters those statuses?
 Bismarck.Radec
Offline
サーバ: Bismarck
Game: FFXI
user: Radec
Posts: 148
By Bismarck.Radec 2022-05-24 14:13:03  
Something on buff change maybe
Code
function buff_change(buff, gain)
    if player.status == idle and buff == "weakness" and gain then
        unlock
    end
end


It's not perfect (Raise after Mijin doesn't have weakness, for example) but should catch the case of dying while engaged, then getting a raise. Also unlocks you if you're disengaged and get weakness status from a WS though, which may not be intended - another condition on player.tp > x could adjust for that
[+]
Offline
Posts: 40
By quelthos 2022-05-27 03:33:09  
I have sleepmaxduration setup for sleep, sleep2, sleepga
swaps correctly when sleepmaxduration is turned on for sleep2 and sleepga, sleep(sleep1) will not swap to sleepmaxduration gear, only swaps to sets.midcast.sleep gear. Please help
Code
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 = {
    range=empty,
	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.buff.ComposureOther = set_combine(sets.midcast.EnhancingDuration,  {
		head="Leth. Chappel +1",
		body="Lethargy Sayon +1",
		legs="Leth. Fuseau +1",
		feet="Leth. Houseaux +1",
        })
    sets.midcast.EnhancingSkill = set_combine(sets.midcast['Enhancing Magic'], {
        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 = set_combine(sets.midcast.EnhancingDuration, {
        body="Atrophy Tabard +3", -- +3
        legs="Leth. Fuseau +1", -- +2
		waist="Gishdubar Sash",
        back="Grapevine Cape"
        })

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

    sets.midcast['Phalanx'] =  set_combine(sets.midcast.EnhancingSkill, {
	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['Phalanx II'] =  sets.midcast.EnhancingSkill

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

    sets.midcast.Storm = sets.midcast.EnhancingDuration
    sets.midcast.GainSpell = sets.midcast.EnhancingSkill
    sets.midcast.SpikesSpell = set_combine(sets.midcast.EnhancingDuration, {
	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="Atrophy Tabard +3",
    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",
        waist="Acuity Belt +1",
		back="Aurist's Cape +1",
        })

    sets.midcast.MndEnfeeblesEffect = set_combine(sets.midcast.MndEnfeebles, {
        body="Lethargy Sayon +1",
        })

    sets.midcast.IntEnfeebles = sets.midcast.MndEnfeebles
        

    sets.midcast.IntEnfeeblesAcc = set_combine(sets.midcast.MndEnfeeblesAcc, {
        })

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

    sets.midcast.SkillEnfeebles = set_combine(sets.midcast.MndEnfeebles, {
		hands="Leth. Gantherots +1",
		legs={ name="Psycloth Lappas", augments={'Mag. Acc.+10','Spell interruption rate down +15%','MND+7',}},
		waist="Rumination Sash",
		right_ear="Vor Earring",
		left_ring	=	{name="Stikini Ring +1", bag="wardrobe2"},
        })

    sets.midcast.Sleep = set_combine(sets.midcast.IntEnfeebles, {
        ring1="Kishar Ring",
        })

    sets.midcast.SleepMaxDuration = set_combine(sets.midcast.Sleep, {
        head="Leth. Chappel +1",
        body="Lethargy Sayon +1",
		hands="Leth. Gantherots +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.IntEnfeebles, {main="Daybreak"})

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

        })

    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.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",
    waist="Kentarch Belt +1",
    left_ear="Telos Earring",
    right_ear="Sherida 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", --7
    left_ear="Telos Earring",
    right_ear="Eabani Earring", --4
    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", --5
    feet={ name="Taeon Boots", augments={'Accuracy+24','"Dual Wield"+5','Phalanx +3',}}, --9
    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
		if not skill_spells: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
		end
        if skill_spells:contains(spell.english) then
            equip(sets.midcast.EnhancingSkill)
		end
        if spell.english:startswith('Gain') then
            equip(sets.midcast.GainSpell)
		end
        if spell.english == 'Phalanx' then
            equip(sets.midcast['Phalanx'])
		end
        if spell.english == 'Phalanx II' then
            equip(sets.midcast['Phalanx II'])
		end
        if spell.english == 'Aquaveil' then
            equip(sets.midcast.Aquaveil)
		end
        if spell.english == 'Stoneskin' then
            equip(sets.midcast.Stoneskin)
		end
        if spell.english:contains('Spikes') then
            equip(sets.midcast.SpikesSpell)
		end 
        if (spell.target.type == 'PLAYER' or spell.target.type == 'NPC') and buffactive.Composure and spell.english ~= 'Phalanx II' 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 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 player.sub_job == 'NIN' then
		state.CombatForm:set('DW')
	else
        state.CombatForm:reset()
	end
--function update_combat_form()
    --if DW == true then
     --   state.CombatForm:set('DW')
		--equip(sets.engaged.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


-- 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
 Asura.Yottaxa
Offline
サーバ: Asura
Game: FFXI
user: Yottaxa
Posts: 176
By Asura.Yottaxa 2022-06-11 18:24:22  
I have a dumb question, I think its been answered probably before:
I am not as familiar with modes as the rest of gearswap. I recently moved over to one that uses them for RDM. It has the weapons defined in a set such as:
mainWeapon = M('Vitiation Sword','etc.','etc.','etc.')

The gearswap just usses the toggle command to cycle through them, but I would like to possible have few in game macro button that will directly set them - can you force set the mainWeapon or subWeapon states with a console command? something involving mainWeapon:set(name)?

Thanks for any info.
 Asura.Neviskio
Offline
サーバ: Asura
Game: FFXI
user: Neviskio
Posts: 116
By Asura.Neviskio 2022-06-11 19:11:46  
Heya been wondering, I remember many years ago some luas had a function to stop you from WSing if the mob moves at the last second, think maybe, and sorry if I'm wrong, that arislan luas used to have that?

Is it a thing anymore? Thanks
 Asura.Buffyslyph
Offline
サーバ: Asura
Game: FFXI
Posts: 111
By Asura.Buffyslyph 2022-06-11 19:34:35  
Asura.Yottaxa said: »
I have a dumb question, I think its been answered probably before:
I am not as familiar with modes as the rest of gearswap. I recently moved over to one that uses them for RDM. It has the weapons defined in a set such as:
mainWeapon = M('Vitiation Sword','etc.','etc.','etc.')

The gearswap just usses the toggle command to cycle through them, but I would like to possible have few in game macro button that will directly set them - can you force set the mainWeapon or subWeapon states with a console command? something involving mainWeapon:set(name)?

Thanks for any info.
Code
gs c set WeaponMode Naegling
gs c set OffHandWeaponMode Gleti
gs c set RangedWeaponMode Anarchy


or whatever the name is of the mode you want to set.
Offline
Posts: 189
By ryukin182 2022-06-21 23:20:13  
I no longer can find the link to Selindriles discord so I guess this is my best shot. Been using his gearswap for a long time with no issues, but I only recently made Thibron. It is not recognizing the weapon, and refuses to go into tp or ws sets, as the check for sub is "empty". Now it's saying to check line 2269 in the lib/sel-utility which states

function is_dual_wielding()
if ((player.equipment.main and not (player.equipment.sub == 'empty' or player.equipment.sub:contains('Grip') or player.equipment.sub:contains('Strap') or res.items[item_name_to_id(player.equipment.sub)].shield_size))) then
return true
else
return false
end
end
I'm unsure of how to proceed, or make Thibron be recognized and not as empty in the offhand.
 Asura.Bippin
Offline
サーバ: Asura
Game: FFXI
user: Gunit
Posts: 1090
By Asura.Bippin 2022-06-21 23:47:42  
ryukin182 said: »
I no longer can find the link to Selindriles discord
Its in like everyone of the files

https://discord.gg/TxPZt2nt
Offline
Posts: 40
By quelthos 2022-07-05 03:52:18  
Trying to achieve 4 things
1. equip Mache Earring +1 when engaged and when weapon is Godhands
I did some codes in update_combat_form, and defined sets.god to include the earring but wouldn't work
2. switch to normal tp/engaged earring when swapped to a different weapon other than godhands.
3. equip Anch. Gaiters +3 when engaged and footwork buff is up.
Try to define in update_combat_form as well but wouldn't work..
4. switch back to default tp/engaged gear set after footwork duration ends.

Thanks for the help
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------

-- 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.Buff.Footwork = buffactive.Footwork or false
    state.Buff.Impetus = buffactive.Impetus or false

    state.FootworkWS = M(false, 'Footwork on WS')

    info.impetus_hit_count = 0
    windower.raw_register_event('action', on_action_for_impetus)
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','Tank')
    state.WeaponskillMode:options('Normal')
    state.PhysicalDefenseMode:options('PDT','Hybrid')

    state.WeaponSet = M{['description']='Weapon Set', 'Vere', 'GH', 'Pole'}
	send_command('bind @r gs c cycle WeaponSet')
    send_command('bind @e gs c cycleback WeaponSet')

    update_combat_form()
    update_melee_groups()

end

function user_unload()
    send_command('unbind @r')
    send_command('unbind @e')
end


-- Define sets and vars used by this job file.
function init_gear_sets()
	gear.CritBack = { name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Crit.hit rate+10',}}
	gear.DABack = { name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','"Dbl.Atk."+10',}}

	-- Precast Sets
    
    -- Precast sets to enhance JAs on use
    sets.precast.JA['Hundred Fists'] = {legs="Hes. Hose +3"}
    sets.precast.JA['Boost'] = {hands="Anchor. Gloves +3"}
    sets.precast.JA['Dodge'] = {feet="Anchorite's Gaiters +3"}
    sets.precast.JA['Focus'] = {head="Anchorite's Crown +1"}
    sets.precast.JA['Counterstance'] = {feet="Hes. Gaiters +3"}
    sets.precast.JA['Footwork'] = {feet="Shukuyu Sune-ate"}
    sets.precast.JA['Formless Strikes'] = {body="Hes. Cyclas +3"}
    sets.precast.JA['Mantra'] = {feet="Hes. Gaiters +3"}

    sets.precast.JA['Chi Blast'] = {head={ name="Hes. Crown +3", augments={'Enhances "Penance" effect',}}}

    sets.precast.JA['Chakra'] = {
		ammo="Aurgelmir Orb",
        head="Genmei Kabuto",
		neck="Unmoving Collar +1",
		body="Tatena. Harama. +1",		
		hands="Tatena. Gote +1",
		ring1="Niqmaddu Ring",
		ring2="Gelatinous Ring +1",
		back={ name="Segomo's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Weapon skill damage +10%',}},
		waist="Caudata Belt",
		legs="Tatena. Haidate +1",
		feet="Tatena. Sune. +1"
		}
	
	sets.precast.JA['Provoke'] = {		
	ammo="Per. Lucky Egg",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet={ name="Herculean Boots", augments={'Mag. Acc.+10','AGI+8','"Treasure Hunter"+2','Accuracy+13 Attack+13','Mag. Acc.+19 "Mag.Atk.Bns."+19',}},
    waist="Chaac Belt",

	}
	
    -- Waltz set (chr and vit)
    sets.precast.Waltz = {
		ammo="Staunch Tathlum +1",
        head="Mummu Bonnet +2",neck="Unmoving Collar +1",
        body="Passion Jacket",hands=gear.WaltzHands,ring1="Valseur's Ring",ring2="Asklepian Ring",
        back="Moonbeam Cape",waist="Chaac Belt",legs=gear.WaltzLegs,feet=gear.WaltzFeet}
        
    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}

    sets.precast.Step = {waist="Chaac Belt"}
    sets.precast.Flourish1 = {waist="Chaac Belt"}


    -- Fast cast sets for spells
    
    sets.precast.FC = {
    ammo="Sapience Orb",
    head={ name="Herculean Helm", augments={'Mag. Acc.+25','"Fast Cast"+5','MND+4','"Mag.Atk.Bns."+15',}},
    body={ name="Taeon Tabard", augments={'"Fast Cast"+4','Phalanx +3',}},
	hands={ name="Leyline Gloves", augments={'Accuracy+2','Mag. Acc.+5','"Mag.Atk.Bns."+4',}},
    legs={ name="Herculean Trousers", augments={'Mag. Acc.+13','"Fast Cast"+4','INT+9','"Mag.Atk.Bns."+4',}},
    feet={ name="Herculean Boots", augments={'AGI+2','"Fast Cast"+6','Mag. Acc.+5 "Mag.Atk.Bns."+5',}},
    neck="Baetyl Pendant",
	waist="Black Belt",
    left_ear="Loquac. Earring",
    right_ear="Etiolation Earring",
    left_ring="Prolix Ring",
    right_ring="Weather. Ring",
    --back="",
		}

    sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {body="Passion Jacket",neck="Magoraga Beads"})

       
    -- Weaponskill sets

    sets.precast.WS    = {
    ammo="Knobkierrie",
    head="Mpaca's Cap",
    body="Tatena. Harama. +1",
    hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
    legs={ name="Tatena. Haidate +1", augments={'Path: A',}},
    feet="Mpaca's Boots",
    neck={ name="Mnk. Nodowa +2", augments={'Path: A',}},
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','"Dbl.Atk."+10',}},
	}

    sets.precast.WS['Raging Fists']    = set_combine(sets.precast.WS, {
    body="Adhemar Jacket +1",
	})
    sets.precast.WS['Howling Fist']    = set_combine(sets.precast.WS, {
	})
	
    sets.precast.WS["Victory Smite"]	= set_combine(sets.precast.WS, {
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}},
    body="Mpaca's Doublet",
    hands={ name="Ryuo Tekko +1", augments={'STR+12','DEX+12','Accuracy+20',}},
    legs="Mpaca's Hose",
    right_ear="Odr Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back=gear.CritBack,
	})
	
    sets.precast.WS['Shijin Spiral']   = set_combine(sets.precast.WS, {
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Hes. Hose +3",
    right_ear="Mache Earring +1",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
	})
	
    sets.precast.WS['Tornado Kick']    = set_combine(sets.precast.WS, {
    legs="Mpaca's Hose",
    feet="Anch. Gaiters +3",
	})
	
    sets.precast.WS['Shell Crusher']   = set_combine(sets.precast.WS, {
    ammo="Pemphredo Tathlum",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Sanctity Necklace",
    waist="Acuity Belt +1",
    left_ear="Digni. Earring",
    right_ear="Crep. Earring",
    left_ring="Stikini Ring +1",
    right_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
    back="Sacro Mantle",
	})
    
	--weaponsets
	sets.Vere = {main="Verethragna"}
	sets.GH = {main="Godhands"}
    sets.Pole = {main="Malignance Pole", sub="Flanged Grip"}
   
    -- Midcast Sets
    sets.midcast.FastRecast = {ammo="Sapience Orb",
        head=gear.FCHead,neck="Orunmila's Torque",
        body="Adhemar Jacket +1",hands="Leyline Gloves",ring1="Weather. Ring",ring2="Prolix Ring",
        back="Moonbeam Cape",waist="Black Belt",legs="Rawhide Trousers",feet=gear.FCFeet}
    
	-- Idle sets
    sets.idle = {
    ammo="Crepuscular Pebble",
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Bathy Choker +1",
    waist="Moonbow Belt +1",
    left_ear="Etiolation Earring",
    right_ear={ name="Odnowa Earring +1", augments={'Path: A',}},
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
		}
    
    -- Defense sets
    sets.defense.PDT = {
		}

    sets.defense.Hybrid = sets.defense.PDT

    sets.defense.MDT = sets.defense.PDT

    sets.Kiting = {feet="Hermes' Sandals"}

    -- Engaged sets
    
    -- Normal melee sets
    sets.engaged = {
    ammo="Coiste Bodhar",
    head="Malignance Chapeau",
    body="Mpaca's Doublet",
    hands="Malignance Gloves",
    legs="Mpaca's Hose",
    feet="Malignance Boots",
    neck={ name="Mnk. Nodowa +2", augments={'Path: A',}},
    waist="Moonbow Belt +1",
    left_ear="Sherida Earring",
    right_ear="Schere Earring",
    left_ring="Niqmaddu Ring",
    right_ring="Gere Ring",
    back={ name="Segomo's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
	}
		
	sets.god = 	{right_ear="Mache Earring +1",}
		
    sets.engaged.Tank = set_combine(sets.engaged, {
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
	})
	
        
    -- Quick sets for post-precast adjustments, listed here so that the gear can be Validated.
    sets.engaged.Impetus = set_combine(sets.engaged, {body="Bhikku Cyclas +1"})
    sets.engaged.Tank.Impetus = set_combine(sets.engaged.Tank, {body="Bhikku Cyclas +1"})
    sets.footwork_kick_feet = {feet="Anch. Gaiters +3"}
	sets.impetus_body = {body="Bhikku Cyclas +1", ammo="Coiste Bodhar", right_ear="Schere Earring", back=gear.DABack}	
	sets.YourAskSashSetname  =  {waist="Ask Sash"}
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)
    -- Don't gearswap for weaponskills when Defense is on.
    --if spell.type == 'WeaponSkill' and state.DefenseMode.current ~= 'None' then
        --eventArgs.handled = true
    --end
--end

-- Run after the general precast() is done.
function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.type == 'WeaponSkill' then
        if state.Buff.Impetus and (spell.english == "Ascetic's Fury" or spell.english == "Victory Smite") then
          equip(sets.impetus_body)
		  -- Need 6 hits at capped dDex, or 9 hits if dDex is uncapped, for Tantra to tie or win.
        elseif state.Buff.Footwork and (spell.english == "Dragon's Kick" or spell.english == "Tornado Kick") then
            equip(sets.footwork_kick_feet)
        end
    end
end

--function job_aftercast(spell, action, spellMap, eventArgs)
    --if spell.type == 'WeaponSkill' and not spell.interrupted and state.FootworkWS and state.Buff.Footwork then
        --send_command('cancel Footwork')
    --end
--end

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

-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
	--ask sash
	if buff == 'Boost' then
        if gain then
            equip(sets.YourAskSashSetname)
            disable('waist')
        else
            enable('waist')
        end
    end
    -- Set Footwork as combat form any time it's active and Hundred Fists is not.
    if buff == 'Footwork' and gain and not buffactive['hundred fists'] then
	            equip(sets.footwork_kick_feet)
        --state.CombatForm:set('Footwork')
    elseif buff == "Hundred Fists" and not gain and buffactive.footwork then
	            equip(sets.footwork_kick_feet)
        --state.CombatForm:set('Footwork')
    else
        state.CombatForm:reset()
    end
    
    -- Hundred Fists and Impetus modify the custom melee groups
    if buff == "Hundred Fists" or buff == "Impetus" then
        classes.CustomMeleeGroups:clear()
        
        if (buff == "Hundred Fists" and gain) or buffactive['hundred fists'] then
            classes.CustomMeleeGroups:append('HF')
        end
        
        if (buff == "Impetus" and gain) or buffactive.impetus then
            classes.CustomMeleeGroups:append('Impetus')
        end
    end

    -- Update gear if any of the above changed
    if buff == "Hundred Fists" or buff == "Impetus" or buff == "Footwork" then
        handle_equipping_gear(player.status)
    end
end


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

function customize_idle_set(idleSet)
    if player.hpp < 75 then
        idleSet = set_combine(idleSet, sets.ExtraRegen)
    end
    
    return idleSet
end

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

function update_combat_form()
    --if buffactive.footwork and not buffactive['hundred fists'] then
        --state.CombatForm:set('Footwork')
    if player.equipment.main == 'Godhands' then
		equip(sets.god)
	else
        state.CombatForm:reset()
    end
end

function update_melee_groups()
    classes.CustomMeleeGroups:clear()
    
    if buffactive['hundred fists'] then
        classes.CustomMeleeGroups:append('HF')
    end
    
    if buffactive.impetus then
        classes.CustomMeleeGroups:append('Impetus')
    end
end


-------------------------------------------------------------------------------------------------------------------
-- Custom event hooks.
-------------------------------------------------------------------------------------------------------------------

-- Keep track of the current hit count while Impetus is up.
function on_action_for_impetus(action)
    if state.Buff.Impetus then
        -- count melee hits by player
        if action.actor_id == player.id then
            if action.category == 1 then
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- Reactions (bitset):
                        -- 1 = evade
                        -- 2 = parry
                        -- 4 = block/guard
                        -- 8 = hit
                        -- 16 = JA/weaponskill?
                        -- If action.reaction has bits 1 or 2 set, it missed or was parried. Reset count.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 1
                        end
                    end
                end
            elseif action.category == 3 then
                -- Missed weaponskill hits will reset the counter.  Can we tell?
                -- Reaction always seems to be 24 (what does this value mean? 8=hit, 16=?)
                -- Can't tell if any hits were missed, so have to assume all hit.
                -- Increment by the minimum number of weaponskill hits: 2.
                for _,target in pairs(action.targets) do
                    for _,action in pairs(target.actions) do
                        -- This will only be if the entire weaponskill missed or was parried.
                        if (action.reaction % 4) > 0 then
                            info.impetus_hit_count = 0
                        else
                            info.impetus_hit_count = info.impetus_hit_count + 2
                        end
                    end
                end
            end
        elseif action.actor_id ~= player.id and action.category == 1 then
            -- If mob hits the player, check for counters.
            for _,target in pairs(action.targets) do
                if target.id == player.id then
                    for _,action in pairs(target.actions) do
                        -- Spike effect animation:
                        -- 63 = counter
                        -- ?? = missed counter
                        if action.has_spike_effect then
                            -- spike_effect_message of 592 == missed counter
                            if action.spike_effect_message == 592 then
                                info.impetus_hit_count = 0
                            elseif action.spike_effect_animation == 63 then
                                info.impetus_hit_count = info.impetus_hit_count + 1
                            end
                        end
                    end
                end
            end
        end
        
        --add_to_chat(123,'Current Impetus hit count = ' .. tostring(info.impetus_hit_count))
    else
        info.impetus_hit_count = 0
    end
    
end

-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)

    equip(sets[state.WeaponSet.current])

end

send_command('input /macro set 3;input /macro book 12')
    send_command('@wait 5; input /lockstyleset 60')

By ithorien 2022-07-05 15:02:42  
Eek. Been away from this way too long (7 long years) to remember, but I cannot for the life of me get the "auto haste" functions to work from Mote's oldschool LUAs, specifically this piece-
Code
function determine_haste_group()
    -- We have three groups of DW in gear: Hachiya body/legs, Iga head + Patentia Sash, and DW earrings
    
    -- Standard gear set reaches near capped delay with just Haste (77%-78%, depending on HQs)

    -- For high haste, we want to be able to drop one of the 10% groups.
    -- Basic gear hits capped delay (roughly) with:
    -- 1 March + Haste
    -- 2 March
    -- Haste + Haste Samba
    -- 1 March + Haste Samba
    -- Embrava
    
    -- High haste buffs:
    -- 2x Marches + Haste Samba == 19% DW in gear
    -- 1x March + Haste + Haste Samba == 22% DW in gear
    -- Embrava + Haste or 1x March == 7% DW in gear
    
    -- For max haste (capped magic haste + 25% gear haste), we can drop all DW gear.
    -- Max haste buffs:
    -- Embrava + Haste+March or 2x March
    -- 2x Marches + Haste
    
    -- So we want four tiers:
    -- Normal DW
    -- 20% DW -- High Haste
    -- 7% DW (earrings) - Embrava Haste (specialized situation with embrava and haste, but no marches)
    -- 0 DW - Max Haste
    
    classes.CustomMeleeGroups:clear()
    
    if buffactive.embrava and (buffactive.march == 2 or (buffactive.march and buffactive.haste)) then
        classes.CustomMeleeGroups:append('MaxHaste')
    elseif buffactive.march == 2 and buffactive.haste then
        classes.CustomMeleeGroups:append('MaxHaste')
    elseif buffactive.embrava and (buffactive.haste or buffactive.march) then
        classes.CustomMeleeGroups:append('EmbravaHaste')
    elseif buffactive.march == 1 and buffactive.haste and buffactive['haste samba'] then
        classes.CustomMeleeGroups:append('HighHaste')
    elseif buffactive.march == 2 then
        classes.CustomMeleeGroups:append('HighHaste')
    end
end


I have the sets defined as they used to be (don't lol, these are 7 year old gearsets), but it doesn't seem that Haste of any kind is causing any processing and debug isn't helping me get there. For example, working on getting this updated:
Code
sets.engaged.HighHaste = {ammo="Qirmiz Tathlum",
        head="Taeon Chapeau",neck="Moonbeam Nodowa",ear1="Eabani Earring",ear2="Suppanomimi",
        body="Hattori Ningi",hands="Taeon Gloves",ring1="Rajas Ring",ring2="Epona's Ring",
        back="Yokaze Mantle",waist="Patentia Sash",legs="Mochizuki Hakama +1",feet="Mochizuki Kyahan"}


Any pointers?
Offline
Posts: 4
By Solux 2022-07-19 22:24:59  
Heya! Was hoping for help with my new BST lua. I cannot for the life of me figure out how to get Gearswap to interpret /bstpet 1, 2, etc.. as their ability names so it changes gear. My biggest hurdle is that I'm not even certain what is being passed to gearswap when I use the command. I have them mapped for physical, magical, etc... but I can't get it to compare. Worse is the catch-all won't register equipping the Gleti's Breeches, or the TP bonus empyrean. Tried JobAbilites, spell.type = 'Monster', and Precast, Midcast, Pet_Midcast. I'm outta ideas and my lua is in pieces across multiple scratch files awaiting re-assembly. Any help would be appreciated.
 Bahamut.Galakar
Offline
サーバ: Bahamut
Game: FFXI
user: Galakar
Posts: 181
By Bahamut.Galakar 2022-07-20 02:50:28  
I don't play BST, but maybe how it looks for my SMN will help you solve the issue. First, I make sure that if I use pet action, it doesn't execute midcast action.
Code
function midcast(spell)
	if pet_midaction() then
		return
	end


My pet precast set is also in the midcast function.
Code
if spell.type=='BloodPactWard' or spell.type=='BloodPactRage' then
equip()
end


And this is how my set for pet midcast work. I first call function pet.isvalid in case it dies before executing the spell (I saw that others do not use this step, so maybe it is not needed).
Code
function pet_midcast(spell)
	if pet.isvalid then
		if SpellMaps:contains(spell.name) then
			equip()
		end
	end
end
Offline
Posts: 4
By Solux 2022-07-20 11:41:52  
Edited:
Yeah. Thanks for the help. A little peeved at the moment, but I got this to work. All my problems from 5-6hours of work just vanished today. Apparently the solution to everything was to restart FFXI. Fresh today, logged into BST, and the lua functions as intended. Everything works now, not just the ws and personal job abilites like yesterday - pet stuff is changing etc.. I have no idea what changed between logoff last night and logon this morning. <sigh> Thanks again for your help. Please ignore the below - leaving it in case someone will benefit from the code or something.





Heya^^ thank you for the response.
Gonna take notes for SMN, though for me it isn't really an issue as the ability name is passed with the macro- something like /pet "Predator Claws" <t> - and (spell.english) or (spell.name) can be used with the SpellMaps:contains() to compare searching for "Predator Claws".

Macro-wise for SMN I utilize a line for each Avatar specifying each blood pact since.. well that's all SMN really does. I can throw in a "Cure" or Myrkr on an ability row of the macro book and usually call it good. - this is just how I handle SMN personally when I do play it.

BST on the other hand has more Melee versatility and filling a macro book full of pet moves doesn't seem practical since it negates ability rows, Weapon Skills, etc...
So to allow for more space I use "/bstpet 3 <me>" - or whatever corresponding move I want my pet to do(1-7). The problem I'm having is when this is passed to vanilla gearswap (no includes) whatever is being sent doesn't seem to be a spell name that I can compare to.
Code
function pet_midcast(spell,action)
		if Pet_Phys:contains(spell.english) then
			equip(sets.midcast.JA.Ready.Pet_Phys)
		elseif Pet_Mag:contains(spell.english) then
			equip(sets.midcast.JA.Ready.Pet_Mag)
		elseif Pet_MAcc:contains(spell.english) then
			equip(sets.midcast.JA.Ready.Pet_MAcc)
		elseif Pet_xHit:contains(spell.english) then
			equip(sets.midcast.JA.Ready.Pet_xHit)
		elseif Pet_TPReady:contains(spell.english) then
			equip(sets.midcast.JA.Ready.Pet_TPReady)
		elseif Pet_BuffTP:contains(spell.english) then
			equip(sets.midcast.JA.Ready.Pet_BuffTP)
		else
		end
end


p.s. sorry the code's a mess, the lua is in parts trying to get this to work.
 Phoenix.Tgo
Offline
サーバ: Phoenix
Game: FFXI
Posts: 1
By Phoenix.Tgo 2022-07-23 23:43:37  
Hi,

I'm having trouble getting my idle set to load on my thief lua. I'm using a modified version of Kinematics thf lua. I also have the treasure hunter mote from him. Whenever I'm in town or not engaged it will not equip my Jute Boots unless I manually switch the treasure hunter mode regardless of what TH mode it was on. Also by default the treasure hunter mode is on tag rather than none. Would anyone be able to help me figure out what's wrong here? Here's my lua:
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------

--[[
    Custom commands:
    gs c cycle treasuremode (set on ctrl-= by default): Cycles through the available treasure hunter modes.
    
    Treasure hunter modes:
        None - Will never equip TH gear
        Tag - Will equip TH gear sufficient for initial contact with a mob (either melee, ranged hit, or Aeolian Edge AOE)
        SATA - Will equip TH gear sufficient for initial contact with a mob, and when using SATA
        Fulltime - Will keep TH gear equipped fulltime
--]]

-- 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.Buff['Sneak Attack'] = buffactive['sneak attack'] or false
    state.Buff['Trick Attack'] = buffactive['trick attack'] or false
    state.Buff['Feint'] = buffactive['feint'] or false
    
    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}
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', 'Mod')
    state.HybridMode:options('Normal', 'Evasion', 'PDT')
    state.RangedMode:options('Normal', 'Acc')
    state.WeaponskillMode:options('Normal', 'Acc', 'Mod')
    state.PhysicalDefenseMode:options('Evasion', 'PDT')


    gear.default.weaponskill_neck = "Asperity Necklace"
    gear.default.weaponskill_waist = "Caudata Belt"
    gear.AugQuiahuiz = {name="Quiahuiz Trousers", augments={'Haste+2','"Snapshot"+2','STR+8'}}

    -- Additional local binds
    send_command('bind ^` input /ja "Flee" <me>')
    send_command('bind ^= gs c cycle treasuremode')
    send_command('bind !- gs c cycle targetmode')

    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()
    --------------------------------------
    -- Special sets (required by rules)
    --------------------------------------

    sets.TreasureHunter = {main="Sandung/",
    sub="Thief's Knife/", ammo="Aurgelmir Orb",
    body={ name="Herculean Vest", augments={'Attack+10','Pet: INT+3','"Treasure Hunter"+2',}}, 
	hands="Plun. Armlets +1",
    feet="Skulk. Poulaines",}
    sets.ExtraRegen = {}
    sets.Kiting = {}

    sets.buff['Sneak Attack'] = {hands="Plun. Armlets +1"}

    sets.buff['Trick Attack'] = {}

    -- Actions we want to use to tag TH.
    sets.precast.Step = sets.TreasureHunter
    sets.precast.Flourish1 = sets.TreasureHunter
    sets.precast.JA.Provoke = sets.TreasureHunter


    --------------------------------------
    -- Precast sets
    --------------------------------------

    -- Precast sets to enhance JAs
    sets.precast.JA['Collaborator'] = {}
    sets.precast.JA['Accomplice'] = {}
    sets.precast.JA['Flee'] = { head="Pillager's Bonnet +2",
    legs="Rogue's Culottes",
    feet="Rogue's Poulaines"}
    sets.precast.JA['Hide'] = {}
    sets.precast.JA['Conspirator'] = {} -- {body="Raider's Vest +2"}
    sets.precast.JA['Steal'] = {head="Pillager's Bonnet +2",
    legs="Rogue's Culottes",
    feet="Rogue's Poulaines"}
    sets.precast.JA['Despoil'] = {}
    sets.precast.JA['Perfect Dodge'] = {}
    sets.precast.JA['Feint'] = {} -- {legs="Assassin's Culottes +2"}

    sets.precast.JA['Sneak Attack'] = sets.buff['Sneak Attack']
    sets.precast.JA['Trick Attack'] = sets.buff['Trick Attack']


    -- Waltz set (chr and vit)
    sets.precast.Waltz = {}

    -- Don't need any special gear for Healing Waltz.
    sets.precast.Waltz['Healing Waltz'] = {}


    -- Fast cast sets for spells
    sets.precast.FC = {}

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


    -- Ranged snapshot gear
    sets.precast.RA = {ranged="Rogetsurin"}


    -- Weaponskill sets

    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS =  {
    ammo="Jukukik Feather",
    head={ name="Adhemar Bonnet", augments={'STR+10','DEX+10','Attack+15',}},
    body={ name="Herculean Vest", augments={'Pet: Phys. dmg. taken -1%','Pet: "Subtle Blow"+11','Weapon skill damage +10%','Mag. Acc.+17 "Mag.Atk.Bns."+17',}},
    hands="Meg. Gloves +2",
    legs={name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
    feet={ name="Herculean Boots", augments={'DEX+5','Potency of "Cure" effect received+1%','Weapon skill damage +10%','Mag. Acc.+14 "Mag.Atk.Bns."+14',}},
    neck="Asn. Gorget +1",
    waist="Artful Belt",
    left_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    right_ear="Odr Earring",
    left_ring="Karieyh Ring",
    right_ring="Ramuh Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%',}},}

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

    -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
    sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Exenterator'].Acc = set_combine(sets.precast.WS['Exenterator'], {})
    sets.precast.WS['Exenterator'].Mod = set_combine(sets.precast.WS['Exenterator'], {})
    sets.precast.WS['Exenterator'].SA = set_combine(sets.precast.WS['Exenterator'].Mod, {})
    sets.precast.WS['Exenterator'].TA = set_combine(sets.precast.WS['Exenterator'].Mod, {})
    sets.precast.WS['Exenterator'].SATA = set_combine(sets.precast.WS['Exenterator'].Mod, {})

    sets.precast.WS['Dancing Edge'] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Dancing Edge'].Acc = set_combine(sets.precast.WS['Dancing Edge'], {})
    sets.precast.WS['Dancing Edge'].Mod = set_combine(sets.precast.WS['Dancing Edge'], {})
    sets.precast.WS['Dancing Edge'].SA = set_combine(sets.precast.WS['Dancing Edge'].Mod, {})
    sets.precast.WS['Dancing Edge'].TA = set_combine(sets.precast.WS['Dancing Edge'].Mod, {})
    sets.precast.WS['Dancing Edge'].SATA = set_combine(sets.precast.WS['Dancing Edge'].Mod, {})

    sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS, {
	  ammo="Aurgelmir Orb",
    head={ name="Adhemar Bonnet", augments={'STR+10','DEX+10','Attack+15',}},
    body="Pillager's Vest +3",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +1",
    feet="Meg. Jam. +1",
    neck="Asn. Gorget +1",
    waist="Dynamic Belt",
    left_ear="Suppanomimi",
    right_ear="Allegro Earring",
    left_ring="Epona's Ring",
    right_ring="Solemn Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10',}}})
    sets.precast.WS['Evisceration'].Acc = set_combine(sets.precast.WS['Evisceration'], {})
    sets.precast.WS['Evisceration'].Mod = set_combine(sets.precast.WS['Evisceration'], {})
    sets.precast.WS['Evisceration'].SA = set_combine(sets.precast.WS['Evisceration'].Mod, {})
    sets.precast.WS['Evisceration'].TA = set_combine(sets.precast.WS['Evisceration'].Mod, {})
    sets.precast.WS['Evisceration'].SATA = set_combine(sets.precast.WS['Evisceration'].Mod, {})

    sets.precast.WS["Rudra's Storm"] = set_combine(sets.precast.WS, {
	ammo="Jukukik Feather",
    head={ name="Pillager's Bonnet +2",},
    body={ name="Herculean Vest", augments={'Pet: Phys. dmg. taken -1%','Pet: "Subtle Blow"+11','Weapon skill damage +10%','Mag. Acc.+17 "Mag.Atk.Bns."+17',}},
    hands="Meg. Gloves +2",
    legs="Mummu Kecks +2",
    feet={ name="Herculean Boots", augments={'DEX+5','Potency of "Cure" effect received+1%','Weapon skill damage +10%','Mag. Acc.+14 "Mag.Atk.Bns."+14',}},
    neck="Asn. Gorget +1",
    waist="Artful Belt",
    left_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    right_ear="Odr Earring",
    left_ring="Karieyh Ring",
    right_ring="Ramuh Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%',}},})
    sets.precast.WS["Rudra's Storm"].Acc = set_combine(sets.precast.WS["Rudra's Storm"], {})
    sets.precast.WS["Rudra's Storm"].Mod = set_combine(sets.precast.WS["Rudra's Storm"], {})
    sets.precast.WS["Rudra's Storm"].SA = set_combine(sets.precast.WS["Rudra's Storm"].Mod, {})
    sets.precast.WS["Rudra's Storm"].TA = set_combine(sets.precast.WS["Rudra's Storm"].Mod, {})
    sets.precast.WS["Rudra's Storm"].SATA = set_combine(sets.precast.WS["Rudra's Storm"].Mod, {})

    sets.precast.WS["Shark Bite"] = set_combine(sets.precast.WS, {})
    sets.precast.WS['Shark Bite'].Acc = set_combine(sets.precast.WS['Shark Bite'], {})
    sets.precast.WS['Shark Bite'].Mod = set_combine(sets.precast.WS['Shark Bite'], {})
    sets.precast.WS['Shark Bite'].SA = set_combine(sets.precast.WS['Shark Bite'].Mod, {})
    sets.precast.WS['Shark Bite'].TA = set_combine(sets.precast.WS['Shark Bite'].Mod, {})
    sets.precast.WS['Shark Bite'].SATA = set_combine(sets.precast.WS['Shark Bite'].Mod, {})

    sets.precast.WS['Mandalic Stab'] = set_combine(sets.precast.WS, {
	ammo="Jukukik Feather",
    head={ name="Pillager's Bonnet +2",},
    body={ name="Herculean Vest", augments={'Pet: Phys. dmg. taken -1%','Pet: "Subtle Blow"+11','Weapon skill damage +10%','Mag. Acc.+17 "Mag.Atk.Bns."+17',}},
    hands="Meg. Gloves +2",
    legs="Mummu Kecks +2",
    feet={ name="Herculean Boots", augments={'DEX+5','Potency of "Cure" effect received+1%','Weapon skill damage +10%','Mag. Acc.+14 "Mag.Atk.Bns."+14',}},
    neck="Asn. Gorget +1",
    waist="Artful Belt",
    left_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    right_ear="Odr Earring",
    left_ring="Karieyh Ring",
    right_ring="Ramuh Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%',}},})
    sets.precast.WS['Mandalic Stab'].Acc = set_combine(sets.precast.WS['Mandalic Stab'], {})
    sets.precast.WS['Mandalic Stab'].Mod = set_combine(sets.precast.WS['Mandalic Stab'], {})
    sets.precast.WS['Mandalic Stab'].SA = set_combine(sets.precast.WS['Mandalic Stab'].Mod, {})
    sets.precast.WS['Mandalic Stab'].TA = set_combine(sets.precast.WS['Mandalic Stab'].Mod, {})
    sets.precast.WS['Mandalic Stab'].SATA = set_combine(sets.precast.WS['Mandalic Stab'].Mod, {})

    sets.precast.WS['Aeolian Edge'] = {
  
    ammo="Jukukik Feather",
    head="Pill. Bonnet +2",
    body={ name="Herculean Vest", augments={'Pet: Phys. dmg. taken -1%','Pet: "Subtle Blow"+11','Weapon skill damage +10%','Mag. Acc.+17 "Mag.Atk.Bns."+17',}},
    hands={ name="Adhemar Wristbands", augments={'DEX+10','AGI+10','Accuracy+15',}},
    legs={ name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
    feet={ name="Herculean Boots", augments={'Accuracy+11 Attack+11','"Triple Atk."+3',}},
    neck="Sanctity Necklace",
    waist="Artful Belt",
    left_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    right_ear="Dedition Earring",
    left_ring="Epona's Ring",
    right_ring="Karieyh Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%',}}}

    sets.precast.WS['Aeolian Edge'].TH = set_combine(sets.precast.WS['Aeolian Edge'], sets.TreasureHunter)


    --------------------------------------
    -- Midcast sets
    --------------------------------------

    sets.midcast.FastRecast = {}

    -- Specific spells
    sets.midcast.Utsusemi = {}

    -- Ranged gear
    sets.midcast.RA = {ranged="Rogetsurin"}

    sets.midcast.RA.Acc = {}


    --------------------------------------
    -- Idle/resting/defense sets
    --------------------------------------

    -- Resting sets
    sets.resting = {}


    -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)

    sets.idle = {feet="Jute Boots +1",}

    sets.idle.Town = {feet="Jute Boots +1",}

    sets.idle.Weak = {}


    -- Defense sets

    sets.defense.Evasion = {}

    sets.defense.PDT = {}

    sets.defense.MDT = {}


    --------------------------------------
    -- Melee sets
    --------------------------------------

    -- Normal melee group
    sets.engaged = {main="", sub="", range=empty, ammo="Aurgelmir Orb",
    head={ name="Adhemar Bonnet", augments={'STR+10','DEX+10','Attack+15',}},
    body="Pillager's Vest +3",
    hands={ name="Adhemar Wristbands", augments={'DEX+10','AGI+10','Accuracy+15',}},
    legs= {name="Samnuha Tights", augments={'STR+10','DEX+10','"Dbl.Atk."+3','"Triple Atk."+3',}},
    feet={ name="Herculean Boots", augments={'Accuracy+11 Attack+11','"Triple Atk."+3',}},
    neck="Assassin's gorget +1",
	waist="Windbuffet Belt +1",
    left_ear="Cessance Earring",
    right_ear="Dedition Earring",
    left_ring="Epona's Ring",
    right_ring="Petrov Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10',}},}
	
	    sets.engaged.Acc = {}
        
    -- Mod set for trivial mobs (Skadi+1)
    sets.engaged.Mod = {}

    -- Mod set for trivial mobs (Thaumas)
    sets.engaged.Mod2 = {}

    sets.engaged.Evasion = {}
    sets.engaged.Acc.Evasion = {} 

    sets.engaged.PDT = {}
    sets.engaged.Acc.PDT = {}

end


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

-- Run after the general precast() is done.
function job_post_precast(spell, action, spellMap, eventArgs)
    if spell.english == 'Aeolian Edge' and state.TreasureMode.value ~= 'None' then
        equip(sets.TreasureHunter)
    elseif spell.english=='Sneak Attack' or spell.english=='Trick Attack' or spell.type == 'WeaponSkill' then
        if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
            equip(sets.TreasureHunter)
        end
    end
end

-- Run after the general midcast() set is constructed.
function job_post_midcast(spell, action, spellMap, eventArgs)
    if state.TreasureMode.value ~= 'None' and spell.action_type == 'Ranged Attack' then
        equip(sets.midcast.RA)
    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)
    -- Weaponskills wipe SATA/Feint.  Turn those state vars off before default gearing is attempted.
    if spell.type == 'WeaponSkill' and not spell.interrupted then
        state.Buff['Sneak Attack'] = false
        state.Buff['Trick Attack'] = false
        state.Buff['Feint'] = false
    end
end

-- Called after the default aftercast handling is complete.
function job_post_aftercast(spell, action, spellMap, eventArgs)
    -- If Feint is active, put that gear set on on top of regular gear.
    -- This includes overlaying SATA gear.
    check_buff('Feint', eventArgs)
end

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

-- Called when a player gains or loses a buff.
-- buff == buff gained or lost
-- gain == true if the buff was gained, false if it was lost.
function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
        if not midaction() then
            handle_equipping_gear(player.status)
        end
    end
end


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

function get_custom_wsmode(spell, spellMap, defaut_wsmode)
    local wsmode

    if state.Buff['Sneak Attack'] then
        wsmode = 'SA'
    end
    if state.Buff['Trick Attack'] then
        wsmode = (wsmode or '') .. 'TA'
    end

    return wsmode
end


-- Called any time we attempt to handle automatic gear equips (ie: engaged or idle gear).
function job_handle_equipping_gear(playerStatus, eventArgs)
    -- Check that ranged slot is locked, if necessary
    check_range_lock()

    -- Check for SATA when equipping gear.  If either is active, equip
    -- that gear specifically, and block equipping default gear.
    check_buff('Sneak Attack', eventArgs)
    check_buff('Trick Attack', eventArgs)
end


function customize_idle_set(idleSet)
    if player.hpp < 80 then
        idleSet = set_combine(idleSet, sets.ExtraRegen)
    end

    return idleSet
end


function customize_melee_set(meleeSet)
    if state.TreasureMode.value == 'Fulltime' then
        meleeSet = set_combine(meleeSet, sets.TreasureHunter)
    end

    return meleeSet
end


-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
    th_update(cmdParams, eventArgs)
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 msg = 'Melee'
    
    if state.CombatForm.has_value then
        msg = msg .. ' (' .. state.CombatForm.value .. ')'
    end
    
    msg = msg .. ': '
    
    msg = msg .. state.OffenseMode.value
    if state.HybridMode.value ~= 'Normal' then
        msg = msg .. '/' .. state.HybridMode.value
    end
    msg = msg .. ', WS: ' .. state.WeaponskillMode.value
    
    if state.DefenseMode.value ~= 'None' then
        msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
    end
    
    if state.Kiting.value == true then
        msg = msg .. ', Kiting'
    end

    if state.PCTargetMode.value ~= 'default' then
        msg = msg .. ', Target PC: '..state.PCTargetMode.value
    end

    if state.SelectNPCTargets.value == true then
        msg = msg .. ', Target NPCs'
    end
    
    msg = msg .. ', TH: ' .. state.TreasureMode.value

    add_to_chat(122, msg)

    eventArgs.handled = true
end

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

-- State buff checks that will equip buff gear and mark the event as handled.
function check_buff(buff_name, eventArgs)
    if state.Buff[buff_name] then
        equip(sets.buff[buff_name] or {})
        if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
            equip(sets.TreasureHunter)
        end
        eventArgs.handled = true
    end
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 to lock the ranged slot if we have a ranged weapon equipped.
function check_range_lock()
    if player.equipment.range ~= 'empty' then
        disable('range', 'ammo')
    else
        enable('range', 'ammo')
    end
end


-- Select default macro book on initial load or subjob change.
function select_default_macro_book()
    -- Default macro set/book
    if player.sub_job == 'DNC' then
        set_macro_page(1, 6)
    elseif player.sub_job == 'WAR' then
        set_macro_page(1, 6)
    elseif player.sub_job == 'NIN' then
        set_macro_page(5, 6)
    else
        set_macro_page(1, 6)
    end
end


First Page 2 3 ... 168 169 170 ... 183 184 185