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

local ffxiv_ipc_faux_hollow_init = Proto("ffxiv_ipc_faux_hollow_init", "FFXIV-IPC Faux Hollow Init")

local faux_hollow_init_fields = {
  unknown1          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown1", "Unknown1", base.DEC),
  unknown2          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown2", "Unknown2", base.DEC),
  unknown3          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown3", "Unknown3", base.DEC),
  unknown4          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown4", "Unknown4", base.DEC),
  unknown5          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown5", "Unknown5", base.DEC),
  unknown6          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown6", "Unknown6", base.DEC),
  unknown7          = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.unknown7", "Unknown7", base.DEC),
  chance            = ProtoField.uint32("ffxiv_ipc_faux_hollow_init.chance", "Chance", base.DEC),
  timestamp1        = ProtoField.uint64("ffxiv_ipc_faux_hollow_init.timestamp1", "Timestamp1", base.DEC),
  timestamp2        = ProtoField.uint64("ffxiv_ipc_faux_hollow_init.timestamp2", "Timestamp2", base.DEC),
}

ffxiv_ipc_faux_hollow_init.fields = faux_hollow_init_fields

function ffxiv_ipc_faux_hollow_init.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_faux_hollow_init, tvbuf)
  pktinfo.cols.info:set("Faux Hollow Init")

  local len = tvbuf:len()

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

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

  -- dissect the unknown3 field
  local unknown3_tvbr = tvbuf:range(8, 4)
  local unknown3_val  = unknown3_tvbr:le_uint()
  tree:add_le(faux_hollow_init_fields.unknown3, unknown3_tvbr, unknown3_val)

  -- dissect the unknown4 field
  local unknown4_tvbr = tvbuf:range(12, 4)
  local unknown4_val  = unknown4_tvbr:le_uint()
  tree:add_le(faux_hollow_init_fields.unknown4, unknown4_tvbr, unknown4_val)

  -- dissect the unknown5 field
  local unknown5_tvbr = tvbuf:range(16, 4)
  local unknown5_val  = unknown5_tvbr:le_uint()
  tree:add_le(faux_hollow_init_fields.unknown5, unknown5_tvbr, unknown5_val)

  -- dissect the unknown6 field
  local unknown6_tvbr = tvbuf:range(20, 4)
  local unknown6_val  = unknown6_tvbr:le_uint()
  tree:add_le(faux_hollow_init_fields.unknown6, unknown6_tvbr, unknown6_val)

  -- dissect the unknown7 field
  local unknown7_tvbr = tvbuf:range(24, 4)
  local unknown7_val  = unknown7_tvbr:le_uint()
  tree:add_le(faux_hollow_init_fields.unknown7, unknown7_tvbr, unknown7_val)

  -- dissect the chance field
  local chance_tvbr = tvbuf:range(28, 4)
  local chance_val  = chance_tvbr:le_uint()
  tree:add_le(faux_hollow_init_fields.chance, chance_tvbr, chance_val)

  -- dissect faux_hollow_block
  local faux_hollow_block_dissector = Dissector.get('ffxiv_ipc_faux_hollow_block')
  local faux_hollow_block_pos = 36
  local faux_hollow_block_len = 8
  local faux_hollow_block_count = 5

  while faux_hollow_block_pos + faux_hollow_block_len <= len do
    local faux_hollow_block_tvbr = tvbuf:range(faux_hollow_block_pos, 8)
    faux_hollow_block_dissector:call(faux_hollow_block_tvbr:tvb(), pktinfo, root)
    faux_hollow_block_pos = faux_hollow_block_pos + faux_hollow_block_len
    faux_hollow_block_count = faux_hollow_block_count - 1
    if faux_hollow_block_count <= 0 then
      break
    end
  end

  -- dissect the timestamp1 field
  local timestamp1_tvbr = tvbuf:range(88, 8)
  local timestamp1_val  = timestamp1_tvbr:le_uint64()
  tree:add_le(faux_hollow_init_fields.timestamp1, timestamp1_tvbr, timestamp1_val)

  -- dissect the timestamp2 field
  local timestamp2_tvbr = tvbuf:range(80, 8)
  local timestamp2_val  = timestamp2_tvbr:le_uint64()
  tree:add_le(faux_hollow_init_fields.timestamp2, timestamp2_tvbr, timestamp2_val)

  return len
end