#author("2025-03-07T04:05:03+00:00","default:yoya","yoya")
#author("2025-03-07T04:07:43+00:00","default:yoya","yoya")
[[Windower/Lua]]

# NPC

- https://github.com/Ivaar/Windower-addons/blob/master/SellNPC/SellNPC.lua
    local num = 0
    for index = 1, 80 do local item = windower.ffxi.get_items(0,index)
        if item and sales_que[item.id] and item.status == 0 then
            windower.packets.inject_outgoing(0x084,string.char(0x084,0x06,0,0,item.count,0,0,0,item.id%256,math.floor(item.id/256)%256,index,0))
            windower.packets.inject_outgoing(0x085,string.char(0x085,0x04,0,0,1,0,0,0))
            num = num + item.count
        end
    end

# Auction

- https://github.com/Ivaar/Windower-addons/tree/master/AuctionHelper

 local trans = string.char(0x4E,0x1E,0,0)
 trans = trans.. string.char(0x04,0,0,0, (price%256), (math.floor((price/256)%256)), (math.floor((price/65536)%256)), (math.floor((price/16777216)%256)))
 index = find_item(item.id, single == 1 and single or item.stack, item.max_charges)
 trans = trans..string.char((index%256), (math.floor((index/256)%256)), (item.id%256), (math.floor((item.id/256)%256)))
 trans = trans..string.char(single,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
    --print('Modified packet 0x04E: %s\n%s bytes':format(space_hex(trans:hex()),#trans))	
    windower.packets.inject_outgoing(0x4E,trans)