namespace Decal.Filters;

public sealed class VitalTable : IdNameTable<Vital>
{
	internal VitalTable(byte[] Data)
	{
		LoadFrom(Data);
	}

	internal override bool LoadFrom(byte[] Data)
	{
		int Index = 0;
		if (Get.DWord(Data, ref Index) != 620756999)
		{
			return false;
		}
		Index++;
		int num = Get.Byte(Data, ref Index);
		InitializeTable(num);
		for (int i = 0; i < num; i++)
		{
			Vital vital = new Vital(Get.DWord(Data, ref Index));
			vital.IconId = Get.DWord(Data, ref Index);
			Add(vital);
		}
		Index++;
		num = Get.Byte(Data, ref Index);
		for (int j = 0; j < num; j++)
		{
			int id = Get.DWord(Data, ref Index);
			GetById(id).Name = Get.PString(Data, ref Index);
		}
		return true;
	}
}
