Skip to content

Instantly share code, notes, and snippets.

@Nifim
Last active March 22, 2021 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nifim/704cda677cac18c371e60307d8e2844e to your computer and use it in GitHub Desktop.
Save Nifim/704cda677cac18c371e60307d8e2844e to your computer and use it in GitHub Desktop.
Sam Gearswap `No Include`
-------------------------------------------
--[[ No mote-includes associated with this
This lua for SAM uses 2 arrays. One controls gear for melee (normal, acc, hybrid, and turtle) and the
other controls the application of 'special circumstance' gear (Twilight gear for auto-raise, a Vagary set,
and a CP set). In my init file I bound the command for the 2 arrays to my Ctrl-q and Ctrl-w keys.
All my lua's have these key bindings but people who want to use this lua can get the same functionality using the
key bindings I have built-in below. You simply need to unlock them.
- Look towards the bottom of the gearsets, you'll see 4 sets of "send_command" stuff that is commented (--) out.
- Simply delete the "--" marks, save the lua, reload it in Windower and you can now use Ctrl-Q and WS
to toggle though the above arrays.
The arrays work independently so you can have any melee gearset on with or without the special circumstance
gear. If a special circumstance is turned on, it will override the first array in whatever gear slots are
associated. For example, Zombie mode is head/body, so it will override the melee array's gear choices for
just those 2 slots.
The Zombie set puts on the Twilight-reraise gear (head/body) automatically, as long as you are alive.
If you die, and rise up, wait til you are alive before turning it on to get the 'auto-put-on' action. It
will work when idle, engaged, during WS's, and when casting magic. I call it 'Zombie' because it won't
change out of those 2 gears even if casting a spell, so you can zombie if needed.
The Vagary set is to keep you in a high acc set with lots of TA/DA, and you won't change out when you WS
so you can keep ws-damage low.
The CP set just equips the CP cape and not change out of it. Handy if you are trying to master the job or save JP
for the last REMA upgrade unlocking process.
If you try to WS at a distance over 5, it will prevent you from WS'ing.
-------------------------------------------
I thought it would be helpful to have a comprehensive listing of items with augments.
You do not need to show augments among sets unless you have 2 with the same name and different augments.
Some people like to show augments in the name. I find that hard on the eyes.
If I have 2 of the same item, I define them by special names at the top of the 'function get_sets()' at
the beginning of the lua. It's easy on the eyes and if I have to update their augments I only need
to change it in one spot rather than every instance among the sets.
For augmented items that I only own one (thus not showing augments) a listing is below:
- Moonshade Earring: Attack+4, TP Bonus +250
- Ryuo Somen +1: (path A) STR+12, DEX+12, Accuracy+20
- Ryuo Tekko +1: (path A) STR+12, DEX+12, Accuracy+20
- Ryuo Hakama +1: (path D) Accuracy+25, "Store TP"+5, Phys. dmg. taken -4%
- Sinister Reign gear assume max augments, I am lazy and not listing them
-------------------------------------------]]
function get_sets()
TPback = { name="Smertrios's Mantle", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Damage taken-5%',}}
WSback = { name="Smertrios's Mantle", augments={'STR+20','Accuracy+20 Attack+20','Accuracy+10','Weapon skill damage +10%','Damage taken-5%',}}
WShead = { name="Valorous Mask", augments={'Weapon skill damage +5%','Accuracy+15','Attack+5',}}
WShands = { name="Valorous Mitts", augments={'Attack+30','Weapon skill damage +4%','Accuracy+12',}}
WSfeet = { name="Valorous Greaves", augments={'Accuracy+9 Attack+9','Weapon skill damage +4%','STR+10','Attack+7',}}
TPfeet = { name="Valorous Greaves", augments={'Accuracy+17 Attack+17','"Store TP"+7','DEX+10','Attack+6',}}
TP_Index = 1
HP_Index = 1
TP_Array = {'TPnormal', 'TPacc', 'Hybrid', 'Turtle'}
HP_Array = {'Normal', 'Zombie', 'Vagary', 'CP'}
-------------------------------------------
-- aftercast for returning to TP and Idle sets
-- the 'self command' area will change the set defined as aftercast.TP
-------------------------------------------
sets.aftercast = {}
sets.engaged = {}
sets.precast = {}
sets.precast.Normal = {}
sets.precast.Acc = {}
sets.midcast = {}
sets.buffs = {}
Str_WS = S{"Tachi: Hobaku","Tachi: Yukikaze","Tachi: Gekko"}
Str2_WS = S{"Tachi: Fudo"}
Str3_WS = S{"Tachi: Enpi","Tachi: Shoha","Tachi: Rana"}
MAB_WS = S{"Tachi: Goten","Tachi: Kagero","Tachi: Jinpu"}
StrMnd_WS = S{"Tachi: Koki"}
StrChr_WS = S{"Tachi: Ageha"}
Range_WS = S{"Flaming Arrow","Piercing Arrow","Dulling Arrow","Sidewinder","Namas Arrow","Refulgent Arrow"}
sets.aftercast.Idle = {
sub="Utu Grip",
ammo="Staunch Tathlum +1",
head="Loess Barbuta +1",
neck="Loricate Torque +1",
lear="Infused Earring",
rear="Etiolation Earring",
body="Tartarus Platemail",
hands="Sakonji Kote +1",
lring="Defending Ring",
rring="Gelatinous Ring +1",
back="Shadow Mantle",
waist="Flume Belt +1",
legs="Arjuna Breeches",
feet="Danzo Sune-ate"}
-------------------------------------------
-- The outermost table has to be named "sets", but otherwise there are no restrictions.
-------------------------------------------
sets.engaged.TPnormal = {
sub="Utu Grip",
ammo="Paeapua",
head="Flam. Zucchetto +2", --6 stp, TA5
neck="Moonlight Nodowa", --10 stp
lear="Telos Earring", --5 stp, DA1
rear="Cessance Earring", --3 stp, DA3
body="Ken. Samue +1", --TA6, Crit 9%
hands="Flam. Manopolas +2", --6 stp
lring="Hetairoi Ring",
rring="Niqmaddu Ring", --QA3
back=TPback, --10 stp
waist="Windbuffet Belt +1", --QA2, TA2
legs="Ken. Hakama +1", --TA5, Crit 7%
feet=TPfeet} --5+7 stp
--10 weapon +6+10+5+3+6+10+12=62 ... need 57 for a 4 hit build, 66 for 3 hit build
--4(hd)+4(bd)+4(hn)+9(lg)+3(ft)=24 haste
--1219 acc, 1241 atk, eva 808, def 1224
sets.engaged.TPacc = set_combine(sets.engaged.TPnormal, {
head="Ryuo Somen +1", --7 stp
hands="Ryuo Tekko +1",
lring="Ilabrat Ring", --5 stp
waist="Ioskeha Belt"})
--65+(-6+7)-6+5=65 STP
--20+7(waist)=27 haste
--1238 acc, 1153 atk, eva 780, def 1160
sets.engaged.Hybrid = {--midacc, low DT
sub="Utu Grip",
ammo="Ginsen", --3 stp
head="Flam. Zucchetto +2", --6 stp, TA5
neck="Loricate Torque +1",
lear="Telos Earring", --5 stp, DA1
rear="Cessance Earring", --3 stp
body="Tartarus Platemail",
hands="Ryuo Tekko +1",
lring="Defending Ring",
rring="Petrov Ring", --5 stp
back=TPback, --10 stp
waist="Ioskeha Belt",
legs="Ken. Hakama +1", --TA5, Crit 7%
feet=TPfeet} --5+7 stp
--10 weapon +3+6+5+3+5+10+12=54 ... need 57 for a 4 hit build, 66 for 3 hit build
--1179 acc, 1225 atk, eva 762, def 1214
sets.engaged.Turtle = { --midacc, high dt
sub="Utu Grip",
ammo="Staunch Tathlum +1", --DT 3
head="Loess Barbuta +1", --DT 10
neck="Loricate Torque +1", --DT 6
lear="Telos Earring", --5 stp, DA1
rear="Cessance Earring", --3 stp
body="Tartarus Platemail", --DT 10
hands="Wakido Kote +3", --7 stp
lring="Defending Ring", --DT 10
rring="Gelatinous Ring +1", --PDT 7
back=TPback, --10 stp, DT 5
waist="Ioskeha Belt",
legs="Ryuo Hakama +1", --8+5 stp, PDT 4
feet=TPfeet} --5+7 stp, MDT 2
--10 weapon +3+5+3+7+10+13+12=63 ... need 57 for a 4 hit build, 66 for 3 hit build
--DT: 3+10+6+10+10+5=44
--PDT: 7+4=11
--1077 acc, 1104 atk, eva 693, def 1191
sets.engaged.Vagary = sets.engaged.TPnormal
sets.engaged.Zombie = {
head="Twilight Helm",
body="Twilight Mail",
waist="Ioskeha Belt"}
sets.engaged.CP = {
back="Mecistopins Mantle"}
sets.aftercast.TP = sets.engaged[TP_Array[TP_Index]]
sets.aftercast.HP = sets.engaged[HP_Array[HP_Index]]
-------------------------------------------
-- STR WS : Non-magic & solely STR mod WS's
-- So it's easy to determine if new obtained gear can replace anything, listed str stats per piece
-------------------------------------------
sets.precast.Normal.WSStr = {
ammo="Knobkierrie", --6 wsd
head=WShead, --28, 5 wsd
neck="Fotia Gorget", --4
lear="Moonshade Earring",
rear="Ishvara Earring", --2 wsd
body="Sakonji Domaru +3", --42, 10 wsd
hands=WShands, --13, 4 wsd
lring="Regal Ring", --10
rring="Niqmaddu Ring", --10
back=WSback, --20, 10 wsd
waist="Fotia Belt", --8
legs="Wakido Haidate +3", --44, 10 wsd
feet=WSfeet} --17+10, 4 wsd
--1092 +20 fotia +100 first hit = 1212 acc, 1326 atk
sets.precast.Acc.WSStr = set_combine(sets.precast.Normal.WSStr, {
rear="Telos Earring", --0
hands="Ryuo Tekko +1", --24
waist="Grunfeld Rope"}) --5
--1159 +20 fotia +100 first hit = 1279 acc, 1328 atk
--Str2 is Fudo, typically meant to have more ATK built into the WS, though gears and augments have lately resulted in shared ws gears
sets.precast.Normal.WSStr2 = set_combine(sets.precast.Normal.WSStr, {
waist="Grunfeld Rope", --5
legs="Wakido Haidate +3"}) --44, 10 wsd
sets.precast.Acc.WSStr2 = set_combine(sets.precast.Normal.WSStr2, {
rear="Telos Earring"}) --0
--Str3 is Shoha & Rana, typically meant to have more multi-hit built into the WS, though gears and augments have lately resulted in shared ws gears
sets.precast.Normal.WSStr3 = set_combine(sets.precast.Normal.WSStr, {
waist="Grunfeld Rope", --5
legs="Wakido Haidate +3"}) --44, 10 wsd
sets.precast.Acc.WSStr3 = set_combine(sets.precast.Normal.WSStr3, {
rear="Telos Earring", --0
hands="Ryuo Tekko +1", --24
lring="Ilabrat Ring", --0
legs="Wakido Haidate +3", --44, 10 wsd
feet=WSfeet}) --17+10, 4 wsd
-------------------------------------------
-- STR/MND WS Mix : Tachi: Koki
-- So it's easy to determine if new obtained gear can replace anything, listed str/mnd stats per piece
-------------------------------------------
sets.precast.Normal.WSStrMnd = {
ammo="Knobkierrie", --6 wsd
head=WShead, --2814, 5 wsd
neck="Fotia Gorget",
lear="Moonshade Earring",
rear="Sherida Earring", --5/0
body="Sakonji Domaru +3", --42/31, 10 wsd
hands=WShands, --13/24, 4 wsd
lring="Regal Ring", --10/0
rring="Niqmaddu Ring", --10/0
back=WSback, --20/0
waist="Fotia Belt",
legs="Wakido Haidate +3", --44/26, 10 wsd
feet=WSfeet} --17+10/5, 4 wsd
sets.precast.Acc.WSStrMnd = sets.precast.Normal.WSStrMnd
-------------------------------------------
-- STR/CHR WS Mix : Tachi: Ageha
-- So it's easy to determine if new obtained gear can replace anything, listed str/chr stats per piece
-------------------------------------------
sets.precast.Normal.WSStrChr = {
ammo="Knobkierrie", --6 wsd
head=WShead, --28/14, 5 wsd
neck="Fotia Gorget",
lear="Moonshade Earring",
rear="Sherida Earring", --5/0
body="Sakonji Domaru +3", --42/31, 10 wsd
hands=WShands, --13/24, 4 wsd
lring="Regal Ring", --10/0
rring="Niqmaddu Ring", --10/0
back=WSback, --20/0
waist="Fotia Belt",
legs="Wakido Haidate +3", --44/22, 10 wsd
feet=WSfeet} --17+10/20, 4 wsd
sets.precast.Acc.WSStrChr = sets.precast.Normal.WSStrChr
-------------------------------------------
-- STR-MAB WS Mix : Tachi: Goten, Kagero, Jinpu
-- So it's easy to determine if new obtained gear can replace anything, listed str/MAB stats per piece
-------------------------------------------
sets.precast.Normal.WSMAB = {
ammo="Knobkierrie", --6 wsd
head="Highwing Helm", --26/20
neck="Fotia Gorget",
lear="Moonshade Earring",
rear="Ishvara Earring",
body="Found. Breastplate", --30/20+3
hands="Leyline Gloves", --11/15+15
lring="Regal Ring", --10/0
rring="Niqmaddu Ring", --10/0
back=WSback, --20/0
waist="Fotia Belt",
legs="Wakido Haidate +3", --44/0, 10 wsd
feet="Founder's Greaves"} --19/20+15
sets.precast.Acc.WSMAB = sets.precast.Normal.WSMAB
-------------------------------------------
-- Ranged Attack & WS
-------------------------------------------
sets.precast.Range = {
head="Sakonji Kabuto +1",
neck="Iqabi Necklace",
lear="Tripudio Earring",
rear="Enervating Earring",
body="Kyujutsugi",
hands="Alruna's Gloves +1",
lring="Paqichikaji Ring",
rring="Cacoethic Ring",
back="Kayapa Cape",
waist="Buccaneer's Belt",
legs="Ken. Hakama +1",
feet="Waki. Sune-ate +3"}
sets.precast.Normal.WSRange = set_combine(sets.precast.Range, {
head="Ryuo Somen +1",
lear="Moonshade Earring",
legs="Wakido Haidate +3"})
sets.precast.Acc.WSRange = set_combine(sets.precast.Normal.WSRange, {
legs="Ken. Hakama +1"})
-------------------------------------------
-- Precast sets for fastcast spells
-------------------------------------------
sets.precast.Fastcast = set_combine(sets.engaged.TPnormal, {
ammo="Impatiens",
neck="Voltsurge Torque",
lear="Loquac. Earring",
rear="Enchntr. Earring +1",
hands="Leyline Gloves",
lring="Lebeche Ring",
rring="Prolix Ring"})
-------------------------------------------
-- Job Ability sets
-- The sets.buff is present because this particular JA requires gear to be worn during the duration of the buff
-- and not just at the point of activation like the rest. Rules for both are in the function for precast
-------------------------------------------
sets.precast["Meikyo Shisui"] = {feet="Sak. Sune-Ate +1"}
sets.precast["Third Eye"] = {legs="Sakonji Haidate +1"}
sets.precast.Meditate = {head="Wakido Kabuto +3",hands="Sakonji Kote +1",back="Smertrios's Mantle"}
sets.precast["Warding Circle"] = {head="Wakido Kabuto +3"}
sets.precast["Blade Bash"] = {hands="Sakonji Kote +1"}
sets.precast.Hasso = {hands="Wakido Kote +3",legs="Kasuga Haidate +1"}
sets.precast.Seigan = {head="Kasuga Kabuto +1"}
sets.precast.Sekkanoki = {hands="Kasuga Kote +1"}
sets.precast.Sengikori = {feet="Kas. Sune-Ate +1"}
sets.precast.Shikikoyo = {legs="Sakonji Haidate +1"}
sets.precast.Waltz = {hands="Slither Gloves +1"}
sets.buffs["Meikyo Shisui"] = {feet="Sak. Sune-Ate +1"}
send_command('input /macro book 2')
-- send_command('bind ^q gs c toggle TP set')
-- send_command('bind ^w gs c toggle RA set')
end
function file_unload()
-- send_command('unbind ^q')
-- send_command('unbind ^w')
end
function precast(spell,action)
equip_sets = {}
if player.equipment.range == 'Yoichinoyumi' then
disable('ammo')
else enable('ammo') end
if sets.precast[spell.english] then
equip(sets.precast[spell.english])
elseif spell.type == 'WeaponSkill' then
if sets.aftercast.TP == sets.engaged.TPnormal then
mode = "Normal"
else
mode = "Acc"
end
if spell.target.distance > 5 then
cancel_spell()
add_to_chat(8, 'Target to far away. Move closer')
return
elseif Str_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSStr
elseif Str2_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSStr2
elseif Str3_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSStr3
elseif StrMnd_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSStrMnd
elseif StrChr_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSStrChr
elseif MAB_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSMAB
elseif Range_WS:contains(spell.english) then
equip_sets[#equip_sets+1] = sets.precast[mode].WSRange
else equip_sets[#equip_sets+1] = sets.precast[mode].WSStr
end
if HP_Array[HP_Index] == 'Zombie' then
equip_sets[#equip_sets+1] = sets.engaged.Zombie
end
if HP_Array[HP_Index] == 'Vagary' then
equip_sets[#equip_sets+1] = sets.engaged.Vagary
end
if HP_Array[HP_Index] == 'CP' then
equip_sets[#equip_sets+1] = sets.engaged.CP
end
end
for buff in pairs(buffactive) do
equip_sets[#equip_sets+1] = sets.buffs[buff]
end
equip(set_combine(table.unpack(equip_sets)))
end
function midcast(spell,action)
if spell.type:endswith('Magic') or spell.type == 'Ninjutsu' then
if windower.wc_match(spell.english,'Utsusemi') then
if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then -- Cancel Copy Image 1 & 2 For Utsusemi: Ichi --
send_command('@wait 1.7;cancel Copy Image*')
end
elseif spell.english == 'Monomi: Ichi' then -- Cancel Sneak --
if buffactive['Sneak'] then
send_command('@wait 1.7;cancel sneak')
end
elseif S{'Elemental Magic','Enfeebling Magic','Dark Magic'}:contains(spell.skill) and HP_Array[HP_Index] == 'Zombie' then
equip(set_combine(sets.precast.Fastcast,sets.engaged.Zombie))
else
equip(sets.precast.Fastcast)
end
end
end
function aftercast(spell)
if player.status == 'Engaged' then
equip(sets.aftercast.TP)
equip(sets.aftercast.HP)
else
equip(sets.aftercast.Idle)
end
end
-- Standard lua status change rules except for the last one
-- If you turn on the Zombie array while dead it will equip reraise gear the moment you get up
-- This is for when you intend to zombie a mob or when there is a chance you can die immediately when you raise up
function status_change(new,old)
if new == 'Idle' then
equip(sets.aftercast.Idle)
equip(sets.aftercast.HP)
elseif new == 'Resting' then
equip(sets.aftercast.Resting)
equip(sets.aftercast.HP)
elseif new == 'Engaged' then
equip(sets.aftercast.TP)
equip(sets.aftercast.HP)
end
if old == 'Dead' or old == 'Engaged dead' and new == 'Idle' then
equip(sets.aftercast.HP)
end
end
function self_command(command)
if command == 'toggle TP set' then
TP_Index = (TP_Index % #TP_Array) + 1
sets.aftercast.TP = sets.engaged[TP_Array[TP_Index]]
status_change(player.status, player.status)
--Use these rules if a TP set is eventually made for using the Yoichinoyumi bow or Cibitshavore
-- if sets.midcast.Ranged[TP_Array[TP_Index]][player.equipment.range] then
-- sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]][player.equipment.range]
-- else
-- sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]].default
-- end
send_command('@input /echo '..TP_Array[TP_Index]..' SET')
end
if command == 'toggle RA set' then
HP_Index = (HP_Index % #HP_Array) + 1
sets.aftercast.HP = sets.engaged[HP_Array[HP_Index]]
status_change(player.status, player.status)
send_command('@input /echo '..HP_Array[HP_Index]..' SET')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment