ActorDat.bin and ItemTable.bin - LordNed/WindEditor GitHub Wiki

res/ActorDat/ActorDat.bin and res/ItemTable/ItemTable.bin both contain tables for spawning items. ActorDat.bin is referenced by enemy actors to determine what they drop when they are killed, and ItemTable.bin is referenced by grass and possibly pots to determine what spawns when they are destroyed.

##ActorDat.bin

//The format for ActorDat.bin is reminiscent of the format for DZR and DZS, where there are 
//three chunks with FourCC IDs and the data that follows.

class ActorDat
{
    /*0x00/00*/ int ChunkCount; //Always 3

    /*0x04/04*/ string AcfnFourCC; //"ACFN"
    /*0x08/08*/ int AcfnEntryCount;
    /*0x0C/12*/ int AcfnEntryOffset;

    /*0x04/04*/ string AcnaFourCC; //"ACNA"
    /*0x08/08*/ int AcnaEntryCount;
    /*0x0C/12*/ int AcnaEntryOffset;

    /*0x04/04*/ string AcdsFourCC; //"ACDS"
    /*0x08/08*/ int AcdsSize; //This is the size of the section in bytes, not the entry count
    /*0x0C/12*/ int AcdsEntryOffset;

    List<string> AcfnFieldNames;

    List<string> AcnaEnemyNames;

    List<ActorDatEntry> AcdsEntries;

    public void Read(EndianBinaryReader reader)
    {
        ChunkCount = reader.ReadInt32();

        AcfnFourCC = reader.ReadStringUntil('\0');
        AcfnEntryCount = reader.ReadInt32();
        AcfnEntryOffset = reader.ReadInt32();

        AcnaFourCC = reader.ReadStringUntil('\0');
        AcnaEntryCount = reader.ReadInt32();
        AcnaEntryOffset = reader.ReadInt32();

        AcdsFourCC = reader.ReadStringUntil('\0');
        AcdsEntryCount = reader.ReadInt32();
        AcdsEntryOffset = reader.ReadInt32();

        LoadActorFieldNames(reader);

        reader.BaseStream.Position = AcnaEntryOffset;

        LoadActorNames(reader);

        reader.BaseStream.Position = AcdsEntryOffset;

        LoadActorData(reader);
    }

    void LoadActorFieldNames(EndianBinaryReader reader)
    {
        AcfnFieldNames = new List<string>();
        int readerPositionStorage;

        for (int i = 0; i < AcfnEntryCount; i++)
        {
            int nameOffset = reader.ReadInt32();

            readerPositionStorage = (int)reader.BaseStream.Position;

            reader.BaseStream.Position = nameOffset;

            AcfnFieldNames.Add(reader.ReadStringUntil('\0'));

            reader.BaseStream.Position = readerOffsetStorage;
        }
    }

    void LoadActorNames(EndianBinaryReader reader)
    {
        AcnaEnemyNames = new List<string>();

        int readerPositionStorage;

        for (int i = 0; i < AcnaEntryCount; i++)
        {
            int nameOffset = reader.ReadInt32();

            readerPositionStorage = (int)reader.BaseStream.Position;

            reader.BaseStream.Position = nameOffset;

            AcnaFieldNames.Add(reader.ReadStringUntil('\0'));

            reader.BaseStream.Position = readerOffsetStorage;
        }
    }

    void LoadActorData(EndianBinaryReader reader)
    {
        AcdsEntries = new List<ActorDatEntry>();

        //To do
    }
}

##ItemTable.bin

//General file layout
/*0x00/00*/ string Magic; //"ITEM_TABLE"
/*0x0A/10*/ short EntryCount;
/*0x0C/12*/ int Padding; //It's 0, so I'm not sure what it could be used for
/*0x10/16*/ ItemTableEntry[EntryCount] TableEntries;

//ItemTableEntry
class ItemTableEntry
{
    byte[] ItemIDs = new byte[16];

    public byte[] Read(EndianBinaryReader reader)
    {
        for (int i = 0; i < 16; i++)
        {
            ItemIDs[i] = reader.ReadByte();
        }

        return ItemIDs;
    }
}
⚠️ **GitHub.com Fallback** ⚠️