THF Lua

Eorzea Time
 
 
 
Language: JP EN FR DE
users online
Forum » FFXI » Jobs » Thief » THF lua
THF lua
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 00:44:44
Link | Quote | Reply
 
I cannot figure out what I have done wrong in my lua, but I'm getting very frustrated. I have zero experience with coding or whatever, so I just copied and pasted what I thought would be a good lua for me to use, editing the various gear sets to what gear I have of course. When I load it, it is saying that it is loading successfully, but then gives me some "autofood" errors. Then when I engage, it does not swap to my engaged set, but gives me another error, referencing "ambush mode", which i see nowhere in the lua I have. I am completely clueless, and extremely frustrated. Can anyone please help?
 Asura.Eiryl
Offline
Server: Asura
Game: FFXI
user: Eiryl
By Asura.Eiryl 2019-04-11 01:53:31
Link | Quote | Reply
 
Can't really help, unless they know whos lua you copied. Or paste it yourself (use the code tag so it's not huge)
[+]
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 02:02:06
Link | Quote | Reply
 
https://github.com/Kinematics/GearSwap-Jobs/blob/master/THF.lua

Sorry, not sure what you mean by code tag, I'm really not very computer savvy. I messed with it some more and here are the issues I am having:

Keep getting some "autofood" error

Engaging won't put me in my engaged set, but rather my idle + TH pieces

Engaging also says somethng about "ambush mode", whatever the hell that is

Even after TH procs, will not put me in my engaged set

Won't switch to WS sets

I had a couple of ls folks try to help and have me delete various lines, so what I have now with my actual sets is so doctored I'm probably gonna have to start from scratch again. I just want to be able to switch between sets, and have control over when I put on my TH gear rather than it being automatic. Assuming all of that is even possible.
 Asura.Eiryl
Offline
Server: Asura
Game: FFXI
user: Eiryl
By Asura.Eiryl 2019-04-11 02:05:47
Link | Quote | Reply
 
Monten's gearswaps don't do ambush mode or autofood. His are very barebones.

If a gearswap file throws an error it won't function at all.

(monten, is kinematics )

Take your notepad++ file, copy and past it using this: [code ][ /code] (no spaces)
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 10:38:07
Link | Quote | Reply
 
Code
function user_setup()
    state.OffenseMode:options('Normal', 'Acc', 'Mod')
    state.HybridMode:options('Normal', 'Acc', 'PDT', 'TreasureHunter')
    state.RangedMode:options('Normal', 'Acc')
    state.WeaponskillMode:options('Normal', 'Acc', 'Mod')
    state.PhysicalDefenseMode:options('Evasion', 'PDT')


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

    select_default_macro_book()
end

-- Called when this job file is unloaded (eg: job change)
function user_unload()
    send_command('unbind ^`')
    send_command('unbind !-')
end

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

    sets.TreasureHunter = {hands="Plunderer's Armlets +3", waist="Chaac Belt"}
    sets.ExtraRegen = {head="Ocelomeh Headpiece +1"}
    sets.Kiting = {feet="Skadi's Jambeaux +1"}

    sets.buff['Sneak Attack'] = {ammo="Yetshila +1",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body="Meg. Cuirie +2",
    hands="Mummu Wrists +2",
    legs="Pill. Culottes +2",
    feet={ name="Plun. Poulaines +3", augments={'Enhances "Assassin\'s Charge" effect',}},
    neck="Asn. Gorget +2",
    waist="Chiner's Belt +1",
    left_ear="Brutal Earring",
    right_ear="Sherida Earring",
    left_ring="Regal Ring",
    right_ring="Hetairoi Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Crit.hit rate+10',}},}

    sets.buff['Trick Attack'] = {ammo="Yetshila +1",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body={ name="Plunderer's Vest +2", augments={'Enhances "Ambush" effect',}},
    hands="Mummu Wrists +2",
    legs="Pill. Culottes +2",
    feet={ name="Plun. Poulaines +3", augments={'Enhances "Assassin\'s Charge" effect',}},
    neck="Asn. Gorget +2",
    waist="Chiner's Belt +1",
    left_ear="Brutal Earring",
    right_ear="Sherida Earring",
    left_ring="Regal Ring",
    right_ring="Hetairoi Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Crit.hit rate+10',}},}

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


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

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

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


    -- Waltz set (chr and vit)
    sets.precast.Waltz = {ammo="Sonia's Plectrum",
        head="Whirlpool Mask",
        body="Pillager's Vest +1",hands="Pillager's Armlets +1",ring1="Asklepian Ring",
        back="Iximulew Cape",waist="Caudata Belt",legs="Pillager's Culottes +1",feet="Plunderer's Poulaines +1"}

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


    -- Fast cast sets for spells
    sets.precast.FC = {head="Haruspex Hat",ear2="Loquacious Earring",hands="Thaumas Gloves",ring1="Prolix Ring",legs="Enif Cosciales"}

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


    -- Ranged snapshot gear
    sets.precast.RA = {head="Aurore Beret",hands="Iuitl Wristbands",legs="Nahtirah Trousers",feet="Wurrukatte Boots"}


    -- Weaponskill sets

    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {ammo="Jukukik Feather",
    head={ name="Plun. Bonnet +2", augments={'Enhances "Aura Steal" effect',}},
    body={ name="Plunderer's Vest +2", augments={'Enhances "Ambush" effect',}},
    hands="Meg. Gloves +2",
    legs={ name="Plun. Culottes +3", augments={'Enhances "Feint" effect',}},
    feet={ name="Plun. Poulaines +3", augments={'Enhances "Assassin\'s Charge" effect',}},
    neck="Asn. Gorget +2",
    waist="Grunfeld Rope",
    left_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    right_ear="Sherida Earring",
    left_ring="Regal Ring",
    right_ring="Ilabrat Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Damage taken-5%',}},}
    sets.precast.WS.Acc = set_combine(sets.precast.WS, {ammo="Seething bomblet +1"})

    -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
    sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS, {ring1="Stormsoul Ring",legs="Nahtirah Trousers"})
    sets.precast.WS['Exenterator'].Acc = set_combine(sets.precast.WS['Exenterator'], {ammo="Honed Tathlum", back="Letalis Mantle"})
    sets.precast.WS['Exenterator'].Mod = set_combine(sets.precast.WS['Exenterator'], {head="Felistris Mask",waist=gear.ElementalBelt})
    sets.precast.WS['Exenterator'].SA = set_combine(sets.precast.WS['Exenterator'].Mod, {ammo="Qirmiz Tathlum"})
    sets.precast.WS['Exenterator'].TA = set_combine(sets.precast.WS['Exenterator'].Mod, {ammo="Qirmiz Tathlum"})
    sets.precast.WS['Exenterator'].SATA = set_combine(sets.precast.WS['Exenterator'].Mod, {ammo="Qirmiz Tathlum"})

    sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS, {ammo="Yetshila +1",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body={ name="Plunderer's Vest +2", augments={'Enhances "Ambush" effect',}},
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs="Pill. Culottes +2",
    feet={ name="Lustra. Leggings +1", augments={'HP+65','STR+15','DEX+15',}},
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    right_ear="Sherida Earring",
    left_ring="Begrudging Ring",
    right_ring="Regal Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Crit.hit rate+10',}},})
    sets.precast.WS['Evisceration'].Acc = set_combine(sets.precast.WS['Evisceration'], {ammo="Honed Tathlum", back="Letalis Mantle"})
    sets.precast.WS['Evisceration'].Mod = set_combine(sets.precast.WS['Evisceration'], {back="Kayapa Cape",waist=gear.ElementalBelt})
    sets.precast.WS['Evisceration'].SA = set_combine(sets.precast.WS['Evisceration'].Mod, {})
    sets.precast.WS['Evisceration'].TA = set_combine(sets.precast.WS['Evisceration'].Mod, {})
    sets.precast.WS['Evisceration'].SATA = set_combine(sets.precast.WS['Evisceration'].Mod, {})

    sets.precast.WS["Rudra's Storm"] = set_combine(sets.precast.WS, {})
    sets.precast.WS["Rudra's Storm"].Acc = set_combine(sets.precast.WS["Rudra's Storm"], {ammo="Honed Tathlum", back="Letalis Mantle"})
    sets.precast.WS["Rudra's Storm"].Mod = set_combine(sets.precast.WS["Rudra's Storm"], {back="Kayapa Cape",waist=gear.ElementalBelt})
    sets.precast.WS["Rudra's Storm"].SA = set_combine(sets.precast.WS["Rudra's Storm"].Mod, {ammo="Qirmiz Tathlum",
        body="Pillager's Vest +1",legs="Pillager's Culottes +1"})
    sets.precast.WS["Rudra's Storm"].TA = set_combine(sets.precast.WS["Rudra's Storm"].Mod, {ammo="Qirmiz Tathlum",
        body="Pillager's Vest +1",legs="Pillager's Culottes +1"})
    sets.precast.WS["Rudra's Storm"].SATA = set_combine(sets.precast.WS["Rudra's Storm"].Mod, {ammo="Qirmiz Tathlum",
        body="Pillager's Vest +1",legs="Pillager's Culottes +1"})
      
    sets.precast.WS['Aeolian Edge'] = {ammo="Seeth. Bomblet +1",
    head={ name="Herculean Helm", augments={'Rng.Atk.+10','Weapon skill damage +5%','DEX+5','Rng.Acc.+9',}},
    body={ name="Herculean Vest", augments={'Mag. Acc.+17 "Mag.Atk.Bns."+17','Enmity-2','MND+3','Mag. Acc.+3','"Mag.Atk.Bns."+12',}},
    hands="Meg. Gloves +2",
    legs={ name="Herculean Trousers", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','Weapon skill damage +1%','"Mag.Atk.Bns."+15',}},
    feet={ name="Herculean Boots", augments={'Accuracy+30','"Triple Atk."+4',}},
    neck="Sanctity Necklace",
    waist="Eschan Stone",
    left_ear="Friomisi Earring",
    right_ear={ name="Moonshade Earring", augments={'Accuracy+4','TP Bonus +250',}},
    left_ring="Dingir Ring",
    right_ring="Ilabrat Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%',}},}

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


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

    sets.midcast.FastRecast = {
        head="Whirlpool Mask",ear2="Loquacious Earring",
        body="Pillager's Vest +1",hands="Pillager's Armlets +1",
        back="Canny Cape",legs="Kaabnax Trousers",feet="Iuitl Gaiters +1"}

    -- Specific spells
    sets.midcast.Utsusemi = {
        head="Whirlpool Mask",neck="Ej Necklace",ear2="Loquacious Earring",
        body="Pillager's Vest +1",hands="Pillager's Armlets +1",ring1="Beeline Ring",
        back="Canny Cape",legs="Kaabnax Trousers",feet="Iuitl Gaiters +1"}

    -- Ranged gear
    sets.midcast.RA = {
        head="Whirlpool Mask",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
        body="Iuitl Vest",hands="Iuitl Wristbands",ring1="Beeline Ring",ring2="Hajduk Ring",
        back="Libeccio Mantle",waist="Aquiline Belt",legs="Nahtirah Trousers",feet="Iuitl Gaiters +1"}

    sets.midcast.RA.Acc = {
        head="Pillager's Bonnet +1",neck="Ej Necklace",ear1="Clearview Earring",ear2="Volley Earring",
        body="Iuitl Vest",hands="Buremte Gloves",ring1="Beeline Ring",ring2="Hajduk Ring",
        back="Libeccio Mantle",waist="Aquiline Belt",legs="Thurandaut Tights +1",feet="Pillager's Poulaines +1"}


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

    -- Resting sets
    sets.resting = {head="Ocelomeh Headpiece +1",neck="Wiglen Gorget",
        ring1="Sheltered Ring",ring2="Paguroidea Ring"}


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

    sets.idle = {ammo="Staunch Tathlum",
    head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Fajin Boots",
    neck="Loricate Torque +1",
    waist="Flume Belt +1",
    left_ear="Infused Earring",
    right_ear="Genmei Earring",
    left_ring="Defending Ring",
    right_ring="Moonbeam Ring",
    back="Moonbeam Cape",}

    sets.idle.Town = {ammo="Staunch Tathlum",
    head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Fajin Boots",
    neck="Loricate Torque +1",
    waist="Flume Belt +1",
    left_ear="Infused Earring",
    right_ear="Genmei Earring",
    left_ring="Defending Ring",
    right_ring="Moonbeam Ring",
    back="Moonbeam Cape",}

    sets.idle.Weak = {ammo="Staunch Tathlum",
    head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Fajin Boots",
    neck="Loricate Torque +1",
    waist="Flume Belt +1",
    left_ear="Infused Earring",
    right_ear="Genmei Earring",
    left_ring="Defending Ring",
    right_ring="Moonbeam Ring",
    back="Moonbeam Cape",}


    -- Defense sets

    sets.defense.Evasion = {
        head="Pillager's Bonnet +1",neck="Ej Necklace",
        body="Qaaxo Harness",hands="Pillager's Armlets +1",ring1="Defending Ring",ring2="Beeline Ring",
        back="Canny Cape",waist="Flume Belt",legs="Kaabnax Trousers",feet="Iuitl Gaiters +1"}

    sets.defense.PDT = {ammo="Staunch Tathlum",
    head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Meg. Jam. +2",
    neck="Asn. Gorget +2",
    waist="Chiner's Belt +1",
    left_ear="Brutal Earring",
    right_ear="Sherida Earring",
    left_ring="Moonbeam Ring",
    right_ring="Moonbeam Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Damage taken-5%',}},}

    sets.defense.MDT = {ammo="Demonry Stone",
        head="Pillager's Bonnet +1",neck="Twilight Torque",
        body="Pillager's Vest +1",hands="Pillager's Armlets +1",ring1="Defending Ring",ring2="Shadow Ring",
        back="Engulfer Cape",waist="Flume Belt",legs="Pillager's Culottes +1",feet="Iuitl Gaiters +1"}


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

    -- Normal melee group
    sets.engaged = {ammo="Ginsen",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body={ name="Adhemar Jacket +1", augments={'STR+12','DEX+12','Attack+20',}},
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    legs="Pill. Culottes +2",
    feet={ name="Plun. Poulaines +3", augments={'Enhances "Assassin\'s Charge" effect',}},
    neck="Asn. Gorget +2",
    waist="Chiner's Belt +1",
    left_ear="Telos Earring",
    right_ear="Sherida Earring",
    left_ring="Epona's Ring",
    right_ring="Hetairoi Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Damage taken-5%',}},}
	
    sets.engaged.Acc = {ammo="Yetshila +1",
    head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    body="Mummu Jacket +2",
    hands="Mummu Wrists +2",
    legs="Mummu Kecks +1",
    feet="Mummu Gamash. +1",
    neck="Asn. Gorget +2",
    waist="Reiki Yotai",
    left_ear="Suppanomimi",
    right_ear="Sherida Earring",
    left_ring="Epona's Ring",
    right_ring="Hetairoi Ring",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Crit.hit rate+10',}},}
        
   
end


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


This is what I've stripped it down to trying to find the issue. Whatever I did took out the autofood error, but it still keeps saying something about ambush mode every time i am about to swing a weapon, keeps me in idle mode + TH gear the entire time I am engaged, and does not swap to my ws sets when it should.
Offline
Posts: 634
By zaxtiss 2019-04-11 10:52:57
Link | Quote | Reply
 
does it say what line is causing the errors?
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 10:56:33
Link | Quote | Reply
 
No the line number is never coming up, which made it that much more confusing for me.
Offline
Posts: 634
By zaxtiss 2019-04-11 11:26:04
Link | Quote | Reply
 
hmmmm personally i'd swap to a diff lua. i was never a big fan of motes lua's
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 11:37:51
Link | Quote | Reply
 
Do you know of any good thief one's out there? I just googled it and that was one I found that I could just copy and paste.
 Asura.Eiryl
Offline
Server: Asura
Game: FFXI
user: Eiryl
By Asura.Eiryl 2019-04-11 12:30:32
Link | Quote | Reply
 
lol you took out literally all the rules that make it function no wonder it doesn't work

It doesn't "just put on gear" It has to know "WHY" it needs to put on gear.

All of this stuff isn't optional broski. Well, the Aeolean edge and TH are "optional" I suppose.
Code
-------------------------------------------------------------------------------------------------------------------
-- Job-specific hooks for standard casting events.
-------------------------------------------------------------------------------------------------------------------

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

-- Run after the general midcast() set is constructed.
function job_post_midcast(spell, action, spellMap, eventArgs)
    if state.TreasureMode.value ~= 'None' and spell.action_type == 'Ranged Attack' then
        equip(sets.TreasureHunter)
    end
end

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
    -- Weaponskills wipe SATA/Feint.  Turn those state vars off before default gearing is attempted.
    if spell.type == 'WeaponSkill' and not spell.interrupted then
        state.Buff['Sneak Attack'] = false
        state.Buff['Trick Attack'] = false
        state.Buff['Feint'] = false
    end
end

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

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

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


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

function get_custom_wsmode(spell, spellMap, defaut_wsmode)
    local wsmode

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

    return wsmode
end


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

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


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

    return idleSet
end


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

    return meleeSet
end


-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
    th_update(cmdParams, eventArgs)
end

-- Function to display the current relevant user state when doing an update.
-- Return true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
    local msg = 'Melee'
    
    if state.CombatForm.has_value then
        msg = msg .. ' (' .. state.CombatForm.value .. ')'
    end
    
    msg = msg .. ': '
    
    msg = msg .. state.OffenseMode.value
    if state.HybridMode.value ~= 'Normal' then
        msg = msg .. '/' .. state.HybridMode.value
    end
    msg = msg .. ', WS: ' .. state.WeaponskillMode.value
    
    if state.DefenseMode.value ~= 'None' then
        msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
    end
    
    if state.Kiting.value == true then
        msg = msg .. ', Kiting'
    end

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

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

    add_to_chat(122, msg)

    eventArgs.handled = true
end

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

-- State buff checks that will equip buff gear and mark the event as handled.
function check_buff(buff_name, eventArgs)
    if state.Buff[buff_name] then
        equip(sets.buff[buff_name] or {})
        if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
            equip(sets.TreasureHunter)
        end
        eventArgs.handled = true
    end
end


-- Check for various actions that we've specified in user code as being used with TH gear.
-- This will only ever be called if TreasureMode is not 'None'.
-- Category and Param are as specified in the action event packet.
function th_action_check(category, param)
    if category == 2 or -- any ranged attack
        --category == 4 or -- any magic action
        (category == 3 and param == 30) or -- Aeolian Edge
        (category == 6 and info.default_ja_ids:contains(param)) or -- Provoke, Animated Flourish
        (category == 14 and info.default_u_ja_ids:contains(param)) -- Quick/Box/Stutter Step, Desperate/Violent Flourish
        then return true
    end
end
[+]
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 13:43:15
Link | Quote | Reply
 
Problem is it didn't work when the functions were in there either. I'm not sure if something else is messing it up outside of the THF specific lua or what, but it wasn't working at all. All of that stuff that you put, do I add that to what I already had? I honestly have no clue exactly what I need to do at this point.
 Asura.Eiryl
Offline
Server: Asura
Game: FFXI
user: Eiryl
By Asura.Eiryl 2019-04-11 13:46:37
Link | Quote | Reply
 
If you copy and paste kinematics lua and don't start randomly deleting ***that you have no idea how it works... it will work. I use it. I deleted the aeolean edge rule.

The whole thing with ambush mode/autofood is something you got from someone else and if you don't want it you need to figure out where it is and what is it, it's not in his gearswap file.

I would delete your whole gs folder (maybe save it somewhere else for later if you care about it) and start fresh. With just his files. Fix the gearsets. Delete the gearsets (NOT THE RULES!) that you don't care about.
[+]
 Quetzalcoatl.Orestes
Offline
Server: Quetzalcoatl
Game: FFXI
user: Orestes78
Posts: 430
By Quetzalcoatl.Orestes 2019-04-11 15:05:22
Link | Quote | Reply
 
It sounds like you downloaded Selindrile's lua's, as they have AmbushMode + autoFood features. (these aren't things you would have otherwise)

His luas are going to be packed with features compared to the normal Mote luas, but they're also going to require extra setup. At this point, you probably don't care about these features anyways.

I recommend removing everything and starting fresh. Drop the Kinematics THF.lua directly in your data folder, swap out the gear, and be done with it.
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 15:12:26
Link | Quote | Reply
 
That's entirely possible. I had a ls member remote log to set everything up, so I'm not really sure what he started with. I already have warrior, dark knight, and corsair lua's set up that all work fine, so is there a way to keep those if I start from fresh?
 Asura.Eiryl
Offline
Server: Asura
Game: FFXI
user: Eiryl
By Asura.Eiryl 2019-04-11 15:14:45
Link | Quote | Reply
 
Should only need to delete the thf lua. But if you want to go the whole thing, drop the gs folder on the desktop, download the whole kinematics file and then just replace his drk/war/cor with your old dark/war/cor
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-11 17:00:02
Link | Quote | Reply
 
So it is definitely Selindrile's that I have. As I stated, the sets I made for WAR, DRK, and COR work fine, but the THF one just won't work. I asked the person that initially helped me set all of this up if he could help me figure out exactly why a THF one won't work, and rather than helping me he is saying I am stupid for not being able to figure it out, and everyone that says this particular set of lua's isn't amazing is stupid also. Clearly this is counterproductive to me. I don't know if it would be best to start from scratch with the other person's files that several of you have recommended or just not use lua's on THF at this point. If I do start from scratch, I have literally zero idea what i need to download to make everything work right next time around. I appreciate the advice I have gotten here so far, but I am asking now for the most basic of hand holding through this since the person who seemed eager to help with the other lua's has now resorted to condescension and name calling rather than just helping me figure it out.
 Quetzalcoatl.Orestes
Offline
Server: Quetzalcoatl
Game: FFXI
user: Orestes78
Posts: 430
By Quetzalcoatl.Orestes 2019-04-11 17:33:39
Link | Quote | Reply
 
Selindrie’s luas are each separated in two files. data/THF.lua contains the logic, so it’s not necessary to edit. Gear is kept in a sub folder with your characters name. For example, mine would be - data/Orestes/Orestes_THF_Gear.lua

Check the link I posted above to Sel’s github and read his instructions.
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-12 01:46:54
Link | Quote | Reply
 
Ended up starting from scratch with Kinematic's stuff and got THF to work. Granted, he had no luas for WAR or DRK for some reason, so now I get to figure those out again.
 Asura.Eiryl
Offline
Server: Asura
Game: FFXI
user: Eiryl
By Asura.Eiryl 2019-04-12 01:51:00
Link | Quote | Reply
 
Your other ones that work will still work just drop them in the new folder. it's really that easy. All you needed to do was get rid of selindriles thf luas.

You can mix and match, you just have to keep all the lua that the gearswap calls for data.
 Asura.Mavre
Offline
Server: Asura
Game: FFXI
Posts: 35
By Asura.Mavre 2019-04-12 01:52:06
Link | Quote | Reply
 
Oh I was under the impression I couldn't mix and match. That is encouraging to hear, thanks!
 Asura.Ladyofhonor
Offline
Server: Asura
Game: FFXI
Posts: 2666
By Asura.Ladyofhonor 2019-04-12 07:49:25
Link | Quote | Reply
 
If you have Selindrile's GS setup for other jobs, all you need to do is go into gearswap, find the 'Selindrile' folder, copy the Selindrile_thf_gear file, paste it into the folder named after your character, change the name of the file to be yourchar_thf_gear, and then edit the gear inside of it. Do not remove code or rules, especially not to start.
necroskull Necro Bump Detected! [154 days between previous and next post]
Offline
Posts: 281
By Galkapryme 2019-09-13 12:54:42
Link | Quote | Reply
 
Try this. Tweak as you need:
Code
-------------------------------------------------------------------------------------------------------------------
-- Setup functions for this job.  Generally should not be modified.
-------------------------------------------------------------------------------------------------------------------

--[[
    Custom commands:

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

--]]

-- Initialization function for this job file.
function get_sets()
    mote_include_version = 2
    
    -- Load and initialize the include file.
    include('Mote-Include.lua')
end

-- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
function job_setup()
    state.Buff['Sneak Attack'] = buffactive['sneak attack'] or false
    state.Buff['Trick Attack'] = buffactive['trick attack'] or false
    state.Buff['Feint'] = buffactive['feint'] or false
    
    include('Mote-TreasureHunter')

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

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

-- Setup vars that are user-dependent.  Can override this function in a sidecar file.
function user_setup()
    state.OffenseMode:options('Normal', 'Acc', 'RA', 'Mod')
    state.HybridMode:options('Normal', 'Evasion', 'PDT')
    state.RangedMode:options('Normal', 'Acc')
    state.WeaponskillMode:options('Normal', 'Acc', 'Mod')
    state.PhysicalDefenseMode:options('Evasion', 'PDT')


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

    -- Additional local binds
    send_command('bind f10 input /ja "Flee" <me>')
    send_command('bind f1 gs c cycle OffenseMode')
    send_command('bind f2 gs c cycle RangedMode')

    select_default_macro_book()
end

-- Called when this job file is unloaded (eg: job change)
function user_unload()
    send_command('unbind ^`')
    send_command('unbind !-')
end

-- Define sets and vars used by this job file.
function init_gear_sets()
    --------------------------------------
    -- Start defining the sets
    --------------------------------------
    TaeonHands = {}
    TaeonHands.TA = {name="Taeon Gloves", augments={'DEX+6','Accuracy+17 Attack+17','"Triple Atk."+2'}}
    TaeonHands.Snap = {name="Taeon Gloves", augments={'Attack+22','"Snapshot"+8'}}

    TaeonHead = {}
    TaeonHead.Snap = { name="Taeon Chapeau", augments={'Accuracy+20 Attack+20','"Snapshot"+5','"Snapshot"+4',}}

    HercFeet = {}
    HercHead = {}
    HercLegs = {}
	HercVest = {}
    
    HercFeet.MAB={ name="Herculean Boots", augments={'Mag. Acc.+14 "Mag.Atk.Bns."+14','Weapon skill damage +4%','Mag. Acc.+6','"Mag.Atk.Bns."+6',}}
    HercFeet.TP = { name="Herculean Boots", augments={'Accuracy+22 Attack+22','"Triple Atk."+3','STR+5','Attack+11',}}
    --HercFeet.TH = { name="Herculean Boots", augments={'AGI+1','Weapon Skill Acc.+3','"Treasure Hunter"+1','Accuracy+19 Attack+19','Mag. Acc.+7 "Mag.Atk.Bns."+7',}}
    HercHead.MAB = {name="Herculean Helm", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','Weapon skill damage +3%','INT+1','Mag. Acc.+3','"Mag.Atk.Bns."+8',}}
    HercHead.TP = { name="Herculean Helm", augments={'Accuracy+25','"Triple Atk."+4','AGI+6','Attack+14',}}

    HercLegs.TH = { name="Herculean Trousers", augments={'INT+8','Attack+3','"Treasure Hunter"+1','Accuracy+6 Attack+6','Mag. Acc.+13 "Mag.Atk.Bns."+13',}}
    HercLegs.MAB = { name="Herculean Trousers", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','Weapon skill damage +2%','STR+8','Mag. Acc.+5','"Mag.Atk.Bns."+6',}}
	HercVest.TH = { name="Herculean Vest", augments={'Magic dmg. taken -2%','Accuracy+5','"Treasure Hunter"+1','Mag. Acc.+9 "Mag.Atk.Bns."+9',}}

    Toutatis = {}
    Toutatis.STP = { name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','"Store TP"+10','Phys. dmg. taken-10%',}}
    Toutatis.DEX = { name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Evasion+5','"Dual Wield"+10','Evasion+15',}}
	Toutatis.AGI = { name="Toutatis's Cape", augments={'AGI+20','Accuracy+20 Attack+20','Enmity +10',}}
	Toutatis.RA = { name="Toutatis's Cape", augments={'AGI+20','Rng.Acc.+20 Rng.Atk.+20','Rng.Acc.+2','"Store TP"+10',}}
	Toutatis.WSD = { name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Weapon skill damage +10%',}}

	-- Treasure Hunter - Gandring x2 TH+6
	
    sets.TreasureHunter = {
	head="Meghanada Visor +2",
    body=HercVest.TH, -- TH+1
    hands={ name="Plun. Armlets +1", augments={'Enhances "Perfect Dodge" effect',}}, -- TH+3
    legs=HercLegs.TH, -- TH+1
    feet="Skulk. Poulaines +1", -- TH+3
    neck="Asn. Gorget +2",
    waist="Chaac Belt", -- TH+1
    left_ear="Cessance Earring",
    right_ear="Telos Earring",
    left_ring="Epona's Ring",
    right_ring="Demonry Ring",
	back=Toutatis.DEX,
}
    sets.TreasureHunterRA = set_combine(sets.TreasureHunter, {neck="Sanctity Necklace",left_ring="Hajduk Ring +1",
    right_ring="Hajduk Ring +1"})
	
    sets.ExtraRegen = {neck="Wiglen Gorget",left_ring="Chirich Ring +1",
    right_ring="Chirich Ring +1"}
	
    sets.Kiting = {feet="Pillager's Poulaines +1"}
	
    sets.CapacityMantle = {back="Mecistopins Mantle"}

    sets.Organizer = {
        main="Odium",
        sub="Jugo Kukri",
        ammo="Izhiikoh",
        range="Raider's Boomerang"
    }

    sets.buff['Sneak Attack'] = {
    head="Mummu Bonnet +2",
    body="Mummu Jacket +2",
    hands="Skulker's Armlets +1",
    legs="Mummu Kecks +2",
    feet="Mummu Gamash. +2",
    neck="Asn. Gorget +2",
    waist="Chiner's Belt +1",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Ramuh Ring +1",
    right_ring="Ramuh Ring +1",
    back=Toutatis.DEX
    }

    sets.buff['Trick Attack'] = {
	head="Mummu Bonnet +2",
    body="Mummu Jacket +2",
    hands="Pillager's Armlets +1",
    legs="Mummu Kecks +2",
    feet="Mummu Gamash. +2",
    neck="Asn. Gorget +2",
    waist="Chaac Belt",
    left_ear="Sherida Earring",
    right_ear="Telos Earring",
    left_ring="Garuda Ring +1",
    right_ring="Garuda Ring +1",
    back=Toutatis.AGI
    }
	
	-- Actions we want to use to tag TH.
    sets.precast.Step = sets.TreasureHunter
    sets.precast.Flourish1 = sets.TreasureHunter
    sets.precast.JA.Provoke = sets.TreasureHunter

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

    -- Precast sets to enhance JAs
    sets.precast.JA['Collaborator'] = {head="Skulker's's Bonnet +1"}
    sets.precast.JA['Accomplice'] = {head="Skulker's's Bonnet +1"}
    sets.precast.JA['Flee'] = {feet="Pillager's Poulaines +1"}
    sets.precast.JA['Hide'] = {body="Pillager's Vest"}
    sets.precast.JA['Conspirator'] = {"Skulker's Vest +1"} -- {body="Raider's Vest +2"}
    sets.precast.JA['Steal'] = {neck="Pentalagus Charm",hands="Thief's Kote",legs="Pillager's Culottes +1",feet="Pillager's Poulaines +1"}
    sets.precast.JA['Despoil'] = {legs="Skulker's Culottes +1",feet="Skulker's Poulaines +1"}
    sets.precast.JA['Perfect Dodge'] = {hands="Plunderer's Armlets +1"}
    sets.precast.JA['Feint'] = {"Plunderer's Culottes +3"} -- {legs="Assassin's Culottes +2"}

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


    -- Waltz set (chr and vit)
    sets.precast.Waltz = {
	head="Mummu Bonnet +2",
    body="Meg. Cuirie +2",
    hands={ name="Buremte Gloves", augments={'Phys. dmg. taken -2%','Magic dmg. taken -2%','Rng.Atk.+10',}},
    legs="Dashing Subligar",
    feet={ name="Rawhide Boots", augments={'HP+50','Accuracy+15','Evasion+20',}},
    neck="Wiglen Gorget",
    waist="Chuq'aba Belt",
    left_ear="Impreg. Earring",
    right_ear="Oneiros Earring",
    left_ring="Epona's Ring",
    right_ring="Kunaji Ring",
    back="Solemnity Cape", 
	
	}

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


    -- Fast cast sets for spells
    sets.precast.FC = {head="Haruspex Hat",ear2="Loquacious Earring",hands="Thaumas Gloves",ring1="Prolix Ring",legs="Enif Cosciales"}

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


    -- Ranged snapshot gear
    sets.precast.RA = {
	head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Meg. Jam. +2",
    neck="Iskur Gorget",
    waist="Flax Sash",
    left_ear="Telos Earring",
    right_ear="Volley Earring",
    left_ring="Hajduk Ring +1",
    right_ring="Hajduk Ring +1",
    back=Toutatis.RA,
}


    -- Weaponskill sets

    -- Default set for any weaponskill that isn't any more specifically defined
    sets.precast.WS = {
    head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Plunderer's Culottes +3",
    feet="Meg. Jam. +2",
    neck="Fotia Gorget",
    waist="Fotia Belt",
    left_ear="Sherida Earring",
    right_ear="Ishvara Earring",
    left_ring="Ramuh Ring +1",
    right_ring="Ramuh Ring +1",
    back=Toutatis.WSD,
}
   

    -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
    
    


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

    sets.midcast.FastRecast = {
        head="Whirlpool Mask",ear2="Loquacious Earring",
        body="Pillager's Vest",hands="Pillager's Armlets +1",
        back="Canny Cape",legs="Kaabnax Trousers",feet="Iuitl Gaiters +1"}

    -- Specific spells
    sets.midcast.Utsusemi = {
        head="Whirlpool Mask",neck="Magoraga Beads",ear2="Loquacious Earring",
        body="Pillager's Vest",hands="Pillager's Armlets +1",ring1="Beeline Ring",
        back="Canny Cape",legs="Kaabnax Trousers",feet="Iuitl Gaiters +1"}

    -- Ranged gear
    sets.midcast.RA = {
	head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Meg. Jam. +2",
    neck="Iskur Gorget",
    waist="Flax Sash",
    left_ear="Telos Earring",
    right_ear="Volley Earring",
    left_ring="Hajduk Ring +1",
    right_ring="Hajduk Ring +1",
    back="Moondoe Mantle +1",}

    sets.midcast.RA.Acc = {
	head="Meghanada Visor +2",
    body="Meg. Cuirie +2",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Meg. Jam. +2",
    neck="Iskur Gorget",
    waist="Flax Sash",
    left_ear="Telos Earring",
    right_ear="Volley Earring",
    left_ring="Hajduk Ring +1",
    right_ring="Hajduk Ring +1",
    back=Toutatis.RA,
}


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

    -- Resting sets
    sets.resting = {head="Ocelomeh Headpiece +1",neck="Wiglen Gorget",
        ring1="Sheltered Ring",ring2="Paguroidea Ring"}


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

    sets.idle = {
        head="Pillager's Bonnet +1",neck="Wiglen Gorget",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
        body="Pillager's Vest",hands="Pillager's Armlets +1",ring1="Sheltered Ring",ring2="Paguroidea Ring",
        back="Shadow Mantle",waist="Flume Belt",legs="Pillager's Culottes +1",feet="Skadi's Jambeaux +1"}

    sets.idle.Town = {
	head="Meghanada Visor +2",
    body="Councilor's Garb",
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Pill. Poulaines +1",
    neck="Wiglen Gorget",
    waist="Chiner's Belt +1",
    left_ear="Heartseeker Earring",
    right_ear="Dudgeon Earring",
    left_ring="Chirich Ring +1",
    right_ring="Chirich Ring +1",
    back={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Evasion+5','"Dual Wield"+10','Evasion+15',}},}

    sets.idle.Weak = {
        head="Pillager's Bonnet +1",neck="Wiglen Gorget",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
        body="Pillager's Vest +1",hands="Pillager's Armlets +1",ring1="Sheltered Ring",ring2="Paguroidea Ring",
        back="Shadow Mantle",waist="Flume Belt",legs="Pillager's Culottes +1",feet="Skadi's Jambeaux +1"}


    -- Defense sets

    sets.defense.Evasion = {
        head="Pillager's Bonnet +1",neck="Ej Necklace",
        body="Qaaxo Harness",hands="Pillager's Armlets +1",ring1="Defending Ring",ring2="Beeline Ring",
        back="Canny Cape",waist="Flume Belt",legs="Kaabnax Trousers",feet="Iuitl Gaiters +1"}

    sets.defense.PDT = {
        head="Pillager's Bonnet +1",neck="Twilight Torque",
        body="Iuitl Vest",hands="Pillager's Armlets +1",ring1="Defending Ring",ring2=gear.DarkRing.physical,
        back="Iximulew Cape",waist="Flume Belt",legs="Pillager's Culottes +1",feet="Iuitl Gaiters +1"}

    sets.defense.MDT = {
        head="Pillager's Bonnet +1",neck="Twilight Torque",
        body="Pillager's Vest +1",hands="Pillager's Armlets +1",ring1="Defending Ring",ring2="Shadow Ring",
        back="Engulfer Cape",waist="Flume Belt",legs="Pillager's Culottes +1",feet="Iuitl Gaiters +1"}


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

    -- Normal melee group
    -- Triple Attack 35%, Triple Attack Damage 42%, ACC 1173, Attack 1129
    sets.engaged = {
	head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}}, -- Trip.Attk. 4%
    body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}}, -- Trip.Attk. 4%
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}}, -- Trip.Attk. 4%
    legs="Meg. Chausses +2", -- Trip.Attk. 5%
    feet="Plun. Poulaines +1", -- Trip.Attk. 3%
    neck="Asn. Gorget +2", -- Trip.Attk. 4%
    waist="Chiner's Belt +1", -- Trip.Attk. 2%
    left_ear="Sherida Earring",
    right_ear="Cessance Earring",
    left_ring="Demonry Ring",
    right_ring="Epona's Ring", -- Trip.Attk. 3%
    back=Toutatis.DEX,
}
    sets.engaged.Acc = {
	head="Meghanada Visor +2",
    body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
    hands="Meg. Gloves +2",
    legs="Meg. Chausses +2",
    feet="Meg. Jam. +2",
    neck="Asn. Gorget +2",
    waist="Kentarch Belt +1",
    left_ear="Telos Earring",
    right_ear="Cessance Earring",
    left_ring="Chirich Ring +1",
    right_ring="Chirich Ring +1",
    back=Toutatis.DEX,
}

sets.engaged.RA = {
    head={ name="Adhemar Bonnet +1", augments={'STR+12','DEX+12','Attack+20',}}, -- Trip.Attk. 4%
    body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}}, -- Trip.Attk. 4%
    hands={ name="Adhemar Wrist. +1", augments={'DEX+12','AGI+12','Accuracy+20',}}, -- Trip.Attk. 4%
    legs="Meg. Chausses +2", -- Trip.Attk. 5%
    feet="Plun. Poulaines +1", -- Trip.Attk. 3%
    neck="Asn. Gorget +2", -- Trip.Attk. 4%
    waist="Chiner's Belt +1", -- Trip.Attk. 2%
    left_ear="Sherida Earring",
    right_ear="Cessance Earring",
    left_ring="Demonry Ring",
    right_ring="Epona's Ring", -- Trip.Attk. 3%
    back=Toutatis.DEX,
}
        
    
    sets.engaged.Evasion = {
	head="Mummu Bonnet +2",
    body="Mummu Jacket +2",
    hands="Mummu Wrists +2",
    legs="Mummu Kecks +2",
    feet="Mummu Gamash. +2",
    neck="Asn. Gorget +2",
    waist="Kentarch Belt +1",
    left_ear="Steelflash Earring",
    right_ear="Heartseeker Earring",
    left_ring="Chirich Ring +1",
    right_ring="Chirich Ring +1",
    back=Toutatis.DEX,
}
    

end


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

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

-- Run after the general midcast() set is constructed.
function job_post_midcast(spell, action, spellMap, eventArgs)
    if state.TreasureMode.value ~= 'None' and spell.action_type == 'Ranged Attack' then
        equip(sets.TreasureHunter)
    end
end

-- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
function job_aftercast(spell, action, spellMap, eventArgs)
    -- Weaponskills wipe SATA/Feint.  Turn those state vars off before default gearing is attempted.
    if spell.type == 'WeaponSkill' and not spell.interrupted then
        state.Buff['Sneak Attack'] = false
        state.Buff['Trick Attack'] = false
        state.Buff['Feint'] = false
    end
end

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

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

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


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

function get_custom_wsmode(spell, spellMap, defaut_wsmode)
    local wsmode

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

    return wsmode
end


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

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


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

    return idleSet
end


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


    return meleeSet
end


-- Called by the 'update' self-command.
function job_update(cmdParams, eventArgs)
    th_update(cmdParams, eventArgs)
end

-- Function to display the current relevant user state when doing an update.
-- Return true if display was handled, and you don't want the default info shown.
function display_current_job_state(eventArgs)
    local msg = 'Melee'
    
    if state.CombatForm.has_value then
        msg = msg .. ' (' .. state.CombatForm.value .. ')'
    end
    
    msg = msg .. ': '
    
    msg = msg .. state.OffenseMode.value
    if state.HybridMode.value ~= 'Normal' then
        msg = msg .. '/' .. state.HybridMode.value
    end
    msg = msg .. ', WS: ' .. state.WeaponskillMode.value
    
    if state.DefenseMode.value ~= 'None' then
        msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
    end
    
    if state.Kiting.value == true then
        msg = msg .. ', Kiting'
    end

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

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

    add_to_chat(122, msg)

    eventArgs.handled = true
end

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

-- State buff checks that will equip buff gear and mark the event as handled.
function check_buff(buff_name, eventArgs)
    if state.Buff[buff_name] then
        equip(sets.buff[buff_name] or {})
        if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
            equip(sets.TreasureHunter)
        end
        eventArgs.handled = true
    end
	
function idle_town_values ()
sets.idle.Town = S{
    "Ru'Lude Gardens",
    "Upper Jeuno",
    "Lower Jeuno",
    "Port Jeuno",
    "Port Windurst",
    "Windurst Waters",
    "Windurst Woods",
    "Windurst Walls",
    "Heavens Tower",
    "Port San d'Oria",
    "Northern San d'Oria",
    "Southern San d'Oria",
    "Port Bastok",
    "Bastok Markets",
    "Bastok Mines",
    "Metalworks",
    "Aht Urhgan Whitegate",
	"Al Zahbi",
	"South Sandoria [S]",
	"Bastok Markets [S]",
	"Windurst Waters [S]",
    "Tavnazian Safehold",
    "Nashmau",
    "Selbina",
    "Mhaura",
	"Rabao",
    "Norg",
    "Eastern Adoulin",
    "Western Adoulin",
    "Kazham"
}
end

end





-- Function to lock the ranged slot if we have a ranged weapon equipped.
function check_range_lock()
    if player.equipment.range ~= 'empty' then
        disable('range', 'ammo')
    else
        enable('range', 'ammo')
    end
end


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