示例#1
0
        public static void OnSave(WorldSaveEventArgs e)
        {
            Persistence.Serialize(
                FilePath,
                writer =>
            {
                writer.Write((int)1);

                Server.Regions.SeaMarketRegion.Save(writer);

                writer.Write(PlayerFishingEntry.FishingEntries.Count);

                foreach (PlayerFishingEntry entry in PlayerFishingEntry.FishingEntries.Values)
                {
                    entry.Serialize(writer);
                }

                if (CharydbisSpawner.SpawnInstance != null)
                {
                    writer.Write(0);
                    CharydbisSpawner.SpawnInstance.Serialize(writer);
                }
                else
                {
                    writer.Write(1);
                }

                ForgedPardon.Save(writer);
            });
        }
示例#2
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                Server.Regions.SeaMarketRegion.Load(reader);
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    new PlayerFishingEntry(reader);
                }

                if (version == 0 || reader.ReadInt() == 0)
                {
                    CharydbisSpawner.SpawnInstance = new CharydbisSpawner();
                    CharydbisSpawner.SpawnInstance.Deserialize(reader);
                }

                ForgedPardon.Load(reader);
            });
        }