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

local db = require('ffxiv_db')
local ffxiv_ipc_fellowship_message_board_item = Proto("ffxiv_ipc_fellowship_message_board_item", "FFXIV-IPC FellowshipMessageBoardItem")

local fellowship_message_board_item_fields = {
  unique_id   = ProtoField.uint64("ffxiv_ipc_fellowship_message_board_item.unique_id", "UniqueID", base.HEX),
  time        = ProtoField.uint32("ffxiv_ipc_fellowship_message_board_item.time", "Time", base.DEC),
  user_server = ProtoField.uint16("ffxiv_ipc_fellowship_message_board_item.user_server", "UserServer", base.DEC, db.server),
  unknown0    = ProtoField.uint8("ffxiv_ipc_fellowship_message_board_item.unknown0", "Unknown0", base.DEC),
  emotion     = ProtoField.uint8("ffxiv_ipc_fellowship_message_board_item.emotion", "Emotion", base.DEC),
  index       = ProtoField.uint16("ffxiv_ipc_fellowship_message_board_item.index", "Index", base.DEC),
  nickname    = ProtoField.string("ffxiv_ipc_fellowship_message_board_item.nickname", "Nickname", base.UNICODE),
  content     = ProtoField.string("ffxiv_ipc_fellowship_message_board_item.content", "Content", base.UNICODE),
}

ffxiv_ipc_fellowship_message_board_item.fields = fellowship_message_board_item_fields

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

  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_message_board_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_message_board_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_message_board_item_fields.user_server, user_server_tvbr, user_server_val)

  -- dissect the unknown0 field
  local unknown0_tvbr = tvbuf:range(14, 1)
  local unknown0_val  = unknown0_tvbr:le_uint()
  tree:add_le(fellowship_message_board_item_fields.unknown0, unknown0_tvbr, unknown0_val)

  -- dissect the emotion field
  local emotion_tvbr = tvbuf:range(15, 1)
  local emotion_val  = emotion_tvbr:le_uint()
  tree:add_le(fellowship_message_board_item_fields.emotion, emotion_tvbr, emotion_val)

  -- dissect the index field
  local index_tvbr = tvbuf:range(16, 2)
  local index_val  = index_tvbr:le_uint()
  tree:add_le(fellowship_message_board_item_fields.index, index_tvbr, index_val)

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

  -- dissect the content field
  local content_tvbr = tvbuf:range(50, 102)
  local content_val  = content_tvbr:string(ENC_UTF_8)
  tree:add(fellowship_message_board_item_fields.content, content_tvbr, content_val)

  return len
end