Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions addons/GearSwap/equip_processing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ function unpack_equip_list(equip_list,cur_equip)
-- If the item is Rare, then even if the augments are wrong try to equip it anyway because you only have one
equip_list[slot_name] = nil
ret_list[slot_id] = {bag_id=bag.id,slot=item_tab.slot}
used_list = ret_list[slot_id]
used_list[slot_id] = ret_list[slot_id]
break
--else the piece specifies augments that don't match the current piece, so don't break and keep trying.
end
else
equip_list[slot_name] = nil
ret_list[slot_id] = {bag_id=bag.id,slot=item_tab.slot}
used_list = ret_list[slot_id]
used_list[slot_id] = ret_list[slot_id]
break
end
end
Expand All @@ -192,11 +192,11 @@ function unpack_equip_list(equip_list,cur_equip)
else
for __,slot_name in pairs(default_slot_map) do
local name = expand_entry(equip_list[slot_name])
if name ~= empty and name_match(item_id,name) then
if name and name ~= empty and name_match(item_tab.id,name) then
if not res.items[item_tab.id].jobs[player.main_job_id] then
equip_list[slot_name] = nil
error_list[slot_name] = name..' (cannot be worn by this job)'
elseif not (res.items[item_tab.id].level<=player.jobs[player.main_job]) then
elseif not (res.items[item_tab.id].level<=player.jobs[res.jobs[player.main_job_id].ens]) then
equip_list[slot_name] = nil
error_list[slot_name] = name..' (job level is too low)'
elseif not res.items[item_tab.id].races[player.race_id] then
Expand Down
11 changes: 3 additions & 8 deletions addons/GearSwap/export.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function export_set(options)

local compact = contains_any('compact')
local bgwiki = contains_any('bgwiki')
if check_exclusive(compact) then
if check_exclusive(compact, bgwiki) then
msg.addon_msg(123, 'Cannot export: "compact" and "bgwiki" are mutually exclusive.')
return
end
Expand Down Expand Up @@ -128,7 +128,7 @@ function export_set(options)

msg.addon_msg(123, buildmsg)

local item_list = T{}
local item_list, exported = T{}, nil
if all_items then
for i = 0, #res.bags do
item_list:extend(get_item_list(items[res.bags[i].english:gsub(' ', ''):lower()]))
Expand Down Expand Up @@ -326,7 +326,7 @@ function unpack_names(ret_tab,up,tab_level,unpacked_table,exported)
elseif i=='name' and type(v) == 'string' then
alt = up
flag = true
elseif type(v) == 'string' and v~='augment' and v~= 'augments' and v~= 'priority' then
elseif type(v) == 'string' and v~='augment' and v~= 'augments' and v~= 'priority' and i ~= 'bag' and v ~= 'bag' then
alt = i
flag = true
end
Expand All @@ -343,11 +343,6 @@ function unpack_names(ret_tab,up,tab_level,unpacked_table,exported)
end
if aug_str ~= '' then unpacked_table[#unpacked_table].augments = aug_str end
end
if tab_level.augment then
local aug_str = unpacked_table[#unpacked_table].augments or ''
if tab_level.augment ~= 'none' then aug_str = aug_str.."'"..augment:gsub("'","\\'").."'," end
if aug_str ~= '' then unpacked_table[#unpacked_table].augments = aug_str end
end
exported[tempname:lower()] = true
exported[v:lower()] = true
end
Expand Down
8 changes: 4 additions & 4 deletions addons/GearSwap/flow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function equip_sets(swap_type,ts,...)
end
end

logit('\n\n'..tostring(os.clock)..'(15) equip_sets: '..tostring(swap_type))
logit('\n\n'..tostring(os.clock())..'(15) equip_sets: '..tostring(swap_type))
if val1 then
if type(val1) == 'table' and val1.english then
logit(' : '..val1.english)
Expand Down Expand Up @@ -142,7 +142,7 @@ function equip_sets(swap_type,ts,...)
failure_reason = 'KOed'
end
msg.debugging("Cannot change gear right now: "..tostring(failure_reason))
logit('\n\n'..tostring(os.clock)..'(69) failure_reason: '..tostring(failure_reason))
logit('\n\n'..tostring(os.clock())..'(69) failure_reason: '..tostring(failure_reason))
else
local chunk_table = L{}
for eq_slot_id,priority in priorities:it() do
Expand Down Expand Up @@ -318,7 +318,7 @@ end
function user_pcall(str,...)
if user_env then
if type(user_env[str]) == 'function' then
bool,err = pcall(user_env[str],...)
local bool,err = pcall(user_env[str],...)
if not bool then error('\nGearSwap has detected an error in the user function '..str..':\n'..err) end
elseif user_env[str] then
msg.addon_msg(123,windower.to_shift_jis(tostring(str))..'() exists but is not a function')
Expand All @@ -339,7 +339,7 @@ end
function user_pcall2(str,...)
if user_env then
if type(user_env[str]) == 'function' then
bool,err = pcall(user_env[str],...)
local bool,err = pcall(user_env[str],...)
if not bool then print('\nGearSwap has detected an error in the user function '..str..':\n'..err) end
elseif user_env[str] then
msg.addon_msg(123,windower.to_shift_jis(tostring(str))..'() exists but is not a function')
Expand Down
4 changes: 2 additions & 2 deletions addons/GearSwap/gearswap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ require 'actions'
packets = require 'packets'

-- Resources Checks
if res.items and res.bags and res.slots and res.statuses and res.jobs and res.elements and res.skills and res.buffs and res.spells and res.job_abilities and res.weapon_skills and res.monster_skills and res.action_messages and res.skills and res.monstrosity and res.weather and res.moon_phases and res.races and res.monster_abilities then
if res.items and res.bags and res.slots and res.statuses and res.jobs and res.elements and res.skills and res.buffs and res.spells and res.job_abilities and res.weapon_skills and res.monster_skills and res.action_messages and res.monstrosity and res.weather and res.moon_phases and res.races and res.monster_abilities then
else
error('Missing resources!')
end
Expand Down Expand Up @@ -151,7 +151,7 @@ end)

windower.register_event('addon command',function (...)
windower.debug('addon command')
logit('\n\n'..tostring(os.clock)..table.concat({...},' '))
logit('\n\n'..tostring(os.clock())..table.concat({...},' '))
local splitup = {...}
if not splitup[1] then return end -- handles //gs

Expand Down
8 changes: 4 additions & 4 deletions addons/GearSwap/helper_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ function assemble_use_item_packet(target_id,target_index,item_id)
outstr = outstr..string.char( (target_id%256), math.floor(target_id/256)%256, math.floor( (target_id/65536)%256) , math.floor( (target_id/16777216)%256) )
outstr = outstr..string.char(0,0,0,0)
outstr = outstr..string.char( (target_index%256), math.floor(target_index/256)%256)
inventory_index,bag_id = find_usable_item(item_id)
local inventory_index,bag_id = find_usable_item(item_id)
if inventory_index then
outstr = outstr..string.char(inventory_index%256)..string.char(0,bag_id,0,0,0)
else
Expand Down Expand Up @@ -551,7 +551,7 @@ function assemble_menu_item_packet(target_id,target_index,...)
-- Inventory Index for the one unit

for i,v in pairs(counts) do
inventory_index = find_inventory_item(i)
local inventory_index = find_inventory_item(i)
if inventory_index then
outstr = outstr..string.char(inventory_index%256)
else
Expand Down Expand Up @@ -678,7 +678,7 @@ function filter_pretarget(action)
if not table.contains(available,action.id) then
bool,err = false,"Unable to execute command. You do not have access to that job ability."
end
elseif category == 25 and (not player.main_job_id == 23 or not windower.ffxi.get_mjob_data().species or
elseif category == 25 and (player.main_job_id ~= 23 or not windower.ffxi.get_mjob_data().species or
not res.monstrosity[windower.ffxi.get_mjob_data().species] or not res.monstrosity[windower.ffxi.get_mjob_data().species].tp_moves[action.id] or
not (res.monstrosity[windower.ffxi.get_mjob_data().species].tp_moves[action.id] <= player.main_job_level)) then
-- Monstrosity filtering
Expand Down Expand Up @@ -1008,7 +1008,7 @@ function get_spell(act)
spell = copy_entry(res.job_abilities[75]) -- 'Elemental Seal'
elseif msg_ID == 305 then
spell = copy_entry(res.job_abilities[76]) -- 'Trick Attack'
elseif msg_ID == 311 or msg_ID == 311 then
elseif msg_ID == 311 or msg_ID == 312 then
spell = copy_entry(res.job_abilities[79]) -- 'Cover'
elseif msg_ID == 240 or msg_ID == 241 then
spell = copy_entry(res.job_abilities[43]) -- 'Hide'
Expand Down
11 changes: 2 additions & 9 deletions addons/GearSwap/packet_parsing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ parse.i[0x01B] = function (data)
local tab = {}
for slot_id,slot_name in pairs(default_slot_map) do
local tf = (((enc%(2^(slot_id+1))) / 2^slot_id) >= 1)
if encumbrance_table[slot_id] and not tf and not_sent_out_equip[slot_name] and not disable_table[i] then
if encumbrance_table[slot_id] and not tf and not_sent_out_equip[slot_name] and not disable_table[slot_id] then
tab[slot_name] = not_sent_out_equip[slot_name]
not_sent_out_equip[slot_name] = nil
end
Expand Down Expand Up @@ -283,7 +283,6 @@ parse.i[0x050] = function (data)
if chunk == data:sub(5,7) then
-- Matched
injected_equipment_registry[slot] = injected_equipment_registry[slot]:slice(ind+1) -- Eliminate current and all preceding packets if we get a match
matched = true
return
end
--[[for i=9,9+4*(chunk:byte(5)-1),4 do -- The server replies to equipset packets with both single equip packets and equipset packets.
Expand All @@ -307,7 +306,7 @@ function update_equipment()
tab[default_slot_map[i]] = {
bag_id = last:byte(3),
slot = last:byte(1) == 0 and empty or last:byte(1),
}
}
end
end
return tab
Expand Down Expand Up @@ -615,12 +614,6 @@ parse.i[0x076] = function (data)
end
end
local new_buffs = convert_buff_list(_ExtraPartyData.buffs[index])
if index == 1464 then
local newbuff_count = 0
for _,v in pairs(new_buffs) do
newbuff_count = newbuff_count + 1
end
end
if cur_player and cur_player.buffactive and not gearswap_disabled and
user_env and type(user_env['party_buff_change']) == 'function' then
-- Make sure the character existed before (with a buffactive list) - Avoids zoning.
Expand Down
5 changes: 1 addition & 4 deletions addons/GearSwap/refresh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ function refresh_player(dt,user_event_flag)
pet.claim_id = nil
pet.is_npc = nil
pet.isvalid = true
if pet.tp then pet.tp = pet.tp/10 end

if avatar_element[pet.name] then
pet.element = res.elements[avatar_element[pet.name]][language]
Expand Down Expand Up @@ -346,8 +345,6 @@ function refresh_player(dt,user_event_flag)
player.subtarget = target_complete(windower.ffxi.get_mob_by_target('st'))
player.last_subtarget = target_complete(windower.ffxi.get_mob_by_target('lastst'))



table.reassign(fellow,target_complete(windower.ffxi.get_mob_by_target('<ft>')))
if fellow.name then
fellow.isvalid = true
Expand Down Expand Up @@ -622,7 +619,7 @@ end
---- It also allows one to check for the alternate spelling of an item.
-----------------------------------------------------------------------------------
function refresh_item_list(itemlist)
retarr = make_user_table()
local retarr = make_user_table()
for i,v in pairs(itemlist) do
if type(v) == 'table' and v.id and v.id ~= 0 then
-- If we don't already have the primary item name in the table, add it.
Expand Down
2 changes: 1 addition & 1 deletion addons/GearSwap/statics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ region_to_zone_map = {
[14] = S{126,127,157,158,179,184},
[15] = S{121,122,153,154,202,251},
[16] = S{114,125,168,208,209,247},
[17] = S{113,128.174,201,212},
[17] = S{113,128,174,201,212},
[18] = S{123,176,250,252},
[19] = S{124,159,160,163,205,207,211},
[20] = S{130,177,178,180,181},
Expand Down
4 changes: 2 additions & 2 deletions addons/GearSwap/triggers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ parse.i[0x028] = function (data)
local spell = get_spell(act)
-- if not spell_res or (spell.english ~= spell_res.english) then print('Did not match.',spell.english,spell_res) end

if spell then logit('\n\n'..tostring(os.clock)..'(178) Event Action: '..tostring(spell[language])..' '..tostring(act.category))
if spell then logit('\n\n'..tostring(os.clock())..'(178) Event Action: '..tostring(spell[language])..' '..tostring(act.category))
else logit('\n\nNil spell detected') end

if spell and spell[language] then
Expand Down Expand Up @@ -341,7 +341,7 @@ parse.i[0x029] = function (data)
end

if unable_to_use:contains(arr.message_id) then
logit('\n\n'..tostring(os.clock)..'(195) Event Action Message: '..tostring(message_id)..' Interrupt')
logit('\n\n'..tostring(os.clock())..'(195) Event Action Message: '..tostring(arr.message_id)..' Interrupt')
local ts,tab = command_registry:find_by_time()

if tab and tab.spell then
Expand Down
8 changes: 4 additions & 4 deletions addons/GearSwap/user_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function debug_mode(boolean)
elseif boolean == nil then
_settings.debug_mode = true
else
error('\nGearSwap: show_swaps() was passed an invalid value ('..tostring(boolean)..'). (true/no value/nil=on, false=off)', 2)
error('\nGearSwap: debug_mode() was passed an invalid value ('..tostring(boolean)..'). (true/no value/nil=on, false=off)', 2)
end
end

Expand Down Expand Up @@ -245,7 +245,7 @@ function print_set(set,title)
end

function send_cmd_user(command)
if string.byte(1) ~= 0x40 then
if command:byte(1) ~= 0x40 then
command='@'..command
end
windower.send_command(command)
Expand Down Expand Up @@ -355,7 +355,7 @@ function user_midaction(bool)

for i,v in pairs(command_registry) do
if type(v) == 'table' and v.midaction then
return true, v.spell
return true, v.spell, i
end
end

Expand All @@ -366,7 +366,7 @@ function user_pet_midaction(bool)
if bool == false then
for i,v in pairs(command_registry) do
if v.pet_midaction then
command_registry.pet_midaction = false
command_registry[i].pet_midaction = false
end
end
end
Expand Down