mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* Read the Generators from portal.dat file 0x0E00000D and enhance DatReader to handle obfuscated strings. * Found a better name for ReadOString. Left ReadPString untouched as that's the name used in the client.
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ACE.DatLoader.Entity
|
|
{
|
|
public class Generator
|
|
{
|
|
public int Id { get; set; }
|
|
|
|
public int Count { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
|
|
public List<Generator> Items;
|
|
|
|
public Generator()
|
|
{
|
|
Id = 0;
|
|
Count = 0;
|
|
Name = "";
|
|
Items = new List<Generator>();
|
|
}
|
|
|
|
public Generator GetNextGenerator(DatReader datReader)
|
|
{
|
|
Name = datReader.ReadObfuscatedString();
|
|
datReader.AlignBoundary();
|
|
Id = datReader.ReadInt32();
|
|
Count = datReader.ReadInt32();
|
|
|
|
// Console.WriteLine($"{Id:X8} {Count:X8} {Name}");
|
|
|
|
for (var i = 0; i < Count; i++)
|
|
{
|
|
var child = new Generator();
|
|
child = child.GetNextGenerator(datReader);
|
|
Items.Add(child);
|
|
}
|
|
return this;
|
|
}
|
|
}
|
|
}
|