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

local ffxiv_ipc_examine_item_materia = Proto("ffxiv_ipc_examine_item_materia", "FFXIV-IPC ExamineItemMateria")

local examine_item_materia_fields = {
  materia_id = ProtoField.uint16("ffxiv_ipc_examine_item_materia.materia_id", "MateriaId", base.DEC),
  tier       = ProtoField.uint16("ffxiv_ipc_examine_item_materia.tier", "Tier", base.DEC),
}

ffxiv_ipc_examine_item_materia.fields = examine_item_materia_fields

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

  local len = tvbuf:len()

  -- dissect the materia_id field
  local materia_id_tvbr = tvbuf:range(0, 2)
  local materia_id_val  = materia_id_tvbr:le_uint()
  tree:add_le(examine_item_materia_fields.materia_id, materia_id_tvbr, materia_id_val)

  -- dissect the tier field
  local tier_tvbr = tvbuf:range(2, 2)
  local tier_val  = tier_tvbr:le_uint()
  tree:add_le(examine_item_materia_fields.tier, tier_tvbr, tier_val)

  if materia_id_val == 0 then
    tree:set_hidden(true)
  end

  return len
end