public static void Load(string fileName) { if (NPCs.Count > 0) { return; } using (Stream s = File.OpenRead(fileName)) { using (BitReader read = new BitReader(s)) { int count = read.ReadInt(); for (int i = 0; i < count; i++) { MDBNPC entry = new MDBNPC(); entry.i0 = read.ReadInt(); entry.Id = read.ReadUInt(); entry.Name = read.ReadZString(Encoding.Unicode, 128); entry.Desc = read.ReadZString(Encoding.Unicode, 1024); int counter = read.ReadInt(); entry.uInts = new int[counter]; for (int j = 0; j < counter; j++) { entry.uInts[j] = read.ReadInt(); } NPCs.Add(entry.Id, entry); } count = read.ReadInt(); for (int i = 0; i < count; i++) { MDBDigimon entry = new MDBDigimon(); entry.i1 = read.ReadInt(); entry.Id = read.ReadUInt(); entry.Name = read.ReadZString(Encoding.Unicode, 128); entry.Desc = read.ReadZString(Encoding.Unicode, 1024); int counter = read.ReadInt(); entry.Models = new int[counter]; for (int j = 0; j < counter; j++) { entry.Models[j] = read.ReadInt(); } Digimon.Add(entry.Id, entry); } count = read.ReadInt(); for (int i = 0; i < count; i++) { MDBMap entry = new MDBMap(); entry.i2 = read.ReadInt(); entry.Id = read.ReadUInt(); entry.Name = read.ReadZString(Encoding.Unicode, 128); entry.Desc = read.ReadZString(Encoding.Unicode, 1024); int counter = read.ReadInt(); entry.uInts = new int[counter]; for (int j = 0; j < counter; j++) { entry.uInts[j] = read.ReadInt(); } Maps.Add(entry.Id, entry); } } } Console.WriteLine("[MonsterDB] Loaded {0} NPCs, {1} Digimon, {2} Maps.", NPCs.Count, Digimon.Count, Maps.Count); }
public static void Load(string fileName) { if (NPCs.Count > 0) return; using (Stream s = File.OpenRead(fileName)) { using (BitReader read = new BitReader(s)) { int count = read.ReadInt(); for (int i = 0; i < count; i++) { MDBNPC entry = new MDBNPC(); entry.i0 = read.ReadInt(); entry.Id = read.ReadUInt(); entry.Name = read.ReadZString(Encoding.Unicode, 128); entry.Desc = read.ReadZString(Encoding.Unicode, 1024); int counter = read.ReadInt(); entry.uInts = new int[counter]; for (int j = 0; j < counter; j++) entry.uInts[j] = read.ReadInt(); NPCs.Add(entry.Id, entry); } count = read.ReadInt(); for (int i = 0; i < count; i++) { MDBDigimon entry = new MDBDigimon(); entry.i1 = read.ReadInt(); entry.Id = read.ReadUInt(); entry.Name = read.ReadZString(Encoding.Unicode, 128); entry.Desc = read.ReadZString(Encoding.Unicode, 1024); int counter = read.ReadInt(); entry.Models = new int[counter]; for (int j = 0; j < counter; j++) entry.Models[j] = read.ReadInt(); Digimon.Add(entry.Id, entry); } count = read.ReadInt(); for (int i = 0; i < count; i++) { MDBMap entry = new MDBMap(); entry.i2 = read.ReadInt(); entry.Id = read.ReadUInt(); entry.Name = read.ReadZString(Encoding.Unicode, 128); entry.Desc = read.ReadZString(Encoding.Unicode, 1024); int counter = read.ReadInt(); entry.uInts = new int[counter]; for (int j = 0; j < counter; j++) entry.uInts[j] = read.ReadInt(); Maps.Add(entry.Id, entry); } } } Console.WriteLine("[MonsterDB] Loaded {0} NPCs, {1} Digimon, {2} Maps.", NPCs.Count, Digimon.Count, Maps.Count); }