ace/Source/ACE.DatLoader/PortalDatDatabase.cs
OptimShi cad0e661d0 Dat updates (#847)
* Fix Replace Animation Hook

* SoundTable

* Numerous Dat Updates

* Added highres and language export commands
2018-07-05 07:50:42 -05:00

51 lines
2.3 KiB
C#

using System.Collections.Generic;
using System.IO;
using ACE.DatLoader.FileTypes;
namespace ACE.DatLoader
{
public class PortalDatDatabase : DatDatabase
{
public PortalDatDatabase(string filename) : base(filename)
{
}
public BadData BadData => ReadFromDat<BadData>(BadData.FILE_ID);
public ChatPoseTable ChatPoseTable => ReadFromDat<ChatPoseTable>(ChatPoseTable.FILE_ID);
public CharGen CharGen => ReadFromDat<CharGen>(CharGen.FILE_ID);
public ContractTable ContractTable => ReadFromDat<ContractTable>(ContractTable.FILE_ID);
public GeneratorTable GeneratorTable => ReadFromDat<GeneratorTable>(GeneratorTable.FILE_ID);
public NameFilterTable NameFilterTable => ReadFromDat<NameFilterTable>(NameFilterTable.FILE_ID);
public RegionDesc RegionDesc => ReadFromDat<RegionDesc>(RegionDesc.FILE_ID);
public SecondaryAttributeTable SecondaryAttributeTable => ReadFromDat<SecondaryAttributeTable>(SecondaryAttributeTable.FILE_ID);
public SkillTable SkillTable => ReadFromDat<SkillTable>(SkillTable.FILE_ID);
public SpellComponentsTable SpellComponentsTable => ReadFromDat<SpellComponentsTable>(SpellComponentsTable.FILE_ID);
public SpellTable SpellTable => ReadFromDat<SpellTable>(SpellTable.FILE_ID);
public XpTable XpTable => ReadFromDat<XpTable>(XpTable.FILE_ID);
public void ExtractCategorizedContents(string path)
{
foreach (KeyValuePair<uint, DatFile> entry in AllFiles)
{
string thisFolder;
if (entry.Value.GetFileType(DatDatabaseType.Portal) != null)
thisFolder = Path.Combine(path, entry.Value.GetFileType(DatDatabaseType.Portal).ToString());
else
thisFolder = Path.Combine(path, "UnknownType");
if (!Directory.Exists(thisFolder))
Directory.CreateDirectory(thisFolder);
string hex = entry.Value.ObjectId.ToString("X8");
string thisFile = Path.Combine(thisFolder, hex + ".bin");
// Use the DatReader to get the file data
DatReader dr = GetReaderForFile(entry.Value.ObjectId);
File.WriteAllBytes(thisFile, dr.Buffer);
}
}
}
}