Gearswap Support Thread

Eorzea Time
 
 
 
Language: JP EN FR DE
Version 3.1
New Items
users online
Forum » Windower » Support » Gearswap Support Thread
Gearswap Support Thread
First Page 2 3 ... 186 187 188
Offline
Posts: 55
By Shukudai 2025-05-22 14:27:34
Link | Quote | Reply
 
Asura.Yottaxa said: »
Shukudai said: »
The lua I'm using for BRD has a section for Instrument for each song type. Is it possible to make a toggle that takes that into account and allows me to toggle between Gjallarhorn for each song type and Miracle Cheer? i.e: If it's a short fight, I hit the toggle, and get Ghorn buffs, if it's longer (like Ody C), I hit the toggle and get Miracle instead of Ghorn?

Anything is possible, but without seeing your lua and its specifics, hard to advise: if you post it here maybe we can help. Do you know who's lua you are using? Basically you will want to find the logic, add a keybind, and implement an override of the default logic.

I'm using the Arislan BRD one (Original: Motenten / Modified: Arislan). I think I can just share via PasteBin? https://pastebin.com/JJTDEtbz

I figured it would be adding a keybind (I just look at how the others are implemented, copy that but change what I need) but I'm not sure if that would do it.
 Asura.Yottaxa
Offline
Server: Asura
Game: FFXI
user: Yottaxa
Posts: 201
By Asura.Yottaxa 2025-05-22 17:14:19
Link | Quote | Reply
 
Shukudai said: »
Asura.Yottaxa said: »
Shukudai said: »
The lua I'm using for BRD has a section for Instrument for each song type. Is it possible to make a toggle that takes that into account and allows me to toggle between Gjallarhorn for each song type and Miracle Cheer? i.e: If it's a short fight, I hit the toggle, and get Ghorn buffs, if it's longer (like Ody C), I hit the toggle and get Miracle instead of Ghorn?

Anything is possible, but without seeing your lua and its specifics, hard to advise: if you post it here maybe we can help. Do you know who's lua you are using? Basically you will want to find the logic, add a keybind, and implement an override of the default logic.

I'm using the Arislan BRD one (Original: Motenten / Modified: Arislan). I think I can just share via PasteBin? https://pastebin.com/JJTDEtbz

I figured it would be adding a keybind (I just look at how the others are implemented, copy that but change what I need) but I'm not sure if that would do it.

I am not super familiar with Motes based gs, but it looks like you already have potential functionality:
Line 133: (send_command('bind ^` gs c cycle SongMode'))

I took the liberty of playing around here with this for 15mins for fun - let me know if it works: (Free to try) You can ping me on discord too same name, perhaps we can get it working.

https://pastebin.com/ki0xRhnA

Use ^` to toggle into miracle cheer mode (Same key as dummy songs). You need to update sets.midcast.SongMiracleCheer line 414 with any relevant gear. (I dont play bard cant really test any of this)

FYI details of what I think needed to be done:

I added miracle cheer to line 73:
state.SongMode = M{['description']='Song Mode', 'None', 'Placeholder', 'MiracleCheer'}

Then adding to near line 1008:

elseif state.SongMode.value == 'MiracleCheer' then
return 'SongMiracleCheer'

And then setting up the invoked set around line 413: (edit as needed)

sets.midcast.SongMiracleCheer = set_combine(sets.midcast.SongEnhancing, {range=info.MiracleCheer})

As well as putting at line 124:
info.MiracleCheer = 'Miracle Cheer'

Not sure if the precast set was needed, as I don't see logic but added that too.
[+]
Offline
Posts: 55
By Shukudai 2025-05-22 18:05:30
Link | Quote | Reply
 
Asura.Yottaxa said: »
I added miracle cheer to line 73:

Thank you for the effort! The toggle says it's toggling, but it's not actually using the Miracle Cheer when it does. I tested it out with five different songs, didn't use it.

I understand what you did with the line 73 change, the line 124 one, the line 413 one. It looks to me like you set it up to A) Have a new Toggle for Miracle Cheer, made a set for Miracle Cheer for midcast and made it refer to it as "info.MiracleCheer". I tried changing it to 'Miracle Cheer' for the range slot but that also didn't work XD
 Asura.Yottaxa
Offline
Server: Asura
Game: FFXI
user: Yottaxa
Posts: 201
By Asura.Yottaxa 2025-05-22 18:32:49
Link | Quote | Reply
 
Shukudai said: »
Asura.Yottaxa said: »
I added miracle cheer to line 73:

Thank you for the effort! The toggle says it's toggling, but it's not actually using the Miracle Cheer when it does. I tested it out with five different songs, didn't use it.

I understand what you did with the line 73 change, the line 124 one, the line 413 one. It looks to me like you set it up to A) Have a new Toggle for Miracle Cheer, made a set for Miracle Cheer for midcast and made it refer to it as "info.MiracleCheer". I tried changing it to 'Miracle Cheer' for the range slot but that also didn't work XD

Hmm. Does the Daurdable mode work? Just not this? I am thinking about what else could be going on. My limitation here is experience with Motes and no way to test this myself.
Offline
Posts: 55
By Shukudai 2025-05-22 18:39:59
Link | Quote | Reply
 
Asura.Yottaxa said: »
Hmm. Does the Daurdable mode work? Just not this? I am thinking about what else could be going on. My limitation here is experience with Motes and no way to test this myself.

It sort of works?

I had already defined Paeons to use Daurdabla. But when I switch to PH mode (Daurdabla mode) and sang Goblin Gavotte, Daurdabla was used. But if I tried Minuet (with PH mode on) it went to my Minuet instrument and not Daurdabla.

I'd also be willing to swap LUAs as well if there's a cool BRD one :D
 Asura.Yottaxa
Offline
Server: Asura
Game: FFXI
user: Yottaxa
Posts: 201
By Asura.Yottaxa 2025-05-22 18:43:29
Link | Quote | Reply
 
Shukudai said: »
Asura.Yottaxa said: »
Hmm. Does the Daurdable mode work? Just not this? I am thinking about what else could be going on. My limitation here is experience with Motes and no way to test this myself.

It sort of works?

I had already defined Paeons to use Daurdabla. But when I switch to PH mode (Daurdabla mode) and sang Goblin Gavotte, Daurdabla was used. But if I tried Minuet (with PH mode on) it went to my Minuet instrument and not Daurdabla.

I'd also be willing to swap LUAs as well if there's a cool BRD one :D

Sadly there might be some other overrides present I just cant see. If something pops out at me I can let you know.
Offline
Posts: 55
By Shukudai 2025-05-22 18:56:31
Link | Quote | Reply
 
Asura.Yottaxa said: »
Shukudai said: »
Asura.Yottaxa said: »
Hmm. Does the Daurdable mode work? Just not this? I am thinking about what else could be going on. My limitation here is experience with Motes and no way to test this myself.

It sort of works?

I had already defined Paeons to use Daurdabla. But when I switch to PH mode (Daurdabla mode) and sang Goblin Gavotte, Daurdabla was used. But if I tried Minuet (with PH mode on) it went to my Minuet instrument and not Daurdabla.

I'd also be willing to swap LUAs as well if there's a cool BRD one :D

Sadly there might be some other overrides present I just cant see. If something pops out at me I can let you know.

It's appreciated, thank you :)
Offline
Posts: 53
By quelthos 2025-06-05 15:41:25
Link | Quote | Reply
 
Just returned recently.
I know the answer was no, but checking to see if anyone has a work around now.

Issue: Not able to swap the same weapon from off hand to main hand and vice versa

Example: crocea main, daybreak sub, meleeing using seraph blade. I want to cast a potency enfeeble with daybreak main ammurapi sub, GS will not swap.

Thank you
Offline
By Shichishito 2025-06-05 15:53:06
Link | Quote | Reply
 
It doesn't work cause in this instance the daybreak is already in the sub slot and when it's equipped it's not accessible from the equipment menue.
A workaround is to equip different weapons or unequip both slots in a in-between step. For instance swap to two FC weapons in precast and then to the desired daybreak/ammurapi combo during midcast.

If it still doesn't work you probably have some rule in your GS that locks main/sub slots.
Offline
Posts: 53
By quelthos 2025-06-05 16:01:39
Link | Quote | Reply
 
Shichishito said: »
It doesn't work cause in this instance the daybreak is already in the sub slot and when it's equipped it's not accessible from the equipment menue.
A workaround is to equip different weapons or unequip both slots in a in-between step. For instance swap to two FC weapons in precast and then to the desired daybreak/ammurapi combo during midcast.

If it still doesn't work you probably have some rule in your GS that locks main/sub slots.

or just state empty for both main and sub in FC set, still frustrating as I don't want to reset my TP for every single spell.
Guess I'll just have to deal with it.
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-05 16:28:05
Link | Quote | Reply
 
quelthos said: »
Just returned recently.
I know the answer was no, but checking to see if anyone has a work around now.

Issue: Not able to swap the same weapon from off hand to main hand and vice versa

Example: crocea main, daybreak sub, meleeing using seraph blade. I want to cast a potency enfeeble with daybreak main ammurapi sub, GS will not swap.

Thank you


I believe prioritites would handle this. Higher priorities swap first.

So all you'd really need is to swap the sub first to the shield, then main to Daybreak since it'd no longer be equipped in the Sub slot.
Code
main={ name="Daybreak", priority=1},
sub={ name="Ammurapi Shield", priotity=2}


And then reverse it when you switch back.
Code
main={ name="Crocea Mors", priority=2},
sub={ name="Daybreak", priority=1}


**Edit**
quelthos said: »
"..." still frustrating as I don't want to reset my TP for every single spell.

Also, swapping any main/sub resets your TP, so you're losing TP no matter what.
[+]
Offline
By Shichishito 2025-06-05 17:18:13
Link | Quote | Reply
 
quelthos said: »
still frustrating as I don't want to reset my TP for every single spell.
Guess I'll just have to deal with it.
What are you trying to achieve? Is this spell always ment to be cast in potency gear and therefore the weapon swap/tp lose is always necessary or do you want to decide depending on situation whether the weapon swap is necessary or not?

If you're working with the kinematics/mote lua templates and you want to always cast in potency gear but only for that particular spell you could explicitly state:
Code
function job_post_precast(spell, spellMap, eventArgs)
if spell.name == 'Spell name in question' then
equip(sets.precast.Spellnameinquestion)
end end

Code
function job_post_midcast(spell, action, spellMap, eventArgs)
if spell.name == 'Spell name in question' then
equip(sets.midcast.Spellnameinquestion)
end
end


remember to define the correct sets in pre and midcast. I don't know if it works with other templates too.


If you want to make the decission on the fly whether to do the weaponswap or not I guess you could make 2 different macros and work with weaponlocks.
Offline
Posts: 53
By quelthos 2025-06-05 20:33:54
Link | Quote | Reply
 
Bahamut.Boposhopo said: »
quelthos said: »
Just returned recently.
I know the answer was no, but checking to see if anyone has a work around now.

Issue: Not able to swap the same weapon from off hand to main hand and vice versa

Example: crocea main, daybreak sub, meleeing using seraph blade. I want to cast a potency enfeeble with daybreak main ammurapi sub, GS will not swap.

Thank you


I believe prioritites would handle this. Higher priorities swap first.

So all you'd really need is to swap the sub first to the shield, then main to Daybreak since it'd no longer be equipped in the Sub slot.
Code
main={ name="Daybreak", priority=1},
sub={ name="Ammurapi Shield", priotity=2}


And then reverse it when you switch back.
Code
main={ name="Crocea Mors", priority=2},
sub={ name="Daybreak", priority=1}


**Edit**
quelthos said: »
"..." still frustrating as I don't want to reset my TP for every single spell.

Also, swapping any main/sub resets your TP, so you're losing TP no matter what.

This working perfectly, thank you so much!
Exactly code for anyone in the future searching
Code
    
sets.mws = {
		main={name="Crocea Mors", priority=2}, 
		sub={name="Daybreak", priority=1}
		}
sets.macc = {
		main={name="Daybreak", priority=1}, 
		sub={name="Ammurapi Shield", priority=2}
		}
[+]
Offline
Posts: 53
By quelthos 2025-06-06 01:35:54
Link | Quote | Reply
 
Another question if anyone can help
Currently the codes for equipping sets.kiting
Code
function customize_idle_set(idleSet)
    if state.Auto_Kite.value == true then
       idleSet = set_combine(idleSet, sets.Kiting)		
    end
    return idleSet
end


It does its job when kiting is toggled on, however the set.kiting persists when I am engaged, how would I make it auto unequip set.kiting upon engaged?

I tried adding a player.status ~= engaged line to the if, but does not seem to work.

Thanks
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 10:27:58
Link | Quote | Reply
 
Would need to see more than that section of code. Would need to see all rules and functions that handle kiting in the lua. Ideally just providing the entire lua would be easiet, can upload it free to pastebin or something.
Offline
Posts: 53
By quelthos 2025-06-06 10:52:20
Link | Quote | Reply
 
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()
    -- QuickDraw Selector
    state.Mainqd = M{['description']='Primary Shot', 'Fire Shot', 'Ice Shot', 'Wind Shot', 'Earth Shot', 'Thunder Shot', 'Water Shot'}
    state.Altqd = M{['description']='Secondary Shot', 'Fire Shot', 'Ice Shot', 'Wind Shot', 'Earth Shot', 'Thunder Shot', 'Water Shot'}
    state.UseAltqd = M(false, 'Use Secondary Shot')
    state.SelectqdTarget = M(false, 'Select Quick Draw Target')
    state.IgnoreTargetting = M(false, 'Ignore Targetting')

    state.QDMode = M{['description']='Quick Draw Mode', 'STP', 'Enhance', 'Potency', 'TH'}

    state.Currentqd = M{['description']='Current Quick Draw', 'Main', 'Alt'}

    -- Whether to use Luzaf's Ring
    state.LuzafRing = M(false, "Luzaf's Ring")
    -- Whether a warning has been given for low ammo
    state.warned = M(false)

    no_swap_gear = S{"Warp Ring", "Dim. Ring (Dem)", "Dim. Ring (Holla)", "Dim. Ring (Mea)",
              "Trizek Ring", "Echad Ring", "Facility Ring", "Capacity Ring",
              "Dev. Bul. Pouch", "Chr. Bul. Pouch", "Liv. Bul. Pouch"}
    elemental_ws = S{"Aeolian Edge", "Leaden Salute", "Wildfire", "Hot Shot"}
    no_shoot_ammo = S{"Animikii Bullet", "Hauksbok Bullet"}

    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}

    define_roll_values()

    lockstyleset = 1
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')
    state.HybridMode:options('Normal')
    state.RangedMode:options('Normal', 'RACC')
    state.WeaponskillMode:options('Normal', 'Acc', 'RACC')
    state.IdleMode:options('Normal')

    state.WeaponSet = M{['description']='Weapon Set', 'DP', 'HS', 'LS', 'AE', 'SB'}
    -- state.CP = M(false, "Capacity Points Mode")
    state.WeaponLock = M(false, 'Weapon Lock')	

    gear.RAbullet = "Chrono Bullet"
    gear.RAccbullet = "Chrono Bullet"
    gear.WSbullet = "Chrono Bullet"
    gear.MAbullet = "Living Bullet"
    gear.QDbullet = "Hauksbok Bullet"
    options.ammo_warning_limit = 10

    -- 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 @t gs c cycle treasuremode')
    --send_command('bind ^` input /ja "Double-up" <me>')
    --send_command('bind ^c input /ja "Crooked Cards" <me>')
    --send_command('bind ^s input /ja "Snake Eye" <me>')
    --send_command('bind ^f input /ja "Fold" <me>')
    --send_command('bind !` input /ja "Bolter\'s Roll" <me>')
    send_command ('bind @` gs c toggle LuzafRing')

    --send_command('bind ^insert gs c cycleback mainqd')
    --send_command('bind ^delete gs c cycle mainqd')
    --send_command('bind ^home gs c cycle altqd')
    --send_command('bind ^end gs c cycleback altqd')
    --send_command('bind ^pageup gs c toggle selectqdtarget')
    --send_command('bind ^pagedown gs c toggle usealtqd')

    -- send_command('bind @c gs c toggle CP')
    --send_command('bind @q gs c cycle QDMode')
    send_command('bind ` tc nearest')
    send_command('bind @e gs c cycleback WeaponSet')
    send_command('bind @r gs c cycle WeaponSet')
    send_command('bind @w gs c toggle WeaponLock')

    --send_command('bind ^numlock input /ja "Triple Shot" <me>')

    --if player.sub_job == 'WAR' then
    --    send_command('bind ^numpad/ input /ja "Berserk" <me>')
    --    send_command('bind ^numpad* input /ja "Warcry" <me>')
    --    send_command('bind ^numpad- input /ja "Aggressor" <me>')
    --end

    --send_command('bind ^numpad7 input /ws "Savage Blade" <t>')
    --send_command('bind ^numpad8 input /ws "Last Stand" <t>')
    --send_command('bind ^numpad4 input /ws "Leaden Salute" <t>')
    --send_command('bind ^numpad5 input /ws "Requiescat" <t>')
    --send_command('bind ^numpad6 input /ws "Wildfire" <t>')
    --send_command('bind ^numpad1 input /ws "Aeolian Edge" <t>')
    --send_command('bind ^numpad2 input /ws "Evisceration" <t>')

    --send_command('bind %numpad0 input /ra <t>')


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


-- Called when this job file is unloaded (eg: job change)
function user_unload()
    send_command('unbind ^`')
    send_command('unbind ^c')
    send_command('unbind ^s')
    send_command('unbind ^f')
    send_command('unbind !`')
    send_command('unbind @t')
    send_command('unbind @`')
    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 ^,')
    send_command('unbind @c')
    send_command('unbind `')
    send_command('unbind @w')
    send_command('unbind @e')
    send_command('unbind @r')
    send_command('unbind ^numlock')
    send_command('unbind ^numpad/')
    send_command('unbind ^numpad*')
    send_command('unbind ^numpad-')
    send_command('unbind ^numpad8')
    send_command('unbind ^numpad4')
    send_command('unbind ^numpad5')
    send_command('unbind ^numpad6')
    send_command('unbind ^numpad1')
    send_command('unbind ^numpad2')
    send_command('unbind numpad0')

    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 ------------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.precast.JA['Snake Eye'] = {legs="Lanun Trews"}
    sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +3"}
    sets.precast.JA['Random Deal'] = {body="Lanun Frac +3"}

    sets.precast.CorsairRoll = {
    main={ name="Rostam", augments={'Path: C',}, priority=1},
    range="Compensator",
    head="Lanun Tricorne",
    body="Nyame Mail",
    hands="Chasseur's Gants +3",
    legs="Desultor Tassets",
    feet="Nyame Sollerets",
    neck="Regal Necklace",
    waist="Flume Belt",
    left_ear="Etiolation Earring",
    right_ear="Eabani Earring",
    left_ring="Defending Ring",
    right_ring="Luzaf's Ring",
    back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
        }

    sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chasseur's Culottes +3"})
    sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chasseur's Bottes +3"})
    sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chasseur's Tricorne +3"})
    sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac +3"})
    sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants +3"})

    sets.precast.LuzafRing = {ring2="Luzaf's Ring"}
    sets.precast.FoldDoubleBust = {hands="Lanun Gants +3"}

    sets.precast.Waltz = {
        body="Passion Jacket",
        ring1="Asklepian Ring",
        waist="Gishdubar Sash",
        }

    sets.precast.Waltz['Healing Waltz'] = {}

    sets.precast.FC = {
    head="Carmine Mask +1",
    body="Taeon Tabard",
    hands="Leyline Gloves",
    legs={ name="Herculean Trousers", augments={'"Mag.Atk.Bns."+20','"Fast Cast"+6','STR+9','Mag. Acc.+1',}},
    feet="Carmine Greaves +1",
    neck="Baetyl Pendant",
    waist="Plat. Mog. Belt",
    left_ear="Etiolation Earring",
    right_ear="Loquac. Earring",
    right_ring="Kishar Ring",
    left_ring="Weather. Ring",
    back={ name="Camulus's Mantle", augments={'"Fast Cast"+10',}},
        }

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

    -- (10% Snapshot from JP Gifts)
    sets.precast.RA = {
        ammo=gear.RAbullet,
        head="Chasseur's Tricorne +3", --0/14
        body="Laksa. Frac +3", --0/20
        --body="Oshosi Vest +1", --14/0
        hands="Lanun Gants +3",
		legs="Adhemar Kecks +1",
        feet="Meg. Jam. +2", --10/0
        neck="Comm. Charm +2", --4/0
		ring1="Crepuscular Ring",
		back={ name="Camulus's Mantle", augments={'"Snapshot"+10',}},
        waist="Yemaya Belt", --0/5
        } --61/32

    sets.precast.RA.Flurry1 = set_combine(sets.precast.RA, {
        }) --47/52

    sets.precast.RA.Flurry2 = set_combine(sets.precast.RA.Flurry1, {
        }) --32/73

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

    sets.precast.WS = {
	head="Nyame Helm",
    body="Nyame Mail",
    hands="Nyame Gauntlets",
	legs="Nyame Flanchard",		
    feet="Nyame Sollerets",
	neck="Comm. Charm +2",
    waist="Sailfi Belt +1",
    left_ear="Ishvara Earring",
    right_ear="Moonshade Earring",
    left_ring="Cornelia's Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},
        }
	sets.precast.WS.Acc = set_combine(sets.precast.WS, {
		neck="Fotia Gorget",
		waist="Fotia Belt",
	})
	sets.precast.WS.RACC = set_combine(sets.precast.WS, {
		neck="Fotia Gorget",
		waist="Fotia Belt",
		})
    sets.precast.WS['Last Stand'] = set_combine(sets.precast.WS, {
		ammo=gear.WSbullet,
		hands="Chasseur's Gants +3",
		neck="Fotia Gorget",
		waist="Fotia Belt",
		back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
		})
    sets.precast.WS['Last Stand'].RACC = set_combine(sets.precast.WS['Last Stand'], {
		})
		
    sets.precast.WS['Detonator'] = set_combine(sets.precast.WS['Last Stand'], {})
	
    sets.precast.WS['Wildfire'] = {
    ammo=gear.MAbullet,
    head="Nyame Helm",
    body="Lanun Frac +3",
    hands="Nyame Gauntlets",
	legs="Nyame Flanchard",
    feet="Lanun Bottes +3", 
	waist="Orpheus's Sash",
	neck="Comm. Charm +2",
    left_ear="Friomisi Earring",
    right_ear="Crematio Earring",
    left_ring="Cornelia's Ring",
    right_ring="Dingir Ring",
    back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},
        }
    sets.precast.WS['Aeolian Edge'] = set_combine(sets.precast.WS['Wildfire'], {
	right_ear="Moonshade Earring",
        })
    sets.precast.WS['Hot Shot'] = set_combine(sets.precast.WS['Wildfire'], {
	--ammo=gear.WSbullet,
	body="Nyame Mail",
	--neck="Fotia Gorget",
	--waist="Fotia Belt",
	right_ear="Moonshade Earring",
	})
    sets.precast.WS['Leaden Salute'] = set_combine(sets.precast.WS['Wildfire'], {
	head="Pixie Hairpin +1",
    right_ear="Moonshade Earring",
    right_ring="Archon Ring",
    })

    sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS, {
    neck="Fotia Gorget",
    waist="Fotia Belt",
        })
    sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS, {
		neck="Rep. Plat. Medal",	
		hands="Chasseur's Gants +3",
        })
    sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'], {
    neck="Fotia Gorget",
    waist="Fotia Belt",
        })
    sets.precast.WS['Swift Blade'] = set_combine(sets.precast.WS, {
        })
    sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS, {
        }) --MND
    sets.precast.WS['Requiescat'].Acc = set_combine(sets.precast.WS.Acc, {
        }) --MND
    sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {
        }) 
    sets.precast.WS['Exenterator'].Acc = set_combine(sets.precast.WS.Acc, {
        })

    sets.precast.CorsairShot = { 
	ammo=gear.QDbullet,
    head="Nyame Helm",
    body="Lanun Frac +3",
    hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
	legs="Nyame Flanchard",
    feet="Chasseur's Bottes +3",
	waist="Orpheus's Sash",
	neck="Comm. Charm +2",
    left_ear="Friomisi Earring",
    right_ear="Crematio Earring",
    left_ring="Weather. Ring",
    right_ring="Dingir Ring",
    back="Izdubar Mantle",
	}

    sets.precast.CorsairShot['Light Shot'] = set_combine(sets.precast.CorsairShot, {
	ammo=gear.QDbullet,
    left_ring="Weather. Ring",
        })

    sets.precast.CorsairShot['Dark Shot'] = set_combine(sets.precast.CorsairShot, {
	ammo=gear.QDbullet,
	head="Pixie Hairpin +1",
    left_ring="Archon Ring",
	})
    sets.precast.CorsairShot.Enhance = sets.precast.CorsairShot


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

    sets.midcast.FastRecast = sets.precast.FC

    sets.midcast.SpellInterrupt = {
        body=gear.Taeon_Phalanx_body, --10
        hands="Rawhide Gloves", --15
        legs="Carmine Cuisses +1", --20
        feet=gear.Taeon_Phalanx_feet, --10
        neck="Loricate Torque +1", --5
        ear1="Halasz Earring", --5
        ear2="Magnetic Earring", --8
        ring2="Evanescence Ring", --5
        waist="Rumination Sash", --10
        }

    sets.midcast.Utsusemi = sets.midcast.SpellInterrupt

    sets.midcast.Cure = {
        neck="Incanter's Torque",
        ear1="Roundel Earring",
        ear2="Mendi. Earring",
        ring1="Lebeche Ring",
        ring2="Haoma's Ring",
        waist="Bishop's Sash",
        }

    sets.midcast.Utsusemi = sets.midcast.SpellInterrupt

    -- Ranged gear
    sets.midcast.RA = {
        ammo=gear.RAbullet,
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Chas. Culottes +3",
    feet="Malignance Boots",
    neck="Iskur Gorget",
    waist="Yemaya Belt",
    left_ear="Telos Earring",
    right_ear="Crep. Earring",
    left_ring="Crepuscular Ring",
    right_ring="Ilabrat Ring",
    back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10',}},
        }

	sets.midcast.RA.RACC = set_combine(sets.midcast.RA, {
    --waist="K. Kachina Belt +1",
	--neck="Null Loop",
	waist="Null Belt",
	back="Null Shawl",
	})


    sets.midcast.RA.Acc = set_combine(sets.midcast.RA, {
        })

    sets.midcast.RA.HighAcc = set_combine(sets.midcast.RA.Acc, {

        })

    sets.midcast.RA.Critical = set_combine(sets.midcast.RA, {
        })

    sets.midcast.RA.STP = set_combine(sets.midcast.RA, {
        })

    sets.TripleShot = set_combine(sets.midcast.RA, {
        --head="Oshosi Mask +1", --5
        body="Chasseur's Frac +3", --13
        hands="Lanun Gants +3",
        --legs="Osh. Trousers +1", --6
        --feet="Osh. Leggings +1", --3
        }) --27
		

    sets.TripleShotCritical = set_combine(sets.midcast.RA, {
        })

    sets.TrueShot = set_combine(sets.midcast.RA, {
        })

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

    sets.resting = {}

    sets.idle = {
    ammo=gear.RAbullet,
        head="Malignance Chapeau", --6/6
        body="Malignance Tabard", --9/9
        hands="Malignance Gloves", --5/5
		legs="Chasseur's Culottes +3",
        feet="Malignance Boots", --4/4
    neck="Elite Royal Collar",
    waist="Flume Belt",
    left_ear="Etiolation Earring",
    right_ear="Eabani Earring",
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
        }

    sets.idle.DT = set_combine(sets.idle, {
        })

    sets.idle.Refresh = set_combine(sets.idle, {
        })

    sets.idle.Town = set_combine(sets.idle, {
        })


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

    sets.defense.PDT = sets.idle.DT

    sets.defense.MDT = {
        }

    sets.Kiting = {legs="Carmine Cuisses +1"}


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

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

    sets.engaged = {
	ammo=gear.RAbullet,
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Iskur Gorget",
    waist="Sailfi Belt +1",
    left_ear="Telos Earring",
    right_ear="Crep. Earring",
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
        }
		
	sets.engaged.Acc = set_combine(sets.engaged, {	
	neck="Null Loop",
	waist="Null Belt",
	back="Null Shawl",
	})
    -- * DNC Subjob DW Trait: +15%
    -- * NIN Subjob DW Trait: +25%

    -- No Magic Haste (74% DW to cap)
    sets.engaged.DW = set_combine(sets.engaged, {
    waist="Reiki Yotai",
    right_ear="Eabani Earring",
      })
	  
	sets.engaged.DW.Acc = set_combine(sets.engaged.DW, {	
	neck="Null Loop",
	--waist="Null Belt",
	back="Null Shawl",
	})
	   
    sets.empylegs =  {
    legs="Chasseur's Culottes +3",
      } 
    ------------------------------------------------------------------------------------------------
    ---------------------------------------- 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.TreasureHunter = {head="Volte Cap", hands=gear.Herc_TH_hands, feet="Volte Boots", waist="Chaac Belt"}
	
	sets.fulltp = { right_ear="Crematio Earring" }
	
	sets.RP = {    
	main={ name="Rostam", augments={'Path: A',}},
    sub={ name="Rostam", augments={'Path: C',}},
	ranged="Death Penalty"
	}
    sets.DP = {main={ name="Rostam", augments={'Path: A',}}, sub="Tauret", ranged="Death Penalty"}
    sets.SB = {main="Naegling", sub="Gleti's Knife", ranged="Anarchy +2"}
    sets.HS = {main="Naegling", sub="Tauret", ranged="Fomalhaut"}
    sets.LS = {main={ name="Rostam", augments={'Path: A',}}, sub="Kustawi +1", ranged="Fomalhaut"}
	sets.AE = {main="Tauret", sub="Gleti's Knife", ranged="Anarchy +2"}
	
    sets.DefaultShield = {sub="Nusku Shield"}

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)
    if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
        do_bullet_checks(spell, spellMap, eventArgs)
    end

    if spell.english == 'Fold' and buffactive['Bust'] == 2 then
        if sets.precast.FoldDoubleBust then
            equip(sets.precast.FoldDoubleBust)
            eventArgs.handled = true
        end
    end
    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 elemental_ws:contains(spell.name) and player.tp == 3000 then
        equip(sets.fulltp)
    end
    if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") then
        if state.LuzafRing.value then
            equip(sets.precast.LuzafRing)
        end
    end
    if spell.action_type == 'Ranged Attack' then
        special_ammo_check()
        if flurry == 2 then
            equip(sets.precast.RA.Flurry2)
        elseif flurry == 1 then
            equip(sets.precast.RA.Flurry1)
        end
    elseif spell.type == 'WeaponSkill' then
        if spell.skill == 'Marksmanship' then
            special_ammo_check()
        end
        if elemental_ws:contains(spell.name) then
            -- Matching double weather (w/o day conflict).
            if spell.element == world.weather_element and (get_weather_intensity() == 2 and spell.element ~= elements.weak_to[world.day_element]) then
                equip({waist="Hachirin-no-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({waist="Hachirin-no-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({waist="Hachirin-no-Obi"})
            end
        end
    end
end

function job_post_midcast(spell, action, spellMap, eventArgs)
	if spell.type == 'CorsairShot' then
        if (spell.english ~= 'Light Shot' and spell.english ~= 'Dark Shot') then
            -- Matching double weather (w/o day conflict).
            if spell.element == world.weather_element and (get_weather_intensity() == 2 and spell.element ~= elements.weak_to[world.day_element]) then
                equip({waist="Hachirin-no-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({waist="Hachirin-no-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({waist="Hachirin-no-Obi"})
            end
        end
	elseif spell.action_type == 'Ranged Attack' then
        if buffactive['Triple Shot'] and state.RangedMode.value ~= "RACC" then
            equip(sets.TripleShot)
            if buffactive['Aftermath: Lv.3'] and player.equipment.ranged == "Armageddon" then
                equip(sets.TripleShotCritical)
                if (spell.target.distance < (7 + spell.target.model_size)) and (spell.target.distance > (5 + spell.target.model_size)) then
                    equip(sets.TrueShot)
                end
            end
        elseif buffactive['Aftermath: Lv.3'] and player.equipment.ranged == "Armageddon" then
            equip(sets.midcast.RA.Critical)
            if (spell.target.distance < (7 + spell.target.model_size)) and (spell.target.distance > (5 + spell.target.model_size)) then
                equip(sets.TrueShot)
            end
        end
    end
end

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
    if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and not spell.interrupted then
        display_roll_info(spell)
    end
    --if spell.english == "Light Shot" then
        --send_command('@timers c "Light Shot ['..spell.target.name..']" 60 down abilities/00195.png')
    --end
    if player.status ~= 'Engaged' and state.WeaponLock.value == false then
        check_weaponset()
    end
    if player.status == 'Engaged' and state.WeaponLock.value == false then
        check_weaponset()
    end
end

function job_buff_change(buff,gain)
-- If we gain or lose any flurry buffs, adjust gear.
    if S{'flurry'}:contains(buff:lower()) then
        if not gain then
            flurry = nil
            --add_to_chat(122, "Flurry status cleared.")
        end
        if not midaction() then
            handle_equipping_gear(player.status)
        end
    end

    if buff == "doom" then
                if gain then           
                        equip(sets.buff.Doom)
                        send_command('@input /p Doomed, please Cursna.')
                        send_command('@input /item "Holy Water" <me>')					
                        disable('ring1','ring2','waist')
                elseif not gain and not player.status == "Dead" and not player.status == "Engaged Dead" then
                        enable('ring1','ring2','waist')
                        send_command('input /p Doom removed, Thank you.')
                        handle_equipping_gear(player.status)
                else
                        enable('ring1','ring2','waist')
                        send_command('input /p '..player.name..' is no longer Doom Thank you !')
                end
    end

end

-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
    if state.WeaponLock.value == true then
        disable('ranged')
    else
        enable('ranged')
    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()
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
end

-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
	if player.sub_job == 'NIN' and (state.WeaponSet.value == "SB" or state.WeaponSet.value == "AE") then
		meleeSet = set_combine(meleeSet, sets.empylegs)
	end
    return meleeSet
end

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

    return idleSet
end



function get_custom_wsmode(spell, action, spellMap)
    local wsmode
    if spell.skill == 'Marksmanship' then
        if state.RangedMode.value == 'RACC' then
            wsmode = 'RACC'
        end
    else
        if state.OffenseMode.value == 'Acc' then
            wsmode = 'Acc'
        end
    end

    return wsmode
end


-- Handle auto-targetting based on local setup.
function job_auto_change_target(spell, action, spellMap, eventArgs)
    if spell.type == 'CorsairShot' then
        if state.IgnoreTargetting.value == true then
            state.IgnoreTargetting:reset()
            eventArgs.handled = true
        end

        eventArgs.SelectNPCTargets = state.SelectqdTarget.value
    end
end

-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)
    local 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 qd_msg = '(' ..string.sub(state.QDMode.value,1,1).. ')'

    local e_msg = state.Mainqd.current
    if state.UseAltqd.value == true then
        e_msg = e_msg .. '/'..state.Altqd.current
    end

    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.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).. ' QD' ..qd_msg.. ': '  ..string.char(31,001)..e_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.
-------------------------------------------------------------------------------------------------------------------

--Read incoming packet to differentiate between Haste/Flurry I and II
windower.register_event('action',
    function(act)
        --check if you are a target of spell
        local actionTargets = act.targets
        playerId = windower.ffxi.get_player().id
        isTarget = false
        for _, target in ipairs(actionTargets) do
            if playerId == target.id then
                isTarget = true
            end
        end
        if isTarget == true then
            if act.category == 4 then
                local param = act.param
                if param == 845 and flurry ~= 2 then
                    --add_to_chat(122, 'Flurry Status: Flurry I')
                    flurry = 1
                elseif param == 846 then
                    --add_to_chat(122, 'Flurry Status: Flurry II')
                    flurry = 2
              end
            end
        end
    end)


function job_self_command(cmdParams, eventArgs)
    if cmdParams[1] == 'qd' then
        if cmdParams[2] == 't' then
            state.IgnoreTargetting:set()
        end

        local doqd = ''
        if state.UseAltqd.value == true then
            doqd = state[state.Currentqd.current..'qd'].current
            state.Currentqd:cycle()
        else
            doqd = state.Mainqd.current
        end

        send_command('@input /ja "'..doqd..'" <t>')
    end
end

function define_roll_values()
    rolls = {
        ["Corsair's Roll"] =    {lucky=5, unlucky=9, bonus="Experience Points"},
        ["Ninja Roll"] =        {lucky=4, unlucky=8, bonus="Evasion"},
        ["Hunter's Roll"] =     {lucky=4, unlucky=8, bonus="Accuracy"},
        ["Chaos Roll"] =        {lucky=4, unlucky=8, bonus="Attack"},
        ["Magus's Roll"] =      {lucky=2, unlucky=6, bonus="Magic Defense"},
        ["Healer's Roll"] =     {lucky=3, unlucky=7, bonus="Cure Potency Received"},
        ["Drachen Roll"] =      {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
        ["Choral Roll"] =       {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
        ["Monk's Roll"] =       {lucky=3, unlucky=7, bonus="Subtle Blow"},
        ["Beast Roll"] =        {lucky=4, unlucky=8, bonus="Pet Attack"},
        ["Samurai Roll"] =      {lucky=2, unlucky=6, bonus="Store TP"},
        ["Evoker's Roll"] =     {lucky=5, unlucky=9, bonus="Refresh"},
        ["Rogue's Roll"] =      {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
        ["Warlock's Roll"] =    {lucky=4, unlucky=8, bonus="Magic Accuracy"},
        ["Fighter's Roll"] =    {lucky=5, unlucky=9, bonus="Double Attack Rate"},
        ["Puppet Roll"] =       {lucky=3, unlucky=7, bonus="Pet Magic Attack/Accuracy"},
        ["Gallant's Roll"] =    {lucky=3, unlucky=7, bonus="Defense"},
        ["Wizard's Roll"] =     {lucky=5, unlucky=9, bonus="Magic Attack"},
        ["Dancer's Roll"] =     {lucky=3, unlucky=7, bonus="Regen"},
        ["Scholar's Roll"] =    {lucky=2, unlucky=6, bonus="Conserve MP"},
        ["Naturalist's Roll"] = {lucky=3, unlucky=7, bonus="Enh. Magic Duration"},
        ["Runeist's Roll"] =    {lucky=4, unlucky=8, bonus="Magic Evasion"},
        ["Bolter's Roll"] =     {lucky=3, unlucky=9, bonus="Movement Speed"},
        ["Caster's Roll"] =     {lucky=2, unlucky=7, bonus="Fast Cast"},
        ["Courser's Roll"] =    {lucky=3, unlucky=9, bonus="Snapshot"},
        ["Blitzer's Roll"] =    {lucky=4, unlucky=9, bonus="Attack Delay"},
        ["Tactician's Roll"] =  {lucky=5, unlucky=8, bonus="Regain"},
        ["Allies' Roll"] =      {lucky=3, unlucky=10, bonus="Skillchain Damage"},
        ["Miser's Roll"] =      {lucky=5, unlucky=7, bonus="Save TP"},
        ["Companion's Roll"] =  {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
        ["Avenger's Roll"] =    {lucky=4, unlucky=8, bonus="Counter Rate"},
    }
end

function display_roll_info(spell)
    rollinfo = rolls[spell.english]
    local rollsize = (state.LuzafRing.value and string.char(129,157)) or ''

    if rollinfo then
        add_to_chat(001, string.char(129,115).. '  ' ..string.char(31,210)..spell.english..string.char(31,001)..
            ' : '..rollinfo.bonus.. ' ' ..string.char(129,116).. ' ' ..string.char(129,195)..
            '  Lucky: ' ..string.char(31,204).. tostring(rollinfo.lucky)..string.char(31,001).. ' /' ..
            ' Unlucky: ' ..string.char(31,167).. tostring(rollinfo.unlucky)..string.char(31,002)..
            '  ' ..rollsize)
    end
end


-- Determine whether we have sufficient ammo for the action being attempted.
function do_bullet_checks(spell, spellMap, eventArgs)
    local bullet_name
    local bullet_min_count = 1

    if spell.type == 'WeaponSkill' then
        if spell.skill == "Marksmanship" then
            if spell.english == 'Wildfire' or spell.english == 'Leaden Salute' then
                -- magical weaponskills
                bullet_name = gear.MAbullet
            else
                -- physical weaponskills
                bullet_name = gear.WSbullet
            end
        else
            -- Ignore non-ranged weaponskills
            return
        end
    elseif spell.type == 'CorsairShot' then
        bullet_name = gear.QDbullet
    elseif spell.action_type == 'Ranged Attack' then
        bullet_name = gear.RAbullet
        if buffactive['Triple Shot'] then
            bullet_min_count = 3
        end
    end

    local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]

    -- If no ammo is available, give appropriate warning and end.
    if not available_bullets then
        if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
            add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
            return
        elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
            add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
            return
        else
            add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
            eventArgs.cancel = true
            return
        end
    end

    -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
    if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
        add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
        eventArgs.cancel = true
        return
    end

    -- Low ammo warning.
    if spell.type ~= 'CorsairShot' and state.warned.value == false
        and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
        local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
        --local border = string.repeat("*", #msg)
        local border = ""
        for i = 1, #msg do
            border = border .. "*"
        end

        add_to_chat(104, border)
        add_to_chat(104, msg)
        add_to_chat(104, border)

        state.warned:set()
    elseif available_bullets.count > options.ammo_warning_limit and state.warned then
        state.warned:reset()
    end
end

function special_ammo_check()
    -- Stop if Animikii/Hauksbok equipped
    if no_shoot_ammo:contains(player.equipment.ammo) then
        cancel_spell()
        add_to_chat(123, '** Action Canceled: [ '.. player.equipment.ammo .. ' equipped!! ] **')
        return
    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 check_gear()
    if no_swap_gear:contains(player.equipment.left_ring) then
        disable("ring1")
    else
        enable("ring1")
    end
    if no_swap_gear:contains(player.equipment.right_ring) then
        disable("ring2")
    else
        enable("ring2")
    end
    if no_swap_gear:contains(player.equipment.waist) then
        disable("waist")
    else
        enable("waist")
    end
end

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

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

Here is the whole thing, thank you
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 11:19:12
Link | Quote | Reply
 
It looks like entire functions were removed/changed and the check for auto-kite is gone. Looking around, I found an old post from you from 2022 with the same lua with the function here.
Code
function check_moving()
    if state.DefenseMode.value == 'None'  and state.Kiting.value == false then
        if state.Auto_Kite.value == false and moving then
            state.Auto_Kite:set(true)
        elseif state.Auto_Kite.value == true and moving == false then
            state.Auto_Kite:set(false)
        end
    end
end


So in this case the function was checking for movement to set Auto_Kite and when you stopped it ended. This function is gone now so there's nothing telling it to stop kiting mode. Really there isn't anything that's telling it to start Kiting mode either.

Now it looks like you potentially added a state Toggle at the top here
Code
    state.Auto_Kite = M(false, 'Auto_Kite')
    --Haste = 0
    --DW_needed = 0
    --DW = false
    --moving = false
    update_combat_form()
    --determine_haste_group()


But specifically, that's a toggle, it doesn't do any detection for moving or anything else, it's just basically overwriting your sets with kiting whenever it's on. So you can either put an auto detection back in for kiting, or (in my opinion) just make an idle set that has movement speed in it. It'll only be active in idle, you can toggle it on and off, and engaging won't be a problem.
Offline
Posts: 53
By quelthos 2025-06-06 13:41:21
Link | Quote | Reply
 
Thanks, if I want the auto equip carmine legs when moving and not engaged, then unequip when not moving and engaged, what lines do i need to add?
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 14:44:57
Link | Quote | Reply
 
Code
function check_moving()
    if state.DefenseMode.value == 'None'  and state.Kiting.value == false then
        if state.Auto_Kite.value == false and moving then
            state.Auto_Kite:set(true)
        elseif state.Auto_Kite.value == true and moving == false then
            state.Auto_Kite:set(false)
        end
    end
end


This function that was removed, it checks for movement.
Offline
Posts: 5
By tarokupo 2025-06-06 14:52:04
Link | Quote | Reply
 
I hope someone can help me! My DW sets aren't working which are my standard sets since I play DNC. I've tested it in debug mode and when battle starts it equips 'sets.engaged.DW.MaxHaste' as the default but no gear is swapped.

Here is the whole file: https://pastebin.com/d8cxb7H8
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 14:57:52
Link | Quote | Reply
 
tarokupo said: »
I hope someone can help me! My DW sets aren't working which are my standard sets since I play DNC. I've tested it in debug mode and when battle starts it equips 'sets.engaged.DW.MaxHaste' as the default but no gear is swapped.

Here is the whole file: https://pastebin.com/d8cxb7H8


All Arislan's Lua's use GearInfo (As noted at the top of the Lua) to calculate haste/dual wield. If you're not using GearInfo it's not going to handle the swaps as you're hoping. You would need to change the rules/functions for how it handles the swaps without using GearInfo.

Alternatively you can use GearInfo, but it's no longer kept up to date or maintained, so I can't speak to its functionality or usefulness.
Offline
Posts: 5
By tarokupo 2025-06-06 15:05:44
Link | Quote | Reply
 
Ah I see, thank you. Do you know of any lua's that don't use GearInfo that I could take a look at?
Offline
Posts: 53
By quelthos 2025-06-06 15:27:00
Link | Quote | Reply
 
i added this back but does not work, i also attached entire lua
Code
	function check_moving()
        if state.Auto_Kite.value == false and moving then
            state.Auto_Kite:set(true)
        elseif state.Auto_Kite.value == true and moving == false then
            state.Auto_Kite:set(false)
        end
	end

Code
-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2

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

-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()
    -- QuickDraw Selector
    state.Mainqd = M{['description']='Primary Shot', 'Fire Shot', 'Ice Shot', 'Wind Shot', 'Earth Shot', 'Thunder Shot', 'Water Shot'}
    state.Altqd = M{['description']='Secondary Shot', 'Fire Shot', 'Ice Shot', 'Wind Shot', 'Earth Shot', 'Thunder Shot', 'Water Shot'}
    state.UseAltqd = M(false, 'Use Secondary Shot')
    state.SelectqdTarget = M(false, 'Select Quick Draw Target')
    state.IgnoreTargetting = M(false, 'Ignore Targetting')

    state.QDMode = M{['description']='Quick Draw Mode', 'STP', 'Normal'}

    state.Currentqd = M{['description']='Current Quick Draw', 'Main', 'Alt'}

    -- Whether to use Luzaf's Ring
    state.LuzafRing = M(false, "Luzaf's Ring")
    -- Whether a warning has been given for low ammo
    state.warned = M(false)

    no_swap_gear = S{"Warp Ring", "Dim. Ring (Dem)", "Dim. Ring (Holla)", "Dim. Ring (Mea)",
              "Trizek Ring", "Echad Ring", "Facility Ring", "Capacity Ring",
              "Dev. Bul. Pouch", "Chr. Bul. Pouch", "Liv. Bul. Pouch"}
    elemental_ws = S{"Aeolian Edge", "Leaden Salute", "Wildfire", "Hot Shot"}
    no_shoot_ammo = S{"Animikii Bullet", "Hauksbok Bullet"}

    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}

    define_roll_values()

    lockstyleset = 1
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')
    state.HybridMode:options('Normal')
    state.RangedMode:options('Normal', 'RACC')
    state.WeaponskillMode:options('Normal', 'Acc', 'RACC')
    state.IdleMode:options('Normal')

    state.WeaponSet = M{['description']='Weapon Set', 'DP', 'SB', 'HS', 'LS', 'AE'}
    -- state.CP = M(false, "Capacity Points Mode")
    state.WeaponLock = M(false, 'Weapon Lock')	

    gear.RAbullet = "Chrono Bullet"
    gear.RAccbullet = "Chrono Bullet"
    gear.WSbullet = "Chrono Bullet"
    gear.MAbullet = "Living Bullet"
    gear.QDbullet = "Hauksbok Bullet"
    options.ammo_warning_limit = 10

    -- 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 @t gs c cycle treasuremode')
    --send_command('bind ^` input /ja "Double-up" <me>')
    --send_command('bind ^c input /ja "Crooked Cards" <me>')
    --send_command('bind ^s input /ja "Snake Eye" <me>')
    --send_command('bind ^f input /ja "Fold" <me>')
    --send_command('bind !` input /ja "Bolter\'s Roll" <me>')
    send_command ('bind @` gs c toggle LuzafRing')

    send_command('bind ^insert gs c cycleback mainqd')
    send_command('bind ^delete gs c cycle mainqd')
    send_command('bind ^home gs c cycle altqd')
    send_command('bind ^end gs c cycleback altqd')
    send_command('bind ^pageup gs c toggle selectqdtarget')
    send_command('bind ^pagedown gs c toggle usealtqd')

    -- send_command('bind @c gs c toggle CP')
    send_command('bind @q gs c cycle QDMode')
    send_command('bind ` tc nearest')
    send_command('bind @e gs c cycleback WeaponSet')
    send_command('bind @r gs c cycle WeaponSet')
    send_command('bind @w gs c toggle WeaponLock')

    --send_command('bind ^numlock input /ja "Triple Shot" <me>')

    --if player.sub_job == 'WAR' then
    --    send_command('bind ^numpad/ input /ja "Berserk" <me>')
    --    send_command('bind ^numpad* input /ja "Warcry" <me>')
    --    send_command('bind ^numpad- input /ja "Aggressor" <me>')
    --end

    --send_command('bind ^numpad7 input /ws "Savage Blade" <t>')
    --send_command('bind ^numpad8 input /ws "Last Stand" <t>')
    --send_command('bind ^numpad4 input /ws "Leaden Salute" <t>')
    --send_command('bind ^numpad5 input /ws "Requiescat" <t>')
    --send_command('bind ^numpad6 input /ws "Wildfire" <t>')
    --send_command('bind ^numpad1 input /ws "Aeolian Edge" <t>')
    --send_command('bind ^numpad2 input /ws "Evisceration" <t>')

    --send_command('bind %numpad0 input /ra <t>')


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


-- Called when this job file is unloaded (eg: job change)
function user_unload()
    send_command('unbind ^`')
    send_command('unbind ^c')
    send_command('unbind ^s')
    send_command('unbind ^f')
    send_command('unbind !`')
    send_command('unbind @t')
    send_command('unbind @`')
    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 ^,')
    send_command('unbind @c')
    send_command('unbind `')
    send_command('unbind @w')
    send_command('unbind @e')
    send_command('unbind @r')
    send_command('unbind ^numlock')
    send_command('unbind ^numpad/')
    send_command('unbind ^numpad*')
    send_command('unbind ^numpad-')
    send_command('unbind ^numpad8')
    send_command('unbind ^numpad4')
    send_command('unbind ^numpad5')
    send_command('unbind ^numpad6')
    send_command('unbind ^numpad1')
    send_command('unbind ^numpad2')
    send_command('unbind numpad0')

    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 ------------------------------------------
    ------------------------------------------------------------------------------------------------

    sets.precast.JA['Snake Eye'] = {legs="Lanun Trews"}
    sets.precast.JA['Wild Card'] = {feet="Lanun Bottes +3"}
    sets.precast.JA['Random Deal'] = {body="Lanun Frac +3"}

    sets.precast.CorsairRoll = {
    main={ name="Rostam", augments={'Path: C',}, priority=1},
    range="Compensator",
    head="Lanun Tricorne",
    body="Nyame Mail",
    hands="Chasseur's Gants +3",
    legs="Desultor Tassets",
    feet="Nyame Sollerets",
    neck="Regal Necklace",
    waist="Flume Belt",
    left_ear="Etiolation Earring",
    right_ear="Eabani Earring",
    left_ring="Defending Ring",
    right_ring="Luzaf's Ring",
    back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
        }

    sets.precast.CorsairRoll["Caster's Roll"] = set_combine(sets.precast.CorsairRoll, {legs="Chasseur's Culottes +3"})
    sets.precast.CorsairRoll["Courser's Roll"] = set_combine(sets.precast.CorsairRoll, {feet="Chasseur's Bottes +3"})
    sets.precast.CorsairRoll["Blitzer's Roll"] = set_combine(sets.precast.CorsairRoll, {head="Chasseur's Tricorne +3"})
    sets.precast.CorsairRoll["Tactician's Roll"] = set_combine(sets.precast.CorsairRoll, {body="Chasseur's Frac +3"})
    sets.precast.CorsairRoll["Allies' Roll"] = set_combine(sets.precast.CorsairRoll, {hands="Chasseur's Gants +3"})

    sets.precast.LuzafRing = {ring2="Luzaf's Ring"}
    sets.precast.FoldDoubleBust = {hands="Lanun Gants +3"}

    sets.precast.Waltz = {
        body="Passion Jacket",
        ring1="Asklepian Ring",
        waist="Gishdubar Sash",
        }

    sets.precast.Waltz['Healing Waltz'] = {}

    sets.precast.FC = {
    head="Carmine Mask +1",
    body="Taeon Tabard",
    hands="Leyline Gloves",
    legs={ name="Herculean Trousers", augments={'"Mag.Atk.Bns."+20','"Fast Cast"+6','STR+9','Mag. Acc.+1',}},
    feet="Carmine Greaves +1",
    neck="Baetyl Pendant",
    waist="Plat. Mog. Belt",
    left_ear="Etiolation Earring",
    right_ear="Loquac. Earring",
    right_ring="Kishar Ring",
    left_ring="Weather. Ring",
    back={ name="Camulus's Mantle", augments={'"Fast Cast"+10',}},
        }

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

    -- (10% Snapshot from JP Gifts)
    sets.precast.RA = {
        ammo=gear.RAbullet,
        head="Chasseur's Tricorne +3", --0/14
        body="Laksa. Frac +3", --0/20
        --body="Oshosi Vest +1", --14/0
        hands="Lanun Gants +3",
		legs="Adhemar Kecks +1",
        feet="Meg. Jam. +2", --10/0
        neck="Comm. Charm +2", --4/0
		ring1="Crepuscular Ring",
		back={ name="Camulus's Mantle", augments={'"Snapshot"+10',}},
        waist="Yemaya Belt", --0/5
        } --61/32

    sets.precast.RA.Flurry1 = set_combine(sets.precast.RA, {
        }) --47/52

    sets.precast.RA.Flurry2 = set_combine(sets.precast.RA.Flurry1, {
        }) --32/73

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

    sets.precast.WS = {
	head="Nyame Helm",
    body="Nyame Mail",
    hands="Nyame Gauntlets",
	legs="Nyame Flanchard",		
    feet="Nyame Sollerets",
	neck="Comm. Charm +2",
    waist="Sailfi Belt +1",
    left_ear="Ishvara Earring",
    right_ear="Moonshade Earring",
    left_ring="Cornelia's Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Camulus's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},
        }
	sets.precast.WS.Acc = set_combine(sets.precast.WS, {
		neck="Fotia Gorget",
		waist="Fotia Belt",
	})
	sets.precast.WS.RACC = set_combine(sets.precast.WS, {
		neck="Fotia Gorget",
		waist="Fotia Belt",
		})
    sets.precast.WS['Last Stand'] = set_combine(sets.precast.WS, {
		ammo=gear.WSbullet,
		hands="Chasseur's Gants +3",
		neck="Fotia Gorget",
		waist="Fotia Belt",
		back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','AGI+10','Weapon skill damage +10%',}},
		})
    sets.precast.WS['Last Stand'].RACC = set_combine(sets.precast.WS['Last Stand'], {
		})
		
    sets.precast.WS['Detonator'] = set_combine(sets.precast.WS['Last Stand'], {})
	
    sets.precast.WS['Wildfire'] = {
    ammo=gear.MAbullet,
    head="Nyame Helm",
    body="Lanun Frac +3",
    hands="Nyame Gauntlets",
	legs="Nyame Flanchard",
    feet="Lanun Bottes +3", 
	waist="Orpheus's Sash",
	neck="Comm. Charm +2",
    left_ear="Friomisi Earring",
    right_ear="Crematio Earring",
    left_ring="Cornelia's Ring",
    right_ring="Dingir Ring",
    back={ name="Camulus's Mantle", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%',}},
        }
    sets.precast.WS['Aeolian Edge'] = set_combine(sets.precast.WS['Wildfire'], {
	right_ear="Moonshade Earring",
        })
    sets.precast.WS['Hot Shot'] = set_combine(sets.precast.WS['Wildfire'], {
	--ammo=gear.WSbullet,
	body="Nyame Mail",
	--neck="Fotia Gorget",
	--waist="Fotia Belt",
	right_ear="Moonshade Earring",
	})
    sets.precast.WS['Leaden Salute'] = set_combine(sets.precast.WS['Wildfire'], {
	head="Pixie Hairpin +1",
    right_ear="Moonshade Earring",
    right_ring="Archon Ring",
    })

    sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS, {
    neck="Fotia Gorget",
    waist="Fotia Belt",
        })
    sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS, {
		neck="Rep. Plat. Medal",	
		hands="Chasseur's Gants +3",
        })
    sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'], {
    neck="Fotia Gorget",
    waist="Fotia Belt",
        })
    sets.precast.WS['Swift Blade'] = set_combine(sets.precast.WS, {
        })
    sets.precast.WS['Requiescat'] = set_combine(sets.precast.WS, {
        }) --MND
    sets.precast.WS['Requiescat'].Acc = set_combine(sets.precast.WS.Acc, {
        }) --MND
    sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {
        }) 
    sets.precast.WS['Exenterator'].Acc = set_combine(sets.precast.WS.Acc, {
        })

    sets.precast.CorsairShot = { 
	ammo=gear.QDbullet,
    head="Nyame Helm",
    body="Lanun Frac +3",
    hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
	legs="Nyame Flanchard",
    feet="Chasseur's Bottes +3",
	waist="Orpheus's Sash",
	neck="Comm. Charm +2",
    left_ear="Friomisi Earring",
    right_ear="Crematio Earring",
    left_ring="Weather. Ring",
    right_ring="Dingir Ring",
    back="Izdubar Mantle",
	}
    sets.precast.CorsairShot.STP = { 
	ammo=gear.QDbullet,
    head="Nyame Helm",
    body="Lanun Frac +3",
    hands={ name="Carmine Fin. Ga. +1", augments={'Rng.Atk.+20','"Mag.Atk.Bns."+12','"Store TP"+6',}},
	legs="Nyame Flanchard",
    feet="Chasseur's Bottes +3",
	waist="Orpheus's Sash",
	neck="Comm. Charm +2",
    left_ear="Friomisi Earring",
    right_ear="Crematio Earring",
    left_ring="Weather. Ring",
    right_ring="Dingir Ring",
    back="Izdubar Mantle",
	}
	
    sets.precast.CorsairShot['Light Shot'] = set_combine(sets.precast.CorsairShot, {
	ammo=gear.QDbullet,
    left_ring="Weather. Ring",
        })

    sets.precast.CorsairShot['Dark Shot'] = set_combine(sets.precast.CorsairShot, {
	ammo=gear.QDbullet,
	head="Pixie Hairpin +1",
    left_ring="Archon Ring",
	})

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

    sets.midcast.FastRecast = sets.precast.FC

    sets.midcast.SpellInterrupt = {
        body=gear.Taeon_Phalanx_body, --10
        hands="Rawhide Gloves", --15
        legs="Carmine Cuisses +1", --20
        feet=gear.Taeon_Phalanx_feet, --10
        neck="Loricate Torque +1", --5
        ear1="Halasz Earring", --5
        ear2="Magnetic Earring", --8
        ring2="Evanescence Ring", --5
        waist="Rumination Sash", --10
        }

    sets.midcast.Utsusemi = sets.midcast.SpellInterrupt

    sets.midcast.Cure = {
        neck="Incanter's Torque",
        ear1="Roundel Earring",
        ear2="Mendi. Earring",
        ring1="Lebeche Ring",
        ring2="Haoma's Ring",
        waist="Bishop's Sash",
        }

    sets.midcast.Utsusemi = sets.midcast.SpellInterrupt

    -- Ranged gear
    sets.midcast.RA = {
        ammo=gear.RAbullet,
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Chas. Culottes +3",
    feet="Malignance Boots",
    neck="Iskur Gorget",
    waist="Yemaya Belt",
    left_ear="Telos Earring",
    right_ear="Crep. Earring",
    left_ring="Crepuscular Ring",
    right_ring="Ilabrat Ring",
    back={ name="Camulus's Mantle", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+10','"Store TP"+10',}},
        }

	sets.midcast.RA.RACC = set_combine(sets.midcast.RA, {
    --waist="K. Kachina Belt +1",
	--neck="Null Loop",
	waist="Null Belt",
	back="Null Shawl",
	})


    sets.midcast.RA.Acc = set_combine(sets.midcast.RA, {
        })

    sets.midcast.RA.HighAcc = set_combine(sets.midcast.RA.Acc, {

        })

    sets.midcast.RA.Critical = set_combine(sets.midcast.RA, {
        })

    sets.midcast.RA.STP = set_combine(sets.midcast.RA, {
        })

    sets.TripleShot = set_combine(sets.midcast.RA, {
        --head="Oshosi Mask +1", --5
        body="Chasseur's Frac +3", --13
        hands="Lanun Gants +3",
        --legs="Osh. Trousers +1", --6
        --feet="Osh. Leggings +1", --3
        }) --27
		

    sets.TripleShotCritical = set_combine(sets.midcast.RA, {
        })

    sets.TrueShot = set_combine(sets.midcast.RA, {
        })

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

    sets.resting = {}

    sets.idle = {
    ammo=gear.RAbullet,
        head="Malignance Chapeau", --6/6
        body="Malignance Tabard", --9/9
        hands="Malignance Gloves", --5/5
		legs="Chasseur's Culottes +3",
        feet="Malignance Boots", --4/4
    neck="Elite Royal Collar",
    waist="Flume Belt",
    left_ear="Etiolation Earring",
    right_ear="Eabani Earring",
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
        }

    sets.idle.DT = set_combine(sets.idle, {
        })

    sets.idle.Refresh = set_combine(sets.idle, {
        })

    sets.idle.Town = set_combine(sets.idle, {
        })


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

    sets.defense.PDT = sets.idle.DT

    sets.defense.MDT = {
        }

    sets.Kiting = {legs="Carmine Cuisses +1"}


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

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

    sets.engaged = {
	ammo=gear.RAbullet,
    head="Malignance Chapeau",
    body="Malignance Tabard",
    hands="Malignance Gloves",
    legs="Malignance Tights",
    feet="Malignance Boots",
    neck="Iskur Gorget",
    waist="Sailfi Belt +1",
    left_ear="Telos Earring",
    right_ear="Crep. Earring",
    left_ring={name="Chirich Ring +1", bag="wardrobe2"},
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
    back={ name="Camulus's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
        }
		
	sets.engaged.Acc = set_combine(sets.engaged, {	
	neck="Null Loop",
	waist="Null Belt",
	back="Null Shawl",
	})
    -- * DNC Subjob DW Trait: +15%
    -- * NIN Subjob DW Trait: +25%

    -- No Magic Haste (74% DW to cap)
    sets.engaged.DW = set_combine(sets.engaged, {
    waist="Reiki Yotai",
    right_ear="Eabani Earring",
      })
	  
	sets.engaged.DW.Acc = set_combine(sets.engaged.DW, {	
	neck="Null Loop",
	--waist="Null Belt",
	back="Null Shawl",
	})
	   
    sets.empylegs =  {
    legs="Chasseur's Culottes +3",
      } 
    ------------------------------------------------------------------------------------------------
    ---------------------------------------- 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.TreasureHunter = {head="Volte Cap", hands=gear.Herc_TH_hands, feet="Volte Boots", waist="Chaac Belt"}
	
	sets.fulltp = { right_ear="Crematio Earring" }
	
	sets.RP = {    
	main={ name="Rostam", augments={'Path: A',}},
    sub={ name="Rostam", augments={'Path: C',}},
	ranged="Death Penalty"
	}
    sets.DP = {main={ name="Rostam", augments={'Path: A',}}, sub="Tauret", ranged="Death Penalty"}
    sets.SB = {main="Naegling", sub="Gleti's Knife", ranged="Anarchy +2"}
    sets.HS = {main="Naegling", sub="Tauret", ranged="Fomalhaut"}
    sets.LS = {main={ name="Rostam", augments={'Path: A',}}, sub="Kustawi +1", ranged="Fomalhaut"}
	sets.AE = {main="Tauret", sub="Gleti's Knife", ranged="Anarchy +2"}
	
    sets.DefaultShield = {sub="Nusku Shield"}

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)
    if spell.action_type == 'Ranged Attack' or spell.type == 'WeaponSkill' or spell.type == 'CorsairShot' then
        do_bullet_checks(spell, spellMap, eventArgs)
    end

    if spell.english == 'Fold' and buffactive['Bust'] == 2 then
        if sets.precast.FoldDoubleBust then
            equip(sets.precast.FoldDoubleBust)
            eventArgs.handled = true
        end
    end
    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 elemental_ws:contains(spell.name) and player.tp == 3000 then
        equip(sets.fulltp)
    end
    if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") then
        if state.LuzafRing.value then
            equip(sets.precast.LuzafRing)
        end
    end
    if spell.action_type == 'Ranged Attack' then
        special_ammo_check()
        if flurry == 2 then
            equip(sets.precast.RA.Flurry2)
        elseif flurry == 1 then
            equip(sets.precast.RA.Flurry1)
        end
    elseif spell.type == 'WeaponSkill' then
        if spell.skill == 'Marksmanship' then
            special_ammo_check()
        end
        if elemental_ws:contains(spell.name) then
            -- Matching double weather (w/o day conflict).
            if spell.element == world.weather_element and (get_weather_intensity() == 2 and spell.element ~= elements.weak_to[world.day_element]) then
                equip({waist="Hachirin-no-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({waist="Hachirin-no-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({waist="Hachirin-no-Obi"})
            end
        end
    end
end

function job_post_midcast(spell, action, spellMap, eventArgs)
	if spell.type == 'CorsairShot' then
        if (spell.english ~= 'Light Shot' and spell.english ~= 'Dark Shot') then
            -- Matching double weather (w/o day conflict).
            if spell.element == world.weather_element and (get_weather_intensity() == 2 and spell.element ~= elements.weak_to[world.day_element]) then
                equip({waist="Hachirin-no-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({waist="Hachirin-no-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({waist="Hachirin-no-Obi"})
            end
        end
	elseif spell.action_type == 'Ranged Attack' then
        if buffactive['Triple Shot'] and state.RangedMode.value ~= "RACC" then
            equip(sets.TripleShot)
            if buffactive['Aftermath: Lv.3'] and player.equipment.ranged == "Armageddon" then
                equip(sets.TripleShotCritical)
                if (spell.target.distance < (7 + spell.target.model_size)) and (spell.target.distance > (5 + spell.target.model_size)) then
                    equip(sets.TrueShot)
                end
            end
        elseif buffactive['Aftermath: Lv.3'] and player.equipment.ranged == "Armageddon" then
            equip(sets.midcast.RA.Critical)
            if (spell.target.distance < (7 + spell.target.model_size)) and (spell.target.distance > (5 + spell.target.model_size)) then
                equip(sets.TrueShot)
            end
        end
    end
end

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
    if (spell.type == 'CorsairRoll' or spell.english == "Double-Up") and not spell.interrupted then
        display_roll_info(spell)
    end
    --if spell.english == "Light Shot" then
        --send_command('@timers c "Light Shot ['..spell.target.name..']" 60 down abilities/00195.png')
    --end
    if player.status ~= 'Engaged' and state.WeaponLock.value == false then
        check_weaponset()
    end
    if player.status == 'Engaged' and state.WeaponLock.value == false then
        check_weaponset()
    end
end

function job_buff_change(buff,gain)
-- If we gain or lose any flurry buffs, adjust gear.
    if S{'flurry'}:contains(buff:lower()) then
        if not gain then
            flurry = nil
            --add_to_chat(122, "Flurry status cleared.")
        end
        if not midaction() then
            handle_equipping_gear(player.status)
        end
    end

    if buff == "doom" then
                if gain then           
                        equip(sets.buff.Doom)
                        send_command('@input /p Doomed, please Cursna.')
                        send_command('@input /item "Holy Water" <me>')					
                        disable('ring1','ring2','waist')
                elseif not gain and not player.status == "Dead" and not player.status == "Engaged Dead" then
                        enable('ring1','ring2','waist')
                        send_command('input /p Doom removed, Thank you.')
                        handle_equipping_gear(player.status)
                else
                        enable('ring1','ring2','waist')
                        send_command('input /p '..player.name..' is no longer Doom Thank you !')
                end
    end

end

-- Handle notifications of general user state change.
function job_state_change(stateField, newValue, oldValue)
    if state.WeaponLock.value == true then
        disable('ranged')
    else
        enable('ranged')
    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()
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
end

-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
	if player.sub_job == 'NIN' and (state.WeaponSet.value == "SB" or state.WeaponSet.value == "AE") then
		meleeSet = set_combine(meleeSet, sets.empylegs)
	end
    return meleeSet
end

function get_custom_wsmode(spell, action, spellMap)
    local wsmode
    if spell.skill == 'Marksmanship' then
        if state.RangedMode.value == 'RACC' then
            wsmode = 'RACC'
        end
    else
        if state.OffenseMode.value == 'Acc' then
            wsmode = 'Acc'
        end
    end

    return wsmode
end

-- Handle auto-targetting based on local setup.
function job_auto_change_target(spell, action, spellMap, eventArgs)
    if spell.type == 'CorsairShot' then
        if state.IgnoreTargetting.value == true then
            state.IgnoreTargetting:reset()
            eventArgs.handled = true
        end

        eventArgs.SelectNPCTargets = state.SelectqdTarget.value
    end
end

-- Set eventArgs.handled to true if we don't want the automatic display to be run.
function display_current_job_state(eventArgs)
    local 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 qd_msg = '(' ..string.sub(state.QDMode.value,1,1).. ')'

    local e_msg = state.Mainqd.current
    if state.UseAltqd.value == true then
        e_msg = e_msg .. '/'..state.Altqd.current
    end

    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.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).. ' QD' ..qd_msg.. ': '  ..string.char(31,001)..e_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.
-------------------------------------------------------------------------------------------------------------------

--Read incoming packet to differentiate between Haste/Flurry I and II
windower.register_event('action',
    function(act)
        --check if you are a target of spell
        local actionTargets = act.targets
        playerId = windower.ffxi.get_player().id
        isTarget = false
        for _, target in ipairs(actionTargets) do
            if playerId == target.id then
                isTarget = true
            end
        end
        if isTarget == true then
            if act.category == 4 then
                local param = act.param
                if param == 845 and flurry ~= 2 then
                    --add_to_chat(122, 'Flurry Status: Flurry I')
                    flurry = 1
                elseif param == 846 then
                    --add_to_chat(122, 'Flurry Status: Flurry II')
                    flurry = 2
              end
            end
        end
    end)


function job_self_command(cmdParams, eventArgs)
    if cmdParams[1] == 'qd' then
        if cmdParams[2] == 't' then
            state.IgnoreTargetting:set()
        end

        local doqd = ''
        if state.UseAltqd.value == true then
            doqd = state[state.Currentqd.current..'qd'].current
            state.Currentqd:cycle()
        else
            doqd = state.Mainqd.current
        end

        send_command('@input /ja "'..doqd..'" <t>')
    end
end

function define_roll_values()
    rolls = {
        ["Corsair's Roll"] =    {lucky=5, unlucky=9, bonus="Experience Points"},
        ["Ninja Roll"] =        {lucky=4, unlucky=8, bonus="Evasion"},
        ["Hunter's Roll"] =     {lucky=4, unlucky=8, bonus="Accuracy"},
        ["Chaos Roll"] =        {lucky=4, unlucky=8, bonus="Attack"},
        ["Magus's Roll"] =      {lucky=2, unlucky=6, bonus="Magic Defense"},
        ["Healer's Roll"] =     {lucky=3, unlucky=7, bonus="Cure Potency Received"},
        ["Drachen Roll"] =      {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
        ["Choral Roll"] =       {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
        ["Monk's Roll"] =       {lucky=3, unlucky=7, bonus="Subtle Blow"},
        ["Beast Roll"] =        {lucky=4, unlucky=8, bonus="Pet Attack"},
        ["Samurai Roll"] =      {lucky=2, unlucky=6, bonus="Store TP"},
        ["Evoker's Roll"] =     {lucky=5, unlucky=9, bonus="Refresh"},
        ["Rogue's Roll"] =      {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
        ["Warlock's Roll"] =    {lucky=4, unlucky=8, bonus="Magic Accuracy"},
        ["Fighter's Roll"] =    {lucky=5, unlucky=9, bonus="Double Attack Rate"},
        ["Puppet Roll"] =       {lucky=3, unlucky=7, bonus="Pet Magic Attack/Accuracy"},
        ["Gallant's Roll"] =    {lucky=3, unlucky=7, bonus="Defense"},
        ["Wizard's Roll"] =     {lucky=5, unlucky=9, bonus="Magic Attack"},
        ["Dancer's Roll"] =     {lucky=3, unlucky=7, bonus="Regen"},
        ["Scholar's Roll"] =    {lucky=2, unlucky=6, bonus="Conserve MP"},
        ["Naturalist's Roll"] = {lucky=3, unlucky=7, bonus="Enh. Magic Duration"},
        ["Runeist's Roll"] =    {lucky=4, unlucky=8, bonus="Magic Evasion"},
        ["Bolter's Roll"] =     {lucky=3, unlucky=9, bonus="Movement Speed"},
        ["Caster's Roll"] =     {lucky=2, unlucky=7, bonus="Fast Cast"},
        ["Courser's Roll"] =    {lucky=3, unlucky=9, bonus="Snapshot"},
        ["Blitzer's Roll"] =    {lucky=4, unlucky=9, bonus="Attack Delay"},
        ["Tactician's Roll"] =  {lucky=5, unlucky=8, bonus="Regain"},
        ["Allies' Roll"] =      {lucky=3, unlucky=10, bonus="Skillchain Damage"},
        ["Miser's Roll"] =      {lucky=5, unlucky=7, bonus="Save TP"},
        ["Companion's Roll"] =  {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
        ["Avenger's Roll"] =    {lucky=4, unlucky=8, bonus="Counter Rate"},
    }
end

function display_roll_info(spell)
    rollinfo = rolls[spell.english]
    local rollsize = (state.LuzafRing.value and string.char(129,157)) or ''

    if rollinfo then
        add_to_chat(001, string.char(129,115).. '  ' ..string.char(31,210)..spell.english..string.char(31,001)..
            ' : '..rollinfo.bonus.. ' ' ..string.char(129,116).. ' ' ..string.char(129,195)..
            '  Lucky: ' ..string.char(31,204).. tostring(rollinfo.lucky)..string.char(31,001).. ' /' ..
            ' Unlucky: ' ..string.char(31,167).. tostring(rollinfo.unlucky)..string.char(31,002)..
            '  ' ..rollsize)
    end
end


-- Determine whether we have sufficient ammo for the action being attempted.
function do_bullet_checks(spell, spellMap, eventArgs)
    local bullet_name
    local bullet_min_count = 1

    if spell.type == 'WeaponSkill' then
        if spell.skill == "Marksmanship" then
            if spell.english == 'Wildfire' or spell.english == 'Leaden Salute' then
                -- magical weaponskills
                bullet_name = gear.MAbullet
            else
                -- physical weaponskills
                bullet_name = gear.WSbullet
            end
        else
            -- Ignore non-ranged weaponskills
            return
        end
    elseif spell.type == 'CorsairShot' then
        bullet_name = gear.QDbullet
    elseif spell.action_type == 'Ranged Attack' then
        bullet_name = gear.RAbullet
        if buffactive['Triple Shot'] then
            bullet_min_count = 3
        end
    end

    local available_bullets = player.inventory[bullet_name] or player.wardrobe[bullet_name]

    -- If no ammo is available, give appropriate warning and end.
    if not available_bullets then
        if spell.type == 'CorsairShot' and player.equipment.ammo ~= 'empty' then
            add_to_chat(104, 'No Quick Draw ammo left.  Using what\'s currently equipped ('..player.equipment.ammo..').')
            return
        elseif spell.type == 'WeaponSkill' and player.equipment.ammo == gear.RAbullet then
            add_to_chat(104, 'No weaponskill ammo left.  Using what\'s currently equipped (standard ranged bullets: '..player.equipment.ammo..').')
            return
        else
            add_to_chat(104, 'No ammo ('..tostring(bullet_name)..') available for that action.')
            eventArgs.cancel = true
            return
        end
    end

    -- Don't allow shooting or weaponskilling with ammo reserved for quick draw.
    if spell.type ~= 'CorsairShot' and bullet_name == gear.QDbullet and available_bullets.count <= bullet_min_count then
        add_to_chat(104, 'No ammo will be left for Quick Draw.  Cancelling.')
        eventArgs.cancel = true
        return
    end

    -- Low ammo warning.
    if spell.type ~= 'CorsairShot' and state.warned.value == false
        and available_bullets.count > 1 and available_bullets.count <= options.ammo_warning_limit then
        local msg = '*****  LOW AMMO WARNING: '..bullet_name..' *****'
        --local border = string.repeat("*", #msg)
        local border = ""
        for i = 1, #msg do
            border = border .. "*"
        end

        add_to_chat(104, border)
        add_to_chat(104, msg)
        add_to_chat(104, border)

        state.warned:set()
    elseif available_bullets.count > options.ammo_warning_limit and state.warned then
        state.warned:reset()
    end
end

function special_ammo_check()
    -- Stop if Animikii/Hauksbok equipped
    if no_shoot_ammo:contains(player.equipment.ammo) then
        cancel_spell()
        add_to_chat(123, '** Action Canceled: [ '.. player.equipment.ammo .. ' equipped!! ] **')
        return
    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 check_gear()
    if no_swap_gear:contains(player.equipment.left_ring) then
        disable("ring1")
    else
        enable("ring1")
    end
    if no_swap_gear:contains(player.equipment.right_ring) then
        disable("ring2")
    else
        enable("ring2")
    end
    if no_swap_gear:contains(player.equipment.waist) then
        disable("waist")
    else
        enable("waist")
    end
end

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

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

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

    --return idleSet
--end


send_command('input /macro set 1;input /macro book 2')
    send_command('@wait 5; input /lockstyleset 60')
	
	function check_moving()
        if state.Auto_Kite.value == false and moving then
            state.Auto_Kite:set(true)
        elseif state.Auto_Kite.value == true and moving == false then
            state.Auto_Kite:set(false)
        end
	end
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 15:40:29
Link | Quote | Reply
 
tarokupo said: »
Ah I see, thank you. Do you know of any lua's that don't use GearInfo that I could take a look at?

The Kinematics luas are old, but work just fine and are basically a super base line version of Arislan's lua (he references this at the top of his LUAs as well. They're great cause they're basically a skeleton you can just keep adding to. So the base is there, and whatever you want to add in and make work can be added in.

If you're looking for one that's already got a bunch of functions in it, I unfortunately do not have a DNC lua.
Offline
Posts: 5
By tarokupo 2025-06-06 15:46:13
Link | Quote | Reply
 
Bahamut.Boposhopo said: »
tarokupo said: »
Ah I see, thank you. Do you know of any lua's that don't use GearInfo that I could take a look at?

The Kinematics luas are old, but work just fine and are basically a super base line version of Arislan's lua (he references this at the top of his LUAs as well. They're great cause they're basically a skeleton you can just keep adding to. So the base is there, and whatever you want to add in and make work can be added in.

If you're looking for one that's already got a bunch of functions in it, I unfortunately do not have a DNC lua.

Thanks! I'm gonna have a look into it and see what I can add safely :)
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 15:46:25
Link | Quote | Reply
 
quelthos said: »
i added this back but does not work, i also attached entire lua

You have the function commented out.
line 1099-1105
Code
function customize_idle_set(idleSet)
    if state.Auto_Kite.value == true then
       idleSet = set_combine(idleSet, sets.Kiting)
    end

    return idleSet
end
Offline
Posts: 53
By quelthos 2025-06-06 15:50:24
Link | Quote | Reply
 
I put them back and still not working.
 Bahamut.Boposhopo
Offline
Server: Bahamut
Game: FFXI
user: Boposhopo
Posts: 149
By Bahamut.Boposhopo 2025-06-06 15:59:16
Link | Quote | Reply
 
Uh crap, I'm not subbed so I can't check this before replying. Does ALT+F10 toggle on kiting mode for you?
Offline
Posts: 53
By quelthos 2025-06-06 16:21:27
Link | Quote | Reply
 
Problem solved
For future googler
Equips fast run set when not in combat and moving, puts you back into idle gear once stopped moving.

If you are using Arislan's lua, you just copy paste these to the end of the lua. Don't forget to define your sets.kiting to carmine cuisses +1 or whatever you are using

Credit to the OP here, I just frankensteined his code to work with Arislan's
Code
function customize_idle_set(idleSet)
    if state.Auto_Kite.value == true then
       idleSet = set_combine(idleSet, sets.Kiting)
    end
	return idleSet
end	

	mov = {counter=0}
    if player and player.index and windower.ffxi.get_mob_by_index(player.index) then
        mov.x = windower.ffxi.get_mob_by_index(player.index).x
        mov.y = windower.ffxi.get_mob_by_index(player.index).y
        mov.z = windower.ffxi.get_mob_by_index(player.index).z
    end
    moving = false
	
    windower.raw_register_event('prerender',function()
        mov.counter = mov.counter + 1;
        if mov.counter>30 then
            local pl = windower.ffxi.get_mob_by_index(player.index)
            if pl and pl.x and mov.x then
                local movement = math.sqrt( (pl.x-mov.x)^2 + (pl.y-mov.y)^2 + (pl.z-mov.z)^2 ) > 0.1
                if movement and not moving then
                    send_command('gs c toggle Auto_Kite')
                    moving = true
                elseif not movement and moving then
                    send_command('gs c toggle Auto_Kite')
                    moving = false
                end
            end

            if pl and pl.x then
                mov.x = pl.x
                mov.y = pl.y
                mov.z = pl.z
            end
            mov.counter = 0
        end
    end)	
Offline
Posts: 53
By quelthos 2025-06-14 20:14:38
Link | Quote | Reply
 
currently if i toggle offensemode into Acc
It automatically toggles my wsmode into Acc as well.
Example: if offensemode/engagemode is set to Acc, it auto equips the acc ws set which is fotia neck/belt when i savage blade
How do I control weaponskillmode manually instead of the current automatic toggle?

Thanks
Code
function get_sets()
    mote_include_version = 2
    -- Load and initialize the include file.
    include('Mote-Include.lua')
    include('organizer-lib')
end

------------------------------------------------------------------------------------------------------------------- 
-- Setup vars that are user-independent.
-------------------------------------------------------------------------------------------------------------------

function job_setup()	
	--Your Main + Sub Weapon Sets. Add new sets here and define below (sets.Montante etc.)
    state.WeaponSet = M{['description']='Weapon Set', 'sword', 'gaxe', 'pole', 'club', 'axe'}
    state.WeaponLock = M(false, 'Weapon Lock')
    
	--CP Mode
	state.CP = M(false, "Capacity Points Mode")
	
	--Pause Mode 
	state.Pause = M(false, "Pause Mode")

	--Buffs we have gearsets for
    state.Buff.Berserk = buffactive.berserk or false
    state.Buff.Retaliation = buffactive.retaliation or false
	
	--Weaponskills we DO NOT want Gavialis Helm with
    wsList = S{'Savage Blade', 'Impulse Drive', 'Torcleaver', 'Upheaval'}
    
	--Gear we DO NOT want automatically taken off (currently only supports commonly used rings, can use pause mode for all other slots)
	no_swap_gear = S{"Warp Ring", "Dim. Ring (Dem)", "Dim. Ring (Holla)", "Dim. Ring (Mea)", "Trizek Ring", "Endorsement Ring", "Echad Ring", "Facility Ring", "Capacity Ring", "Emporox's Ring"}

    --TH Rules
	include('Mote-TreasureHunter')

end
 
------------------------------------------------------------------------------------------------------------------- 
-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
-------------------------------------------------------------------------------------------------------------------

function user_setup()
    -- Options: Override default values
    state.OffenseMode:options('Normal','Acc', 'MEVA')
    state.WeaponskillMode:options('Normal',"Acc")
    state.HybridMode:options('Normal')
    state.CastingMode:options('Normal')
    state.IdleMode:options('Normal')
    state.RestingMode:options('Normal')
    state.PhysicalDefenseMode:options('PDT', 'Reraise')
    state.MagicalDefenseMode:options('MDT')
    
	
    --Auto Kite (Auto Move Speed Gear)
	state.Auto_Kite = M(false, 'Auto_Kite')   
	moving = false
    
	-- Additional Local Binds
    --send_command('bind @t gs c cycle treasuremode')
    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 @p gs c toggle Pause')
	
    send_command('bind ` tc nearest')
	
	send_command('bind !F1 exec war/sb.txt')
    send_command('bind !F2 exec war/leaden.txt')
    send_command('bind !F3 exec war/remedy.txt')
    send_command('bind !F4 exec war/panacea.txt')
    send_command('bind !F5 exec war/speed.txt')
    send_command('bind !F6 exec war/doubleup.txt')
    send_command('bind !F7 exec war/sam.txt')
    send_command('bind !F11 exec war/sneak.txt')
    send_command('bind !F12 exec war/invis.txt')
	update_combat_form()
end

-------------------------------------------------------------------------------------------------------------------
-- Called when this job file is unloaded (eg: job change)
-------------------------------------------------------------------------------------------------------------------

function file_unload()

    send_command('unbind !F1')
    send_command('unbind !F2')
    send_command('unbind !F3')
    send_command('unbind !F4')
    send_command('unbind !F5')
    send_command('unbind !F6')
    send_command('unbind !F7')
    send_command('unbind !F11')
    send_command('unbind !F12')

    send_command('unbind `')
	
    send_command('unbind @t')
    send_command('unbind @w')
    send_command('unbind @c')
    send_command('unbind @e')
    send_command('unbind @r')
	send_command('unbind @p')
end

-------------------------------------------------------------------------------------------------------------------
-- Define sets and vars used by this job file.
-------------------------------------------------------------------------------------------------------------------

function init_gear_sets()
    sets.WSDayBonus      					= { head = "Gavialis Helm" }
    sets.TreasureHunter 					= { ammo = "Per. Lucky Egg", waist = "Chaac Belt" }
    sets.reive 								= { neck = "Ygnas's Resolve +1"}
    sets.Organizer 							= { }

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

	-- Job Abilities
    --sets.precast.JA['Blood Rage'] 			= { body = WAREmpy.Body }
    sets.precast.JA['Provoke'] 				= set_combine(sets.TreasureHunter)
    sets.precast.JA['Berserk'] 				= { main="Instigator", body = "Pumm. Lorica +3", feet = "Agoge Calligae +3", back="Cichol's Mantle"}
    sets.precast.JA['Warcry'] 				= { head = "Agoge Mask +3" }
    sets.precast.JA['Mighty Strikes'] 		= { hands = "Agoge Mufflers"}
    sets.precast.JA['Retaliation'] 			= { feet = "Boii Calligae +3" }
    sets.precast.JA['Aggressor'] 			= { main="Instigator", body = "Agoge Lorica +3", feet = "Pummeler's Mask +3", back="Cichol's Mantle"}
    sets.precast.JA['Restraint'] 			= { hands = "Boii Mufflers +3"}
    sets.precast.JA['BLood Rage'] 			= { body = "Boii Lorica +3"}
    --sets.precast.JA['Warrior\'s Charge'] 	= { legs = WARRelic.Legs }
	sets.precast.JA['Tomahawk']				= { ammo = "Thr. Tomahawk", feet = "Agoge Calligae +3" }
    sets.precast.JA['Jump'] 				= { hands = "Crusher Gauntlets", feet = "Ostro Greaves"}
    sets.precast.JA['High Jump'] 			= { hands = "Crusher Gauntlets", feet = "Ostro Greaves"}
    -- Waltz (CHR and VIT)
    sets.precast.Waltz = { }
 
	-- Fast Cast
    sets.precast.FC = {
	ammo="Sapience Orb",
	head="Sakpata's Helm",
    body="Sacro Breastplate",
    hands="Leyline Gloves",
    neck="Orunmila's Torque",
    left_ear="Etiolation Earring",
    right_ear="Loquac. Earring",
    right_ring="Weather. Ring",
    right_ring="Prolix Ring",
	
	}
	
	-- Utsusemi 
    sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, { neck="Magoraga Beads" })

    -- Ranged Attacks
	sets.precast.RA = { }

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

    sets.midcast.FastRecast = { }
   
    -- Utsusemi
    sets.midcast.Utsusemi = { }

    -- Ranged Attacks
    sets.midcast.RA = { }

-------------------------------------------------------------------------------------------------------------------
-- Weaponskill Sets
-------------------------------------------------------------------------------------------------------------------

    -- General Set
    sets.precast.WS = {
    ammo="Knobkierrie",
    head="Agoge Mask +3", 
    body="Nyame Mail",
	hands ="Boii Mufflers +3",
	legs="Boii Cuisses +3",		
    feet="Nyame Sollerets",
    neck="War. Beads +2",
    waist={ name="Sailfi Belt +1", augments={'Path: A',}},
    left_ear="Thrud Earring",
    right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
    left_ring="Cornelia's Ring",
    right_ring="Epaminondas's Ring",
    back={ name="Cichol's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}},
	}
    sets.precast.WS.Acc = set_combine(sets.precast.WS, {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	--Club
	sets.precast.WS['Judgement'] = set_combine(sets.precast.WS, { })
    sets.precast.WS['Judgement'].Acc = set_combine(sets.precast.WS['Judgement'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})

	--Great Sword	
    sets.precast.WS['Resolution'] = set_combine(sets.precast.WS, { 
	ammo="Seeth. Bomblet +1",
    head="Sakpata's Helm", 
    body="Tatena. Harama. +1",
	neck="Fotia Gorget",
    left_ear="Lugra Earring +1",
	waist="Fotia Belt",
	})
    sets.precast.WS['Resolution'].Acc = set_combine(sets.precast.WS['Resolution'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	--Great Axe
    sets.precast.WS['Upheaval'] = set_combine(sets.precast.WS, {
    right_ring="Gelatinous Ring +1",
    back={ name="Cichol's Mantle", augments={'VIT+20','Accuracy+20 Attack+20','VIT+10','Weapon skill damage +10%',}},
	})
    sets.precast.WS['Upheaval'].Acc = set_combine(sets.precast.WS['Upheaval'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	
	sets.precast.WS['Full Break'] = set_combine(sets.precast.WS, {
	neck="Null Loop",
	waist="Null Belt",
	ear1="Digni. Earring",
	ear2="Hermetic Earring",
	ring1="Metamor. Ring +1",
	ring2="Stikini Ring +1",
	ammo="Pemphredo Tathlum",
	back="Null Shawl",
	})
	sets.precast.WS['Full Break'].Acc = set_combine(sets.precast.WS['Full Break'], {
	})
	sets.precast.WS['Fell Cleave'] = set_combine(sets.precast.WS, {
	ammo="Per. Lucky Egg",
    waist="Chaac Belt",
	hands="Volte Bracers",
	})
	sets.precast.WS['Fell Cleave'].Acc = set_combine(sets.precast.WS['Fell Cleave'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	
    sets.precast.WS['Ukko\'s Fury'] = set_combine(sets.precast.WS, { 
	ammo="Yetshila", 
	feet="Boii Calligae +3"
	})
    sets.precast.WS['Ukko\'s Fury'].Acc = set_combine(sets.precast.WS['Ukko\'s Fury'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	--Polearm
    sets.precast.WS['Stardiver'] = set_combine(sets.precast.WS, { })
    sets.precast.WS['Stardiver'].Acc = set_combine(sets.precast.WS['Stardiver'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	
    sets.precast.WS['Impulse Drive'] = set_combine(sets.precast.WS, { })
    sets.precast.WS['Impulse Drive'].Acc = set_combine(sets.precast.WS['Impulse Drive'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	
	--Sword
    sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS, { })
    sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	
    sets.precast.WS['Sanguine Blade'] = set_combine(sets.precast.WS, { 
	ammo="Pemphredo Tathlum",
    head="Pixie Hairpin +1",
    body="Sacro Breastplate",
	hands="Nyame Gauntlets",
	legs="Nyame Flanchard",
	feet="Nyame Sollerets",
    neck="Sibyl Scarf",
    waist="Orpheus's Sash",
    left_ear="Hermetic Earring",
    right_ear="Friomisi Earring",
    left_ring="Cornelia's Ring",
    right_ring="Archon Ring",
	back="Izdubar Mantle",
	})

    sets.precast.WS['Requiscat'] = set_combine(sets.precast.WS, { })
    sets.precast.WS['Requiscat'].Acc = set_combine(sets.precast.WS['Requiscat'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
	--Axe
    sets.precast.WS['Decimation'] = set_combine(sets.precast.WS, {
	--war base DA: 33
	--sub="Sangarius +1", --3
	ammo="Coiste Bodhar", --3
    head="Sakpata's Helm", --5
    body="Sakpata's Breastplate", --8
    hands="Sakpata's Gauntlets", --6
    legs="Pumm. Cuisses +3", --11
    feet="Pumm. Calligae +3", --9
    neck="Fotia Gorget", 
    waist="Fotia Belt",
    left_ear="Schere Earring", --6
    right_ear="Boii Earring +1", --8
    left_ring="Niqmaddu Ring", 
    right_ring="Hetairoi Ring",
    back={ name="Cichol's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
	})
    sets.precast.WS['Decimation'].Acc = set_combine(sets.precast.WS['Decimation'], {
	neck="Fotia Gorget",
	waist="Fotia Belt",
	})
    sets.precast.WS['Cloudsplitter'] = set_combine(sets.precast.WS, { })
    sets.precast.WS['Cloudsplitter'].Acc = set_combine(sets.precast.WS['Cloudsplitter'], { })

------------------------------------------------------------------------------------------------------------------- 
-- Idle sets
-------------------------------------------------------------------------------------------------------------------

    sets.idle.Town = { 
	--range="Trollbane",
	ammo="Crepuscular Pebble",
	head="Nyame Helm",
    body="Nyame Mail",
    hands="Nyame Gauntlets",
	legs="Nyame Flanchard",		
    feet="Nyame Sollerets",
    neck="Null Loop",
    waist="Null Belt",
    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="Null Shawl",
	}
    
	sets.precast.JA['Provoke'] = set_combine(sets.idle.Field, { 	
	ammo="Per. Lucky Egg",
    waist="Chaac Belt",
	hands="Volte Bracers",
	})

    sets.idle.Field = set_combine(sets.idle.Town, { })

    sets.idle.Regen = set_combine(sets.idle.Field, { })
 
    -- Twilight goes here
	sets.idle.Weak = set_combine(sets.idle.Field, { })

-------------------------------------------------------------------------------------------------------------------
-- Defense sets
-------------------------------------------------------------------------------------------------------------------

    sets.defense.PDT = { }
	
    sets.defense.Reraise = sets.idle.Weak
 
    sets.defense.MDT = set_combine(sets.defense.PDT, { })

-------------------------------------------------------------------------------------------------------------------
-- Engaged Sets
-------------------------------------------------------------------------------------------------------------------
 -- war default DA rate 33% 68
    sets.engaged = {
    ammo="Coiste Bodhar", --3
	head="Boii Mask +3", --7
    body="Boii Lorica +3", 
    hands="Sakpata's Gauntlets", --6
    legs="Sakpata's Cuisses", --7
    --legs="Pumm. Cuisses +3", --11
    feet="Pumm. Calligae +3", --9
    neck="War. Beads +2", --7
	waist="Sailfi Belt +1", --5
    left_ear="Schere Earring", --6
    right_ear="Boii Earring +1", --8
	left_ring="Niqmaddu Ring",
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
	back={ name="Cichol's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
	}	
    sets.engaged.Acc = set_combine(sets.engaged, { 
    --neck="Null Loop", 
	waist="Ioskeha Belt +1", --9
    left_ring={name="Moonlight Ring", bag="wardrobe5"},
    right_ring={name="Moonlight Ring", bag="wardrobe6"},
	back="Null Shawl", --7
	})
    sets.engaged.MEVA = set_combine(sets.engaged, { 
    ammo="Coiste Bodhar", --3
	head="Sakpata's Helm", --5
    body="Sakpata's Breastplate", --8
    hands="Sakpata's Gauntlets", --6
    legs="Sakpata's Cuisses", --7
	feet="Sakpata's Leggings", --4
    neck="War. Beads +2", --7
	waist="Sailfi Belt +1", --5
    left_ear="Schere Earring", --6
    right_ear="Boii Earring +1", --8
	left_ring="Niqmaddu Ring",
    right_ring={name="Chirich Ring +1", bag="wardrobe3"},
	back={ name="Cichol's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10','Phys. dmg. taken-10%',}},
	})
	
    sets.engaged.AM = set_combine(sets.engaged, { 
	})
	
	sets.engaged.DW = set_combine(sets.engaged, {
		hands={ name="Emi. Gauntlets +1", augments={'Accuracy+25','"Dual Wield"+6','Pet: Accuracy+25',}}, --6
		neck="War. Beads +2", --7
		left_ear="Suppanomimi", --5
		left_ring={name="Moonlight Ring", bag="wardrobe6"},
	})
	
    sets.engaged.MidAcc = set_combine(sets.engaged, { })
    sets.engaged.FullAcc = set_combine(sets.engaged.MidAcc, { })
	sets.engaged.Reraise = set_combine(sets.engaged, { })

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

	sets.Hybrid = { }
    sets.Hybrid.MidAcc = { }
    sets.Hybrid.FullAcc = { }

    sets.engaged.Hybrid = sets.Hybrid
    sets.engaged.MidAcc.Hybrid = sets.Hybrid.MidAcc
    sets.engaged.FullAcc.Hybrid = sets.Hybrid.FullAcc
	
-------------------------------------------------------------------------------------------------------------------
-- Utility Sets
-------------------------------------------------------------------------------------------------------------------
    
	--Buffs
	sets.buff.Berserk 		= { }
    sets.buff.Retaliation 	= { }
	sets.MS = {ammo="Yetshila", feet="Boii Calligae +3"}
	
	--Debuffs
	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.EmergencyDT = { }
 
    sets.Kiting 	 = { feet="Hermes' Sandals" }
 
    sets.Reraise 	 = { }
	
    sets.resting 	 = { }
	
	sets.CP 		 = { }

-------------------------------------------------------------------------------------------------------------------	
-- Weapon Sets
-------------------------------------------------------------------------------------------------------------------
	sets.sword = {main="Naegling", sub="Blurred Shield +1"}
	sets.axe = {main="Dolichenus", sub="Sangarius +1"}
	sets.gaxe = {main="Chango", sub="Utu Grip"}
    sets.pole = {main="Shining one", sub="Utu Grip"}
	sets.club = {main="Loxotic Mace +1", sub="Blurred Shield +1"}
	sets.trial = {main="Axe of Trials", sub="Utu Grip"}
end

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

function job_precast(spell, action, spellMap, eventArgs)
end

 
function job_post_precast(spell, action, spellMap, eventArgs)
    -- Make sure abilities using head gear don't swap 
	if spell.type:lower() == 'weaponskill' then
        -- handle Gavialis Helm
        --if is_sc_element_today(spell) then
            --if wsList:contains(spell.english) then
                -- do nothing
            --else
                --equip(sets.WSDayBonus)
            --end
        --end
        -- Use SOA neck piece for WS in rieves
		if buffactive['Mighty Strikes'] then
			equip(sets.MS)
		end 
        if buffactive['Reive Mark'] then
            equip(sets.reive)
        end
    end
end

-- Check if we need Gavialis Helm
 function is_sc_element_today(spell)
    if spell.type ~= 'WeaponSkill' then
        return
    end

   local weaponskill_elements = S{}:
    union(skillchain_elements[spell.skillchain_a]):
    union(skillchain_elements[spell.skillchain_b]):
    union(skillchain_elements[spell.skillchain_c])

    if weaponskill_elements:contains(world.day_element) then
        return true
    else
        return false
    end

end

function job_midcast(spell, action, spellMap, eventArgs)
end
 
-- Run after the default midcast() is done.
function job_post_midcast(spell, action, spellMap, eventArgs)
    if (state.HybridMode.current == 'Hybrid' and state.PhysicalDefenseMode.current == 'Reraise') then
        equip(sets.Reraise)
    end
    if state.Buff.Berserk and not state.Buff.Retaliation then
        equip(sets.buff.Berserk)
    end
end
 
function job_aftercast(spell, action, spellMap, eventArgs)
    if state.Buff[spell.english] ~= nil then
        state.Buff[spell.english] = not spell.interrupted or buffactive[spell.english]
    end
    if player.status ~= 'Engaged' and state.WeaponLock.value == false then
        check_weaponset()
    end
end

function job_post_aftercast(spell, action, spellMap, eventArgs)
end

-------------------------------------------------------------------------------------------------------------------
-- Customization hooks for idle and melee sets, after they've been automatically constructed.
-------------------------------------------------------------------------------------------------------------------

function job_handle_equipping_gear(status, eventArgs)
    check_gear()
	check_moving()
    update_combat_form()
end

-- Modify the default idle set after it was constructed.
function customize_idle_set(idleSet)
    if state.Auto_Kite.value == true then
       idleSet = set_combine(idleSet, sets.Kiting)
    end
    return idleSet
end
  
function job_self_command(cmdParams, eventArgs)
    gearinfo(cmdParams, eventArgs)
end

-- Gearinfo Hooks 
function gearinfo(cmdParams, eventArgs)
    if cmdParams[1] == 'gearinfo' then
        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 check_moving()
    if state.DefenseMode.value == 'None'  and state.Kiting.value == false then
        if state.Auto_Kite.value == false and moving then
            state.Auto_Kite:set(true)
        elseif state.Auto_Kite.value == true and moving == false then
            state.Auto_Kite:set(false)
        end
    end
end

-- Modify the default melee set after it was constructed.
function customize_melee_set(meleeSet)
	if buffactive['Terror'] or buffactive['Petrification'] or buffactive['Stun'] or buffactive['Sleep']  then
		meleeSet = sets.EmergencyDT
	end
    if state.TreasureMode.value == 'Fulltime' then
        meleeSet = set_combine(meleeSet, sets.TreasureHunter)
    end
	if state.Pause.current == 'on' then
		meleeSet = { } --leave this empty
		state.Auto_Kite:set(false)
	end
    if state.CP.current == 'on' then
        meleeSet = set_combine(meleeSet, sets.CP)
    end
    if state.Buff.Berserk and not state.Buff.Retaliation then
    	meleeSet = set_combine(meleeSet, sets.buff.Berserk)
    end
    check_weaponset()
    return meleeSet
end
 
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

-------------------------------------------------------------------------------------------------------------------
-- General hooks for other events.
-------------------------------------------------------------------------------------------------------------------
 
-- Called when the player's status changes.
function job_status_change(newStatus, oldStatus, eventArgs)
    if newStatus == "Engaged" then
        if buffactive.Berserk and not state.Buff.Retaliation then
            equip(sets.buff.Berserk)
        end
    end
end
 
-- Called when a player gains or loses a buff.
function job_buff_change(buff, gain)
    if state.Buff[buff] ~= nil then
        handle_equipping_gear(player.status)
    end
    if buff == "Berserk" then
        if gain and not buffactive['Retaliation'] then
            equip(sets.buff.Berserk)
        else
            if not midaction() then
                handle_equipping_gear(player.status)
            end
        end
    end
	if buff == "doom" then
                if gain then           
                        equip(sets.buff.Doom)
                        send_command('@input /p Doomed, please Cursna.')
                        send_command('@input /item "Holy Water" <me>')					
                        disable('ring1','ring2','waist')
                elseif not gain and not player.status == "Dead" and not player.status == "Engaged Dead" then
                        enable('ring1','ring2','waist')
                        send_command('input /p Doom removed, Thank you.')
                        handle_equipping_gear(player.status)
                else
                        enable('ring1','ring2','waist')
                        send_command('input /p '..player.name..' is no longer Doom Thank you !')
                end
    end
end
 
function job_state_change(stateField, newValue, oldValue)
    if state.WeaponLock.value == true then
        disable('main','sub')
    else
        enable('main','sub')
    end

    check_weaponset()
end 

-------------------------------------------------------------------------------------------------------------------
-- User code that supplements self-commands.
-------------------------------------------------------------------------------------------------------------------


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

function update_combat_form()
    if player.sub_job == 'NIN' and state.WeaponSet.value == "axe" then
		state.CombatForm:set('DW')
	else
        state.CombatForm:reset()
	end
end
-------------------------------------------------------------------------------------------------------------------
-- Utility functions specific to this job.
-------------------------------------------------------------------------------------------------------------------

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

function check_weaponset()
    equip(sets[state.WeaponSet.current])
end

windower.register_event('zone change',
    function()
        if no_swap_gear:contains(player.equipment.left_ring) then
            enable("ring1")
            equip(sets.idle.Town)
        end
        if no_swap_gear:contains(player.equipment.right_ring) then
            enable("ring2")
            equip(sets.idle.Town)
        end
    end
)
First Page 2 3 ... 186 187 188