Exemple #1
0
        public void Serialize(BinaryFileWriter writer)
        {
            writer.Write((int)0); //Version

            writer.Write((string)serialString.ToString());
            writer.WriteMobile(allianceLeader);

            writer.Write((int)membersOf.Count);

            foreach (Mobile m in membersOf)
            {
                writer.WriteMobile(m);
            }

            writer.Write((int)childGuilds.Count);

            foreach (Guild g in childGuilds)
            {
                writer.WriteGuild(g);
            }

            writer.Write((string)allianceName);
            writer.Write((int)primaryHue);
            writer.Write((int)secondaryHue);
            writer.Write((int)mountBody);
            writer.Write((int)mountID);
        }
Exemple #2
0
        /// <summary>
        /// Saves persistent data
        /// </summary>
        private static void OnWorldSave(WorldSaveEventArgs args)
        {
            if (!Directory.Exists(DataPath))
            {
                Directory.CreateDirectory(DataPath);
            }

            BinaryFileWriter writer = new BinaryFileWriter(DataFile, true);

            writer.Write((int)0); //version

            writer.Write((int)PerkTable.Count);

            foreach (KeyValuePair <Player, Tuple <Perk, Perk> > kvp in PerkTable)
            {
                if (kvp.Key == null || kvp.Key.Deleted)
                {
                    continue;
                }

                writer.WriteMobile <Player>(kvp.Key);

                writer.Write(kvp.Value.Item1.GetType().FullName);
                kvp.Value.Item1.Serialize(writer);

                writer.Write(kvp.Value.Item2.GetType().FullName);
                kvp.Value.Item2.Serialize(writer);
            }

            writer.Close();
        }
Exemple #3
0
        /// <summary>
        /// Saves persistent data
        /// </summary>
        private static void OnWorldSave(WorldSaveEventArgs args)
        {
            if (!Directory.Exists(DataPath))
            {
                Directory.CreateDirectory(DataPath);
            }

            BinaryFileWriter writer = new BinaryFileWriter(DataFile, true);

            writer.Write((int)EoCTable.Count);

            foreach (KeyValuePair <Player, EoCContext> kvp in EoCTable)
            {
                if (kvp.Key == null || kvp.Key.Deleted)
                {
                    writer.Write(false);
                }
                else
                {
                    writer.Write(true);

                    writer.WriteMobile <Player>(kvp.Key);
                    kvp.Value.Serialize(writer);
                }
            }

            writer.Write((int)HitsTable.Count);

            foreach (KeyValuePair <Player, HitsTimer> kvp in HitsTable)
            {
                if (kvp.Key != null && !kvp.Key.Deleted && kvp.Value.Running)
                {
                    writer.Write(true);

                    writer.WriteMobile <Player>(kvp.Key);
                    writer.Write(kvp.Value.Next);
                }
                else
                {
                    writer.Write(false);
                }
            }

            writer.Close();
        }
Exemple #4
0
        /// <summary>
        /// Saves persistent data
        /// </summary>
        private static void OnWorldSave( WorldSaveEventArgs args )
        {
            if( !Directory.Exists(DataPath) )
                Directory.CreateDirectory(DataPath);

            BinaryFileWriter writer = new BinaryFileWriter(DataFile, true);

            writer.Write((int)EoCTable.Count);

            foreach( KeyValuePair<Player, EoCContext> kvp in EoCTable )
            {
                if( kvp.Key == null || kvp.Key.Deleted )
                {
                    writer.Write(false);
                }
                else
                {
                    writer.Write(true);

                    writer.WriteMobile<Player>(kvp.Key);
                    kvp.Value.Serialize(writer);
                }
            }

            writer.Write((int)HitsTable.Count);

            foreach( KeyValuePair<Player, HitsTimer> kvp in HitsTable )
            {
                if( kvp.Key != null && !kvp.Key.Deleted && kvp.Value.Running )
                {
                    writer.Write(true);

                    writer.WriteMobile<Player>(kvp.Key);
                    writer.Write(kvp.Value.Next);
                }
                else
                {
                    writer.Write(false);
                }
            }

            writer.Close();
        }