Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d79ddfe
[GearSwap] Move helper function to helper_functions
Zirk40 Oct 12, 2026
2b0a167
Merge pull request #2575 from Zirk40/zirk-move-helper-function
lili-ffxi Oct 12, 2026
1611c2b
[GearSwap] equip_sets_exit pretarget cleanup part 1
Zirk40 Oct 13, 2026
d4af1cc
[GearSwap] Missed a ranged attack resource name change
Zirk40 Oct 13, 2026
7a55d2c
chore: make Aura refreshes stop triggering Buff Change events (#2571)
Byrth Oct 13, 2026
7423cfc
[GearSwap] Woops had the proposed_packet check in slightly wrong spot
Zirk40 Oct 13, 2026
0d519c0
Support send @p as an alias for send @party
Traelblaser Oct 15, 2026
f14f250
Added @a @z @o for all, zone, and others, respectively
Traelblaser Oct 15, 2026
78b9572
Single quotes instead of double; Bump version to 1.4
Traelblaser Oct 15, 2026
fafc5fc
Missing `@a` check
Traelblaser Oct 17, 2026
198bf50
[linuxfix] Remove from Windower
RubenatorX Oct 19, 2026
d8f9630
Merge pull request #2580 from Zirk40/zirk-flow-cleanup-1
lili-ffxi Oct 20, 2026
e8c361c
[GearSwap] equip_sets_exit pretarget cleanup part 2
Zirk40 Oct 21, 2026
719072a
Merge pull request #2586 from Zirk40/zirk-flow-cleanup-2
lili-ffxi Oct 24, 2026
152cfbf
[GearSwap] Use coroutine scheduler to do delayed casts
Zirk40 Oct 25, 2026
18551d8
Update Logger to support Auto-Translate & JP text
Imisnew2 Oct 29, 2026
de3c8f6
feat: expose sqlite to user files
Byrth Nov 6, 2026
15ddc1e
add monstrosity prestige packet
HiPotionQ8 Nov 7, 2026
c0d7469
feat: reduce gearswap's item-refresh lag
Byrth Nov 19, 2026
9c6c90f
chore: revert temp naming
Byrth Nov 19, 2026
cb66dcd
Merge pull request #2587 from Zirk40/zirk-schedule-cast-delays
lili-ffxi Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 19 additions & 78 deletions addons/GearSwap/flow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ function equip_sets_exit(swap_type, ts, val1)

if command_registry[ts].cancel_spell then
msg.debugging('Action canceled (' .. storedcommand .. ' ' .. val1.target.raw .. ')')
storedcommand = nil
command_registry:delete_entry(ts)
return true
elseif not ts or not command_registry[ts] or not storedcommand then
Expand All @@ -216,6 +215,14 @@ function equip_sets_exit(swap_type, ts, val1)

if command_registry[ts].new_target then
val1.target = command_registry[ts].new_target -- Switch target, if it is requested.

if val1.prefix == '/item' then
if val1.target.type ~= 'NONE' and bit.band(val1.target.spawn_type, 2) == 2 and find_inventory_item(val1.id) then
val1.action_type = 'Trade'
else
val1.action_type = 'Item'
end
end
end

if st_targs[val1.target.raw] then
Expand All @@ -224,70 +231,43 @@ function equip_sets_exit(swap_type, ts, val1)
end

-- Compose a proposed packet for the given action (this should be possible after pretarget)
if val1.target.id and val1.target.index then
if filter_precast(val1) then
if val1.prefix == '/item' then
-- Item use packet handling here
if bit.band(val1.target.spawn_type, 2) == 2 and find_inventory_item(val1.id) then
if val1.action_type == 'Trade' then
-- 0x36 packet
if val1.target.distance <= 6 then
command_registry[ts].proposed_packet = assemble_menu_item_packet(val1.target.id, val1.target.index, val1.id)
else
windower.add_to_chat(67, 'Target out of range.')
end
elseif find_usable_item(val1.id) then
-- 0x37 packet
command_registry[ts].proposed_packet = assemble_use_item_packet(val1.target.id, val1.target.index, val1.id)
end
if not command_registry[ts].proposed_packet then
command_registry:delete_entry(ts)
end
elseif outgoing_action_category_table[unify_prefix[val1.prefix]] then
if filter_precast(val1) then
command_registry[ts].proposed_packet = assemble_action_packet(val1.target.id, val1.target.index, outgoing_action_category_table[unify_prefix[val1.prefix]], val1.id, command_registry[ts].target_arrow)
if not command_registry[ts].proposed_packet then
command_registry:delete_entry(ts)

msg.debugging('Unable to create a packet for this command because the target is still invalid after pretarget (' .. storedcommand .. ' ' .. val1.target.raw .. ')')
storedcommand = nil
return storedcommand .. ' ' .. val1.target.raw
end
end
else
msg.debugging('Hark, what weird prefix through yonder window breaks? ' .. tostring(val1.prefix))
command_registry[ts].proposed_packet = assemble_action_packet(val1.target.id, val1.target.index, outgoing_action_category_table[unify_prefix[val1.prefix]], val1.id, command_registry[ts].target_arrow)
end
end

if ts and command_registry[ts] then
if not val1.target.name then
-- Spells with invalid pass_through_targs, like using <t> without a target
command_registry:delete_entry(ts)
msg.debugging('Change target was used to pick an invalid target (' .. storedcommand .. ' ' .. val1.target.raw .. ')')
local ret = storedcommand .. ' ' .. val1.target.raw
storedcommand = nil
return ret
else
-- Spells with complete target information
-- command_registry[ts] is deleted for cancelled spells
if command_registry[ts].proposed_packet then
if command_registry[ts].pretarget_cast_delay == 0 then
equip_sets('precast', ts, val1)
else
windower.send_command('@wait ' .. command_registry[ts].pretarget_cast_delay .. ';lua i ' .. _addon.name .. ' pretarget_delayed_cast ' .. ts)
equip_sets:schedule(command_registry[ts].pretarget_cast_delay, 'precast', ts, val1)
end
return true
end
elseif not ts or not command_registry[ts] then
msg.debugging('This case should not be hittable - 2')
return true
end

msg.debugging('No valid target at end of pretarget (' .. storedcommand .. ' ' .. val1.target.raw .. ')')
command_registry:delete_entry(ts)
return storedcommand .. ' ' .. val1.target.raw

elseif swap_type == 'precast' then
-- Update the target_arrow
if val1.prefix ~= '/item' then
command_registry[ts].proposed_packet = assemble_action_packet(val1.target.id, val1.target.index, outgoing_action_category_table[unify_prefix[val1.prefix]], val1.id, command_registry[ts].target_arrow)
end
return precast_send_check(ts)
elseif swap_type == 'filtered_action' and command_registry[ts] and command_registry[ts].cancel_spell then
storedcommand = nil
command_registry:delete_entry(ts)
return true
elseif swap_type == 'midcast' and _settings.demo_mode then
Expand Down Expand Up @@ -348,31 +328,11 @@ function user_pcall2(str,...)
end


-----------------------------------------------------------------------------------
--Name: pretarget_delayed_cast(ts)
--Desc: Triggers an outgoing action packet (if the passed key is valid).
--Args:
---- ts - Timestamp argument to precast_delayed_cast
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function pretarget_delayed_cast(ts)
ts = tonumber(ts)
if ts then
equip_sets('precast',ts,command_registry[ts].spell)
else
msg.debugging("Bad index passed to pretarget_delayed_cast")
end
end



-----------------------------------------------------------------------------------
--Name: precast_send_check(ts)
--Desc: Determines whether or not to send the current packet.
-- Cancels if _global.cancel_spell is true
-- If command_registry[ts].precast_cast_delay is not 0, cues precast_delayed_cast with the proper
-- If command_registry[ts].precast_cast_delay is not 0, cues send_action with the proper
-- delay instead of sending immediately.
--Args:
---- ts - key of command_registry
Expand All @@ -389,33 +349,14 @@ function precast_send_check(ts)
send_action(ts)
return
else
windower.send_command('@wait '..command_registry[ts].precast_cast_delay..';lua i '.._addon.name..' precast_delayed_cast '..ts)
send_action:schedule(command_registry[ts].precast_cast_delay, ts)
end
end
end
return true
end


-----------------------------------------------------------------------------------
--Name: precast_delayed_cast(ts)
--Desc: Triggers an outgoing action packet (if the passed key is valid).
--Args:
---- ts - Timestamp argument to precast_delayed_cast
-----------------------------------------------------------------------------------
--Returns:
---- none
-----------------------------------------------------------------------------------
function precast_delayed_cast(ts)
ts = tonumber(ts)
if ts then
send_action(ts)
else
msg.debugging("Bad index passed to precast_delayed_cast")
end
end


-----------------------------------------------------------------------------------
--Name: send_action(ts)
--Desc: Sends the cued action packet, if it exists.
Expand Down
1 change: 1 addition & 0 deletions addons/GearSwap/gearswap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ error = _raw.error
require 'lists'
require 'queues'
require 'sets'
require 'sqlite3'


windower.text.create = function (str)
Expand Down
26 changes: 25 additions & 1 deletion addons/GearSwap/helper_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ function get_spell(act)
end

if act.category == 12 or act.category == 2 then
spell = copy_entry(resources_ranged_attack)
spell = copy_entry(res.ranged_attacks[0])
else
if not res.action_messages[msg_ID] or msg_ID == 31 then
if act.category == 4 or act.category == 8 then
Expand Down Expand Up @@ -1095,6 +1095,30 @@ function spell_complete(rline)
return rline
end

-----------------------------------------------------------------------------------
--Name: find_monster_skill(abil)
--Desc: Takes a monster ability name and finds the corresponding monster_skills
-- resource line for the player's current species
--Args:
---- abil - ability name
-----------------------------------------------------------------------------------
--Returns:
---- rline - resource line
-----------------------------------------------------------------------------------
function find_monster_skill(abil)
local rline = false
if player.species and player.species.tp_moves then
-- Iterates over currently available monster TP moves instead of using validabils
for i, v in pairs(player.species.tp_moves) do
if res.monster_skills[i][language]:lower() == abil then
rline = copy_entry(res.monster_skills[i])
break
end
end
end
return rline
end

-----------------------------------------------------------------------------------
--Name: logit()
--Args:
Expand Down
13 changes: 12 additions & 1 deletion addons/GearSwap/packet_parsing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ end
parse.i[0x00B] = function(data)
-- Blank temporary items when zoning.
items.temporary = make_inventory_table()
if bag_tables then bag_tables.temporary = make_bag_table() end
if player then player.temporary = bag_tables and bag_tables.temporary or make_bag_table() end
end

parse.i[0x00E] = function (data)
Expand Down Expand Up @@ -141,33 +143,42 @@ parse.i[0x01E] = function (data)
local count = data:unpack('I',5)
local status = data:byte(0x0B)
if not items[bag][slot] then items[bag][slot] = make_empty_item_table(slot) end
local old_id = items[bag][slot].id or 0
local old_count = items[bag][slot].count or 0
items[bag][slot].count = count
items[bag][slot].status = status
if count == 0 then
items[bag][slot].id = 0
items[bag][slot].bazaar = 0
items[bag][slot].status = 0
end
update_item_slot(bag, old_id, old_count, items[bag][slot])
end

parse.i[0x01F] = function (data)
local bag = to_windower_compact(res.bags[data:byte(0x0B)].english)
local slot = data:byte(0x0C)
if not items[bag][slot] then items[bag][slot] = make_empty_item_table(slot) end
local old_id = items[bag][slot].id or 0
local old_count = items[bag][slot].count or 0
items[bag][slot].id = data:unpack('H',9)
items[bag][slot].count = data:unpack('I',5)
items[bag][slot].status = data:byte(0x0D)
update_item_slot(bag, old_id, old_count, items[bag][slot])
end

parse.i[0x020] = function (data)
local bag = to_windower_compact(res.bags[data:byte(0x0F)].english)
local slot = data:byte(0x10)
if not items[bag][slot] then items[bag][slot] = make_empty_item_table(slot) end
local old_id = items[bag][slot].id or 0
local old_count = items[bag][slot].count or 0
items[bag][slot].id = data:unpack('H',0x0D)
items[bag][slot].count = data:unpack('I',5)
items[bag][slot].bazaar = data:unpack('I',9)
items[bag][slot].status = data:byte(0x11)
items[bag][slot].extdata = data:sub(0x12,0x29)
update_item_slot(bag, old_id, old_count, items[bag][slot])
-- Did not mess with linkshell stuff
end

Expand Down Expand Up @@ -481,7 +492,7 @@ parse.i[0x063] = function (data)
newbuffs[n].matched_exactly = nil
for i,old in pairs(_ExtraData.player.buff_details) do
-- Find unchanged buffs
if old.id == new.id and math.abs(old.time-new.time) < 1 and not old.matched_exactly then
if old.id == new.id and math.abs(old.time-new.time) < (old.duration < 6 and 4 or 1) and not old.matched_exactly then
newbuffs[n].matched_exactly = true
_ExtraData.player.buff_details[i].matched_exactly = true
break
Expand Down
Loading