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

local db = require('ffxiv_db')
local ffxiv_ipc_content_finder_trigger = Proto("ffxiv_ipc_content_finder_trigger", "FFXIV-IPC Content Finder Trigger")

local content_finder_trigger_fields = {
  roulette = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.roulette", "Roulette", base.DEC, db.ContentRoulette),
  unknown1 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.unknown1", "Unknown1", base.DEC),
  flags    = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.flags", "Flags", base.DEC),
  unknown2 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.unknown2", "Unknown2", base.DEC),
  unknown3 = ProtoField.uint32("ffxiv_ipc_content_finder_trigger.unknown3", "Unknown3", base.DEC),
  unknown4 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.unknown4", "Unknown4", base.DEC),
  content1 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.content1", "Content1", base.DEC, db.ContentFinderCondition),
  content2 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.content2", "Content2", base.DEC, db.ContentFinderCondition),
  content3 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.content3", "Content3", base.DEC, db.ContentFinderCondition),
  content4 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.content4", "Content4", base.DEC, db.ContentFinderCondition),
  content5 = ProtoField.uint16("ffxiv_ipc_content_finder_trigger.content5", "Content5", base.DEC, db.ContentFinderCondition),
}

ffxiv_ipc_content_finder_trigger.fields = content_finder_trigger_fields

function ffxiv_ipc_content_finder_trigger.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_content_finder_trigger, tvbuf)
  pktinfo.cols.info:set("Content Finder Trigger")

  local len = tvbuf:len()

  -- dissect the roulette field
  local roulette_tvbr = tvbuf:range(0, 2)
  local roulette_val  = roulette_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.roulette, roulette_tvbr, roulette_val)

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

  -- dissect the flags field
  local flags_tvbr = tvbuf:range(4, 2)
  local flags_val  = flags_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.flags, flags_tvbr, flags_val)

  -- dissect the unknown2 field
  local unknown2_tvbr = tvbuf:range(6, 2)
  local unknown2_val  = unknown2_tvbr:le_uint()
  tree:add_le(content_finder_trigger_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(content_finder_trigger_fields.unknown3, unknown3_tvbr, unknown3_val)

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

  -- dissect the content1 field
  local content1_tvbr = tvbuf:range(14, 2)
  local content1_val  = content1_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.content1, content1_tvbr, content1_val)

  -- dissect the content2 field
  local content2_tvbr = tvbuf:range(16, 2)
  local content2_val  = content2_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.content2, content2_tvbr, content2_val)

  -- dissect the content3 field
  local content3_tvbr = tvbuf:range(18, 2)
  local content3_val  = content3_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.content3, content3_tvbr, content3_val)

  -- dissect the content4 field
  local content4_tvbr = tvbuf:range(20, 2)
  local content4_val  = content4_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.content4, content4_tvbr, content4_val)

  -- dissect the content5 field
  local content5_tvbr = tvbuf:range(22, 2)
  local content5_val  = content5_tvbr:le_uint()
  tree:add_le(content_finder_trigger_fields.content5, content5_tvbr, content5_val)

  return len
end