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

local db = require('ffxiv_db')
local ffxiv_ipc_fellowship_member_item = Proto("ffxiv_ipc_fellowship_member_item", "FFXIV-IPC FellowshipMemberItem")

local fellowship_member_item_fields = {
  unique_id    = ProtoField.uint64("ffxiv_ipc_fellowship_member_item.unique_id", "UniqueID", base.HEX),
  time         = ProtoField.uint32("ffxiv_ipc_fellowship_member_item.time", "Time", base.DEC),
  user_server  = ProtoField.uint16("ffxiv_ipc_fellowship_member_item.user_server", "UserServer", base.DEC, db.server),
  user_server2 = ProtoField.uint16("ffxiv_ipc_fellowship_member_item.user_server2", "UserServer2", base.DEC, db.server),
  unknown1     = ProtoField.uint16("ffxiv_ipc_fellowship_member_item.unknown1", "Unknown1", base.DEC),
  level        = ProtoField.uint8("ffxiv_ipc_fellowship_member_item.level", "Level", base.DEC),
  group        = ProtoField.uint8("ffxiv_ipc_fellowship_member_item.group", "Group", base.DEC),
  unknown3     = ProtoField.uint16("ffxiv_ipc_fellowship_member_item.unknown3", "Unknown3", base.DEC),
  unknown4     = ProtoField.uint8("ffxiv_ipc_fellowship_member_item.unknown4", "Unknown4", base.DEC),
  nickname     = ProtoField.string("ffxiv_ipc_fellowship_member_item.nickname", "Nickname", base.UNICODE),
  padding      = ProtoField.uint8("ffxiv_ipc_fellowship_member_item.padding", "Padding", base.DEC),
}

ffxiv_ipc_fellowship_member_item.fields = fellowship_member_item_fields

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

  local len = tvbuf:len()

  -- dissect the unique_id field
  local unique_id_tvbr = tvbuf:range(0, 8)
  local unique_id_val  = unique_id_tvbr:le_uint64()
  tree:add_le(fellowship_member_item_fields.unique_id, unique_id_tvbr, unique_id_val)

  -- dissect the time field
  local time_tvbr = tvbuf:range(8, 4)
  local time_val  = time_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.time, time_tvbr, time_val)

  -- dissect the user_server field
  local user_server_tvbr = tvbuf:range(12, 2)
  local user_server_val  = user_server_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.user_server, user_server_tvbr, user_server_val)

  -- dissect the user_server2 field
  local user_server2_tvbr = tvbuf:range(14, 2)
  local user_server2_val  = user_server2_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.user_server2, user_server2_tvbr, user_server2_val)

  -- dissect the unknown1 field
  local unknown1_tvbr = tvbuf:range(16, 2)
  local unknown1_val  = unknown1_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.unknown1, unknown1_tvbr, unknown1_val)

  -- dissect the level field
  local level_tvbr = tvbuf:range(18, 1)
  local level_val  = level_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.level, level_tvbr, level_val)

  -- dissect the group field
  local group_tvbr = tvbuf:range(19, 1)
  local group_val  = group_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.group, group_tvbr, group_val)

  -- dissect the unknown3 field
  local unknown3_tvbr = tvbuf:range(20, 2)
  local unknown3_val  = unknown3_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.unknown3, unknown3_tvbr, unknown3_val)

  -- dissect the unknown4 field
  local unknown4_tvbr = tvbuf:range(22, 1)
  local unknown4_val  = unknown4_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.unknown4, unknown4_tvbr, unknown4_val)

  -- dissect the nickname field
  local nickname_tvbr = tvbuf:range(23, 32)
  local nickname_val  = nickname_tvbr:string(ENC_UTF_8)
  tree:add(fellowship_member_item_fields.nickname, nickname_tvbr, nickname_val)

  -- dissect the padding field
  local padding_tvbr = tvbuf:range(55, 1)
  local padding_val  = padding_tvbr:le_uint()
  tree:add_le(fellowship_member_item_fields.padding, padding_tvbr, padding_val)

  return len
end