-
-
Save Ivaar/9abb704eec00004cc451ee63e3d5b659 to your computer and use it in GitHub Desktop.
test for usable items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('luau') | |
require('pack') | |
bit = require('bit') | |
extdata = require 'extdata' | |
function print_item_packet(id, target_index, item_index, bag) | |
local targ = windower.ffxi.get_mob_by_index(target_index) | |
local item = windower.ffxi.get_items(bag, item_index) | |
local i_res = res.items[item.id] | |
local ext = extdata.decode(item) | |
local str = 'Unhandled' | |
if ext.type == 'Enchanted Equipment' then | |
if item.status == 5 and ext.usable then -- looks like the items target flags are checked here | |
-- 0x037 | |
str = '0x37' | |
end | |
elseif item.status == 0 then | |
if bit.band(targ.spawn_type, 2) == 2 then | |
-- 0x036 | |
str = '0x36' | |
else | |
-- 0x037 | |
str = '0x37' | |
end | |
end | |
windower.add_to_chat(207, '0x%2X | %s | item_type: %d %s | item_name: %s | spawn_type: %d':format(id, str, i_res.type, ext.type, i_res.name, targ.spawn_type)) | |
end | |
windower.register_event('outgoing chunk', function(id, data, modified, injected, blocked) | |
if id == 0x036 then | |
print_item_packet(id, data:unpack('H', 59), data:byte(49), 0) | |
elseif id == 0x037 then | |
print_item_packet(id, data:unpack('H', 13), data:byte(15), data:byte(17)) | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment