using System.Collections.Generic;
using System.IO;
using ACE.DatLoader.Entity;
namespace ACE.DatLoader.FileTypes
{
///
/// This reads the extra items in a landblock from the client_cell.dat. This is mostly buildings, but other static/non-interactive objects like tables, lamps, are also included.
/// CLandBlockInfo is a file designated xxyyFFFE, where xxyy is the landblock.
///
/// The fileId is CELL + 0xFFFE. e.g. a cell of 1234, the file index would be 0x1234FFFE.
///
///
/// Very special thanks again to David Simpson for his early work on reading the cell.dat. Even bigger thanks for his documentation of it!
///
[DatFileType(DatFileType.LandBlockInfo)]
public class LandblockInfo : FileType
{
///
/// number of EnvCells in the landblock. This should match up to the unique items in the building stab lists.
///
public uint NumCells { get; private set; }
///
/// list of model numbers. 0x01 and 0x02 types and their specific locations
///
public List Objects { get; } = new List();
///
/// As best as I can tell, this only affects whether there is a restriction table or not
///
public uint PackMask { get; private set; }
///
/// Buildings and other structures with interior locations in the landblock
///
public List Buildings { get; } = new List();
///
/// The specific landblock/cell controlled by a specific guid that controls access (e.g. housing barrier)
///
public Dictionary RestrictionTables { get; } = new Dictionary();
public override void Unpack(BinaryReader reader)
{
Id = reader.ReadUInt32();
NumCells = reader.ReadUInt32();
Objects.Unpack(reader);
ushort numBuildings = reader.ReadUInt16();
PackMask = reader.ReadUInt16();
Buildings.Unpack(reader, numBuildings);
if ((PackMask & 1) == 1)
RestrictionTables.UnpackPackedHashTable(reader);
}
}
}