-- This file is generated by tools/json2lua.js

local ffxiv_ipc_item_count = Proto("ffxiv_ipc_item_count", "FFXIV-IPC ItemCount")

local item_count_fields = {
  index    = ProtoField.uint32("ffxiv_ipc_item_count.index", "Index", base.DEC),
  amount   = ProtoField.uint32("ffxiv_ipc_item_count.amount", "Amount", base.DEC),
  unknown1 = ProtoField.uint32("ffxiv_ipc_item_count.unknown1", "Unknown1", base.DEC),
  unknown2 = ProtoField.uint32("ffxiv_ipc_item_count.unknown2", "Unknown2", base.DEC),
}

ffxiv_ipc_item_count.fields = item_count_fields

function ffxiv_ipc_item_count.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_item_count, tvbuf)
  pktinfo.cols.info:set("ItemCount")

  local len = tvbuf:len()

  -- dissect the index field
  local index_tvbr = tvbuf:range(0, 4)
  local index_val  = index_tvbr:le_uint()
  tree:add_le(item_count_fields.index, index_tvbr, index_val)

  -- dissect the amount field
  local amount_tvbr = tvbuf:range(4, 4)
  local amount_val  = amount_tvbr:le_uint()
  tree:add_le(item_count_fields.amount, amount_tvbr, amount_val)

  -- dissect the unknown1 field
  local unknown1_tvbr = tvbuf:range(8, 4)
  local unknown1_val  = unknown1_tvbr:le_uint()
  tree:add_le(item_count_fields.unknown1, unknown1_tvbr, unknown1_val)

  -- dissect the unknown2 field
  local unknown2_tvbr = tvbuf:range(12, 4)
  local unknown2_val  = unknown2_tvbr:le_uint()
  tree:add_le(item_count_fields.unknown2, unknown2_tvbr, unknown2_val)

  return len
end