Item Search
     
BG-Wiki Search
+ Reply to Thread
Page 14 of 22 FirstFirst ... 4 12 13 14 15 16 ... LastLast
Results 261 to 280 of 421
  1. #261
    Relic Shield
    Join Date
    Mar 2007
    Posts
    1,789
    BG Level
    6
    FFXIV Character
    Rehn Valor
    FFXIV Server
    Sargatanas
    FFXI Server
    Ragnarok

    GS export the cape and use it in your set like the following:

    Code:
    sets.precast["Trueflight"] = {
    	ammo="Quelling Bolt",
    	head={ name="Herculean Helm", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','STR+6','Mag. Acc.+10','"Mag.Atk.Bns."+14',}},
    	body="Carmine Scale Mail +1",
    	hands="Carmine Finger Gauntlets +1",
    	legs={ name="Herculean Trousers", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','"Mag.Atk.Bns."+15',}},
    	feet={ name="Herculean Boots", augments={'Mag. Acc.+20 "Mag.Atk.Bns."+20','MND+4','"Mag.Atk.Bns."+13',}},
    	neck="Sanctity Necklace",
    	waist="Eschan Stone",
    	left_ear="Moonshade Earring",
    	right_ear="Friomisi Earring",
    	left_ring="Epaminondas's Ring",
    	right_ring="Dingir Ring",
    	back={ name="Belenus's Cape", augments={'AGI+20','Mag. Acc+20 /Mag. Dmg.+20','AGI+10','Weapon skill damage +10%','Phys. dmg. taken-10%'}}}

  2. #262

    Sweaty Dick Punching Enthusiast

    Join Date
    Dec 2006
    Posts
    4,094
    BG Level
    7

    the //gs export is a godsend.

  3. #263

    Quote Originally Posted by Gun-it View Post
    Sorry I am very new to gearswap

    Code:
    -------------------------------------------------------------------------------------------------------------------
    -- Setup functions for this job.  Generally should not be modified.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Initialization function for this job file.
    function get_sets()
        mote_include_version = 2
    
        -- Load and initialize the include file.
        include('Mote-Include.lua')
    end
    
    
    -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
    function job_setup()
        state.Buff.Hasso = buffactive.Hasso or false
        state.Buff.Seigan = buffactive.Seigan or false
        state.Buff.Sekkanoki = buffactive.Sekkanoki or false
        state.Buff.Sengikori = buffactive.Sengikori or false
        state.Buff['Meikyo Shisui'] = buffactive['Meikyo Shisui'] or false
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Setup vars that are user-dependent.
    function user_setup()
        state.OffenseMode:options('Normal', 'Acc')
        state.HybridMode:options('Normal', 'PDT', 'Reraise')
        state.WeaponskillMode:options('Normal', 'Acc', 'Mod')
        state.PhysicalDefenseMode:options('PDT', 'Reraise')
    
        update_combat_form()
        
        -- Additional local binds
        send_command('bind ^` input /ja "Hasso" <me>')
        send_command('bind !` input /ja "Seigan" <me>')
    
        select_default_macro_book()
    end
    
    
    -- Called when this job file is unloaded (eg: job change)
    function user_unload()
        send_command('unbind ^`')
        send_command('unbind !-')
    end
    
    
    		
    -- Define sets and vars used by this job file.
    function init_gear_sets()
        --------------------------------------
        -- Start defining the sets
        --------------------------------------
        
        -- Precast Sets
        -- Precast sets to enhance JAs
    	sets.JA = {}
        sets.JA.Meditate = {head="Wakido kabuto", hands="Sao. kote +2", back="Smertrios's mantle"}
        sets.JA['Warding Circle'] = {head="Wakido kabuto"}
    	sets.JA['Sengikori'] = {feet="Unkai Sune-Ate +2"}
        sets.JA['Blade Bash'] = {hands="Sao. kote +2"}
    
        -- Waltz set (chr and vit)
        sets.precast.Waltz = {ammo="Sonia's Plectrum",
            head="Yaoyotl Helm",
            body="Otronif Harness +1",hands="Buremte Gloves",ring1="Spiral Ring",
            back="Iximulew Cape",waist="Caudata Belt",legs="Karieyh Brayettes +1",feet="Otronif Boots +1"}
            
        -- Don't need any special gear for Healing Waltz.
        sets.precast.Waltz['Healing Waltz'] = {}
    
           
        -- Weaponskill sets
        -- Default set for any weaponskill that isn't any more specifically defined
        sets.precast.WS = {ammo="Thew bomblet",
    					 		 head="Flamma zucchetto +1",neck="Fotia gorget",ear1="Brutal earring",ear2="Moonshade earring",
    							 body="Flamma korazin +1",hands="Flamma Manopolas +1",ring1="Ifrit ring +1",ring2="Ifrit ring",
    							 back="Smertrios's mantle",waist="Fotia belt",legs="Flamma dirs +1",feet="Flamma Gambieras +1"}
        sets.precast.WS.Acc = set_combine(sets.precast.WS, {})
    
        -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
        sets.precast.WS['Tachi: Fudo'] = set_combine(sets.precast.WS, {})
        sets.precast.WS['Tachi: Fudo'].Acc = set_combine(sets.precast.WS.Acc, {})
        sets.precast.WS['Tachi: Fudo'].Mod = set_combine(sets.precast.WS['Tachi: Fudo'], {})
    
        sets.precast.WS['Tachi: Shoha'] = set_combine(sets.precast.WS, {})
        sets.precast.WS['Tachi: Shoha'].Acc = set_combine(sets.precast.WS.Acc, {})
        sets.precast.WS['Tachi: Shoha'].Mod = set_combine(sets.precast.WS['Tachi: Shoha'], {})
    
        sets.precast.WS['Tachi: Rana'] = set_combine(sets.precast.WS, {ear1="Bladeborn Earring",ear2="Steelflash Earring",})
        sets.precast.WS['Tachi: Rana'].Acc = set_combine(sets.precast.WS.Acc, {ear1="Bladeborn Earring",ear2="Steelflash Earring",})
        sets.precast.WS['Tachi: Rana'].Mod = set_combine(sets.precast.WS['Tachi: Rana'], {})
    
        sets.precast.WS['Tachi: Kasha'] = set_combine(sets.precast.WS, {})
    
        sets.precast.WS['Tachi: Gekko'] = set_combine(sets.precast.WS, {})
    
        sets.precast.WS['Tachi: Yukikaze'] = set_combine(sets.precast.WS, {})
    
        sets.precast.WS['Tachi: Ageha'] = set_combine(sets.precast.WS, {})
    
        sets.precast.WS['Tachi: Jinpu'] = set_combine(sets.precast.WS, {})
    
    
        -- Midcast Sets
        sets.midcast.FastRecast = {
            head="Yaoyotl Helm",
            body="Flamma korazin +1",hands="Flamma Manopolas +1",
            legs="Flamma dirs +1",feet="Flamma Gambieras +1"}
    
        
        -- Sets to return to when not performing an action.
        
        -- Resting sets
        sets.resting = {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.Town = {head="Twilight helm",neck="Wiglen gorget",ear1="Merman's Earring",ear2="Merman's Earring",
                        body="Flamma korazin +1",hands="Cizin Mufflers",ring1="Sheltered Ring",ring2="Paguroidea Ring",
                        back="Engulfer cape +1",waist="Flume Belt +1",legs="Flamma dirs +1",feet="Danzo Sune-Ate"}
        
        sets.idle.Field = {head="Twilight helm",neck="Wiglen gorget",ear1="Merman's Earring",ear2="Merman's Earring",
                        body="Flamma korazin +1",hands="Flamma Manopolas +1",ring1="Sheltered Ring",ring2="Paguroidea Ring",
                        back="Engulfer cape +1",waist="Flume Belt +1",legs="Flamma dirs +1",feet="Danzo Sune-Ate"}
    
        sets.idle.Weak = {head="Twilight Helm",body="Twilight Mail",neck="Wiglen gorget",ear1="Merman's Earring",ear2="Merman's Earring",hands="Cizin Mufflers",ring1="Sheltered Ring",ring2="Paguroidea Ring",back="Engulfer cape +1",waist="Flume Belt +1",legs="Flamma dirs +1",feet="Danzo Sune-Ate"}
        
        -- Defense sets
        sets.defense.PDT = {head="Rabid visor",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
                        body="Mikinaak breastplate",hands="Flamma Manopolas +1",ring1="Jelly Ring",ring2="Defending Ring",hands="Flamma Manopolas +1",
    		back="Iximulew cape",waist="Flume Belt +1",legs="Kasuga haidate",feet="Flamma Gambieras +1"}
    
        sets.defense.Reraise = {head="Twilight Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
                        body="Twilight Mail",hands="Flamma Manopolas +1",ring1="Jelly Ring",ring2="Defending Ring",hands="Flamma Manopolas +1",
    		back="Iximulew cape",waist="Flume Belt +1",legs="Kasuga haidate",feet="Flamma Gambieras +1"}
    
        sets.defense.MDT = {head="Flamma zucchetto +1",neck="Twilight Torque",ear1="Merman's Earring",ear2="Merman's Earring",
                        body="Nocturnus mail",hands="Flamma Manopolas +1",ring1="Minerva's Ring",ring2="Defending Ring",
                        back="Engulfer Cape +1",waist="Ioskeha belt",legs="Flamma dirs +1",feet="Flamma Gambieras +1"}
    
        sets.Kiting = {feet="Danzo Sune-ate"}
    
        sets.Reraise = {head="Twilight Helm",body="Twilight Mail"}
    
        -- Engaged sets
    
        -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
        -- sets if more refined versions aren't defined.
        -- If you create a set with both offense and defense modes, the offense mode should be first.
        -- EG: sets.engaged.Dagger.Accuracy.Evasion
        
        -- Normal melee group
        -- Delay 450 GK, 25 Save TP => 65 Store TP for a 5-hit (25 Store TP in gear)
        sets.engaged = {ammo="Hagneia Stone",
    		head="Flamma zucchetto +1",neck="Asperity necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
    		body="Kasuga domaru",hands="Flamma Manopolas +1",ring1="Rajas Ring",ring2="Flamma ring",
    		back="Atheling mantle",waist="Ioskeha belt",legs="Kasuga haidate",feet="Flamma Gambieras +1"}
        sets.engaged.Acc = {ammo="Hagneia Stone",
    		head="Flamma zucchetto +1",neck="Justice torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
    		body="Kasuga domaru",hands="Flamma Manopolas +1",ring1="Rajas Ring",ring2="Flamma ring",
    		back="Smertrios's mantle",waist="Ioskeha belt",legs="Kasuga haidate",feet="Flamma Gambieras +1"}
        sets.engaged.PDT = {ammo="Thew Bomblet",
            head="Yaoyotl Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Otronif Harness +1",hands="Otronif Gloves",ring1="Defending Ring",ring2="K'ayres Ring",
            back="Iximulew Cape",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
        sets.engaged.Acc.PDT = {ammo="Honed Tathlum",
            head="Yaoyotl Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Otronif Harness +1",hands="Otronif Gloves",ring1="Defending Ring",ring2="K'ayres Ring",
            back="Letalis Mantle",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
        sets.engaged.Reraise = {ammo="Thew Bomblet",
            head="Twilight Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Twilight Mail",hands="Otronif Gloves",ring1="Beeline Ring",ring2="K'ayres Ring",
            back="Ik Cape",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
        sets.engaged.Acc.Reraise = {ammo="Thew Bomblet",
            head="Twilight Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Twilight Mail",hands="Otronif Gloves",ring1="Beeline Ring",ring2="K'ayres Ring",
            back="Letalis Mantle",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
            
        -- Melee sets for in Adoulin, which has an extra 10 Save TP for weaponskills.
        -- Delay 450 GK, 35 Save TP => 89 Store TP for a 4-hit (49 Store TP in gear), 2 Store TP for a 5-hit
        sets.engaged.Adoulin = {ammo="Hagneia Stone",
    		head="Flamma zucchetto +1",neck="Asperity necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
    		body="Kasuga domaru",hands="Flamma Manopolas +1",ring1="Rajas Ring",ring2="Flamma ring",
    		back="Atheling mantle",waist="Ioskeha belt",legs="Kasuga haidate",feet="Flamma Gambieras +1"}
        sets.engaged.Adoulin.Acc ={ammo="Hagneia Stone",
    		head="Flamma zucchetto +1",neck="Asperity necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
    		body="Kasuga domaru",hands="Flamma Manopolas +1",ring1="Rajas Ring",ring2="Flamma ring",
    		back="Atheling mantle",waist="Ioskeha belt",legs="Kasuga haidate",feet="Flamma Gambieras +1"}
        sets.engaged.Adoulin.PDT = {ammo="Thew Bomblet",
            head="Yaoyotl Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Otronif Harness +1",hands="Otronif Gloves",ring1="Defending Ring",ring2="K'ayres Ring",
            back="Iximulew Cape",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
        sets.engaged.Adoulin.Acc.PDT = {ammo="Honed Tathlum",
            head="Yaoyotl Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Otronif Harness +1",hands="Otronif Gloves",ring1="Defending Ring",ring2="K'ayres Ring",
            back="Letalis Mantle",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
        sets.engaged.Adoulin.Reraise = {ammo="Thew Bomblet",
            head="Twilight Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Twilight Mail",hands="Otronif Gloves",ring1="Beeline Ring",ring2="K'ayres Ring",
            back="Ik Cape",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
        sets.engaged.Adoulin.Acc.Reraise = {ammo="Thew Bomblet",
            head="Twilight Helm",neck="Twilight Torque",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Twilight Mail",hands="Otronif Gloves",ring1="Beeline Ring",ring2="K'ayres Ring",
            back="Letalis Mantle",waist="Goading Belt",legs="Unkai Haidate +2",feet="Otronif Boots +1"}
    
    
        sets.buff.Sekkanoki = {hands="Unkai kote +1"}
        sets.buff.Sengikori = {feet="Unkai Sune-ate +2"}
        sets.buff['Meikyo Shisui'] = {}
    end
    
    
    -------------------------------------------------------------------------------------------------------------------
    -- Job-specific hooks for standard casting events.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Set eventArgs.handled to true if we don't want any automatic target handling to be done.
    function job_pretarget(spell, action, spellMap, eventArgs)
        if spell.type == 'WeaponSkill' then
            -- Change any GK weaponskills to polearm weaponskill if we're using a polearm.
            if player.equipment.main=='Quint Spear' or player.equipment.main=='Quint Spear' then
                if spell.english:startswith("Tachi:") then
                    send_command('@input /ws "Penta Thrust" '..spell.target.raw)
                    eventArgs.cancel = true
                end
            end
        end
    end
    
    -- Run after the default precast() is done.
    -- eventArgs is the same one used in job_precast, in case information needs to be persisted.
    function job_post_precast(spell, action, spellMap, eventArgs)
        if spell.type:lower() == 'weaponskill' then
            if state.Buff.Sekkanoki then
                equip(sets.buff.Sekkanoki)
            end
            if state.Buff.Sengikori then
                equip(sets.buff.Sengikori)
            end
            if state.Buff['Meikyo Shisui'] then
                equip(sets.buff['Meikyo Shisui'])
            end
        end
    end
    
    
    -- Run after the default midcast() is done.
    -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
    function job_post_midcast(spell, action, spellMap, eventArgs)
        -- Effectively lock these items in place.
        if state.HybridMode.value == 'Reraise' or
            (state.DefenseMode.value == 'Physical' and state.PhysicalDefenseMode.value == 'Reraise') then
            equip(sets.Reraise)
        end
    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_update(cmdParams, eventArgs)
        update_combat_form()
    end
    
    -- Set eventArgs.handled to true if we don't want the automatic display to be run.
    function display_current_job_state(eventArgs)
    
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- Utility functions specific to this job.
    -------------------------------------------------------------------------------------------------------------------
    
    function update_combat_form()
        if areas.Adoulin:contains(world.area) and buffactive.ionis then
            state.CombatForm:set('Adoulin')
        else
            state.CombatForm:reset()
        end
    end
    
    -- Select default macro book on initial load or subjob change.
    function select_default_macro_book()
        -- Default macro set/book
       
    end
    im not well versed with motes include but it should work as is

    one thing is ja's are vary fast so you might not see them change gear if you want to see if gearswap is trying to change gear use this command
    in chat: //gs show_swaps

  4. #264
    Sea Torques
    Join Date
    May 2010
    Posts
    719
    BG Level
    5
    FFXI Server
    Ragnarok

    Quote Originally Posted by dlsmd View Post
    im not well versed with motes include but it should work as is

    one thing is ja's are vary fast so you might not see them change gear if you want to see if gearswap is trying to change gear use this command
    in chat: //gs show_swaps
    Its definitely not changing gear as Meditate is not getting the added TP

  5. #265

    that is why i wanted you to try the command //gs show_swaps to see if it even tries to do so if it is trying but does not succeed then its not gearswaps fault

    these are things i need you to check
    1. your SAM main job is lvl 99
    2. your not using this on a sub job
    3. make sure that your file is in the correct directory with the correct file name (i find this the easiest to use)
    -addons\GearSwap\data\<charname>\SAM.lua
    --example: addons\GearSwap\data\Gun-it\SAM.lua

  6. #266
    Sea Torques
    Join Date
    May 2010
    Posts
    719
    BG Level
    5
    FFXI Server
    Ragnarok

    Quote Originally Posted by dlsmd View Post
    that is why i wanted you to try the command //gs show_swaps to see if it even tries to do so if it is trying but does not succeed then its not gearswaps fault

    these are things i need you to check
    1. your SAM main job is lvl 99
    2. your not using this on a sub job
    3. make sure that your file is in the correct directory with the correct file name (i find this the easiest to use)
    -addons\GearSwap\data\<charname>\SAM.lua
    --example: addons\GearSwap\data\Gun-it\SAM.lua
    Out of town this weekend but I'll check //gs show_swaps next week. Gearswap is working for WS/TP/Idle/MDT sets etc. I find it really weird that it is not working.

    Thank you very much for helping.

    Edit: Also thank you for help with augmented gear. Didn't know about //gs export, it should be very helpful.

  7. #267
    Cerberus
    Join Date
    May 2007
    Posts
    426
    BG Level
    4
    FFXI Server
    Phoenix
    WoW Realm
    Duskwood

    -
    Code:
    -- IdleMode determines the set used after casting. You change it with "/console gs c <IdleMode>"
    -- The modes are:
    -- Refresh: Uses the most refresh available.
    -- DT: A mix of refresh, PDT, and MDT to help when you can't avoid AOE.
    -- PetDT: Sacrifice refresh to reduce avatar's damage taken. WARNING: Selenian Cap drops you below 119, use with caution!
    -- DD: When melee mode is on and you're engaged, uses TP gear. Otherwise, avatar melee gear.
    -- Favor: Uses Beckoner's Horn +1 and max smn skill to boost the favor effect.
    -- Zendik: Favor build with the Zendik Robe added in, for Shiva's Favor in manaburn parties. (Shut up, it sounded like a good idea at the time)
    
    -- Additional Bindings:
    -- F9 - Toggles between a subset of IdleModes (Refresh > DT > PetDT)
    -- F10 - Toggles MeleeMode (When enabled, equips Nirvana and Elan+1, then disables those 2 slots from swapping)
    --       NOTE: If you don't already have the Nirvana & Elan+1 equipped, YOU WILL LOSE TP
    
    -- Additional Commands:
    -- /console gs c AccMode - Toggles high-accuracy sets to be used where appropriate.
    -- /console gs c ImpactMode - Toggles between using normal magic BP set for Fenrir's Impact or a custom high-skill set for debuffs.
    -- /console gs c ForceIlvl - I have this set up to override a few specific slots where I normally use non-ilvl pieces.
    -- /console gs c LagMode - Used to help BPs land in the right gear in high-lag situations.
    --							Sets a timer to swap gear 0.2s after the BP is used rather than waiting for server response.
    
    function file_unload()
    	send_command('unbind f9')
    	send_command('unbind f10')
    end
    
    function get_sets()
    	send_command('bind f9 gs c ToggleIdle')
    	send_command('bind f10 gs c MeleeMode')
    
    	-- Set your merits here. This is used in deciding between Enticer's Pants or Apogee Slacks +1.
    	-- To change in-game, "/console gs c MeteorStrike3" will change Meteor Strike to 3/5 merits.
    	-- The damage difference is very minor unless you're over 2400 TP.
    	-- It's ok to just always use Enticer's Pants and ignore this section.
    	MeteorStrike = 1
    	HeavenlyStrike = 1
    	WindBlade = 1
    	Geocrush = 1
    	Thunderstorm = 5
    	GrandFall = 1
    
    	StartLockStyle = '85'
    	IdleMode = 'Refresh'
    	AccMode = false
    	ImpactDebuff = false
    	MeleeMode = false
    	ForceIlvl = false
    	LagMode = false -- Default LagMode. If you have a lot of lag issues, change to "true".
    	AutoRemedy = false -- Auto Remedy when using an ability while Paralyzed.
    	AutoEcho = false -- Auto Echo Drop when using an ability while Silenced.
    	Test = 0
    
    	-- ===================================================================================================================
    	--		Sets
    	-- ===================================================================================================================
    
    	-- Base Damage Taken Set - Mainly used when IdleMode is "DT"
    	sets.DT_Base = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.precast = {}
    
    	-- Fast Cast
    	sets.precast.FC = {
    		main="Oranyan",
        sub="Elan Strap +1",
        ammo="Impatiens",
        head="Nahtirah Hat",
        body="Inyanga Jubbah +1",
        hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+15 Pet: "Mag.Atk.Bns."+15','Blood Pact Dmg.+9','Pet: INT+3',}},
        legs="Gyve Trousers",
        feet="Convo. Pigaches +3",
        neck="Voltsurge Torque",
        waist="Witful Belt",
        left_ear="Loquac. Earring",
        right_ear="Etiolation Earring",
        left_ring="Prolix Ring",
        right_ring="Varar Ring",
        back="Swith Cape",
    	}
    
        sets.midcast = {}
    
    	-- BP Timer Gear
        sets.midcast.BP = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Con. Doublet +3",
        hands={ name="Glyphic Bracers +1", augments={'Inc. Sp. "Blood Pact" magic burst dmg.',}},
        legs="Beck. Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Summoning magic skill +20','Blood Pact Dmg.+8',}},
        neck="Incanter's Torque",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Gelos Earring",
        left_ring="Stikini Ring",
        right_ring="Evoker's Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
        sets.midcast.Siphon = {
    		main={ name="Espiritus", augments={'Summoning magic skill +15','Pet: Mag. Acc.+30','System: 2 ID: 153 Val: 3',}},
    		sub="Vox Grip",
    		ammo="Esper Stone +1",
    		head="Baayami Hat +1",
    		neck="Incanter's Torque",
    		ear1="Andoaa Earring",
    		ear2="Smn. Earring",
    		body="Baayami Robe +1",
    		hands="Baayami Cuffs +1",
    		ring1="Stikini Ring +1",
    		ring2="Evoker's Ring",
    		back={ name="Conveyance Cape", augments={'Summoning magic skill +5','Pet: Enmity+12','Blood Pact Dmg.+2',}},
    		waist="Kobo Obi",
    		legs="Baayami Slops +1",
    		feet="Beck. Pigaches +1"
    	}
    
    	sets.midcast.SiphonZodiac = set_combine(sets.midcast.Siphon, { ring1="Zodiac Ring" })
    
    	sets.midcast.Summon = set_combine(sets.DT_Base, {
    		body="Baayami Robe +1"
    	})
    
    	sets.midcast.Cure = {
    		main="Nirvana",
    		sub="Oneiros Grip",
    		ammo="Sancus Sachet +1",
    		head={ name="Vanya Hood", augments={'MP+50','"Cure" potency +7%','Enmity-6',}},
    		neck="Nodens Gorget",
    		ear1="Mendi. Earring",
    		ear2="Novia Earring",
    		body="Witching Robe",
    		hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
    		ring1="Lebeche Ring",
    		ring2="Menelaus's Ring",
    		back="Tempered Cape +1",
    		waist="Witful Belt",
    		legs="Assiduity Pants +1",
    		feet={ name="Vanya Clogs", augments={'MP+50','"Cure" potency +7%','Enmity-6',}}
    	}
    
    	sets.midcast.Cursna = set_combine(sets.precast.FC, {
    		neck="Debilis Medallion",
    		ear1="Healing Earring",
    		ear2="Beatific Earring",
    		ring1="Menelaus's Ring",
    		ring2="Haoma's Ring",
    		back="Tempered Cape +1",
    		waist="Bishop's Sash",
    		feet={ name="Vanya Clogs", augments={'Healing magic skill +20','"Cure" spellcasting time -7%','Magic dmg. taken -3',}}
    	})
    	
    	sets.midcast.EnmityRecast = set_combine(sets.precast.FC, {
    		main="Nirvana",
    		ear1="Novia Earring",
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}}
    	})
    
    	sets.midcast.Enfeeble = {
    		main={ name="Gada", augments={'"Fast Cast"+2','MND+13','Mag. Acc.+20','"Mag.Atk.Bns."+14',}},
    		sub="Ammurapi Shield",
    		head="Inyanga Tiara +2",
    		neck="Erra Pendant",
    		ear1="Dignitary's Earring",
    		ear2="Gwati Earring",
    		body="Inyanga Jubbah +2",
    		hands="Inyanga Dastanas +2",
    		ring1="Stikini Ring +1",
    		ring2="Stikini Ring +1",
    		back={ name="Campestres's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Haste+10','Phys. dmg. taken-10%',}},
    		waist="Luminary Sash",
    		legs="Inyanga Shalwar +2",
    		feet="Skaoi Boots"
    	}
    
    	sets.midcast.Enhancing = {
    		main={ name="Gada", augments={'Enh. Mag. eff. dur. +6','DEX+1','Mag. Acc.+5','"Mag.Atk.Bns."+18','DMG:+4',}},
    		sub="Ammurapi Shield",
    		head={ name="Telchine Cap", augments={'Pet: "Mag.Atk.Bns."+19','"Elemental Siphon"+25','Enh. Mag. eff. dur. +10',}},
    		neck="Incanter's Torque",
    		ear1="Andoaa Earring",
    		ear2="Augmenting Earring",
    		body={ name="Telchine Chas.", augments={'"Conserve MP"+5','Enh. Mag. eff. dur. +10',}},
    		hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
    		ring1="Stikini Ring +1",
    		ring2="Stikini Ring +1",
    		back="Merciful Cape",
    		waist="Olympus Sash",
    		legs={ name="Telchine Braconi", augments={'"Conserve MP"+4','Enh. Mag. eff. dur. +10',}},
    		feet={ name="Telchine Pigaches", augments={'"Conserve MP"+3','Enh. Mag. eff. dur. +9',}}
    	}
    
    	sets.midcast.Stoneskin = set_combine(sets.midcast.Enhancing, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Befouled Crown",
        body={ name="Telchine Chas.", augments={'"Regen" potency+3',}},
        hands={ name="Telchine Gloves", augments={'"Cure" potency +8%','Enh. Mag. eff. dur. +9',}},
        legs={ name="Telchine Braconi", augments={'Song spellcasting time -5%','Enh. Mag. eff. dur. +9',}},
        feet={ name="Telchine Pigaches", augments={'Mag. Acc.+5','Song spellcasting time -2%','Enh. Mag. eff. dur. +9',}},
        neck="Incanter's Torque",
        waist="Siegel Sash",
        left_ear="Lugalbanda Earring",
        right_ear="Evans Earring",
        left_ring="Varar Ring",
        right_ring="Evoker's Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	sets.midcast.Nuke = {
    		main={ name="Grioavolr", augments={'"Fast Cast"+6','INT+2','"Mag.Atk.Bns."+17',}},
    		sub="Niobid Strap",
    		head="Inyanga Tiara +2",
    		neck="Eddy Necklace",
    		ear1="Hecate's Earring",
    		ear2="Friomisi Earring",
    		body="Witching Robe",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Crit.hit rate +2','"Mag.Atk.Bns."+25','"Refresh"+2','Mag. Acc.+10 "Mag.Atk.Bns."+10',}},
    		ring1="Acumen Ring",
    		ring2="Strendu Ring",
    		back={ name="Campestres's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Haste+10','Phys. dmg. taken-10%',}},
    		waist="Eschan Stone",
    		legs="Lengo Pants",
    		feet={ name="Merlinic Crackows", augments={'DEX+10','Phys. dmg. taken -2%','"Refresh"+2','Accuracy+3 Attack+3',}}
    	}
    
        sets.midcast["Refresh"] = set_combine(sets.midcast.Enhancing, {
    		head="Amalric Coif +1",
    		waist="Gishdubar Sash"
    	})
    
        sets.midcast["Aquaveil"] = set_combine(sets.midcast.Enhancing, {
    		main="Vadose Rod",
    		head="Amalric Coif +1"
    	})
    
    	sets.midcast["Mana Cede"] = { hands="Beckoner's Bracers +1" }
    
        sets.midcast["Astral Flow"] = { head="Glyphic Horn +1" }
    
    	sets.midcast["Garland of Bliss"] = set_combine(sets.midcast.Nuke, {
    		hands="Inyanga Dastanas +2",
    		legs="Inyanga Shalwar +2",
    		feet="Inyanga Crackows +2"
    	})
    
    	sets.midcast["Shattersoul"] = {
    		head="Convoker's Horn +3",
    		neck="Fotia Gorget",
    		ear1="Zennaroi Earring",
    		ear2="Telos Earring",
    		body="Tali'ah Manteel +2",
    		hands="Tali'ah Gages +2",
    		ring1="Rajas Ring",
    		ring2="Varar Ring +1",
    		back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10',}},
    		waist="Fotia Belt",
    		legs={ name="Telchine Braconi", augments={'Accuracy+17','Weapon Skill Acc.+14','Weapon skill damage +3%',}},
    		feet="Convoker's Pigaches +3"
    	}
    
    	sets.midcast["Cataclysm"] = sets.midcast.Nuke
    
    	sets.pet_midcast = {}
    
    	-- Main physical pact set (Volt Strike, Pred Claws, etc.)
    	sets.pet_midcast.Physical_BP = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Pet: Attack+30 Pet: Rng.Atk.+30','Blood Pact Dmg.+10','Pet: STR+3','Pet: Mag. Acc.+11',}},
        legs={ name="Enticer's Pants", augments={'MP+50','Pet: Accuracy+13 Pet: Rng. Acc.+13','Pet: Mag. Acc.+14','Pet: Damage taken -4%',}},
        feet="Convo. Pigaches +3",
        neck="Shulmanu Collar",
        waist="Regal Belt",
        left_ear="Lugalbanda Earring",
        right_ear="Gelos Earring",
        left_ring="Varar Ring",
        right_ring="Varar Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.Physical_BP_AM3 = set_combine(sets.pet_midcast.Physical_BP, {
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
    		ear2="Gelos Earring",
    		body="Convoker's Doublet +3",
    		feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}}
    	})
    
    	-- Physical pacts which benefit more from TP than Pet:DA (like single-hit BP)
    	sets.pet_midcast.Physical_BP_TP = set_combine(sets.pet_midcast.Physical_BP, {
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
    		ear2="Gelos Earring",
    		body="Convoker's Doublet +3",
    		waist="Regal Belt",
    		legs="Enticer's Pants",
    		feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}}
    	})
    
    	-- Used for all physical pacts when AccMode is true
    	sets.pet_midcast.Physical_BP_Acc = set_combine(sets.pet_midcast.Physical_BP, {
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Accuracy+28 Pet: Rng. Acc.+28','Blood Pact Dmg.+10','Pet: DEX+9','Pet: Mag. Acc.+9','Pet: "Mag.Atk.Bns."+3',}},
    		--feet="Convoker's Pigaches +3"
    	})
    
    	-- Base magic pact set
    	sets.pet_midcast.Magic_BP_Base = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+15 Pet: "Mag.Atk.Bns."+15','Blood Pact Dmg.+9','Pet: INT+3',}},
        legs={ name="Merlinic Shalwar", augments={'Pet: Mag. Acc.+24 Pet: "Mag.Atk.Bns."+24','Pet: INT+15','Pet: "Mag.Atk.Bns."+8',}},
        feet="Convo. Pigaches +3",
        neck="Adad Amulet",
        waist="Regal Belt",
        left_ear="Lugalbanda Earring",
        right_ear="Gelos Earring",
        left_ring="Varar Ring",
        right_ring="Varar Ring",
        back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Mag. Acc+20 /Mag. Dmg.+20','Pet: Damage taken -5%',}},
    	}
    	
    	-- Some magic pacts benefit more from TP than others.
    	-- Note: This set will only be used on merit pacts if you have less than 4 merits.
    	--       Make sure to update your merit values at the top of this Lua.
    	sets.pet_midcast.Magic_BP_TP = set_combine(sets.pet_midcast.Magic_BP_Base, {
    		legs="Enticer's Pants"
    	})
    
    	-- NoTP set used when you don't need Enticer's
    	sets.pet_midcast.Magic_BP_NoTP = set_combine(sets.pet_midcast.Magic_BP_Base, {
    		legs={ name="Apogee Slacks +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}}
    	})
    
    	sets.pet_midcast.Magic_BP_TP_Acc = set_combine(sets.pet_midcast.Magic_BP_TP, {
    		head={ name="Merlinic Hood", augments={'Pet: Mag. Acc.+21 Pet: "Mag.Atk.Bns."+21','Blood Pact Dmg.+7','Pet: INT+6','Pet: "Mag.Atk.Bns."+11',}},
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+29','Blood Pact Dmg.+10','Pet: INT+7','Pet: "Mag.Atk.Bns."+10',}}
    	})
    
    	sets.pet_midcast.Magic_BP_NoTP_Acc = set_combine(sets.pet_midcast.Magic_BP_NoTP, {
    		head={ name="Merlinic Hood", augments={'Pet: Mag. Acc.+21 Pet: "Mag.Atk.Bns."+21','Blood Pact Dmg.+7','Pet: INT+6','Pet: "Mag.Atk.Bns."+11',}},
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+29','Blood Pact Dmg.+10','Pet: INT+7','Pet: "Mag.Atk.Bns."+10',}}
    	})
    
    	sets.pet_midcast.FlamingCrush = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+15 Pet: "Mag.Atk.Bns."+15','Blood Pact Dmg.+9','Pet: INT+3',}},
        legs={ name="Enticer's Pants", augments={'MP+50','Pet: Accuracy+13 Pet: Rng. Acc.+13','Pet: Mag. Acc.+14','Pet: Damage taken -4%',}},
        feet="Convo. Pigaches +3",
        neck="Adad Amulet",
        waist="Regal Belt",
        left_ear="Lugalbanda Earring",
        right_ear="Gelos Earring",
        left_ring="Varar Ring",
        right_ring="Varar Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.FlamingCrush_Acc = set_combine(sets.pet_midcast.FlamingCrush, {
    		ear2="Kyrene's Earring",
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Accuracy+28 Pet: Rng. Acc.+28','Blood Pact Dmg.+10','Pet: DEX+9','Pet: Mag. Acc.+9','Pet: "Mag.Atk.Bns."+3',}},
    		--feet="Convoker's Pigaches +3"
    	})
    
    	-- Pet: Magic Acc set - Mainly used for debuff pacts like Shock Squall
    	sets.pet_midcast.MagicAcc_BP = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Beck. Doublet +1",
        hands="Lamassu Mitts +1",
        legs="Beck. Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Summoning magic skill +20','Blood Pact Dmg.+8',}},
        neck="Incanter's Torque",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Stikini Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.Debuff_Rage = sets.pet_midcast.MagicAcc_BP
    
    	-- Pure summoning magic set, mainly used for buffs like Hastega II.
    	sets.pet_midcast.SummoningMagic = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Beck. Doublet +1",
        hands="Lamassu Mitts +1",
        legs="Beck. Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Summoning magic skill +20','Blood Pact Dmg.+8',}},
        neck="Incanter's Torque",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Stikini Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.Buff = sets.pet_midcast.SummoningMagic
    
    	-- I use Apogee gear for healing BPs because the amount healed is affected by avatar max HP.
    	-- I'm probably stupid. It puts you in yellow HP after using a healing move.
    	sets.pet_midcast.Buff_Healing = set_combine(sets.pet_midcast.SummoningMagic, {
    		main="Nirvana",
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}},
    		back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Attack+10 Pet: Rng.Atk.+10','Pet: "Regen"+10',}},
    		feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}}
    	})
    
    	-- This set is used for certain blood pacts when ImpactDebuff mode is ON. (/console gs c ImpactDebuff)
    	-- These pacts are normally used as nukes, but they're also strong debuffs which are enhanced by smn skill.
    	sets.pet_midcast.Impact = set_combine(sets.pet_midcast.SummoningMagic, {
    		main="Nirvana",
    		head="Convoker's Horn +3",
    		ear1="Lugalbanda Earring",
    		ear2="Enmerkar Earring"
    	})
    
    	sets.aftercast = {}
    
    	-- Idle set with no avatar out.
    	sets.aftercast.Idle = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    	
    	-- Idle set used when ForceIlvl is ON. Use this mode to avoid Gaiters dropping ilvl.
    	sets.aftercast.Idle_Ilvl = set_combine(sets.aftercast.Idle, {
    		feet="Baayami Sabots +1"
    	})
    	
    	sets.aftercast.DT = sets.DT_Base
    
    	-- Many idle sets inherit from this set.
    	-- Put common items here so you don't have to repeat them over and over.
    	sets.aftercast.Perp_Base = {
    		main="Nirvana",
    		sub="Oneiros Grip",
    		ammo="Sancus Sachet +1",
    		head="Convoker's Horn +3",
    		neck="Caller's Pendant",
    		ear1="Moonshade Earring",
    		ear2="Evans Earring",
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}},
    		hands="Asteria Mitts +1",
    		ring1="Stikini Ring +1",
    		ring2="Evoker's Ring",
    		back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Attack+10 Pet: Rng.Atk.+10','Pet: "Regen"+10',}},
    		waist="Isa Belt",
    		legs="Assiduity Pants +1",
    		feet="Baayami Sabots +1"
    	}
    
    	-- Avatar Melee set. Equipped when IdleMode is "DD" and MeleeMode is OFF.
    	sets.aftercast.Perp_DD = set_combine(sets.aftercast.Perp_Base, {
    		ear2="Rimeice Earring",
    		body="Glyphic Doublet +3",
    		hands={ name="Helios Gloves", augments={'Pet: Accuracy+22 Pet: Rng. Acc.+22','Pet: "Dbl. Atk."+8','Pet: Haste+6',}},
    		waist="Klouskap Sash",
    		feet={ name="Helios Boots", augments={'Pet: Accuracy+21 Pet: Rng. Acc.+21','Pet: "Dbl. Atk."+8','Pet: Haste+6',}}
    	})
    
    	-- Refresh set with avatar out. Equipped when IdleMode is "Refresh".
    	sets.aftercast.Perp_Refresh = set_combine(sets.aftercast.Perp_Base, {
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}}
    	})
    
    	sets.aftercast.Perp_RefreshSub50 = set_combine(sets.aftercast.Perp_Refresh, {
    		waist="Fucho-no-obi"
    	})
    	
    	sets.aftercast.Perp_Favor = set_combine(sets.aftercast.Perp_Refresh, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	sets.aftercast.Perp_Zendik = set_combine(sets.aftercast.Perp_Favor, {
    		body="Zendik Robe"
    	})
    
    	-- TP set. Equipped when IdleMode is "DD" and MeleeMode is ON.
    	sets.aftercast.Perp_Melee = set_combine(sets.aftercast.Perp_Refresh, {
    		head="Convoker's Horn +3",
    		neck="Shulmanu Collar",
    		ear1="Telos Earring",
    		ear2="Cessance Earring",
    		body="Tali'ah Manteel +2",
    		hands={ name="Merlinic Dastanas", augments={'"Mag.Atk.Bns."+3','Accuracy+12','"Store TP"+7','Accuracy+7 Attack+7',}},
    		ring1="Rajas Ring",
    		ring2="Petrov Ring",
    		back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10',}},
    		waist="Cetl Belt",
    		legs="Convoker's Spats +3",
    		feet="Convoker's Pigaches +3"
    	})
    
    	-- Pet:DT build. Equipped when IdleMode is "PetDT".
    	sets.aftercast.Avatar_DT = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	-- Perp down set used when ForceIlvl is ON. Use this mode to avoid Selenian Cap dropping ilvl.
    	sets.aftercast.Avatar_DT_Ilvl = set_combine(sets.aftercast.Avatar_DT, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	-- DT build with avatar out. Equipped when IdleMode is "DT".
    	sets.aftercast.Perp_DT = set_combine(sets.DT_Base, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	sets.aftercast.Spirit = {
    		main="Nirvana",
    		sub="Vox Grip",
    		ammo="Sancus Sachet +1",
    		head="Convoker's Horn +3",
    		neck="Incanter's Torque",
    		ear1="Andoaa Earring",
    		ear2="Evans Earring",
    		body="Baayami Robe +1",
    		hands="Baayami Cuffs +1",
    		ring1="Stikini Ring +1",
    		ring2="Evoker's Ring",
    		back={ name="Conveyance Cape", augments={'Summoning magic skill +5','Pet: Enmity+12','Blood Pact Dmg.+2',}},
    		waist="Lucidity Sash",
    		legs="Glyphic Spats +1",
    		feet="Baayami Sabots +1"
    	}
    
    	-- ===================================================================================================================
    	--		End of Sets
    	-- ===================================================================================================================
    
    	Buff_BPs_Duration = S{'Shining Ruby','Aerial Armor','Frost Armor','Rolling Thunder','Crimson Howl','Lightning Armor','Ecliptic Growl','Glittering Ruby','Earthen Ward','Hastega','Noctoshield','Ecliptic Howl','Dream Shroud','Earthen Armor','Fleet Wind','Inferno Howl','Heavenward Howl','Hastega II','Soothing Current','Crystal Blessing'}
    	Buff_BPs_Healing = S{'Healing Ruby','Healing Ruby II','Whispering Wind','Spring Water'}
    	Debuff_BPs = S{'Mewing Lullaby','Eerie Eye','Lunar Cry','Lunar Roar','Nightmare','Pavor Nocturnus','Ultimate Terror','Somnolence','Slowga','Tidal Roar','Diamond Storm','Sleepga','Shock Squall'}
    	Debuff_Rage_BPs = S{'Moonlit Charge','Tail Whip'}
    
    	Magic_BPs_NoTP = S{'Holy Mist','Nether Blast','Aerial Blast','Searing Light','Diamond Dust','Earthen Fury','Zantetsuken','Tidal Wave','Judgment Bolt','Inferno','Howling Moon','Ruinous Omen','Night Terror','Thunderspark'}
    	Magic_BPs_TP = S{'Impact','Conflag Strike','Level ? Holy','Lunar Bay'}
    	Merit_BPs = S{'Meteor Strike','Geocrush','Grand Fall','Wind Blade','Heavenly Strike','Thunderstorm'}
    	Physical_BPs_TP = S{'Rock Buster','Mountain Buster','Crescent Fang','Spinning Dive'}
    
    	AvatarList = S{'Shiva','Ramuh','Garuda','Leviathan','Diabolos','Titan','Fenrir','Ifrit','Carbuncle','Fire Spirit','Air Spirit','Ice Spirit','Thunder Spirit','Light Spirit','Dark Spirit','Earth Spirit','Water Spirit','Cait Sith','Alexander','Odin','Atomos'}
    	--TownIdle = S{"windurst woods","windurst waters","windurst walls","port windurst","bastok markets","bastok mines","port bastok","southern san d'oria","northern san d'oria","port san d'oria","upper jeuno","lower jeuno","port jeuno","ru'lude gardens","norg","kazham","tavnazian safehold","rabao","selbina","mhaura","aht urhgan whitegate","al zahbi","nashmau","western adoulin","eastern adoulin"}
    	--Salvage = S{"Bhaflau Remnants","Zhayolm Remnants","Arrapago Remnants","Silver Sea Remnants"}
    
    	-- Select initial macro set and set lockstyle
    	-- This section likely requires changes or removal if you aren't Pergatory
    	if pet.isvalid then
    		if pet.name=='Fenrir' then
    			send_command('input /macro book 10;wait .1;input /macro set 2;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Ifrit' then
    			send_command('input /macro book 10;wait .1;input /macro set 3;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Titan' then
    			send_command('input /macro book 10;wait .1;input /macro set 4;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Leviathan' then
    			send_command('input /macro book 10;wait .1;input /macro set 5;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Garuda' then
    			send_command('input /macro book 10;wait .1;input /macro set 6;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Shiva' then
    			send_command('input /macro book 10;wait .1;input /macro set 7;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Ramuh' then
    			send_command('input /macro book 10;wait .1;input /macro set 8;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Diabolos' then
    			send_command('input /macro book 10;wait .1;input /macro set 9;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Cait Sith' then
    			send_command('input /macro book 11;wait .1;input /macro set 2;wait 3;input /lockstyleset '..StartLockStyle)
    		end
    	else
    		send_command('input /macro book 10;wait .1;input /macro set 1;wait 3;input /lockstyleset '..StartLockStyle)
    	end
    	-- End macro set / lockstyle section
    end
    
    function pet_change(pet,gain)
        idle()
    end
    
    function pretarget(spell,action)
    	if not buffactive['Muddle'] then
    		-- Auto Remedy --
    		if AutoRemedy and (spell.action_type == 'Magic' or spell.type == 'JobAbility') then
    			if buffactive['Paralysis'] or (buffactive['Silence'] and not AutoEcho) then
    				cancel_spell()
    				send_command('input /item "Remedy" <me>')
    			end
    		end
    		-- Auto Echo Drop --
    		if AutoEcho and spell.action_type == 'Magic' and buffactive['Silence'] then
    			cancel_spell()
    			send_command('input /item "Echo Drops" <me>')
    		end
    	end
    end
    
    function precast(spell)
        if pet_midaction() or spell.type=="Item" then
    		return
    	end
    	-- Spell fast cast
        if spell.action_type=="Magic" then
    		if spell.name=="Stoneskin" then
    			equip(sets.precast.FC,{waist="Siegel Sash"})
    		else
    			equip(sets.precast.FC)
    		end
        end
    end
    
    function midcast(spell)
        if pet_midaction() or spell.type=="Item" then
            return
        end
    	-- BP Timer gear needs to swap here
    	if (spell.type=="BloodPactWard" or spell.type=="BloodPactRage") then
    		if not buffactive["Astral Conduit"] then
    			equip(sets.midcast.BP)
    		end
    		-- If lag compensation mode is on, set up a timer to equip the BP gear.
    		if LagMode then
    			send_command('wait 0.5;gs c EquipBP '..spell.name)
    		end
    	-- Spell Midcast & Potency Stuff
        elseif sets.midcast[spell.english] then
            equip(sets.midcast[spell.english])
    	elseif spell.name=="Elemental Siphon" then
    		if pet.element=="Light" or pet.element=="Dark" then
    			equip(sets.midcast.Siphon)
    		else
    			equip(sets.midcast.SiphonZodiac)
    		end
    	elseif spell.type=="SummonerPact" then
    		equip(sets.midcast.Summon)
    	elseif spell.type=="WhiteMagic" then
    		if string.find(spell.name,"Cure") or string.find(spell.name,"Curaga") then
    			equip(sets.midcast.Cure)
    		elseif string.find(spell.name,"Protect") or string.find(spell.name,"Shell") then
    			equip(sets.midcast.Enhancing,{ring2="Sheltered Ring"})
    		elseif spell.skill=="Enfeebling Magic" then
    			equip(sets.midcast.Enfeeble)
    		elseif spell.skill=="Enhancing Magic" then
    			equip(sets.midcast.Enhancing)
    		else
    			idle()
    		end
    	elseif spell.type=="BlackMagic" then
    		if spell.skill=="Elemental Magic" then
    			equip(sets.midcast.Nuke)
    		end
    	elseif spell.action_type=="Magic" then
    		equip(sets.midcast.EnmityRecast)
        else
            idle()
        end
    	-- Auto-cancel existing buffs
    	if spell.name=="Stoneskin" and buffactive["Stoneskin"] then
    		windower.send_command('cancel 37;')
    	elseif spell.name=="Sneak" and buffactive["Sneak"] and spell.target.type=="SELF" then
    		windower.send_command('cancel 71;')
    	elseif spell.name=="Utsusemi: Ichi" and buffactive["Copy Image"] then
    		windower.send_command('wait 1;cancel 66;')
    	end
    end
    
    function aftercast(spell)
        if pet_midaction() or spell.type=="Item" then
            return
        end
    	if not string.find(spell.type,"BloodPact") then
            idle()
        end
    end
    
    function status_change(new,old)
    	if new=="Idle" then
            idle()
    	end
    end
    
    function buff_change(name,gain)
        if name=="Quickening" then
            idle()
        end
    end
    
    function pet_midcast(spell)
    	if not LagMode then
    		equipBPGear(spell.name)
    	end
    end
    
    function pet_aftercast(spell)
        idle()
    end
    
    function equipBPGear(spell)
        if spell=="Perfect Defense" then
            equip(sets.pet_midcast.SummoningMagic)
    	elseif Debuff_BPs:contains(spell) then
    		equip(sets.pet_midcast.MagicAcc_BP)
    	elseif Buff_BPs_Healing:contains(spell) then
    		equip(sets.pet_midcast.Buff_Healing)
    	elseif Buff_BPs_Duration:contains(spell) then
    		equip(sets.pet_midcast.Buff)
    	elseif spell=="Flaming Crush" then
    		if AccMode then
    			equip(sets.pet_midcast.FlamingCrush_Acc)
    		else
    			equip(sets.pet_midcast.FlamingCrush)
    		end
    	elseif ImpactDebuff and (spell=="Impact" or spell=="Conflag Strike") then
    		equip(sets.pet_midcast.Impact)
    	elseif Magic_BPs_TP:contains(spell) or string.find(spell," II") or string.find(spell," IV") then
    		if AccMode then
    			equip(sets.pet_midcast.Magic_BP_TP_Acc)
    		else
    			equip(sets.pet_midcast.Magic_BP_TP)
    		end
    	elseif Magic_BPs_NoTP:contains(spell) then
    		if AccMode then
    			equip(sets.pet_midcast.Magic_BP_NoTP_Acc)
    		else
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		end
    	elseif Merit_BPs:contains(spell) then
    		if AccMode then
    			equip(sets.pet_midcast.Magic_BP_TP_Acc)
    		elseif spell=="Meteor Strike" and MeteorStrike>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Geocrush" and Geocrush>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Grand Fall" and GrandFall>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Wind Blade" and WindBlade>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Heavenly Strike" and HeavenlyStrike>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Thunderstorm" and Thunderstorm>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		else
    			equip(sets.pet_midcast.Magic_BP_TP)
    		end
    	elseif Debuff_Rage_BPs:contains(spell) then
    		equip(sets.pet_midcast.Debuff_Rage)
    	else
    		if AccMode then
    			equip(sets.pet_midcast.Physical_BP_Acc)
    		elseif Physical_BPs_TP:contains(spell) then
    			equip(sets.pet_midcast.Physical_BP_TP)
    		elseif buffactive["Aftermath: Lv.3"] then
    			equip(sets.pet_midcast.Physical_BP_AM3)
    		else
    			equip(sets.pet_midcast.Physical_BP)
    		end
    	end
    end
    
    -- This command is called whenever you input "gs c <command>"
    function self_command(command)
    	IdleModeCommands = {'DD','Refresh','DT','Favor','PetDT','Zendik'}
    	is_valid = false
    
    	for _, v in ipairs(IdleModeCommands) do
    		if command:lower()==v:lower() then
    			IdleMode = v
    			send_command('console_echo "Idle Mode: ['..IdleMode..']"')
    			idle()
    			return
    		end
    	end
    	if string.sub(command,1,7)=="EquipBP" then
    		equipBPGear(string.sub(command,9,string.len(command)))
    		return
    	elseif command:lower()=="accmode" then
    		AccMode = AccMode==false
    		is_valid = true
    		send_command('console_echo "AccMode: '..tostring(AccMode)..'"')
    	elseif command:lower()=="impactmode" then
    		ImpactDebuff = ImpactDebuff==false
    		is_valid = true
    		send_command('console_echo "Impact Debuff: '..tostring(ImpactDebuff)..'"')
        elseif command:lower()=="forceilvl" then
            ForceIlvl = ForceIlvl==false
            is_valid = true
            send_command('console_echo "Force iLVL: '..tostring(ForceIlvl)..'"')
    	elseif command:lower()=="lagmode" then
    		LagMode = LagMode==false
    		is_valid = true
    		send_command('console_echo "Lag Compensation Mode: '..tostring(LagMode)..'"')
    	elseif command:lower()=="meleemode" then
    		if MeleeMode then
    			MeleeMode = false
    			enable("main","sub")
    			send_command('console_echo "Melee Mode: false"')
    		else
    			MeleeMode = true
    			equip({main="Nirvana",sub="Elan Strap +1"})
    			disable("main","sub")
    			send_command('console_echo "Melee Mode: true"')
    		end
    		is_valid = true
    	elseif command=="ToggleIdle" then
    		is_valid = true
    		if IdleMode=="Refresh" then
    			IdleMode = "DT"
    		elseif IdleMode=="DT" then
    			IdleMode = "PetDT"
    		elseif IdleMode=="PetDT" then
    			IdleMode = "DD"
    		else
    			IdleMode = "Refresh"
    		end
    		send_command('console_echo "Idle Mode: ['..IdleMode..']"')
    	elseif command:lower()=="lowhp" then
    		-- Use for "Cure 500 HP" objectives in Omen
    		equip({head="Apogee Crown +1",body={ name="Apo. Dalmatica +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},legs="Apogee Slacks +1",feet="Apogee Pumps +1",back="Campestres's Cape"})
    		return
    	elseif string.sub(command:lower(),1,12)=="meteorstrike" then
    		MeteorStrike = string.sub(command,13,13)
    		send_command('console_echo "Meteor Strike: '..MeteorStrike..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,8)=="geocrush" then
    		Geocrush = string.sub(command,9,9)
    		send_command('console_echo "Geocrush: '..Geocrush..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,9)=="grandfall" then
    		GrandFall = string.sub(command,10,10)
    		send_command('console_echo "Grand Fall: '..GrandFall..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,9)=="windblade" then
    		WindBlade = +string.sub(command,10,10)
    		send_command('console_echo "Wind Blade: '..WindBlade..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,14)=="heavenlystrike" then
    		HeavenlyStrike = string.sub(command,15,15)
    		send_command('console_echo "Heavenly Strike: '..HeavenlyStrike..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,12)=="thunderstorm" then
    		Thunderstorm = string.sub(command,13,13)
    		send_command('console_echo "Thunderstorm: '..Thunderstorm..'/5"')
    		is_valid = true
    	elseif command=="TestMode" then
    		Test = Test + 1
    		if Test==3 then
    			Test = 0
    		end
    		is_valid = true
    		send_command('console_echo "Test Mode: '..tostring(Test)..'"')
    	end
    
    	if not is_valid then
    		send_command('console_echo "gs c {Refresh|DT|DD|PetDT|Favor} {AccMode} {ImpactMode} {MeleeMode}"')
    	end
    	idle()
    end
    
    function idle()
    	--if TownIdle:contains(world.area:lower()) then
    	--	return
    	--end
        if pet.isvalid then
    		if IdleMode=='DT' then
    			equip(sets.aftercast.Perp_DT)
    		elseif string.find(pet.name,'Spirit') then
                equip(sets.aftercast.Spirit)
    		elseif IdleMode=='PetDT' then
    			if ForceIlvl then
    				equip(sets.aftercast.Avatar_DT_Ilvl)
    			else
    				equip(sets.aftercast.Avatar_DT)
    			end
            elseif IdleMode=='Refresh' then
    			if player.mpp < 50 then
    				equip(sets.aftercast.Perp_RefreshSub50)
    			else
    				equip(sets.aftercast.Perp_Refresh)
    			end
    		elseif IdleMode=='Favor' then
    			equip(sets.aftercast.Perp_Favor)
    		elseif IdleMode=='Zendik' then
    			equip(sets.aftercast.Perp_Zendik)
    		elseif MeleeMode then
    			equip(sets.aftercast.Perp_Melee)
            elseif IdleMode=='DD' then
                equip(sets.aftercast.Perp_DD)
            end
    		-- Gaiters if Fleet Wind is up
    		if buffactive['Quickening'] and IdleMode~='DT' and not ForceIlvl then
    			equip({feet="Herald's Gaiters"})
    		end
    	else
    		if IdleMode=='DT' then
    			equip(sets.aftercast.DT)
    		elseif MeleeMode and IdleMode=='DD' then
    			equip(sets.aftercast.Perp_Melee)
    		elseif ForceIlvl then
    			equip(sets.aftercast.Idle_Ilvl)
    		else
    			equip(sets.aftercast.Idle)
    		end
        end
    	-- Balrahn's Ring
    	--if Salvage:contains(world.area) then
    	--	equip({ring2="Balrahn's Ring"})
    	--end
    	-- Maquette Ring
    	--if world.area=='Maquette Abdhaljs-Legion' and not IdleMode=='DT' then
    	--	equip({ring2="Maquette Ring"})
    	--end
    end
    - would anyone know why certain aftercast equips isn't equiping ? i put debug mode and its spamming gearswap (Debug mode) : enterbuffing Buff_refresh. If someone wanna give me a simpler LUA for smn that would be cool also.

  8. #268

    Quote Originally Posted by trinironnie View Post
    -
    Code:
    -- IdleMode determines the set used after casting. You change it with "/console gs c <IdleMode>"
    -- The modes are:
    -- Refresh: Uses the most refresh available.
    -- DT: A mix of refresh, PDT, and MDT to help when you can't avoid AOE.
    -- PetDT: Sacrifice refresh to reduce avatar's damage taken. WARNING: Selenian Cap drops you below 119, use with caution!
    -- DD: When melee mode is on and you're engaged, uses TP gear. Otherwise, avatar melee gear.
    -- Favor: Uses Beckoner's Horn +1 and max smn skill to boost the favor effect.
    -- Zendik: Favor build with the Zendik Robe added in, for Shiva's Favor in manaburn parties. (Shut up, it sounded like a good idea at the time)
    
    -- Additional Bindings:
    -- F9 - Toggles between a subset of IdleModes (Refresh > DT > PetDT)
    -- F10 - Toggles MeleeMode (When enabled, equips Nirvana and Elan+1, then disables those 2 slots from swapping)
    --       NOTE: If you don't already have the Nirvana & Elan+1 equipped, YOU WILL LOSE TP
    
    -- Additional Commands:
    -- /console gs c AccMode - Toggles high-accuracy sets to be used where appropriate.
    -- /console gs c ImpactMode - Toggles between using normal magic BP set for Fenrir's Impact or a custom high-skill set for debuffs.
    -- /console gs c ForceIlvl - I have this set up to override a few specific slots where I normally use non-ilvl pieces.
    -- /console gs c LagMode - Used to help BPs land in the right gear in high-lag situations.
    --							Sets a timer to swap gear 0.2s after the BP is used rather than waiting for server response.
    
    function file_unload()
    	send_command('unbind f9')
    	send_command('unbind f10')
    end
    
    function get_sets()
    	send_command('bind f9 gs c ToggleIdle')
    	send_command('bind f10 gs c MeleeMode')
    
    	-- Set your merits here. This is used in deciding between Enticer's Pants or Apogee Slacks +1.
    	-- To change in-game, "/console gs c MeteorStrike3" will change Meteor Strike to 3/5 merits.
    	-- The damage difference is very minor unless you're over 2400 TP.
    	-- It's ok to just always use Enticer's Pants and ignore this section.
    	MeteorStrike = 1
    	HeavenlyStrike = 1
    	WindBlade = 1
    	Geocrush = 1
    	Thunderstorm = 5
    	GrandFall = 1
    
    	StartLockStyle = '85'
    	IdleMode = 'Refresh'
    	AccMode = false
    	ImpactDebuff = false
    	MeleeMode = false
    	ForceIlvl = false
    	LagMode = false -- Default LagMode. If you have a lot of lag issues, change to "true".
    	AutoRemedy = false -- Auto Remedy when using an ability while Paralyzed.
    	AutoEcho = false -- Auto Echo Drop when using an ability while Silenced.
    	Test = 0
    
    	-- ===================================================================================================================
    	--		Sets
    	-- ===================================================================================================================
    
    	-- Base Damage Taken Set - Mainly used when IdleMode is "DT"
    	sets.DT_Base = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.precast = {}
    
    	-- Fast Cast
    	sets.precast.FC = {
    		main="Oranyan",
        sub="Elan Strap +1",
        ammo="Impatiens",
        head="Nahtirah Hat",
        body="Inyanga Jubbah +1",
        hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+15 Pet: "Mag.Atk.Bns."+15','Blood Pact Dmg.+9','Pet: INT+3',}},
        legs="Gyve Trousers",
        feet="Convo. Pigaches +3",
        neck="Voltsurge Torque",
        waist="Witful Belt",
        left_ear="Loquac. Earring",
        right_ear="Etiolation Earring",
        left_ring="Prolix Ring",
        right_ring="Varar Ring",
        back="Swith Cape",
    	}
    
        sets.midcast = {}
    
    	-- BP Timer Gear
        sets.midcast.BP = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Con. Doublet +3",
        hands={ name="Glyphic Bracers +1", augments={'Inc. Sp. "Blood Pact" magic burst dmg.',}},
        legs="Beck. Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Summoning magic skill +20','Blood Pact Dmg.+8',}},
        neck="Incanter's Torque",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Gelos Earring",
        left_ring="Stikini Ring",
        right_ring="Evoker's Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
        sets.midcast.Siphon = {
    		main={ name="Espiritus", augments={'Summoning magic skill +15','Pet: Mag. Acc.+30','System: 2 ID: 153 Val: 3',}},
    		sub="Vox Grip",
    		ammo="Esper Stone +1",
    		head="Baayami Hat +1",
    		neck="Incanter's Torque",
    		ear1="Andoaa Earring",
    		ear2="Smn. Earring",
    		body="Baayami Robe +1",
    		hands="Baayami Cuffs +1",
    		ring1="Stikini Ring +1",
    		ring2="Evoker's Ring",
    		back={ name="Conveyance Cape", augments={'Summoning magic skill +5','Pet: Enmity+12','Blood Pact Dmg.+2',}},
    		waist="Kobo Obi",
    		legs="Baayami Slops +1",
    		feet="Beck. Pigaches +1"
    	}
    
    	sets.midcast.SiphonZodiac = set_combine(sets.midcast.Siphon, { ring1="Zodiac Ring" })
    
    	sets.midcast.Summon = set_combine(sets.DT_Base, {
    		body="Baayami Robe +1"
    	})
    
    	sets.midcast.Cure = {
    		main="Nirvana",
    		sub="Oneiros Grip",
    		ammo="Sancus Sachet +1",
    		head={ name="Vanya Hood", augments={'MP+50','"Cure" potency +7%','Enmity-6',}},
    		neck="Nodens Gorget",
    		ear1="Mendi. Earring",
    		ear2="Novia Earring",
    		body="Witching Robe",
    		hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
    		ring1="Lebeche Ring",
    		ring2="Menelaus's Ring",
    		back="Tempered Cape +1",
    		waist="Witful Belt",
    		legs="Assiduity Pants +1",
    		feet={ name="Vanya Clogs", augments={'MP+50','"Cure" potency +7%','Enmity-6',}}
    	}
    
    	sets.midcast.Cursna = set_combine(sets.precast.FC, {
    		neck="Debilis Medallion",
    		ear1="Healing Earring",
    		ear2="Beatific Earring",
    		ring1="Menelaus's Ring",
    		ring2="Haoma's Ring",
    		back="Tempered Cape +1",
    		waist="Bishop's Sash",
    		feet={ name="Vanya Clogs", augments={'Healing magic skill +20','"Cure" spellcasting time -7%','Magic dmg. taken -3',}}
    	})
    	
    	sets.midcast.EnmityRecast = set_combine(sets.precast.FC, {
    		main="Nirvana",
    		ear1="Novia Earring",
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}}
    	})
    
    	sets.midcast.Enfeeble = {
    		main={ name="Gada", augments={'"Fast Cast"+2','MND+13','Mag. Acc.+20','"Mag.Atk.Bns."+14',}},
    		sub="Ammurapi Shield",
    		head="Inyanga Tiara +2",
    		neck="Erra Pendant",
    		ear1="Dignitary's Earring",
    		ear2="Gwati Earring",
    		body="Inyanga Jubbah +2",
    		hands="Inyanga Dastanas +2",
    		ring1="Stikini Ring +1",
    		ring2="Stikini Ring +1",
    		back={ name="Campestres's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Haste+10','Phys. dmg. taken-10%',}},
    		waist="Luminary Sash",
    		legs="Inyanga Shalwar +2",
    		feet="Skaoi Boots"
    	}
    
    	sets.midcast.Enhancing = {
    		main={ name="Gada", augments={'Enh. Mag. eff. dur. +6','DEX+1','Mag. Acc.+5','"Mag.Atk.Bns."+18','DMG:+4',}},
    		sub="Ammurapi Shield",
    		head={ name="Telchine Cap", augments={'Pet: "Mag.Atk.Bns."+19','"Elemental Siphon"+25','Enh. Mag. eff. dur. +10',}},
    		neck="Incanter's Torque",
    		ear1="Andoaa Earring",
    		ear2="Augmenting Earring",
    		body={ name="Telchine Chas.", augments={'"Conserve MP"+5','Enh. Mag. eff. dur. +10',}},
    		hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
    		ring1="Stikini Ring +1",
    		ring2="Stikini Ring +1",
    		back="Merciful Cape",
    		waist="Olympus Sash",
    		legs={ name="Telchine Braconi", augments={'"Conserve MP"+4','Enh. Mag. eff. dur. +10',}},
    		feet={ name="Telchine Pigaches", augments={'"Conserve MP"+3','Enh. Mag. eff. dur. +9',}}
    	}
    
    	sets.midcast.Stoneskin = set_combine(sets.midcast.Enhancing, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Befouled Crown",
        body={ name="Telchine Chas.", augments={'"Regen" potency+3',}},
        hands={ name="Telchine Gloves", augments={'"Cure" potency +8%','Enh. Mag. eff. dur. +9',}},
        legs={ name="Telchine Braconi", augments={'Song spellcasting time -5%','Enh. Mag. eff. dur. +9',}},
        feet={ name="Telchine Pigaches", augments={'Mag. Acc.+5','Song spellcasting time -2%','Enh. Mag. eff. dur. +9',}},
        neck="Incanter's Torque",
        waist="Siegel Sash",
        left_ear="Lugalbanda Earring",
        right_ear="Evans Earring",
        left_ring="Varar Ring",
        right_ring="Evoker's Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	sets.midcast.Nuke = {
    		main={ name="Grioavolr", augments={'"Fast Cast"+6','INT+2','"Mag.Atk.Bns."+17',}},
    		sub="Niobid Strap",
    		head="Inyanga Tiara +2",
    		neck="Eddy Necklace",
    		ear1="Hecate's Earring",
    		ear2="Friomisi Earring",
    		body="Witching Robe",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Crit.hit rate +2','"Mag.Atk.Bns."+25','"Refresh"+2','Mag. Acc.+10 "Mag.Atk.Bns."+10',}},
    		ring1="Acumen Ring",
    		ring2="Strendu Ring",
    		back={ name="Campestres's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Haste+10','Phys. dmg. taken-10%',}},
    		waist="Eschan Stone",
    		legs="Lengo Pants",
    		feet={ name="Merlinic Crackows", augments={'DEX+10','Phys. dmg. taken -2%','"Refresh"+2','Accuracy+3 Attack+3',}}
    	}
    
        sets.midcast["Refresh"] = set_combine(sets.midcast.Enhancing, {
    		head="Amalric Coif +1",
    		waist="Gishdubar Sash"
    	})
    
        sets.midcast["Aquaveil"] = set_combine(sets.midcast.Enhancing, {
    		main="Vadose Rod",
    		head="Amalric Coif +1"
    	})
    
    	sets.midcast["Mana Cede"] = { hands="Beckoner's Bracers +1" }
    
        sets.midcast["Astral Flow"] = { head="Glyphic Horn +1" }
    
    	sets.midcast["Garland of Bliss"] = set_combine(sets.midcast.Nuke, {
    		hands="Inyanga Dastanas +2",
    		legs="Inyanga Shalwar +2",
    		feet="Inyanga Crackows +2"
    	})
    
    	sets.midcast["Shattersoul"] = {
    		head="Convoker's Horn +3",
    		neck="Fotia Gorget",
    		ear1="Zennaroi Earring",
    		ear2="Telos Earring",
    		body="Tali'ah Manteel +2",
    		hands="Tali'ah Gages +2",
    		ring1="Rajas Ring",
    		ring2="Varar Ring +1",
    		back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10',}},
    		waist="Fotia Belt",
    		legs={ name="Telchine Braconi", augments={'Accuracy+17','Weapon Skill Acc.+14','Weapon skill damage +3%',}},
    		feet="Convoker's Pigaches +3"
    	}
    
    	sets.midcast["Cataclysm"] = sets.midcast.Nuke
    
    	sets.pet_midcast = {}
    
    	-- Main physical pact set (Volt Strike, Pred Claws, etc.)
    	sets.pet_midcast.Physical_BP = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Pet: Attack+30 Pet: Rng.Atk.+30','Blood Pact Dmg.+10','Pet: STR+3','Pet: Mag. Acc.+11',}},
        legs={ name="Enticer's Pants", augments={'MP+50','Pet: Accuracy+13 Pet: Rng. Acc.+13','Pet: Mag. Acc.+14','Pet: Damage taken -4%',}},
        feet="Convo. Pigaches +3",
        neck="Shulmanu Collar",
        waist="Regal Belt",
        left_ear="Lugalbanda Earring",
        right_ear="Gelos Earring",
        left_ring="Varar Ring",
        right_ring="Varar Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.Physical_BP_AM3 = set_combine(sets.pet_midcast.Physical_BP, {
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
    		ear2="Gelos Earring",
    		body="Convoker's Doublet +3",
    		feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}}
    	})
    
    	-- Physical pacts which benefit more from TP than Pet:DA (like single-hit BP)
    	sets.pet_midcast.Physical_BP_TP = set_combine(sets.pet_midcast.Physical_BP, {
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
    		ear2="Gelos Earring",
    		body="Convoker's Doublet +3",
    		waist="Regal Belt",
    		legs="Enticer's Pants",
    		feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}}
    	})
    
    	-- Used for all physical pacts when AccMode is true
    	sets.pet_midcast.Physical_BP_Acc = set_combine(sets.pet_midcast.Physical_BP, {
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Accuracy+28 Pet: Rng. Acc.+28','Blood Pact Dmg.+10','Pet: DEX+9','Pet: Mag. Acc.+9','Pet: "Mag.Atk.Bns."+3',}},
    		--feet="Convoker's Pigaches +3"
    	})
    
    	-- Base magic pact set
    	sets.pet_midcast.Magic_BP_Base = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+15 Pet: "Mag.Atk.Bns."+15','Blood Pact Dmg.+9','Pet: INT+3',}},
        legs={ name="Merlinic Shalwar", augments={'Pet: Mag. Acc.+24 Pet: "Mag.Atk.Bns."+24','Pet: INT+15','Pet: "Mag.Atk.Bns."+8',}},
        feet="Convo. Pigaches +3",
        neck="Adad Amulet",
        waist="Regal Belt",
        left_ear="Lugalbanda Earring",
        right_ear="Gelos Earring",
        left_ring="Varar Ring",
        right_ring="Varar Ring",
        back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Mag. Acc+20 /Mag. Dmg.+20','Pet: Damage taken -5%',}},
    	}
    	
    	-- Some magic pacts benefit more from TP than others.
    	-- Note: This set will only be used on merit pacts if you have less than 4 merits.
    	--       Make sure to update your merit values at the top of this Lua.
    	sets.pet_midcast.Magic_BP_TP = set_combine(sets.pet_midcast.Magic_BP_Base, {
    		legs="Enticer's Pants"
    	})
    
    	-- NoTP set used when you don't need Enticer's
    	sets.pet_midcast.Magic_BP_NoTP = set_combine(sets.pet_midcast.Magic_BP_Base, {
    		legs={ name="Apogee Slacks +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}}
    	})
    
    	sets.pet_midcast.Magic_BP_TP_Acc = set_combine(sets.pet_midcast.Magic_BP_TP, {
    		head={ name="Merlinic Hood", augments={'Pet: Mag. Acc.+21 Pet: "Mag.Atk.Bns."+21','Blood Pact Dmg.+7','Pet: INT+6','Pet: "Mag.Atk.Bns."+11',}},
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+29','Blood Pact Dmg.+10','Pet: INT+7','Pet: "Mag.Atk.Bns."+10',}}
    	})
    
    	sets.pet_midcast.Magic_BP_NoTP_Acc = set_combine(sets.pet_midcast.Magic_BP_NoTP, {
    		head={ name="Merlinic Hood", augments={'Pet: Mag. Acc.+21 Pet: "Mag.Atk.Bns."+21','Blood Pact Dmg.+7','Pet: INT+6','Pet: "Mag.Atk.Bns."+11',}},
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+29','Blood Pact Dmg.+10','Pet: INT+7','Pet: "Mag.Atk.Bns."+10',}}
    	})
    
    	sets.pet_midcast.FlamingCrush = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+15 Pet: "Mag.Atk.Bns."+15','Blood Pact Dmg.+9','Pet: INT+3',}},
        legs={ name="Enticer's Pants", augments={'MP+50','Pet: Accuracy+13 Pet: Rng. Acc.+13','Pet: Mag. Acc.+14','Pet: Damage taken -4%',}},
        feet="Convo. Pigaches +3",
        neck="Adad Amulet",
        waist="Regal Belt",
        left_ear="Lugalbanda Earring",
        right_ear="Gelos Earring",
        left_ring="Varar Ring",
        right_ring="Varar Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.FlamingCrush_Acc = set_combine(sets.pet_midcast.FlamingCrush, {
    		ear2="Kyrene's Earring",
    		body="Convoker's Doublet +3",
    		hands={ name="Merlinic Dastanas", augments={'Pet: Accuracy+28 Pet: Rng. Acc.+28','Blood Pact Dmg.+10','Pet: DEX+9','Pet: Mag. Acc.+9','Pet: "Mag.Atk.Bns."+3',}},
    		--feet="Convoker's Pigaches +3"
    	})
    
    	-- Pet: Magic Acc set - Mainly used for debuff pacts like Shock Squall
    	sets.pet_midcast.MagicAcc_BP = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Beck. Doublet +1",
        hands="Lamassu Mitts +1",
        legs="Beck. Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Summoning magic skill +20','Blood Pact Dmg.+8',}},
        neck="Incanter's Torque",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Stikini Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.Debuff_Rage = sets.pet_midcast.MagicAcc_BP
    
    	-- Pure summoning magic set, mainly used for buffs like Hastega II.
    	sets.pet_midcast.SummoningMagic = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Beck. Doublet +1",
        hands="Lamassu Mitts +1",
        legs="Beck. Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Summoning magic skill +20','Blood Pact Dmg.+8',}},
        neck="Incanter's Torque",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Stikini Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	sets.pet_midcast.Buff = sets.pet_midcast.SummoningMagic
    
    	-- I use Apogee gear for healing BPs because the amount healed is affected by avatar max HP.
    	-- I'm probably stupid. It puts you in yellow HP after using a healing move.
    	sets.pet_midcast.Buff_Healing = set_combine(sets.pet_midcast.SummoningMagic, {
    		main="Nirvana",
    		head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}},
    		back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Attack+10 Pet: Rng.Atk.+10','Pet: "Regen"+10',}},
    		feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}}
    	})
    
    	-- This set is used for certain blood pacts when ImpactDebuff mode is ON. (/console gs c ImpactDebuff)
    	-- These pacts are normally used as nukes, but they're also strong debuffs which are enhanced by smn skill.
    	sets.pet_midcast.Impact = set_combine(sets.pet_midcast.SummoningMagic, {
    		main="Nirvana",
    		head="Convoker's Horn +3",
    		ear1="Lugalbanda Earring",
    		ear2="Enmerkar Earring"
    	})
    
    	sets.aftercast = {}
    
    	-- Idle set with no avatar out.
    	sets.aftercast.Idle = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    	
    	-- Idle set used when ForceIlvl is ON. Use this mode to avoid Gaiters dropping ilvl.
    	sets.aftercast.Idle_Ilvl = set_combine(sets.aftercast.Idle, {
    		feet="Baayami Sabots +1"
    	})
    	
    	sets.aftercast.DT = sets.DT_Base
    
    	-- Many idle sets inherit from this set.
    	-- Put common items here so you don't have to repeat them over and over.
    	sets.aftercast.Perp_Base = {
    		main="Nirvana",
    		sub="Oneiros Grip",
    		ammo="Sancus Sachet +1",
    		head="Convoker's Horn +3",
    		neck="Caller's Pendant",
    		ear1="Moonshade Earring",
    		ear2="Evans Earring",
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}},
    		hands="Asteria Mitts +1",
    		ring1="Stikini Ring +1",
    		ring2="Evoker's Ring",
    		back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Attack+10 Pet: Rng.Atk.+10','Pet: "Regen"+10',}},
    		waist="Isa Belt",
    		legs="Assiduity Pants +1",
    		feet="Baayami Sabots +1"
    	}
    
    	-- Avatar Melee set. Equipped when IdleMode is "DD" and MeleeMode is OFF.
    	sets.aftercast.Perp_DD = set_combine(sets.aftercast.Perp_Base, {
    		ear2="Rimeice Earring",
    		body="Glyphic Doublet +3",
    		hands={ name="Helios Gloves", augments={'Pet: Accuracy+22 Pet: Rng. Acc.+22','Pet: "Dbl. Atk."+8','Pet: Haste+6',}},
    		waist="Klouskap Sash",
    		feet={ name="Helios Boots", augments={'Pet: Accuracy+21 Pet: Rng. Acc.+21','Pet: "Dbl. Atk."+8','Pet: Haste+6',}}
    	})
    
    	-- Refresh set with avatar out. Equipped when IdleMode is "Refresh".
    	sets.aftercast.Perp_Refresh = set_combine(sets.aftercast.Perp_Base, {
    		body={ name="Apo. Dalmatica +1", augments={'Summoning magic skill +20','Enmity-6','Pet: Damage taken -4%',}}
    	})
    
    	sets.aftercast.Perp_RefreshSub50 = set_combine(sets.aftercast.Perp_Refresh, {
    		waist="Fucho-no-obi"
    	})
    	
    	sets.aftercast.Perp_Favor = set_combine(sets.aftercast.Perp_Refresh, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	sets.aftercast.Perp_Zendik = set_combine(sets.aftercast.Perp_Favor, {
    		body="Zendik Robe"
    	})
    
    	-- TP set. Equipped when IdleMode is "DD" and MeleeMode is ON.
    	sets.aftercast.Perp_Melee = set_combine(sets.aftercast.Perp_Refresh, {
    		head="Convoker's Horn +3",
    		neck="Shulmanu Collar",
    		ear1="Telos Earring",
    		ear2="Cessance Earring",
    		body="Tali'ah Manteel +2",
    		hands={ name="Merlinic Dastanas", augments={'"Mag.Atk.Bns."+3','Accuracy+12','"Store TP"+7','Accuracy+7 Attack+7',}},
    		ring1="Rajas Ring",
    		ring2="Petrov Ring",
    		back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Dbl.Atk."+10',}},
    		waist="Cetl Belt",
    		legs="Convoker's Spats +3",
    		feet="Convoker's Pigaches +3"
    	})
    
    	-- Pet:DT build. Equipped when IdleMode is "PetDT".
    	sets.aftercast.Avatar_DT = {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	}
    
    	-- Perp down set used when ForceIlvl is ON. Use this mode to avoid Selenian Cap dropping ilvl.
    	sets.aftercast.Avatar_DT_Ilvl = set_combine(sets.aftercast.Avatar_DT, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	-- DT build with avatar out. Equipped when IdleMode is "DT".
    	sets.aftercast.Perp_DT = set_combine(sets.DT_Base, {
    		main="Nirvana",
        sub="Elan Strap +1",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands="Asteria Mitts +1",
        legs="Assid. Pants +1",
        feet="Beck. Pigaches +1",
        neck="Erra Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Lugalbanda Earring",
        left_ring="Evoker's Ring",
        right_ring="Defending Ring",
        back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Accuracy+10 Pet: Rng. Acc.+10','Pet: Haste+10',}},
    	})
    
    	sets.aftercast.Spirit = {
    		main="Nirvana",
    		sub="Vox Grip",
    		ammo="Sancus Sachet +1",
    		head="Convoker's Horn +3",
    		neck="Incanter's Torque",
    		ear1="Andoaa Earring",
    		ear2="Evans Earring",
    		body="Baayami Robe +1",
    		hands="Baayami Cuffs +1",
    		ring1="Stikini Ring +1",
    		ring2="Evoker's Ring",
    		back={ name="Conveyance Cape", augments={'Summoning magic skill +5','Pet: Enmity+12','Blood Pact Dmg.+2',}},
    		waist="Lucidity Sash",
    		legs="Glyphic Spats +1",
    		feet="Baayami Sabots +1"
    	}
    
    	-- ===================================================================================================================
    	--		End of Sets
    	-- ===================================================================================================================
    
    	Buff_BPs_Duration = S{'Shining Ruby','Aerial Armor','Frost Armor','Rolling Thunder','Crimson Howl','Lightning Armor','Ecliptic Growl','Glittering Ruby','Earthen Ward','Hastega','Noctoshield','Ecliptic Howl','Dream Shroud','Earthen Armor','Fleet Wind','Inferno Howl','Heavenward Howl','Hastega II','Soothing Current','Crystal Blessing'}
    	Buff_BPs_Healing = S{'Healing Ruby','Healing Ruby II','Whispering Wind','Spring Water'}
    	Debuff_BPs = S{'Mewing Lullaby','Eerie Eye','Lunar Cry','Lunar Roar','Nightmare','Pavor Nocturnus','Ultimate Terror','Somnolence','Slowga','Tidal Roar','Diamond Storm','Sleepga','Shock Squall'}
    	Debuff_Rage_BPs = S{'Moonlit Charge','Tail Whip'}
    
    	Magic_BPs_NoTP = S{'Holy Mist','Nether Blast','Aerial Blast','Searing Light','Diamond Dust','Earthen Fury','Zantetsuken','Tidal Wave','Judgment Bolt','Inferno','Howling Moon','Ruinous Omen','Night Terror','Thunderspark'}
    	Magic_BPs_TP = S{'Impact','Conflag Strike','Level ? Holy','Lunar Bay'}
    	Merit_BPs = S{'Meteor Strike','Geocrush','Grand Fall','Wind Blade','Heavenly Strike','Thunderstorm'}
    	Physical_BPs_TP = S{'Rock Buster','Mountain Buster','Crescent Fang','Spinning Dive'}
    
    	AvatarList = S{'Shiva','Ramuh','Garuda','Leviathan','Diabolos','Titan','Fenrir','Ifrit','Carbuncle','Fire Spirit','Air Spirit','Ice Spirit','Thunder Spirit','Light Spirit','Dark Spirit','Earth Spirit','Water Spirit','Cait Sith','Alexander','Odin','Atomos'}
    	--TownIdle = S{"windurst woods","windurst waters","windurst walls","port windurst","bastok markets","bastok mines","port bastok","southern san d'oria","northern san d'oria","port san d'oria","upper jeuno","lower jeuno","port jeuno","ru'lude gardens","norg","kazham","tavnazian safehold","rabao","selbina","mhaura","aht urhgan whitegate","al zahbi","nashmau","western adoulin","eastern adoulin"}
    	--Salvage = S{"Bhaflau Remnants","Zhayolm Remnants","Arrapago Remnants","Silver Sea Remnants"}
    
    	-- Select initial macro set and set lockstyle
    	-- This section likely requires changes or removal if you aren't Pergatory
    	if pet.isvalid then
    		if pet.name=='Fenrir' then
    			send_command('input /macro book 10;wait .1;input /macro set 2;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Ifrit' then
    			send_command('input /macro book 10;wait .1;input /macro set 3;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Titan' then
    			send_command('input /macro book 10;wait .1;input /macro set 4;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Leviathan' then
    			send_command('input /macro book 10;wait .1;input /macro set 5;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Garuda' then
    			send_command('input /macro book 10;wait .1;input /macro set 6;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Shiva' then
    			send_command('input /macro book 10;wait .1;input /macro set 7;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Ramuh' then
    			send_command('input /macro book 10;wait .1;input /macro set 8;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Diabolos' then
    			send_command('input /macro book 10;wait .1;input /macro set 9;wait 3;input /lockstyleset '..StartLockStyle)
    		elseif pet.name=='Cait Sith' then
    			send_command('input /macro book 11;wait .1;input /macro set 2;wait 3;input /lockstyleset '..StartLockStyle)
    		end
    	else
    		send_command('input /macro book 10;wait .1;input /macro set 1;wait 3;input /lockstyleset '..StartLockStyle)
    	end
    	-- End macro set / lockstyle section
    end
    
    function pet_change(pet,gain)
        idle()
    end
    
    function pretarget(spell,action)
    	if not buffactive['Muddle'] then
    		-- Auto Remedy --
    		if AutoRemedy and (spell.action_type == 'Magic' or spell.type == 'JobAbility') then
    			if buffactive['Paralysis'] or (buffactive['Silence'] and not AutoEcho) then
    				cancel_spell()
    				send_command('input /item "Remedy" <me>')
    			end
    		end
    		-- Auto Echo Drop --
    		if AutoEcho and spell.action_type == 'Magic' and buffactive['Silence'] then
    			cancel_spell()
    			send_command('input /item "Echo Drops" <me>')
    		end
    	end
    end
    
    function precast(spell)
        if pet_midaction() or spell.type=="Item" then
    		return
    	end
    	-- Spell fast cast
        if spell.action_type=="Magic" then
    		if spell.name=="Stoneskin" then
    			equip(sets.precast.FC,{waist="Siegel Sash"})
    		else
    			equip(sets.precast.FC)
    		end
        end
    end
    
    function midcast(spell)
        if pet_midaction() or spell.type=="Item" then
            return
        end
    	-- BP Timer gear needs to swap here
    	if (spell.type=="BloodPactWard" or spell.type=="BloodPactRage") then
    		if not buffactive["Astral Conduit"] then
    			equip(sets.midcast.BP)
    		end
    		-- If lag compensation mode is on, set up a timer to equip the BP gear.
    		if LagMode then
    			send_command('wait 0.5;gs c EquipBP '..spell.name)
    		end
    	-- Spell Midcast & Potency Stuff
        elseif sets.midcast[spell.english] then
            equip(sets.midcast[spell.english])
    	elseif spell.name=="Elemental Siphon" then
    		if pet.element=="Light" or pet.element=="Dark" then
    			equip(sets.midcast.Siphon)
    		else
    			equip(sets.midcast.SiphonZodiac)
    		end
    	elseif spell.type=="SummonerPact" then
    		equip(sets.midcast.Summon)
    	elseif spell.type=="WhiteMagic" then
    		if string.find(spell.name,"Cure") or string.find(spell.name,"Curaga") then
    			equip(sets.midcast.Cure)
    		elseif string.find(spell.name,"Protect") or string.find(spell.name,"Shell") then
    			equip(sets.midcast.Enhancing,{ring2="Sheltered Ring"})
    		elseif spell.skill=="Enfeebling Magic" then
    			equip(sets.midcast.Enfeeble)
    		elseif spell.skill=="Enhancing Magic" then
    			equip(sets.midcast.Enhancing)
    		else
    			idle()
    		end
    	elseif spell.type=="BlackMagic" then
    		if spell.skill=="Elemental Magic" then
    			equip(sets.midcast.Nuke)
    		end
    	elseif spell.action_type=="Magic" then
    		equip(sets.midcast.EnmityRecast)
        else
            idle()
        end
    	-- Auto-cancel existing buffs
    	if spell.name=="Stoneskin" and buffactive["Stoneskin"] then
    		windower.send_command('cancel 37;')
    	elseif spell.name=="Sneak" and buffactive["Sneak"] and spell.target.type=="SELF" then
    		windower.send_command('cancel 71;')
    	elseif spell.name=="Utsusemi: Ichi" and buffactive["Copy Image"] then
    		windower.send_command('wait 1;cancel 66;')
    	end
    end
    
    function aftercast(spell)
        if pet_midaction() or spell.type=="Item" then
            return
        end
    	if not string.find(spell.type,"BloodPact") then
            idle()
        end
    end
    
    function status_change(new,old)
    	if new=="Idle" then
            idle()
    	end
    end
    
    function buff_change(name,gain)
        if name=="Quickening" then
            idle()
        end
    end
    
    function pet_midcast(spell)
    	if not LagMode then
    		equipBPGear(spell.name)
    	end
    end
    
    function pet_aftercast(spell)
        idle()
    end
    
    function equipBPGear(spell)
        if spell=="Perfect Defense" then
            equip(sets.pet_midcast.SummoningMagic)
    	elseif Debuff_BPs:contains(spell) then
    		equip(sets.pet_midcast.MagicAcc_BP)
    	elseif Buff_BPs_Healing:contains(spell) then
    		equip(sets.pet_midcast.Buff_Healing)
    	elseif Buff_BPs_Duration:contains(spell) then
    		equip(sets.pet_midcast.Buff)
    	elseif spell=="Flaming Crush" then
    		if AccMode then
    			equip(sets.pet_midcast.FlamingCrush_Acc)
    		else
    			equip(sets.pet_midcast.FlamingCrush)
    		end
    	elseif ImpactDebuff and (spell=="Impact" or spell=="Conflag Strike") then
    		equip(sets.pet_midcast.Impact)
    	elseif Magic_BPs_TP:contains(spell) or string.find(spell," II") or string.find(spell," IV") then
    		if AccMode then
    			equip(sets.pet_midcast.Magic_BP_TP_Acc)
    		else
    			equip(sets.pet_midcast.Magic_BP_TP)
    		end
    	elseif Magic_BPs_NoTP:contains(spell) then
    		if AccMode then
    			equip(sets.pet_midcast.Magic_BP_NoTP_Acc)
    		else
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		end
    	elseif Merit_BPs:contains(spell) then
    		if AccMode then
    			equip(sets.pet_midcast.Magic_BP_TP_Acc)
    		elseif spell=="Meteor Strike" and MeteorStrike>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Geocrush" and Geocrush>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Grand Fall" and GrandFall>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Wind Blade" and WindBlade>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Heavenly Strike" and HeavenlyStrike>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		elseif spell=="Thunderstorm" and Thunderstorm>4 then
    			equip(sets.pet_midcast.Magic_BP_NoTP)
    		else
    			equip(sets.pet_midcast.Magic_BP_TP)
    		end
    	elseif Debuff_Rage_BPs:contains(spell) then
    		equip(sets.pet_midcast.Debuff_Rage)
    	else
    		if AccMode then
    			equip(sets.pet_midcast.Physical_BP_Acc)
    		elseif Physical_BPs_TP:contains(spell) then
    			equip(sets.pet_midcast.Physical_BP_TP)
    		elseif buffactive["Aftermath: Lv.3"] then
    			equip(sets.pet_midcast.Physical_BP_AM3)
    		else
    			equip(sets.pet_midcast.Physical_BP)
    		end
    	end
    end
    
    -- This command is called whenever you input "gs c <command>"
    function self_command(command)
    	IdleModeCommands = {'DD','Refresh','DT','Favor','PetDT','Zendik'}
    	is_valid = false
    
    	for _, v in ipairs(IdleModeCommands) do
    		if command:lower()==v:lower() then
    			IdleMode = v
    			send_command('console_echo "Idle Mode: ['..IdleMode..']"')
    			idle()
    			return
    		end
    	end
    	if string.sub(command,1,7)=="EquipBP" then
    		equipBPGear(string.sub(command,9,string.len(command)))
    		return
    	elseif command:lower()=="accmode" then
    		AccMode = AccMode==false
    		is_valid = true
    		send_command('console_echo "AccMode: '..tostring(AccMode)..'"')
    	elseif command:lower()=="impactmode" then
    		ImpactDebuff = ImpactDebuff==false
    		is_valid = true
    		send_command('console_echo "Impact Debuff: '..tostring(ImpactDebuff)..'"')
        elseif command:lower()=="forceilvl" then
            ForceIlvl = ForceIlvl==false
            is_valid = true
            send_command('console_echo "Force iLVL: '..tostring(ForceIlvl)..'"')
    	elseif command:lower()=="lagmode" then
    		LagMode = LagMode==false
    		is_valid = true
    		send_command('console_echo "Lag Compensation Mode: '..tostring(LagMode)..'"')
    	elseif command:lower()=="meleemode" then
    		if MeleeMode then
    			MeleeMode = false
    			enable("main","sub")
    			send_command('console_echo "Melee Mode: false"')
    		else
    			MeleeMode = true
    			equip({main="Nirvana",sub="Elan Strap +1"})
    			disable("main","sub")
    			send_command('console_echo "Melee Mode: true"')
    		end
    		is_valid = true
    	elseif command=="ToggleIdle" then
    		is_valid = true
    		if IdleMode=="Refresh" then
    			IdleMode = "DT"
    		elseif IdleMode=="DT" then
    			IdleMode = "PetDT"
    		elseif IdleMode=="PetDT" then
    			IdleMode = "DD"
    		else
    			IdleMode = "Refresh"
    		end
    		send_command('console_echo "Idle Mode: ['..IdleMode..']"')
    	elseif command:lower()=="lowhp" then
    		-- Use for "Cure 500 HP" objectives in Omen
    		equip({head="Apogee Crown +1",body={ name="Apo. Dalmatica +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},legs="Apogee Slacks +1",feet="Apogee Pumps +1",back="Campestres's Cape"})
    		return
    	elseif string.sub(command:lower(),1,12)=="meteorstrike" then
    		MeteorStrike = string.sub(command,13,13)
    		send_command('console_echo "Meteor Strike: '..MeteorStrike..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,8)=="geocrush" then
    		Geocrush = string.sub(command,9,9)
    		send_command('console_echo "Geocrush: '..Geocrush..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,9)=="grandfall" then
    		GrandFall = string.sub(command,10,10)
    		send_command('console_echo "Grand Fall: '..GrandFall..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,9)=="windblade" then
    		WindBlade = +string.sub(command,10,10)
    		send_command('console_echo "Wind Blade: '..WindBlade..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,14)=="heavenlystrike" then
    		HeavenlyStrike = string.sub(command,15,15)
    		send_command('console_echo "Heavenly Strike: '..HeavenlyStrike..'/5"')
    		is_valid = true
    	elseif string.sub(command:lower(),1,12)=="thunderstorm" then
    		Thunderstorm = string.sub(command,13,13)
    		send_command('console_echo "Thunderstorm: '..Thunderstorm..'/5"')
    		is_valid = true
    	elseif command=="TestMode" then
    		Test = Test + 1
    		if Test==3 then
    			Test = 0
    		end
    		is_valid = true
    		send_command('console_echo "Test Mode: '..tostring(Test)..'"')
    	end
    
    	if not is_valid then
    		send_command('console_echo "gs c {Refresh|DT|DD|PetDT|Favor} {AccMode} {ImpactMode} {MeleeMode}"')
    	end
    	idle()
    end
    
    function idle()
    	--if TownIdle:contains(world.area:lower()) then
    	--	return
    	--end
        if pet.isvalid then
    		if IdleMode=='DT' then
    			equip(sets.aftercast.Perp_DT)
    		elseif string.find(pet.name,'Spirit') then
                equip(sets.aftercast.Spirit)
    		elseif IdleMode=='PetDT' then
    			if ForceIlvl then
    				equip(sets.aftercast.Avatar_DT_Ilvl)
    			else
    				equip(sets.aftercast.Avatar_DT)
    			end
            elseif IdleMode=='Refresh' then
    			if player.mpp < 50 then
    				equip(sets.aftercast.Perp_RefreshSub50)
    			else
    				equip(sets.aftercast.Perp_Refresh)
    			end
    		elseif IdleMode=='Favor' then
    			equip(sets.aftercast.Perp_Favor)
    		elseif IdleMode=='Zendik' then
    			equip(sets.aftercast.Perp_Zendik)
    		elseif MeleeMode then
    			equip(sets.aftercast.Perp_Melee)
            elseif IdleMode=='DD' then
                equip(sets.aftercast.Perp_DD)
            end
    		-- Gaiters if Fleet Wind is up
    		if buffactive['Quickening'] and IdleMode~='DT' and not ForceIlvl then
    			equip({feet="Herald's Gaiters"})
    		end
    	else
    		if IdleMode=='DT' then
    			equip(sets.aftercast.DT)
    		elseif MeleeMode and IdleMode=='DD' then
    			equip(sets.aftercast.Perp_Melee)
    		elseif ForceIlvl then
    			equip(sets.aftercast.Idle_Ilvl)
    		else
    			equip(sets.aftercast.Idle)
    		end
        end
    	-- Balrahn's Ring
    	--if Salvage:contains(world.area) then
    	--	equip({ring2="Balrahn's Ring"})
    	--end
    	-- Maquette Ring
    	--if world.area=='Maquette Abdhaljs-Legion' and not IdleMode=='DT' then
    	--	equip({ring2="Maquette Ring"})
    	--end
    end
    - would anyone know why certain aftercast equips isn't equiping ? i put debug mode and its spamming gearswap (Debug mode) : enterbuffing Buff_refresh. If someone wanna give me a simpler LUA for smn that would be cool also.
    //gs show_swaps
    will probably give you better incite to whats going on

  9. #269
    Sea Torques
    Join Date
    May 2010
    Posts
    719
    BG Level
    5
    FFXI Server
    Ragnarok

    Quote Originally Posted by Gun-it View Post
    Out of town this weekend but I'll check //gs show_swaps next week. Gearswap is working for WS/TP/Idle/MDT sets etc. I find it really weird that it is not working.

    Thank you very much for helping.

    Edit: Also thank you for help with augmented gear. Didn't know about //gs export, it should be very helpful.
    Just tried and //gw show_swaps is showing no gear changing when I use meditate.

  10. #270
    RIDE ARMOR
    Join Date
    Feb 2017
    Posts
    19
    BG Level
    1
    FFXI Server
    Bismarck

    Afternoon all.

    Old returning player here and I was looking for a more simplified COR lua that had cure functions I could use as a baseline, and I ended up finding one that I liked, however even before I made any modifications I get this error when drawing my weapon and entering TP mode...

    "Gearswap has detected an error in the user function status_change:
    ...FFXI WIndower/addons/geraswap/data/Medicat/Cor.lua:435: attempt to index field 'TP' (a nil value)"

    I understand a little about how lua works, but not enough to fix this. I've put the pastebin of the current lua i'm attempting to modify below. Can anyone help me?

    https://pastebin.com/1tKXVT00

  11. #271
    A. Body
    Join Date
    Nov 2005
    Posts
    4,315
    BG Level
    7
    FFXI Server
    Leviathan

    Looks like the DBentt file from the Gearswap Shop thread?

    From what I can see, it's using the basic logic of his other melee LUAs with COR functions bolted on. So, where the function was set up to look for sets.TP (what the sets are called in his BLU file for instance), this file is defining sets for melee and ranged via MeleeTP and RangedTP. So you likely need to either change the functions to look at MeleeTP, or (probably) just search/replace 'MeleeTP' with just 'TP' to restore it to the way it is in other files. The RangedTP variable looks to be used in relevant functions.

  12. #272
    RIDE ARMOR
    Join Date
    Feb 2017
    Posts
    19
    BG Level
    1
    FFXI Server
    Bismarck

    That was exactly the problem! I just replaced any instance of TP or a TP index with a meleeTP and it's functioning great thanks so much!

  13. #273
    You wouldn't know that though because you've demonstrably never picked up a book nor educated yourself on the matter. Let me guess, overweight housewife?
    Join Date
    Mar 2006
    Posts
    22,966
    BG Level
    10
    FFXIV Character
    Allyra Arianos
    FFXIV Server
    Sargatanas
    WoW Realm
    Windrunner

    Can anyone look at my smn GS file and figure out why my dmg sucks? I'm started to get super frustrated by it as like dynamis, omen boss, etc., I'm only doing about 15k BPs. I know I don't have all BiS (working on it) but should the damage really be that low?

    Code:
    -------------------------------------------------------------------------------------------------------------------
    -- Setup functions for this job.  Generally should not be modified.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Also, you'll need the Shortcuts addon to handle the auto-targetting of the custom pact commands.
    
    --[[
        Custom commands:
        
        gs c petweather
            Automatically casts the storm appropriate for the current avatar, if possible.
        
        gs c siphon
            Automatically run the process to: dismiss the current avatar; cast appropriate
            weather; summon the appropriate spirit; Elemental Siphon; release the spirit;
            and re-summon the avatar.
            
            Will not cast weather you do not have access to.
            Will not re-summon the avatar if one was not out in the first place.
            Will not release the spirit if it was out before the command was issued.
            
        gs c pact [PactType]
            Attempts to use the indicated pact type for the current avatar.
            PactType can be one of:
                cure
                curaga
                buffOffense
                buffDefense
                buffSpecial
                debuff1
                debuff2
                sleep
                nuke2
                nuke4
                bp70
                bp75 (merits and lvl 75-80 pacts)
                astralflow
    
    --]]
    
    include('organizer-lib')
    
    -- 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["Avatar's Favor"] = buffactive["Avatar's Favor"] or false
        state.Buff["Astral Conduit"] = buffactive["Astral Conduit"] or false
    
        spirits = S{"LightSpirit", "DarkSpirit", "FireSpirit", "EarthSpirit", "WaterSpirit", "AirSpirit", "IceSpirit", "ThunderSpirit"}
        avatars = S{"Carbuncle", "Fenrir", "Diabolos", "Ifrit", "Titan", "Leviathan", "Garuda", "Shiva", "Ramuh", "Odin", "Alexander", "Cait Sith", "Atomos"}
    
        magicalRagePacts = S{
            'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgment Bolt','Searing Light','Howling Moon','Ruinous Omen',
            'Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II',
            'Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV',
            'Thunderspark','Meteorite','Nether Blast',
            'Meteor Strike','Heavenly Strike','Wind Blade','Geocrush','Grand Fall','Thunderstorm',
            'Holy Mist','Lunar Bay','Night Terror','Level ? Holy'}
    
    	hybridRagePacts = S{'Burning Strike','Flaming Crush'}
        pacts = {}
        pacts.cure = {['Carbuncle']='Healing Ruby'}
        pacts.curaga = {['Carbuncle']='Healing Ruby II', ['Garuda']='Whispering Wind', ['Leviathan']='Spring Water'}
        pacts.buffoffense = {['Carbuncle']='Glittering Ruby', ['Ifrit']='Crimson Howl', ['Garuda']='Hastega', ['Ramuh']='Rolling Thunder',
            ['Fenrir']='Ecliptic Growl'}
        pacts.buffdefense = {['Carbuncle']='Shining Ruby', ['Shiva']='Frost Armor', ['Garuda']='Aerial Armor', ['Titan']='Earthen Ward',
            ['Ramuh']='Lightning Armor', ['Fenrir']='Ecliptic Howl', ['Diabolos']='Noctoshield', ['Cait Sith']='Reraise II'}
        pacts.buffspecial = {['Ifrit']='Inferno Howl', ['Garuda']='Fleet Wind', ['Titan']='Earthen Armor', ['Diabolos']='Dream Shroud',
            ['Carbuncle']='Soothing Ruby', ['Fenrir']='Heavenward Howl', ['Cait Sith']='Raise II'}
        pacts.debuff1 = {['Shiva']='Diamond Storm', ['Ramuh']='Shock Squall', ['Leviathan']='Tidal Roar', ['Fenrir']='Lunar Cry',
            ['Diabolos']='Pavor Nocturnus', ['Cait Sith']='Eerie Eye'}
        pacts.debuff2 = {['Shiva']='Sleepga', ['Leviathan']='Slowga', ['Fenrir']='Lunar Roar', ['Diabolos']='Somnolence'}
        pacts.sleep = {['Shiva']='Sleepga', ['Diabolos']='Nightmare', ['Cait Sith']='Mewing Lullaby'}
        pacts.nuke2 = {['Ifrit']='Fire II', ['Shiva']='Blizzard II', ['Garuda']='Aero II', ['Titan']='Stone II',
            ['Ramuh']='Thunder II', ['Leviathan']='Water II'}
        pacts.nuke4 = {['Ifrit']='Fire IV', ['Shiva']='Blizzard IV', ['Garuda']='Aero IV', ['Titan']='Stone IV',
            ['Ramuh']='Thunder IV', ['Leviathan']='Water IV'}
        pacts.bp70 = {['Ifrit']='Flaming Crush', ['Shiva']='Rush', ['Garuda']='Predator Claws', ['Titan']='Mountain Buster',
            ['Ramuh']='Chaotic Strike', ['Leviathan']='Spinning Dive', ['Carbuncle']='Meteorite', ['Fenrir']='Eclipse Bite',
            ['Diabolos']='Nether Blast',['Cait Sith']='Regal Scratch'}
        pacts.bp75 = {['Ifrit']='Meteor Strike', ['Shiva']='Heavenly Strike', ['Garuda']='Wind Blade', ['Titan']='Geocrush',
            ['Ramuh']='Thunderstorm', ['Leviathan']='Grand Fall', ['Carbuncle']='Holy Mist', ['Fenrir']='Lunar Bay',
            ['Diabolos']='Night Terror', ['Cait Sith']='Level ? Holy'}
        pacts.astralflow = {['Ifrit']='Inferno', ['Shiva']='Diamond Dust', ['Garuda']='Aerial Blast', ['Titan']='Earthen Fury',
            ['Ramuh']='Judgment Bolt', ['Leviathan']='Tidal Wave', ['Carbuncle']='Searing Light', ['Fenrir']='Howling Moon',
            ['Diabolos']='Ruinous Omen', ['Cait Sith']="Altana's Favor"}
    
        -- Wards table for creating custom timers   
        wards = {}
        -- Base duration for ward pacts.
        wards.durations = {
            ['Crimson Howl'] = 60, ['Earthen Armor'] = 60, ['Inferno Howl'] = 60, ['Heavenward Howl'] = 60,
            ['Rolling Thunder'] = 120, ['Fleet Wind'] = 120,
            ['Shining Ruby'] = 180, ['Frost Armor'] = 180, ['Lightning Armor'] = 180, ['Ecliptic Growl'] = 180,
            ['Glittering Ruby'] = 180, ['Hastega'] = 180, ['Noctoshield'] = 180, ['Ecliptic Howl'] = 180,
            ['Dream Shroud'] = 180,
            ['Reraise II'] = 3600
        }
        -- Icons to use when creating the custom timer.
        wards.icons = {
            ['Earthen Armor']   = 'spells/00299.png', -- 00299 for Titan
            ['Shining Ruby']    = 'spells/00043.png', -- 00043 for Protect
            ['Dream Shroud']    = 'spells/00304.png', -- 00304 for Diabolos
            ['Noctoshield']     = 'spells/00106.png', -- 00106 for Phalanx
            ['Inferno Howl']    = 'spells/00298.png', -- 00298 for Ifrit
            ['Hastega']         = 'spells/00358.png', -- 00358 for Hastega
            ['Rolling Thunder'] = 'spells/00104.png', -- 00358 for Enthunder
            ['Frost Armor']     = 'spells/00250.png', -- 00250 for Ice Spikes
            ['Lightning Armor'] = 'spells/00251.png', -- 00251 for Shock Spikes
            ['Reraise II']      = 'spells/00135.png', -- 00135 for Reraise
            ['Fleet Wind']      = 'abilities/00074.png', -- 
        }
        -- Flags for code to get around the issue of slow skill updates.
        wards.flag = false
        wards.spell = ''
        
    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('None', 'Normal', 'Acc')
        state.CastingMode:options('Normal', 'Resistant')
        state.IdleMode:options('Normal', 'PDT')
    
        gear.perp_staff = {name="Gridarvor"}
        
        select_default_macro_book(15)
    end
    
    
    -- Define sets and vars used by this job file.
    function init_gear_sets()
        --------------------------------------
        -- Precast Sets
        --------------------------------------
        
        -- Precast sets to enhance JAs
        sets.precast.JA['Astral Flow'] = {head="Glyphic Horn"}
        
        sets.precast.JA['Elemental Siphon'] = {
        main="Chatoyant Staff",
        sub="Elan Strap",
        ammo="Sancus Sachet",
        head="Beckoner's Horn +1",
        body="Augur's Jaseran",
        hands={ name="Glyphic Bracers +1", augments={'Inc. Sp. "Blood Pact" magic burst dmg.',}},
        legs="Beckoner's Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Caller's Pendant",
        waist="Lucidity Sash",
        left_ear="Andoaa Earring",
        right_ear="Loquac. Earring",
        left_ring="Evoker's Ring",
        right_ring="Zodiac Ring",
    }
    
        sets.precast.JA['Mana Cede'] = {hands="Caller's Bracers +2"}
    
        -- Pact delay reduction gear
        sets.precast.BloodPactWard = {
        main={ name="Espiritus", augments={'MP+50','Pet: "Mag.Atk.Bns."+20','Pet: Mag. Acc.+20',}},
        sub="Elan Strap",
        ammo="Sancus Sachet",
        head={ name="Apogee Crown +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        body="Con. Doublet +3",
        hands={ name="Glyphic Bracers +1", augments={'Inc. Sp. "Blood Pact" magic burst dmg.',}},
        legs="Beckoner's Spats +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Caller's Pendant",
        waist="Lucidity Sash",
        left_ear="Summoning Earring",
        right_ear="Andoaa Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
    
        sets.precast.BloodPactRage = sets.precast.BloodPactWard
    
        -- Fast cast sets for spells
        
        sets.precast.FC = {
        body="Inyanga Jubbah",
    	ammo="Impatiens",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Assid. Pants +1",
        feet="Regal Pumps +1",
        waist="Witful Belt",
        left_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
        right_ear="Loquac. Earring",
        left_ring="Evoker's Ring",
        right_ring="Zodiac Ring",
    }
    
        sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel  Sash"})
    
           
        -- Weaponskill sets
        -- Default set for any weaponskill that isn't any more specifically defined
        sets.precast.WS = {
            head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
            body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
            back="Pahtli Cape",waist="Cascade Belt",legs="Hagondes Pants",feet="Hagondes Sabots"}
    
        -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
        sets.precast.WS['Myrkr'] = {
            head="Nahtirah Hat",ear1="Gifted Earring",ear2="Loquacious Earring",
            body="Con. Doublet +3",hands="Caller's Bracers +2",ring1="Evoker's Ring",ring2="Sangoma Ring",
            back="Pahtli Cape",waist="Fucho-no-Obi",legs="Nares Trews",feet="Chelona Boots +1"}
    
        
        --------------------------------------
        -- Midcast sets
        --------------------------------------
    
        sets.midcast.FastRecast = {
        body="Inyanga Jubbah",
    	ammo="Impatiens",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Assid. Pants +1",
        feet="Regal Pumps +1",
        waist="Witful Belt",
        left_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
        right_ear="Loquac. Earring",
        left_ring="Evoker's Ring",
        right_ring="Zodiac Ring",
    }
        sets.midcast.Cure = {main="Chatoyant Staff", sub="Enki Strap",
            head="Vanya Hat",
    		ear2="Loquacious Earring", 
    		ear1="Moonshade Earring",
            body="Shomonjijoe +1",
    		hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
    		ring1="Evoker's Ring",
    		ring2="Sirona's Ring",
    		waist="Cascade Belt",
    		legs="Tatsumaki sitagoromo",
    		feet="Regal Pumps +1"}
    
        sets.midcast.Stoneskin = {waist="Witful Belt", head="Umuthi Hat"}
    
        sets.midcast['Elemental Magic'] = {main="Lehbrailg +2",sub="Wizzan Grip",
            head="Hagondes Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
            body="Hagondes Coat",hands="Yaoyotl Gloves",ring1="Icesoul Ring",ring2="Acumen Ring",
            back="Toro Cape",waist=gear.ElementalBelt,legs="Hagondes Pants",feet="Hagondes Sabots"}
    
        sets.midcast['Dark Magic'] = {main="Lehbrailg +2",sub="Wizzan Grip",
            head="Nahtirah Hat",neck="Aesir Torque",ear1="Lifestorm Earring",ear2="Psystorm Earring",
            body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Excelsis Ring",ring2="Sangoma Ring",
            waist="Fuchi-no-Obi",legs="Bokwus Slops",feet="Bokwus Boots"}
    
    
        -- Avatar pact sets.  All pacts are Ability type.
        
        sets.midcast.Pet.BloodPactWard = {
        main={ name="Espiritus", augments={'MP+50','Pet: "Mag.Atk.Bns."+20','Pet: Mag. Acc.+20',}},
        sub="Elan Strap",
        ammo="Sancus Sachet",
        head="Apogee Crown +1",
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Apogee Slacks +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Caller's Pendant",
        waist="Lucidity Sash",
        left_ear="Gelos Earring",
        right_ear="Andoaa Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
    
        sets.midcast.Pet.DebuffBloodPactWard = {
        main={ name="Espiritus", augments={'MP+50','Pet: "Mag.Atk.Bns."+20','Pet: Mag. Acc.+20',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Apogee Crown +1", 
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Apogee Slacks +1",
        feet="Convoker's pigaches +2",
        neck="Caller's Pendant",
        waist="Lucidity Sash",
        left_ear="Gelos Earring",
        right_ear="Andoaa Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
            
        sets.midcast.Pet.DebuffBloodPactWard.Acc = sets.midcast.Pet.DebuffBloodPactWard
    
        sets.midcast.Pet.HybridBloodPactRage = {
        main="Keraunos",
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Apogee Crown +1",
        body="Con. Doublet +3",
       hands={ name="Merlinic Dastanas", augments={'Blood Pact Dmg.+6','Pet: DEX+7','Pet: "Mag.Atk.Bns."+11',}},
        legs="Enticer's Pants",
        feet="Convoker's pigaches +2",
        neck="Shulmanu collar",
        waist="Regal Sash",
        left_ear="Gelos Earring",
        right_ear="Kyrene's Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
    
        sets.midcast.Pet.HybridBloodPactRage.Acc = sets.midcast.Pet.HybridBloodPactRage
    
        sets.midcast.Pet.MagicalBloodPactRage = {
        main={ name="Espiritus", augments={'MP+50','Pet: "Mag.Atk.Bns."+20','Pet: Mag. Acc.+20',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Apogee Crown +1",
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Blood Pact Dmg.+6','Pet: DEX+7','Pet: "Mag.Atk.Bns."+11',}},
        legs="Apogee Slacks +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Adad Amulet",
        waist="Regal Sash",
        left_ear="Gelos Earring",
        right_ear="Kyrene's Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
        
        sets.midcast.Pet.PhysicalBloodPactRage = {
        main="Keraunos",
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Apogee Crown +1", 
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Blood Pact Dmg.+6','Pet: DEX+7','Pet: "Mag.Atk.Bns."+11',}},
        legs="Enticer's Pants",
        feet="Convoker's pigaches +2",
        neck="Shulmanu collar",
        waist="Regal Sash",
        left_ear="Gelos Earring",
        right_ear="Kyrene's Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
    
        sets.midcast.Pet.PhysicalBloodPactRage.Acc = sets.midcast.Pet.PhysicalBloodPactRage
    
        sets.midcast.Pet.MagicalBloodPactRage = {
        main={ name="Espiritus", augments={'MP+50','Pet: "Mag.Atk.Bns."+20','Pet: Mag. Acc.+20',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Apogee Crown +1", 
        body="Con. Doublet +3",
        hands={ name="Merlinic Dastanas", augments={'Blood Pact Dmg.+6','Pet: DEX+7','Pet: "Mag.Atk.Bns."+11',}},
        legs="Apogee Slacks +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Adad Amulet",
        waist="Regal Sash",
        left_ear="Gelos Earring",
        right_ear="Kyrene's Earring",
        left_ring="Varar Ring +1",
        right_ring="Varar Ring +1",
    }
    
        sets.midcast.Pet.MagicalBloodPactRage.Acc = sets.midcast.Pet.MagicalBloodPactRage
    
    
        -- Spirits cast magic spells, which can be identified in standard ways.
        
        sets.midcast.Pet.WhiteMagic = {legs="Glyphic Spats"}
        
        sets.midcast.Pet['Elemental Magic'] = set_combine(sets.midcast.Pet.BloodPactRage, {legs="Glyphic Spats"})
    
        sets.midcast.Pet['Elemental Magic'].Resistant = {}
        
    
        --------------------------------------
        -- Idle/resting/defense/etc sets
        --------------------------------------
        
        -- Resting sets
        sets.resting = {main=gear.Staff.HMP,
    		sub="Enki Strap",
    		ammo="Sancus Sachet +1",
            head="Convoker's Horn",
    		neck="Wiglen Gorget",
    		ear1="Gifted Earring",
    		ear2="Loquacious Earring",
            body="Hagondes Coat",
    		hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
    		ring1="Sheltered Ring",
    		ring2="Paguroidea Ring",
            back="Pahtli Cape",
    		waist="Austerity Belt",
    		legs="Nares Trews",
    		feet="Chelona Boots +1"}
        
        -- Idle sets
        sets.idle = {
        main="Bolelabunga",
    	sub="Ammurapi Shield",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Assid. Pants +1",
        feet="Herald's Gaiters",
        neck="Caller's Pendant",
        waist="Fuchi-no-Obi",
        left_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
        right_ear="Loquac. Earring",
        left_ring="Evoker's Ring +1",
        right_ring="Varar Ring +1",
    }
    
        sets.idle.PDT = {main=gear.Staff.PDT,
    		sub="Enki Strap",
    		ammo="Sancus Sachet +1",
            head="Convoker's Horn",
    		neck="Twilight Torque",
    		ear1="Gifted Earring",
    		ear2="Loquacious Earring",
            body="Hagondes Coat",
    		hands="Yaoyotl Gloves",
    		ring1="Gelatinous Ring +1",
    		ring2="Shadow Ring",
            back="Umbra Cape",
    		waist="Fucho-no-Obi",
    		legs="Hagondes Pants",
    		feet="Herald's Gaiters"}
    
        -- perp costs:
        -- spirits: 7
        -- carby: 11 (5 with mitts)
        -- fenrir: 13
        -- others: 15
        -- avatar's favor: -4/tick
        
        -- Max useful -perp gear is 1 less than the perp cost (can't be reduced below 1)
        -- Aim for -14 perp, and refresh in other slots.
        
        -- -perp gear:
        -- Gridarvor: -5
        -- Glyphic Horn: -4
        -- Caller's Doublet +2/Glyphic Doublet: -4
        -- Evoker's Ring: -1
        -- Convoker's Pigaches: -4
        -- total: -18
        
        -- Can make due without either the head or the body, and use +refresh items in those slots.
        
        sets.idle.Avatar = {
        main={ name="Gridarvor", augments={'Pet: Accuracy+70','Pet: Attack+70','Pet: "Dbl. Atk."+15',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Assid. Pants +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Caller's Pendant",
        waist="Regal Sash",
        left_ear="Evans Earring",
        right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
        left_ring="Evoker's Ring",
        right_ring="Varar Ring +1",
    }
    
        sets.idle.PDT.Avatar = {
        main={ name="Gridarvor", augments={'Pet: Accuracy+70','Pet: Attack+70','Pet: "Dbl. Atk."+15',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Assid. Pants +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Caller's Pendant",
        waist="Regal Sash",
        left_ear="Evans Earring",
        right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
        left_ring="Evoker's Ring",
        right_ring="Varar Ring +1",
    }
    
        sets.idle.Spirit = {
        main={ name="Gridarvor", augments={'Pet: Accuracy+70','Pet: Attack+70','Pet: "Dbl. Atk."+15',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands={ name="Merlinic Dastanas", augments={'"Cure" potency +9%','Mag. Acc.+1','"Refresh"+1','Accuracy+2 Attack+2',}},
        legs="Assid. Pants +1",
        feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
        neck="Caller's Pendant",
        waist="Regal Sash",
        left_ear="Evans Earring",
        right_ear={ name="Moonshade Earring", augments={'MP+25','Latent effect: "Refresh"+1',}},
        left_ring="Evoker's Ring",
        right_ring="Varar Ring +1",
    }
    
        sets.idle.Town =set_combine(sets.idle,
    	{
    	feet="Herald's Gaiters",
    	}
    								)
        -- Favor uses Caller's Horn instead of Convoker's Horn for refresh
        sets.idle.Avatar.Favor = {head="Caller's Horn +2"}
        sets.idle.Avatar.Melee = {
        main={ name="Gridarvor", augments={'Pet: Accuracy+70','Pet: Attack+70','Pet: "Dbl. Atk."+15',}},
        sub="Elan Strap",
        ammo="Sancus Sachet +1",
        head="Beckoner's Horn +1",
        body="Shomonjijoe +1",
        hands={ name="Glyphic Bracers +1", augments={'Inc. Sp. "Blood Pact" magic burst dmg.',}},
        legs="Assid. Pants +1",
        feet="Convoker's Pigaches +2",
        neck="Caller's Pendant",
        waist="Lucidity Sash",
        left_ear="Evans Earring",
        right_ear="Kyrene's Earring",
        left_ring="Evoker's Ring",
        right_ring="Varar Ring +1",
    }
            
        sets.perp = {}
        -- Caller's Bracer's halve the perp cost after other costs are accounted for.
        -- Using -10 (Gridavor, ring, Conv.feet), standard avatars would then cost 5, halved to 2.
        -- We can then use Hagondes Coat and end up with the same net MP cost, but significantly better defense.
        -- Weather is the same, but we can also use the latent on the pendant to negate the last point lost.
        sets.perp.Day = {body="Hagondes Coat",hands="Caller's Bracers +2"}
        sets.perp.Weather = {neck="Caller's Pendant",body="Hagondes Coat",hands="Caller's Bracers +2"}
        -- Carby: Mitts+Conv.feet = 1/tick perp.  Everything else should be +refresh
        sets.perp.Carbuncle = {main="Bolelabunga",sub="Ammurapi Shield",
            head="Convoker's Horn",body="Hagondes Coat",hands="Carbuncle Mitts",legs="Nares Trews",feet="Convoker's Pigaches +2"}
        -- Diabolos's Rope doesn't gain us anything at this time
        --sets.perp.Diabolos = {waist="Diabolos's Rope"}
        sets.perp.Alexander = sets.midcast.Pet.BloodPactWard
    
        sets.perp.staff_and_grip = {main=gear.perp_staff,sub="Achaq Grip"}
        
        -- Defense sets
        sets.defense.PDT = {main=gear.Staff.PDT,
            head="Hagondes Hat",neck="Wiglen Gorget",ear1="Gifted Earring",ear2="Loquacious Earring",
            body="Hagondes Coat",hands="Yaoyotl Gloves",ring1="Defending Ring",ring2=gear.DarkRing.physical,
            back="Umbra Cape",waist="Fucho-no-Obi",legs="Hagondes Pants",feet="Hagondes Sabots"}
    
        sets.defense.MDT = {
            head="Hagondes Hat",neck="Twilight Torque",ear1="Gifted Earring",ear2="Loquacious Earring",
            body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Defending Ring",ring2="Shadow Ring",
            back="Umbra Cape",waist="Fucho-no-Obi",legs="Bokwus Slops",feet="Hagondes Sabots"}
    
        sets.Kiting = {feet="Herald's Gaiters"}
        
        sets.latent_refresh = {waist="Fucho-no-obi"}
        
    
        --------------------------------------
        -- Engaged sets
        --------------------------------------
        
        -- Normal melee group
       -- sets.engaged = 
    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 state.Buff['Astral Conduit'] and pet_midaction() then
            eventArgs.handled = true
        end
    end
    
    function job_midcast(spell, action, spellMap, eventArgs)
        if state.Buff['Astral Conduit'] and pet_midaction() then
            eventArgs.handled = true
        end
    end
    
    -- Runs when pet completes an action.
    function job_pet_aftercast(spell, action, spellMap, eventArgs)
        if not spell.interrupted and spell.type == 'BloodPactWard' and spellMap ~= 'DebuffBloodPactWard' then
            wards.flag = true
            wards.spell = spell.english
            send_command('wait 4; gs c reset_ward_flag')
        end
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- Job-specific hooks for non-casting events.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Called when a player gains or loses a buff.
    -- buff == buff gained or lost
    -- gain == true if the buff was gained, false if it was lost.
    function job_buff_change(buff, gain)
        if state.Buff[buff] ~= nil then
            handle_equipping_gear(player.status)
        elseif storms:contains(buff) then
            handle_equipping_gear(player.status)
        end
    end
    
    
    -- Called when the player's pet's status changes.
    -- This is also called after pet_change after a pet is released.  Check for pet validity.
    function job_pet_status_change(newStatus, oldStatus, eventArgs)
        if pet.isvalid and not midaction() and not pet_midaction() and (newStatus == 'Engaged' or oldStatus == 'Engaged') then
            handle_equipping_gear(player.status, newStatus)
        end
    end
    
    
    -- Called when a player gains or loses a pet.
    -- pet == pet structure
    -- gain == true if the pet was gained, false if it was lost.
    function job_pet_change(petparam, gain)
        classes.CustomIdleGroups:clear()
        if gain then
            if avatars:contains(pet.name) then
                classes.CustomIdleGroups:append('Avatar')
            elseif spirits:contains(pet.name) then
                classes.CustomIdleGroups:append('Spirit')
            end
        else
            select_default_macro_book('reset')
        end
    end
    
    -------------------------------------------------------------------------------------------------------------------
    -- User code that supplements standard library decisions.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Custom spell mapping.
    function job_get_spell_map(spell)
        if spell.type == 'BloodPactRage' then
            if magicalRagePacts:contains(spell.english) then
                return 'MagicalBloodPactRage'
    		elseif hybridRagePacts:contains(spell.english) then
    			return 'HybridBloodPactRage'
            else
                return 'PhysicalBloodPactRage'
            end
        elseif spell.type == 'BloodPactWard' and spell.target.type == 'MONSTER' then
            return 'DebuffBloodPactWard'
        end
    end
    
    -- Modify the default idle set after it was constructed.
    function customize_idle_set(idleSet)
        if pet.isvalid then
            if pet.element == world.day_element then
                idleSet = set_combine(idleSet, sets.perp.Day)
            end
            if pet.element == world.weather_element then
                idleSet = set_combine(idleSet, sets.perp.Weather)
            end
            if sets.perp[pet.name] then
                idleSet = set_combine(idleSet, sets.perp[pet.name])
            end
            gear.perp_staff.name = elements.perpetuance_staff_of[pet.element]
            if gear.perp_staff.name and (player.inventory[gear.perp_staff.name] or player.wardrobe[gear.perp_staff.name]) then
                idleSet = set_combine(idleSet, sets.perp.staff_and_grip)
            end
            if state.Buff["Avatar's Favor"] and avatars:contains(pet.name) then
                idleSet = set_combine(idleSet, sets.idle.Avatar.Favor)
            end
            if pet.status == 'Engaged' then
                idleSet = set_combine(idleSet, sets.idle.Avatar.Melee)
            end
        end
        
        if player.mpp < 51 then
            idleSet = set_combine(idleSet, sets.latent_refresh)
        end
        
        return idleSet
    end
    
    -- Called by the 'update' self-command, for common needs.
    -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
    function job_update(cmdParams, eventArgs)
        classes.CustomIdleGroups:clear()
        if pet.isvalid then
            if avatars:contains(pet.name) then
                classes.CustomIdleGroups:append('Avatar')
            elseif spirits:contains(pet.name) then
                classes.CustomIdleGroups:append('Spirit')
            end
        end
    end
    
    -- Set eventArgs.handled to true if we don't want the automatic display to be run.
    function display_current_job_state(eventArgs)
    
    end
    
    
    -------------------------------------------------------------------------------------------------------------------
    -- User self-commands.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Called for custom player commands.
    function job_self_command(cmdParams, eventArgs)
        if cmdParams[1]:lower() == 'petweather' then
            handle_petweather()
            eventArgs.handled = true
        elseif cmdParams[1]:lower() == 'siphon' then
            handle_siphoning()
            eventArgs.handled = true
        elseif cmdParams[1]:lower() == 'pact' then
            handle_pacts(cmdParams)
            eventArgs.handled = true
        elseif cmdParams[1] == 'reset_ward_flag' then
            wards.flag = false
            wards.spell = ''
            eventArgs.handled = true
        end
    end
    
    
    -------------------------------------------------------------------------------------------------------------------
    -- Utility functions specific to this job.
    -------------------------------------------------------------------------------------------------------------------
    
    -- Cast the appopriate storm for the currently summoned avatar, if possible.
    function handle_petweather()
        if player.sub_job ~= 'SCH' then
            add_to_chat(122, "You can not cast storm spells")
            return
        end
            
        if not pet.isvalid then
            add_to_chat(122, "You do not have an active avatar.")
            return
        end
        
        local element = pet.element
        if element == 'Thunder' then
            element = 'Lightning'
        end
        
        if S{'Light','Dark','Lightning'}:contains(element) then
            add_to_chat(122, 'You do not have access to '..elements.storm_of[element]..'.')
            return
        end 
        
        local storm = elements.storm_of[element]
        
        if storm then
            send_command('@input /ma "'..elements.storm_of[element]..'" <me>')
        else
            add_to_chat(123, 'Error: Unknown element ('..tostring(element)..')')
        end
    end
    
    
    -- Custom uber-handling of Elemental Siphon
    function handle_siphoning()
        if areas.Cities:contains(world.area) then
            add_to_chat(122, 'Cannot use Elemental Siphon in a city area.')
            return
        end
    
        local siphonElement
        local stormElementToUse
        local releasedAvatar
        local dontRelease
        
        -- If we already have a spirit out, just use that.
        if pet.isvalid and spirits:contains(pet.name) then
            siphonElement = pet.element
            dontRelease = true
            -- If current weather doesn't match the spirit, but the spirit matches the day, try to cast the storm.
            if player.sub_job == 'SCH' and pet.element == world.day_element and pet.element ~= world.weather_element then
                if not S{'Light','Dark','Lightning'}:contains(pet.element) then
                    stormElementToUse = pet.element
                end
            end
        -- If we're subbing /sch, there are some conditions where we want to make sure specific weather is up.
        -- If current (single) weather is opposed by the current day, we want to change the weather to match
        -- the current day, if possible.
        elseif player.sub_job == 'SCH' and world.weather_element ~= 'None' then
            -- We can override single-intensity weather; leave double weather alone, since even if
            -- it's partially countered by the day, it's not worth changing.
            if get_weather_intensity() == 1 then
                -- If current weather is weak to the current day, it cancels the benefits for
                -- siphon.  Change it to the day's weather if possible (+0 to +20%), or any non-weak
                -- weather if not.
                -- If the current weather matches the current avatar's element (being used to reduce
                -- perpetuation), don't change it; just accept the penalty on Siphon.
                if world.weather_element == elements.weak_to[world.day_element] and
                    (not pet.isvalid or world.weather_element ~= pet.element) then
                    -- We can't cast lightning/dark/light weather, so use a neutral element
                    if S{'Light','Dark','Lightning'}:contains(world.day_element) then
                        stormElementToUse = 'Wind'
                    else
                        stormElementToUse = world.day_element
                    end
                end
            end
        end
        
        -- If we decided to use a storm, set that as the spirit element to cast.
        if stormElementToUse then
            siphonElement = stormElementToUse
        elseif world.weather_element ~= 'None' and (get_weather_intensity() == 2 or world.weather_element ~= elements.weak_to[world.day_element]) then
            siphonElement = world.weather_element
        else
            siphonElement = world.day_element
        end
        
        local command = ''
        local releaseWait = 0
        
        if pet.isvalid and avatars:contains(pet.name) then
            command = command..'input /pet "Release" <me>;wait 1.1;'
            releasedAvatar = pet.name
            releaseWait = 7
        end
        
        if stormElementToUse then
            command = command..'input /ma "'..elements.storm_of[stormElementToUse]..'" <me>;wait 4;'
            releaseWait = releaseWait - 4
        end
        
        if not (pet.isvalid and spirits:contains(pet.name)) then
            command = command..'input /ma "'..elements.spirit_of[siphonElement]..'" <me>;wait 4;'
            releaseWait = releaseWait - 4
        end
        
        command = command..'input /ja "Elemental Siphon" <me>;'
        releaseWait = releaseWait - 1
        releaseWait = releaseWait + 0.1
        
        if not dontRelease then
            if releaseWait > 0 then
                command = command..'wait '..tostring(releaseWait)..';'
            else
                command = command..'wait 1.1;'
            end
            
            command = command..'input /pet "Release" <me>;'
        end
        
        if releasedAvatar then
            command = command..'wait 1.1;input /ma "'..releasedAvatar..'" <me>'
        end
        
        send_command(command)
    end
    
    
    -- Handles executing blood pacts in a generic, avatar-agnostic way.
    -- cmdParams is the split of the self-command.
    -- gs c [pact] [pacttype]
    function handle_pacts(cmdParams)
        if areas.Cities:contains(world.area) then
            add_to_chat(122, 'You cannot use pacts in town.')
            return
        end
    
        if not pet.isvalid then
            add_to_chat(122,'No avatar currently available. Returning to default macro set.')
            select_default_macro_book('reset')
            return
        end
    
        if spirits:contains(pet.name) then
            add_to_chat(122,'Cannot use pacts with spirits.')
            return
        end
    
        if not cmdParams[2] then
            add_to_chat(123,'No pact type given.')
            return
        end
        
        local pact = cmdParams[2]:lower()
        
        if not pacts[pact] then
            add_to_chat(123,'Unknown pact type: '..tostring(pact))
            return
        end
        
        if pacts[pact][pet.name] then
            if pact == 'astralflow' and not buffactive['astral flow'] then
                add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
                return
            end
            
            -- Leave out target; let Shortcuts auto-determine it.
            send_command('@input /pet "'..pacts[pact][pet.name]..'"')
        else
            add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
        end
    end
    
    
    -- Event handler for updates to player skill, since we can't rely on skill being
    -- correct at pet_aftercast for the creation of custom timers.
    windower.raw_register_event('incoming chunk',
        function (id)
            if id == 0x62 then
                if wards.flag then
                    create_pact_timer(wards.spell)
                    wards.flag = false
                    wards.spell = ''
                end
            end
        end)
    
    -- Function to create custom timers using the Timers addon.  Calculates ward duration
    -- based on player skill and base pact duration (defined in job_setup).
    function create_pact_timer(spell_name)
        -- Create custom timers for ward pacts.
        if wards.durations[spell_name] then
            local ward_duration = wards.durations[spell_name]
            if ward_duration < 181 then
                local skill = player.skills.summoning_magic
                if skill > 300 then
                    skill = skill - 300
                    if skill > 200 then skill = 200 end
                    ward_duration = ward_duration + skill
                end
            end
            
            local timer_cmd = 'timers c "'..spell_name..'" '..tostring(ward_duration)..' down'
            
            if wards.icons[spell_name] then
                timer_cmd = timer_cmd..' '..wards.icons[spell_name]
            end
    
            send_command(timer_cmd)
        end
    end
    
    
    -- Select default macro book on initial load or subjob change.
    function select_default_macro_book(reset)
        if reset == 'reset' then
            -- lost pet, or tried to use pact when pet is gone
        end
        
    end

  14. #274
    A. Body
    Join Date
    Nov 2005
    Posts
    4,315
    BG Level
    7
    FFXI Server
    Leviathan

    If the file works in other places, then it's probably more an issue of latency than anything else. Normally, Gearswap is good for that sort of thing, since for direct player actions it can inject the gear changes into packets. So maybe tossing a Cure lagged on your screen, but Gearswap told the server to swap into pre/mid/aftercast sets as data was sent out anyway.

    Where SMN can run into issues, however, is that most files are written to observe the pet state and swap into BP gear accordingly. You say to do a pact, GS injects the swap to your BP timer gear in and sends the command on. It starts executing on the server. Ideally, your game client sees the pet start readying a blood pact and issues a gear change that the server registers before the pact executes. If it happens to be too slow, then server-side the pact will go off with you still in timer reduction gear, and results will be...subpar.

    It's something that has come up multiple times on FFXIAH (for example) and I think your main options are to either use integrated gear sets for pacts (at least) or find a Gearswap (like Pergatory's there) that implements a more blind-fire approach. IE, issues a pact command and then swaps to appropriate gear without waiting on feedback.

  15. #275
    You wouldn't know that though because you've demonstrably never picked up a book nor educated yourself on the matter. Let me guess, overweight housewife?
    Join Date
    Mar 2006
    Posts
    22,966
    BG Level
    10
    FFXIV Character
    Allyra Arianos
    FFXIV Server
    Sargatanas
    WoW Realm
    Windrunner

    Ok thank you! I'll look into it.

  16. #276
    RIDE ARMOR
    Join Date
    Feb 2017
    Posts
    19
    BG Level
    1
    FFXI Server
    Bismarck

    I've got a friend who has used gearswap before, but is annoyed at how he constantly has to edit his file with new gear, as he is constantly updating everything, and has resorted to just using the in-game gear sets option as it is more convenient for him. However, gearswap is really convenient in that it automates the switching of TP/idle and other sets, and severely cuts down on macro space, so I had an idea for an experiemental lua that integrates the gear sets system into the automation of the gearswap luas. This is the baseline I've started with...

    https://pastebin.com/VWCV0Wc2

    It's beyond basic, but it's meant to be a proof of concept, and upon testing I already ran into issues. It appears that gearswap tries to swap sets too quickly for the in-game gear sets system to handle. Now i'm sure I could figure something out by injecting a /wait 1 in a few critical places... but am I wasting my time here with this idea? Or is there a way to inject the gearsets into packets so the /wait isn't necessary?

    Thanks in advance.


    EDIT: Since I haven't got any bites, I'm assuming i'm probably wasting my time on this. I'm still learning how all this works. I suppose the question I have at this point is, is there a command that causes gearswap to wait before executing the next line of code, kind of like the /wait we have in game for macros? I checked out the documentation page at https://docs.windower.net/addons/gearswap/ and I didn't see anything like that, and I'm pretty sure spellcast used to have a function like that. I'm still going to see if I can make this work.

  17. #277

    Quote Originally Posted by TaruRassius View Post
    Since I haven't got any bites, I'm assuming i'm probably wasting my time on this. I'm still learning how all this works. I suppose the question I have at this point is, is there a command that causes gearswap to wait before executing the next line of code, kind of like the /wait we have in game for macros? I checked out the documentation page at https://docs.windower.net/addons/gearswap/ and I didn't see anything like that, and I'm pretty sure spellcast used to have a function like that. I'm still going to see if I can make this work.
    there is no wait command for gearswap how e4ver you can delay call another function with one of these
    Code:
    --these are usefull if you are using windower.raw_register_event in gearswap and cant get gearswap to equip anything
    --delayed equip
    gearswap.equip_sets:schedule(<delay [number]>, <custom name [string]>, nil, set)
    --custom function call
    gearswap.equip_sets(<custom function name [string]>,nil,<custom function variables>)
    --delayed custom function call
    coroutine.schedule(gearswap.equip_sets:prepare(<custom function name [string]>,nil,<custom function variables>),<delay [number]>)
    ---example of custom function
    gearswap.equip_sets('A',nil,b,c,d)
    function A(b,c,d)
        ...
    end
    this is how i added my
    Code:
    function treasure_hunter_change(gain,th_count,name,target_table)
        ---------------------------------------
        --gain            boolean     true for if the effected target has gained a threasure hunter count, false if it had threasure hunter count before this
        --th_count        number      The threasure hunter count on the effected target
        --name            string      The effected targets name
        --target_table    table       A table containing the effected targets data
        ---------------------------------------
        --change gear with
        --equip(<setname>)
        ---------------------------------------
    end

  18. #278
    RIDE ARMOR
    Join Date
    Feb 2017
    Posts
    19
    BG Level
    1
    FFXI Server
    Bismarck

    I think I can work with this. It's certainly worth playing with. Thanks dlsmd.

  19. #279

    Quote Originally Posted by TaruRassius View Post
    I think I can work with this. It's certainly worth playing with. Thanks dlsmd.
    just be for warned if you use the delayed function everytime a function like precast comes up you will cause gearswap/ffxi to slow way down and ffxi's memory usage to skyrocket just the same as if you used coroutine.sleep

    also i made an error with my post i fixed it above and here
    Code:
    ---example of custom function
    gearswap.equip_sets('A',nil,b,c,d)
    function A(b,c,d)
        ...
    end

  20. #280
    Sea Torques
    Join Date
    May 2010
    Posts
    719
    BG Level
    5
    FFXI Server
    Ragnarok

    What needs to be added the my lua to swap to a different earring when capped TP?

Quick Reply Quick Reply

  • Decrease Size
    Increase Size
  • Remove Text Formatting
  • Insert Link Insert Image Insert Video
  • Wrap [QUOTE] tags around selected text
  • Insert NSFW Tag
  • Insert Spoiler Tag

Similar Threads

  1. Gearswap Help Thread!
    By JSHidaka in forum FFXI: Everything
    Replies: 6035
    Last Post: 2018-05-06, 17:15
  2. Randomerest Question Thread III: This Time It's Random
    By isladar in forum FFXI: Everything
    Replies: 868
    Last Post: 2009-08-18, 12:03