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

local ffxiv_ipc_treasure_info = Proto("ffxiv_ipc_treasure_info", "FFXIV-IPC Treasure Info")

local treasure_info_fields = {
  treasure_id = ProtoField.uint32("ffxiv_ipc_treasure_info.treasure_id", "TreasureId", base.DEC),
  in_dungeon  = ProtoField.uint16("ffxiv_ipc_treasure_info.in_dungeon", "InDungeon", base.DEC),
  stage       = ProtoField.uint8("ffxiv_ipc_treasure_info.stage", "Stage", base.DEC),
  unknown07   = ProtoField.uint8("ffxiv_ipc_treasure_info.unknown07", "Unknown07", base.DEC),
  unknown08   = ProtoField.uint32("ffxiv_ipc_treasure_info.unknown08", "Unknown08", base.DEC),
  unknown12   = ProtoField.uint32("ffxiv_ipc_treasure_info.unknown12", "Unknown12", base.DEC),
  unknown16   = ProtoField.uint32("ffxiv_ipc_treasure_info.unknown16", "Unknown16", base.DEC),
  unknown20   = ProtoField.uint32("ffxiv_ipc_treasure_info.unknown20", "Unknown20", base.DEC),
}

ffxiv_ipc_treasure_info.fields = treasure_info_fields

function ffxiv_ipc_treasure_info.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_treasure_info, tvbuf)
  pktinfo.cols.info:set("Treasure Info")

  local len = tvbuf:len()

  -- dissect the treasure_id field
  local treasure_id_tvbr = tvbuf:range(0, 4)
  local treasure_id_val  = treasure_id_tvbr:le_uint()
  tree:add_le(treasure_info_fields.treasure_id, treasure_id_tvbr, treasure_id_val)

  -- dissect the in_dungeon field
  local in_dungeon_tvbr = tvbuf:range(4, 2)
  local in_dungeon_val  = in_dungeon_tvbr:le_uint()
  tree:add_le(treasure_info_fields.in_dungeon, in_dungeon_tvbr, in_dungeon_val)

  -- dissect the stage field
  local stage_tvbr = tvbuf:range(6, 1)
  local stage_val  = stage_tvbr:le_uint()
  tree:add_le(treasure_info_fields.stage, stage_tvbr, stage_val)

  -- dissect the unknown07 field
  local unknown07_tvbr = tvbuf:range(7, 1)
  local unknown07_val  = unknown07_tvbr:le_uint()
  tree:add_le(treasure_info_fields.unknown07, unknown07_tvbr, unknown07_val)

  -- dissect the unknown08 field
  local unknown08_tvbr = tvbuf:range(8, 4)
  local unknown08_val  = unknown08_tvbr:le_uint()
  tree:add_le(treasure_info_fields.unknown08, unknown08_tvbr, unknown08_val)

  -- dissect the unknown12 field
  local unknown12_tvbr = tvbuf:range(12, 4)
  local unknown12_val  = unknown12_tvbr:le_uint()
  tree:add_le(treasure_info_fields.unknown12, unknown12_tvbr, unknown12_val)

  -- dissect the unknown16 field
  local unknown16_tvbr = tvbuf:range(16, 4)
  local unknown16_val  = unknown16_tvbr:le_uint()
  tree:add_le(treasure_info_fields.unknown16, unknown16_tvbr, unknown16_val)

  -- dissect the unknown20 field
  local unknown20_tvbr = tvbuf:range(20, 4)
  local unknown20_val  = unknown20_tvbr:le_uint()
  tree:add_le(treasure_info_fields.unknown20, unknown20_tvbr, unknown20_val)

  return len
end