public static void Load() { Collections.Npcs.Clear(); foreach (var file in Directory.EnumerateFileSystemEntries("RAW\\Npcs\\")) { using (var reader = new KeyValueFormat(file)) { var obj = new Npc { UniqueId = reader.Load <int>("id"), Type = reader.Load <byte>("type"), Look = reader.Load <uint>("lookface"), MapId = reader.Load <ushort>("mapid"), Base = reader.Load <byte>("base"), Sort = reader.Load <byte>("sort") }; UniqueIdGenerator.Goto(obj.UniqueId, EntityType.Npc); obj.Location.X = reader.Load <ushort>("cellx"); obj.Location.Y = reader.Load <ushort>("celly"); if (obj.MapId == 0) { continue; } if (GameWorld.Maps.ContainsKey(obj.MapId)) { Collections.Npcs.Add(obj.UniqueId, obj); GameWorld.Maps[obj.MapId].LoadInEntity(obj); } } } DynamicNpcDb.Load(); }
public static void Load() { var count = 100000; foreach (var file in Directory.EnumerateFileSystemEntries("RAW\\DynNpcs\\")) { using (var reader = new KeyValueFormat(file)) { var map = reader.Load <int>("Map"); if (map > 5000) { continue; } var obj = new DynamicNpc { UniqueId = count, Type = reader.Load <byte>("Action"), Look = reader.Load <uint>("Look"), MapId = reader.Load <ushort>("Map"), MaximumHp = reader.Load <ushort>("HP"), CurrentHp = reader.Load <ushort>("HP"), Base = reader.Load <byte>("Base"), Sort = reader.Load <byte>("Sort"), Defense = reader.Load <ushort>("Defense"), MagicDefense = reader.Load <ushort>("MDefense") }; UniqueIdGenerator.Goto(obj.UniqueId, EntityType.DynamicNpc); obj.Location.X = reader.Load <ushort>("X"); obj.Location.Y = reader.Load <ushort>("Y"); if (obj.MapId == 0) { continue; } if (GameWorld.Maps.ContainsKey(obj.MapId)) { Collections.Npcs.Add(obj.UniqueId, obj); GameWorld.Maps[obj.MapId].LoadInEntity(obj); } count++; } } ShopDb.LoadShops(); }