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

local db = require('ffxiv_db')
local ffxiv_ipc_boss_status_effect_list = Proto("ffxiv_ipc_boss_status_effect_list", "FFXIV-IPC Boss Status Effect List")

local boss_status_effect_list_fields = {
  class_id                = ProtoField.uint8("ffxiv_ipc_boss_status_effect_list.class_id", "classId", base.DEC, db.ClassJob),
  level1                  = ProtoField.uint8("ffxiv_ipc_boss_status_effect_list.level1", "level1", base.DEC),
  level2                  = ProtoField.uint8("ffxiv_ipc_boss_status_effect_list.level2", "level2", base.DEC),
  level3                  = ProtoField.uint8("ffxiv_ipc_boss_status_effect_list.level3", "level3", base.DEC),
  current_hp              = ProtoField.uint32("ffxiv_ipc_boss_status_effect_list.current_hp", "current_hp", base.DEC),
  max_hp                  = ProtoField.uint32("ffxiv_ipc_boss_status_effect_list.max_hp", "max_hp", base.DEC),
  current_mp              = ProtoField.uint16("ffxiv_ipc_boss_status_effect_list.current_mp", "current_mp", base.DEC),
  max_mp                  = ProtoField.uint16("ffxiv_ipc_boss_status_effect_list.max_mp", "max_mp", base.DEC),
  current_tp              = ProtoField.uint16("ffxiv_ipc_boss_status_effect_list.current_tp", "currentTp", base.DEC),
  damage_shield           = ProtoField.uint8("ffxiv_ipc_boss_status_effect_list.damage_shield", "damageShield", base.DEC),
  unknown1                = ProtoField.uint8("ffxiv_ipc_boss_status_effect_list.unknown1", "unknown1", base.DEC),
  padding                 = ProtoField.uint32("ffxiv_ipc_boss_status_effect_list.padding", "padding", base.DEC),
}

ffxiv_ipc_boss_status_effect_list.fields = boss_status_effect_list_fields

function ffxiv_ipc_boss_status_effect_list.dissector(tvbuf, pktinfo, root)
  local tree = root:add(ffxiv_ipc_boss_status_effect_list, tvbuf)
  pktinfo.cols.info:set("Boss Status Effect List")

  local len = tvbuf:len()

  -- dissect status_effect_list_item
  local status_effect_list_item_dissector = Dissector.get('ffxiv_ipc_status_effect_list_item')
  local status_effect_list_item_pos = 0
  local status_effect_list_item_len = 12
  local status_effect_list_item_count = 30

  while status_effect_list_item_pos + status_effect_list_item_len <= len do
    local status_effect_list_item_tvbr = tvbuf:range(status_effect_list_item_pos, 12)
    status_effect_list_item_dissector:call(status_effect_list_item_tvbr:tvb(), pktinfo, root)
    status_effect_list_item_pos = status_effect_list_item_pos + status_effect_list_item_len
    status_effect_list_item_count = status_effect_list_item_count - 1
    if status_effect_list_item_count <= 0 then
      break
    end
  end

  -- dissect the class_id field
  local class_id_tvbr = tvbuf:range(360, 1)
  local class_id_val  = class_id_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.class_id, class_id_tvbr, class_id_val)

  -- dissect the level1 field
  local level1_tvbr = tvbuf:range(361, 1)
  local level1_val  = level1_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.level1, level1_tvbr, level1_val)

  -- dissect the level2 field
  local level2_tvbr = tvbuf:range(362, 1)
  local level2_val  = level2_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.level2, level2_tvbr, level2_val)

  -- dissect the level3 field
  local level3_tvbr = tvbuf:range(363, 1)
  local level3_val  = level3_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.level3, level3_tvbr, level3_val)

  -- dissect the current_hp field
  local current_hp_tvbr = tvbuf:range(364, 4)
  local current_hp_val  = current_hp_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.current_hp, current_hp_tvbr, current_hp_val)

  -- dissect the max_hp field
  local max_hp_tvbr = tvbuf:range(368, 4)
  local max_hp_val  = max_hp_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.max_hp, max_hp_tvbr, max_hp_val)

  -- dissect the current_mp field
  local current_mp_tvbr = tvbuf:range(372, 2)
  local current_mp_val  = current_mp_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.current_mp, current_mp_tvbr, current_mp_val)

  -- dissect the max_mp field
  local max_mp_tvbr = tvbuf:range(374, 2)
  local max_mp_val  = max_mp_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.max_mp, max_mp_tvbr, max_mp_val)

  -- dissect the current_tp field
  local current_tp_tvbr = tvbuf:range(376, 2)
  local current_tp_val  = current_tp_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.current_tp, current_tp_tvbr, current_tp_val)

  -- dissect the damage_shield field
  local damage_shield_tvbr = tvbuf:range(377, 1)
  local damage_shield_val  = damage_shield_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.damage_shield, damage_shield_tvbr, damage_shield_val)

  -- dissect the unknown1 field
  local unknown1_tvbr = tvbuf:range(378, 1)
  local unknown1_val  = unknown1_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.unknown1, unknown1_tvbr, unknown1_val)

  -- dissect status_effect_list_item
  local status_effect_list_item_dissector = Dissector.get('ffxiv_ipc_status_effect_list_item')
  local status_effect_list_item_pos = 380
  local status_effect_list_item_len = 12
  local status_effect_list_item_count = 30

  while status_effect_list_item_pos + status_effect_list_item_len <= len do
    local status_effect_list_item_tvbr = tvbuf:range(status_effect_list_item_pos, 12)
    status_effect_list_item_dissector:call(status_effect_list_item_tvbr:tvb(), pktinfo, root)
    status_effect_list_item_pos = status_effect_list_item_pos + status_effect_list_item_len
    status_effect_list_item_count = status_effect_list_item_count - 1
    if status_effect_list_item_count <= 0 then
      break
    end
  end

  -- dissect the padding field
  local padding_tvbr = tvbuf:range(740, 4)
  local padding_val  = padding_tvbr:le_uint()
  tree:add_le(boss_status_effect_list_fields.padding, padding_tvbr, padding_val)

  return len
end