Inheritance: System.EventArgs
		private static void World_Save( WorldSaveEventArgs args )
		{
			DateTime now = DateTime.Now;

			if ( AuctionConfig.InterestHour <= now.Hour && SavingsAccount.DateLastPaid != now.Date )
			{
				ArrayList accounts = new ArrayList();

				foreach ( Item item in World.Items.Values )
				{
					if ( item is SavingsAccount && item.Parent is BankBox )
						accounts.Add( item );
				}

				foreach ( Item item in accounts )
				{
					SavingsAccount account = item as SavingsAccount;

					account.Gold += (long)( AuctionConfig.GoldInterestRate * account.Gold );
					if ( Arya.Savings.SavingsAccount.EnableTokens )
						account.Tokens += (long)( AuctionConfig.TokensInterestRate * account.Tokens );

					BankBox box = account.Parent as BankBox;

					if ( null != box && null != box.Owner && box.Owner.Map != Map.Internal )
						box.Owner.SendMessage( Xanthos.Utilities.Misc.kRedHue, "Interest has been paid on the {0} in your savings account!", AuctionConfig.EnableTokens ? "gold and tokens" : "gold" );
				}
				SavingsAccount.DateLastPaid = now.Date;
			}
		}
Beispiel #2
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);
                });
        }
Beispiel #3
0
        private static void OnSave(WorldSaveEventArgs args)
        {
            DateTime time = DateTime.Now;
            if (Data.Debug)
            {
                Console.WriteLine("");
                Console.WriteLine(General.Local(241));
            }

            Data.Save();
            Channel.Save();
            GumpInfo.Save();

            foreach (Data data in Data.Datas.Values)
                if (data.SevenDays)
                    foreach (Message msg in new ArrayList(data.Messages))
                        if (msg.Received < DateTime.Now - TimeSpan.FromDays(7))
                            data.Messages.Remove(msg);

            if (Data.Debug)
            {
                TimeSpan elapsed = DateTime.Now - time;
                Console.WriteLine(General.Local(240) + " {0}", (elapsed.Minutes != 0 ? elapsed.Minutes + " minutes" : "") + (elapsed.Seconds != 0 ? elapsed.Seconds + " seconds" : "") + elapsed.Milliseconds + " milliseconds");
            }
        }
Beispiel #4
0
		public static void OnSave( WorldSaveEventArgs e )
		{
			foreach( TownHouseSign sign in new ArrayList( TownHouseSign.AllSigns ) )
				sign.ValidateOwnership();

			foreach( TownHouse house in new ArrayList( TownHouse.AllTownHouses ) )
				if ( house.Deleted )
				{
					TownHouse.AllTownHouses.Remove( house );
					continue;
				}
		}
Beispiel #5
0
        private static void OnSave(WorldSaveEventArgs e)
        {
            foreach (TownHouseSign sign in new List<TownHouseSign>(TownHouseSign.AllSigns))
            {
                sign.ValidateOwnership();
            }

            foreach (TownHouse house in new List<TownHouse>(TownHouse.AllTownHouses).Where(house => house.Deleted))
            {
                TownHouse.AllTownHouses.Remove(house);
            }
        }
Beispiel #6
0
        public static void OnSave(WorldSaveEventArgs e)
        {
            Persistence.Serialize(
                FilePath,
                writer =>
                {
                    writer.Write(0); // version

                    writer.Write(DistillationSystem.Contexts.Count);

                    foreach (KeyValuePair<Mobile, DistillationContext> kvp in DistillationSystem.Contexts)
                    {
                        writer.Write(kvp.Key);
                        kvp.Value.Serialize(writer);
                    }
                });
        }
Beispiel #7
0
		private static void OnSave( WorldSaveEventArgs e )
		{try{

			if ( !Directory.Exists( "Saves/Gumps/" ) )
				Directory.CreateDirectory( "Saves/Gumps/" );

			GenericWriter writer = new BinaryFileWriter( Path.Combine( "Saves/Gumps/", "Gumps.bin" ), true );

			writer.Write( 0 ); // version

			ArrayList list = new ArrayList();

			GumpInfo gumpi;
			foreach( object obj in new ArrayList( s_Infos.Values ) )
			{
				if ( !(obj is Hashtable) )
					continue;

				foreach( object obje in new ArrayList( ((Hashtable)obj).Values ) )
				{
					if ( !(obje is GumpInfo ) )
						continue;

					gumpi = (GumpInfo)obje;

					if ( gumpi.Mobile != null
					&& gumpi.Mobile.Player
					&& !gumpi.Mobile.Deleted
					&& gumpi.Mobile.Account != null
					&& ((Account)gumpi.Mobile.Account).LastLogin > DateTime.Now - TimeSpan.FromDays( 30 ) )
						list.Add( obje );
				}
			}

			writer.Write( list.Count );

			foreach( GumpInfo info in list )
				info.Save( writer );

			writer.Close();

		}catch{ Errors.Report( "GumpInfo-> OnSave" ); } }
Beispiel #8
0
		public static void OnSave(WorldSaveEventArgs e)
		{
            Persistence.Serialize(
                FilePath,
                writer =>
                {
                    writer.Write((int)0);

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

                    writer.Write(BestSingle.Count);
                    foreach (KeyValuePair<Mobile, long> kvp in BestSingle)
                    {
                        writer.Write(kvp.Key);
                        writer.Write(kvp.Value);
                    }

                    writer.Write(OverallTotal.Count);
                    foreach (KeyValuePair<Mobile, long> kvp in OverallTotal)
                    {
                        writer.Write(kvp.Key);
                        writer.Write(kvp.Value);
                    }

                    writer.Write(Top20.Count);
                    foreach(Dictionary<Mobile, long> dic in Top20)
                    {
                        writer.Write(dic.Count);
                        foreach (KeyValuePair<Mobile, long> kvp in dic)
                        {
                            writer.Write(kvp.Key);
                            writer.Write(kvp.Value);
                        }
                    };
                });
		}
Beispiel #9
0
        private static void event_worldSave( WorldSaveEventArgs args )
        {
            if( !Directory.Exists(savePath) )
                Directory.CreateDirectory(savePath);

            using( StreamWriter writer = new StreamWriter(saveMintFile) )
            {
                XmlTextWriter xml = new XmlTextWriter(writer);

                xml.Formatting = Formatting.Indented;
                xml.IndentChar = '\t';
                xml.Indentation = 1;

                xml.WriteStartDocument(true);
                xml.WriteStartElement("mints");
                xml.WriteAttributeString("count", mintList.Count.ToString());

                mintList.ForEach(delegate( CoinMint cm ) { cm.Save(xml); });

                xml.WriteEndElement();
                xml.WriteEndDocument();
                xml.Close();
            }
        }
		private static void OnSave( WorldSaveEventArgs args )
		{
			if ( !Directory.Exists( SavePath ) )
			{
				Directory.CreateDirectory( SavePath );
			}

			GenericWriter writer = new BinaryFileWriter( Path.Combine( SavePath, SaveFile ), true );

			writer.Write( m_LastResetTime );

			writer.Write( MobileRateInfo.Entries.Count );

			foreach ( KeyValuePair<Mobile, MobileRateInfo> kvp in MobileRateInfo.Entries )
			{
				writer.Write( (Mobile)kvp.Key );

				MobileRateInfo info = (MobileRateInfo)kvp.Value;

				info.Serialize( writer );
			}

			writer.Close();
		}
Beispiel #11
0
 private static void Save(WorldSaveEventArgs e)
 {
     _Persistence.Serialize(SerializeFilters);
 }
Beispiel #12
0
 private static void OnWorldSave(WorldSaveEventArgs e)
 {
     Save();
 }
Beispiel #13
0
 public static void InvokeWorldSave( WorldSaveEventArgs e )
 {
     if ( WorldSave != null )
         WorldSave( e );
 }
		public static void Save( WorldSaveEventArgs e )
		{
			if ( BaseHalloweenGiftGiver.IsHalloween() )
			{
				if ( m_Instance == null )
					new TrickorTreatPersistence();
			}
			else if ( m_Instance != null )
				Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( m_Instance.DeleteInternal ) );
		}
Beispiel #15
0
 private static void EventSink_WorldSave(WorldSaveEventArgs e)
 {
     // Args: bool e.Message
     SR_Save.WriteData();
 }
Beispiel #16
0
        private static void Event_WorldSave(WorldSaveEventArgs args)
        {
            try
            {
                if (!Directory.Exists(SavePath))
                    Directory.CreateDirectory(SavePath);

                BinaryFileWriter writer = new BinaryFileWriter(SaveFile, true);

                Serialize(writer);

                ConstructXML();
            }

            catch { Console.WriteLine("Error: Event_WorldSave Failed in Alliance Definition."); }
        }
Beispiel #17
0
		private static void EventSink_WorldSave(WorldSaveEventArgs e)
		{
			Instance.Serialize();
		}
Beispiel #18
0
		private static void EventSink_WorldSave( WorldSaveEventArgs e )
		{
			new UpdateAllTimer().Start();
		}
		public static void OnSave(WorldSaveEventArgs e)
		{
			try
			{
				Console.WriteLine("KinCityManager Saving...");
				if (!Directory.Exists("Saves/AngelIsland"))
					Directory.CreateDirectory("Saves/AngelIsland");

				string filePath = Path.Combine("Saves/AngelIsland", "KinCityManager.bin");

				GenericWriter writer;
				writer = new BinaryFileWriter(filePath, true);

				writer.Write(1); //version

				//v1 below
				//write out the city data class'
				writer.Write(_cityData.Count);
				foreach (KeyValuePair<KinFactionCities, KinCityData> pair in _cityData)
					pair.Value.Save(writer);

				writer.Close();
			}
			catch (Exception ex)
			{
				System.Console.WriteLine("Error saving KinCityManager!");
				Scripts.Commands.LogHelper.LogException(ex);
			}
		}
Beispiel #20
0
        private static void OnSave( WorldSaveEventArgs e )
        {
            try{

            if ( !Directory.Exists( "Saves/Commands/" ) )
                Directory.CreateDirectory( "Saves/Commands/" );

            GenericWriter writer = new BinaryFileWriter( Path.Combine( "Saves/Commands/", "Commands.bin" ), true );

            writer.Write( 0 ); // version

            ArrayList list = new ArrayList( s_Defaults.Values );

            writer.Write( list.Count );

            foreach( DefaultInfo info in list )
            {
                writer.Write( info.NewCommand );
                writer.Write( info.OldCommand );
                writer.Write( (int)info.NewAccess );
            }

            writer.Close();

            }catch{ Errors.Report( "Commands-> OnSave" ); }
        }
		private static void EventSink_WorldSave( WorldSaveEventArgs args)
		{
			HiveUpdateAll();
		}
Beispiel #22
0
 public static void OnSave(WorldSaveEventArgs e)
 {
     Persistence.Serialize(FilePath, OnSerialize);
 }
Beispiel #23
0
		public static void saveGlobalList( WorldSaveEventArgs e )
		{
			if( !System.IO.File.Exists( xmlSchema ) )
			{
				Console.WriteLine( "Could not open {0}.", xmlSchema );
				Console.WriteLine( "{0} must be in .\\Data\\Bounty System", xmlSchema );
				Console.WriteLine( "Cannot save bounties." );
				return;
			}

			if( System.IO.File.Exists(xmlFileBackup) )
				System.IO.File.Delete(xmlFileBackup);

			if( System.IO.File.Exists( xmlFile ) )
			{
				System.IO.File.Move(xmlFile, xmlFileBackup);
			}

			DataSet ds = new DataSet();
			ds.ReadXmlSchema( xmlSchema );
			DataRow bountyRow, OwnerRow, WantedRow, requestedRow, acceptedRow;
            try
            {
                var entries = new BountyBoardEntry[m_Entries.Count];
                m_Entries.CopyTo(entries);

                foreach (BountyBoardEntry entry in m_Entries)
                {
                    if (entry == null)
                        continue;

                    if (entry.Owner == null || entry.Owner.Deleted)
                        continue;

                    if (entry.Wanted == null || entry.Wanted.Deleted)
                    {
                        BountyBoard.RemoveEntry(entry, true);
                        continue;
                    }

                    bountyRow = ds.Tables["Bounty"].NewRow();
                    bountyRow["Price"] = entry.Price;
                    bountyRow["ExpireTime"] = entry.ExpireTime;
                    ds.Tables["Bounty"].Rows.Add(bountyRow);

                    OwnerRow = ds.Tables["Owner"].NewRow();
                    OwnerRow["Name"] = entry.Owner.Name;
                    OwnerRow["Serial"] = entry.Owner.Serial.Value;
                    OwnerRow.SetParentRow(bountyRow, ds.Relations["Bounty_Owner"]);
                    ds.Tables["Owner"].Rows.Add(OwnerRow);

                    WantedRow = ds.Tables["Wanted"].NewRow();
                    WantedRow["Name"] = entry.Wanted.Name;
                    WantedRow["Serial"] = entry.Wanted.Serial.Value;
                    WantedRow.SetParentRow(bountyRow, ds.Relations["Bounty_Wanted"]);
                    ds.Tables["Wanted"].Rows.Add(WantedRow);

                    foreach (Mobile requested in entry.Requested)
                    {
                        if (requested == null || requested.Deleted)
                            continue;

                        requestedRow = ds.Tables["Requested"].NewRow();
                        requestedRow["Name"] = requested.Name;
                        requestedRow["Serial"] = requested.Serial.Value;
                        requestedRow.SetParentRow(bountyRow, ds.Relations["Bounty_Requested"]);
                        ds.Tables["Requested"].Rows.Add(requestedRow);
                    }

                    foreach (Mobile accepted in entry.Accepted)
                    {
                        if (accepted == null || accepted.Deleted)
                            continue;

                        acceptedRow = ds.Tables["Accepted"].NewRow();
                        acceptedRow["Name"] = accepted.Name;
                        acceptedRow["Serial"] = accepted.Serial.Value;
                        acceptedRow.SetParentRow(bountyRow, ds.Relations["Bounty_Accepted"]);
                        ds.Tables["Accepted"].Rows.Add(acceptedRow);
                    }

                    ds.WriteXml(xmlFile);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
		}
 private static void OnShardSave(WorldSaveEventArgs e)
 {
     CustomSave();
 }
Beispiel #25
0
        public static void EventSink_Save(WorldSaveEventArgs args)
        {
            ConsoleColor col = Console.ForegroundColor;

            Console.ForegroundColor = ConsoleColor.DarkGreen;

            Console.WriteLine();
            Console.Write("Level System: Saving... ");
            Setup    set   = new Setup();
            DateTime Start = DateTime.Now;

            if (!Directory.Exists(FilePath))
            {
                Directory.CreateDirectory(FilePath);
            }

            if (File.Exists(FilePath + FileName))
            {
                File.Delete(FilePath + FileName);
            }

            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent      = true;
            settings.IndentChars = "	";

            XmlWriter writer = XmlWriter.Create(FilePath + FileName, settings);

            writer.WriteStartElement("Info");

            string ID;

            foreach (Mobile mob in World.Mobiles.Values)
            {
                if (mob is PlayerMobile)
                {
                    PlayerMobile pm = mob as PlayerMobile;

                    if (PlayerInfo.ContainsKey(Convert.ToInt32(pm.Serial)))
                    {
                        InfoList info = PlayerInfo[Convert.ToInt32(pm.Serial)];

                        ID = Convert.ToString(Convert.ToInt32(pm.Serial));
                        writer.WriteStartElement("ID");
                        writer.WriteStartAttribute("", "Serial", "");
                        writer.WriteString(ID);
                        writer.WriteEndAttribute();

                        if (info.Level > pm.Level && pm.Level == 0 || info.KillExp > pm.KillExp && pm.KillExp == 0)
                        {   //Login-Save-Restart-No Login-Save Saftey
                            SystemInfo.SaveValue("Level", info.Level, 0, writer);
                            SystemInfo.SaveValue("LevelCap", info.LevelCap, 0, writer);
                            SystemInfo.SaveValue("KillExp", info.KillExp, 1, writer);
                            SystemInfo.SaveValue("AccKillExp", info.AccKillExp, 1, writer);
                            SystemInfo.SaveValue("LevelAt", info.LevelAt, 0, writer);
                            SystemInfo.SaveValue("AccLevelAt", info.LevelAt, 0, writer);
                        }
                        else
                        {
                            SystemInfo.SaveValue("Level", pm.Level, 0, writer);
                            SystemInfo.SaveValue("LevelCap", pm.LevelCap, 0, writer);
                            SystemInfo.SaveValue("KillExp", pm.KillExp, 1, writer);
                            SystemInfo.SaveValue("AccKillExp", pm.AccKillExp, 1, writer);
                            SystemInfo.SaveValue("LevelAt", pm.LevelAt, 0, writer);
                            SystemInfo.SaveValue("AccLevelAt", pm.LevelAt, 0, writer);
                        }

                        writer.WriteEndElement();
                    }
                }
            }

            writer.WriteEndElement();
            writer.Close();

            if (set.TimeSave)
            {
                Console.WriteLine("Done! ({0:F1} seconds)", (DateTime.Now - Start).TotalSeconds);
            }
            else
            {
                Console.WriteLine("Done!");
            }

            Console.ForegroundColor = col;
            LoadPlayers(true);
        }
Beispiel #26
0
        public static void Save(WorldSaveEventArgs e)
        {
            if (XmlAttach.MobileAttachments == null && XmlAttach.ItemAttachments == null) return;

            CleanUp();

            if (!Directory.Exists("Saves/Attachments"))
                Directory.CreateDirectory("Saves/Attachments");

            string filePath = Path.Combine("Saves/Attachments", "Attachments.bin");        // the attachment serializations
            string imaPath = Path.Combine("Saves/Attachments", "Attachments.ima");         // the item/mob attachment tables
            string fpiPath = Path.Combine("Saves/Attachments", "Attachments.fpi");        // the file position indices

            BinaryFileWriter writer = null;
            BinaryFileWriter imawriter = null;
            BinaryFileWriter fpiwriter = null;

            try
            {
                writer = new BinaryFileWriter(filePath, true);
                imawriter = new BinaryFileWriter(imaPath, true);
                fpiwriter = new BinaryFileWriter(fpiPath, true);

            }
            catch (Exception err)
            {
                ErrorReporter.GenerateErrorReport(err.ToString());
                return;
            }

            if (writer != null && imawriter != null && fpiwriter != null)
            {
                // save the current global attachment serial state
                ASerial.GlobalSerialize(writer);

                // remove all deleted attachments
                XmlAttach.FullDefrag();

                // save the attachments themselves
                if (XmlAttach.AllAttachments != null)
                {
                    writer.Write(XmlAttach.AllAttachments.Count);

                    object[] valuearray = new object[XmlAttach.AllAttachments.Count];
                    XmlAttach.AllAttachments.Values.CopyTo(valuearray, 0);

                    object[] keyarray = new object[XmlAttach.AllAttachments.Count];
                    XmlAttach.AllAttachments.Keys.CopyTo(keyarray, 0);

                    for (int i = 0; i < keyarray.Length; i++)
                    {
                        // write the key
                        writer.Write((int)keyarray[i]);

                        XmlAttachment a = valuearray[i] as XmlAttachment;

                        // write the value type
                        writer.Write((string)a.GetType().ToString());

                        // serialize the attachment itself
                        a.Serialize(writer);

                        // save the fileposition index
                        fpiwriter.Write((long)writer.Position);
                    }
                }
                else
                {
                    writer.Write((int)0);
                }

                writer.Close();

                // save the hash table info for items and mobiles
                // mobile attachments
                if (XmlAttach.MobileAttachments != null)
                {
                    imawriter.Write(XmlAttach.MobileAttachments.Count);

                    object[] valuearray = new object[XmlAttach.MobileAttachments.Count];
                    XmlAttach.MobileAttachments.Values.CopyTo(valuearray, 0);

                    object[] keyarray = new object[XmlAttach.MobileAttachments.Count];
                    XmlAttach.MobileAttachments.Keys.CopyTo(keyarray, 0);

                    for (int i = 0; i < keyarray.Length; i++)
                    {
                        // write the key
                        imawriter.Write((Mobile)keyarray[i]);

                        // write out the attachments
                        ArrayList alist = (ArrayList)valuearray[i];

                        imawriter.Write((int)alist.Count);
                        foreach (XmlAttachment a in alist)
                        {
                            // write the attachment serial
                            imawriter.Write((int)a.Serial.Value);

                            // write the value type
                            imawriter.Write((string)a.GetType().ToString());

                            // save the fileposition index
                            fpiwriter.Write((long)imawriter.Position);
                        }
                    }
                }
                else
                {
                    // no mobile attachments
                    imawriter.Write((int)0);
                }

                // item attachments
                if (XmlAttach.ItemAttachments != null)
                {
                    imawriter.Write(XmlAttach.ItemAttachments.Count);

                    object[] valuearray = new object[XmlAttach.ItemAttachments.Count];
                    XmlAttach.ItemAttachments.Values.CopyTo(valuearray, 0);

                    object[] keyarray = new object[XmlAttach.ItemAttachments.Count];
                    XmlAttach.ItemAttachments.Keys.CopyTo(keyarray, 0);

                    for (int i = 0; i < keyarray.Length; i++)
                    {
                        // write the key
                        imawriter.Write((Item)keyarray[i]);

                        // write out the attachments			             
                        ArrayList alist = (ArrayList)valuearray[i];

                        imawriter.Write((int)alist.Count);
                        foreach (XmlAttachment a in alist)
                        {
                            // write the attachment serial
                            imawriter.Write((int)a.Serial.Value);

                            // write the value type
                            imawriter.Write((string)a.GetType().ToString());

                            // save the fileposition index
                            fpiwriter.Write((long)imawriter.Position);
                        }
                    }
                }
                else
                {
                    // no item attachments
                    imawriter.Write((int)0);
                }

                imawriter.Close();
                fpiwriter.Close();
            }
        }
        public static void Save(WorldSaveEventArgs e)
        {
            if (!Directory.Exists("LokaiSaves/LokaiSkills"))
            {
                Directory.CreateDirectory("LokaiSaves/LokaiSkills");
            }
            string           filePath = Path.Combine("LokaiSaves/LokaiSkills", "LokaiSkills.bin");
            BinaryFileWriter writer   = null;

            try
            {
                if (File.Exists(filePath))
                {
                    File.Delete(filePath);
                }
                Console.WriteLine(".bin file successfully deleted.");
            }
            catch (Exception err)
            {
                Console.WriteLine("Unable to delete the BinaryFileWriter so exiting SAVE process.");
                Console.WriteLine(err.ToString());
                return;
            }
            try
            {
                writer = new BinaryFileWriter(filePath, true);
            }
            catch
            {
                Console.WriteLine("Unable to create new BinaryFileWriter so exiting SAVE process.");
                return;
            }
            writer.WriteEncodedInt((int)0); //version

            writer.WriteEncodedInt((int)m_LinguisticsLevel);
            writer.Write(m_CommerceEnabled);
            writer.Write(m_RidingChecksEnabled);
            writer.Write(m_SailingChecksEnabled);
            writer.Write(m_LinguisticsEnabled);

            writer.Write(ShowButchering);
            writer.Write(ShowSkinning);
            writer.Write(ShowAnimalRiding);
            writer.Write(ShowSailing);
            writer.Write(ShowDetectEvil);
            writer.Write(ShowCureDisease);
            writer.Write(ShowPickPocket);
            writer.Write(ShowPilfering);
            writer.Write(ShowFraming);
            writer.Write(ShowBrickLaying);
            writer.Write(ShowRoofing);
            writer.Write(ShowStoneMasonry);
            writer.Write(ShowVentriloquism);
            writer.Write(ShowHypnotism);
            writer.Write(ShowPreyTracking);
            writer.Write(ShowSpeakToAnimals);
            writer.Write(ShowWoodworking);
            writer.Write(ShowCooperage);
            writer.Write(ShowSpinning);
            writer.Write(ShowWeaving);
            writer.Write(ShowConstruction);
            writer.Write(ShowCommerce);
            writer.Write(ShowBrewing);
            writer.Write(ShowHerblore);
            writer.Write(ShowTreePicking);
            writer.Write(ShowTreeSapping);
            writer.Write(ShowTreeCarving);
            writer.Write(ShowTreeDigging);
            writer.Write(ShowTeaching);
            writer.Write(ShowLinguistics);
            writer.Close();
            Console.WriteLine("All LokaiSkill values successfully written to .bin file. File closed.");
        }
		private static void EventSink_WorldSave( WorldSaveEventArgs e )
		{
			Save();
		}
Beispiel #29
0
 private static void EventSink_WorldSave( WorldSaveEventArgs e )
 {
     m_Types.Clear();
 }
Beispiel #30
0
        public static void OnSave(WorldSaveEventArgs e)
        {
            Console.WriteLine("CoreAI Saving...");
            if (!Directory.Exists("Saves/AngelIsland"))
            {
                Directory.CreateDirectory("Saves/AngelIsland");
            }

            string filePath = Path.Combine("Saves/AngelIsland", "CoreAI.xml");

            using (StreamWriter op = new StreamWriter(filePath))
            {
                XmlTextWriter xml = new XmlTextWriter(op);

                xml.Formatting  = Formatting.Indented;
                xml.IndentChar  = '\t';
                xml.Indentation = 1;

                xml.WriteStartDocument(true);

                xml.WriteStartElement("CoreAI");

                xml.WriteStartElement("StingerMinHP");
                xml.WriteString(StingerMinHP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("StingerMaxHP");
                xml.WriteString(StingerMaxHP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("StingerMinDamage");
                xml.WriteString(StingerMinDamage.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("StingerMaxDamage");
                xml.WriteString(StingerMaxDamage.ToString());
                xml.WriteEndElement();

                //				xml.WriteStartElement( "CellGuardSpawnFreq" );
                //				xml.WriteString( CellGuardSpawnFreq.ToString() );
                //				xml.WriteEndElement();

                xml.WriteStartElement("CellGuardStrength");
                xml.WriteString(CellGuardStrength.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CellGuardSkillLevel");
                xml.WriteString(CellGuardSkillLevel.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CellGuardNumRegDrop");
                xml.WriteString(CellGuardNumRegDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("GuardSpawnRestartDelay");
                xml.WriteString(GuardSpawnRestartDelay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("GuardSpawnExpireDelay");
                xml.WriteString(GuardSpawnExpireDelay.ToString());
                xml.WriteEndElement();

                //				xml.WriteStartElement( "PostGuardSpawnFreq" );
                //				xml.WriteString( PostGuardSpawnFreq.ToString() );
                //				xml.WriteEndElement();

                xml.WriteStartElement("PostGuardStrength");
                xml.WriteString(PostGuardStrength.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("PostGuardSkillLevel");
                xml.WriteString(PostGuardSkillLevel.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("PostGuardNumRegDrop");
                xml.WriteString(PostGuardNumRegDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("PostGuardNumBandiesDrop");
                xml.WriteString(PostGuardNumBandiesDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("PostGuardNumGHPotDrop");
                xml.WriteString(PostGuardNumGHPotDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardStrength");
                xml.WriteString(CaptainGuardStrength.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardSkillLevel");
                xml.WriteString(CaptainGuardSkillLevel.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardWeapDrop");
                xml.WriteString(CaptainGuardWeapDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardNumRegDrop");
                xml.WriteString(CaptainGuardNumRegDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardNumBandiesDrop");
                xml.WriteString(CaptainGuardNumBandiesDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardGHPotsDrop");
                xml.WriteString(CaptainGuardGHPotsDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardScrollDrop");
                xml.WriteString(CaptainGuardScrollDrop.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CaptainGuardNumLighthousePasses");
                xml.WriteString(CaptainGuardNumLighthousePasses.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CavePortalAvailability");
                xml.WriteString(CavePortalAvailability.ToString());
                xml.WriteEndElement();

                //				xml.WriteStartElement( "CaptainGuardLeatherSets" );
                //				xml.WriteString( CaptainGuardLeatherSets.ToString() );
                //				xml.WriteEndElement();
                //
                //				xml.WriteStartElement( "CaptainGuardRingSets" );
                //				xml.WriteString( CaptainGuardRingSets.ToString() );
                //				xml.WriteEndElement();

                //				xml.WriteStartElement( "SpiritRespawnFreq" );
                //				xml.WriteString( SpiritRespawnFreq.ToString() );
                //				xml.WriteEndElement();

                xml.WriteStartElement("SpiritRestartDelay");
                xml.WriteString(SpiritRestartDelay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritExpireDelay");
                xml.WriteString(SpiritExpireDelay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritPortalAvailablity");
                xml.WriteString(SpiritPortalAvailablity.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritFirstWaveNumber");
                xml.WriteString(SpiritFirstWaveNumber.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritFirstWaveHP");
                xml.WriteString(SpiritFirstWaveHP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritSecondWaveNumber");
                xml.WriteString(SpiritSecondWaveNumber.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritSecondWaveHP");
                xml.WriteString(SpiritSecondWaveHP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritThirdWaveNumber");
                xml.WriteString(SpiritThirdWaveNumber.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritThirdWaveHP");
                xml.WriteString(SpiritThirdWaveHP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritBossHP");
                xml.WriteString(SpiritBossHP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritDepotGHPots");
                xml.WriteString(SpiritDepotGHPots.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritDepotBandies");
                xml.WriteString(SpiritDepotBandies.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritDepotReagents");
                xml.WriteString(SpiritDepotReagents.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritDepotRespawnFreq");
                xml.WriteString(SpiritDepotRespawnFreq.ToString());
                xml.WriteEndElement();

                // GSGG values
                xml.WriteStartElement("GSGGTime");
                xml.WriteString(Server.Mobiles.PlayerMobile.GSGG.ToString());
                xml.WriteEndElement();

                // PowderOfTranslocation availability
                xml.WriteStartElement("PowderOfTranslocationAvail");
                xml.WriteString(PowderOfTranslocationAvail.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("DynamicFeatures");
                xml.WriteString(DynamicFeatures.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritDepotTRPots");
                xml.WriteString(SpiritDepotTRPots.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritFirstWaveVirtualArmor");
                xml.WriteString(SpiritFirstWaveVirtualArmor.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritSecondWaveVirtualArmor");
                xml.WriteString(SpiritSecondWaveVirtualArmor.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritThirdWaveVirtualArmor");
                xml.WriteString(SpiritThirdWaveVirtualArmor.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("SpiritBossVirtualArmor");
                xml.WriteString(SpiritBossVirtualArmor.ToString());
                xml.WriteEndElement();

                // Treasure Map Drop Rate
                xml.WriteStartElement("TreasureMapDrop");
                xml.WriteString(TreasureMapDrop.ToString());
                xml.WriteEndElement();

                // temp var used for system tuning
                xml.WriteStartElement("TempDouble");
                xml.WriteString(TempDouble.ToString());
                xml.WriteEndElement();

                // temp var used for system tuning
                xml.WriteStartElement("TempInt");
                xml.WriteString(TempInt.ToString());
                xml.WriteEndElement();

                // purple potion explosion factors
                xml.WriteStartElement("ExplPotSensitivity");
                xml.WriteString(ExplosionPotionSensitivityLevel.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("ExplPotChance");
                xml.WriteString(ExplosionPotionChance.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("OfflineShortsHours");
                xml.WriteString(OfflineShortsDecayHours.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("OfflineShortsDecay");
                xml.WriteString(OfflineShortsDecay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("ExplosionPotionTargetMethod");
                xml.WriteString(((int)ExplosionPotionTargetMethod).ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("ExplosionPotionThreshold");
                xml.WriteString(ExplosionPotionThreshold.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("TownCrierWordMinuteCost");
                xml.WriteString(TownCrierWordMinuteCost.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CohesionBaseDelay");
                xml.WriteString(CohesionBaseDelay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CohesionLowerDelay");
                xml.WriteString(CohesionLowerDelay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CohesionFactor");
                xml.WriteString(CohesionFactor.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("EScrollChance");
                xml.WriteString(EScrollChance.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("EScrollSuccess");
                xml.WriteString(EScrollSuccess.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("IDOCBroadcastChance");
                xml.WriteString(IDOCBroadcastChance.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("ReaggressIgnoreChance");
                xml.WriteString(ReaggressIgnoreChance.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("ConfusionBaseDelay");
                xml.WriteString(ReaggressIgnoreChance.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("WorldSaveFrequency");
                xml.WriteString(WorldSaveFrequency.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("DebugItemDecayOutput");
                xml.WriteString(DebugItemDecayOutput ? "1" : "0");
                xml.WriteEndElement();

                xml.WriteStartElement("TCAcctCleanupDays");
                xml.WriteString(TCAcctCleanupDays.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("StandingDelay");
                xml.WriteString(StandingDelay.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("PlayAccessLevel");
                xml.WriteString(((int)PlayAccessLevel).ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("TCAcctCleanupEnable");
                xml.WriteString(TCAcctCleanupEnable ? "1" : "0");
                xml.WriteEndElement();

                xml.WriteStartElement("RangedCorrosionModifier");
                xml.WriteString(RangedCorrosionModifier.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("GWRChangeDelayMinutes");
                xml.WriteString(GWRChangeDelayMinutes.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("GracePeriod");
                xml.WriteString(GracePeriod.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("ConnectionFloor");
                xml.WriteString(ConnectionFloor.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("MaxAccountsPerIP");
                xml.WriteString(MaxAccountsPerIP.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("MaxAddresses");
                xml.WriteString(MaxAddresses.ToString());
                xml.WriteEndElement();

                // Slayer Weapon drop rate
                xml.WriteStartElement("SlayerWeaponDropRate");
                xml.WriteString(SlayerWeaponDropRate.ToString());
                xml.WriteEndElement();

                xml.WriteStartElement("CurrentWorldSize");
                xml.WriteString(((int)CurrentWorldSize).ToString());
                xml.WriteEndElement();

                xml.WriteEndElement();
                xml.Close();
            }
        }
        public static void OnSave( WorldSaveEventArgs e )
        {
            if( !Directory.Exists( SAVE_PATH ) )
            {
                Directory.CreateDirectory( SAVE_PATH );
            }

            GenericWriter writer = new BinaryFileWriter( Path.Combine( SAVE_PATH, FILENAME ), true );

            writer.Write( 0 );

            writer.Write( GameData.Count );

            foreach( BoardGameData data in GameData )
            {
                data.Serialize( writer );
            }

            writer.Close();
        }
Beispiel #32
0
		public static void EventSink_WorldSave( WorldSaveEventArgs e )
		{
			BackupSaves();
		}
Beispiel #33
0
		private static void OnSave( WorldSaveEventArgs e )
		{
			Console.WriteLine( "Rewards Saving..." );

			try
			{
				WriteXml( e );
			}
			catch( Exception ex )
			{
				LogHelper.LogException(ex);
				Console.WriteLine( "Error Saving Rewards." );
				Console.WriteLine( "Exception Message :  {0}", ex.ToString() );
				Console.WriteLine( "Rewards system has been disabled." );
				Enabled = false;
			}
		}
Beispiel #34
0
		public static void Save( WorldSaveEventArgs args )
		{
			if( !Directory.Exists( "Saves/ACC" ) )
				Directory.CreateDirectory( "Saves/ACC" );

			string filename = "acc.sav";
			string path =@"Saves/ACC/";
			string pathNfile = path+filename;
			DateTime start = DateTime.Now;

			Console.WriteLine();
			Console.WriteLine();
			Console.WriteLine( "----------" );
			Console.WriteLine( "Saving ACC..." );

			try
			{
				using( FileStream m_FileStream = new FileStream( pathNfile, FileMode.OpenOrCreate, FileAccess.Write ) )
				{
					BinaryFileWriter writer = new BinaryFileWriter( m_FileStream, true );

					writer.Write( (int) m_RegSystems.Count );
					foreach( DictionaryEntry de in m_RegSystems )
					{
						Type t = ScriptCompiler.FindTypeByFullName( (string)de.Key );
						if( t != null )
						{
							writer.Write( (string)de.Key );
							writer.Write( (bool)de.Value );

							if( (bool)m_RegSystems[(string)de.Key] )
							{
								ACCSystem system = (ACCSystem)Activator.CreateInstance( t );
								if( system != null )
									system.StartSave( path );
							}
						}

					}

					writer.Close();
					m_FileStream.Close();
				}

				Console.WriteLine( "Done in {0:F1} seconds.", (DateTime.Now-start).TotalSeconds );
				Console.WriteLine( "----------" );
				Console.WriteLine();
			}
			catch( Exception err )
			{
				Console.WriteLine( "Failed. Exception: "+err );
			}
		}
        private static void EventSink_WorldSave( WorldSaveEventArgs e )
        {
            DateTime start = DateTime.Now;
            Console.WriteLine( "processing additional components." );
            Console.WriteLine( "Forums: Saving..." );

            if( AutoCleanup )
                Console.Write( "Auto Cleanup is checking posts..." );
            else
                Console.Write( "Checking deletion queue..." );

            int queue = 0;
            int deleted = RemovedDeletedQueue(out queue);

            if( queue == 0 )
                Console.Write( "Empty Queue..." );
            else
                Console.Write( "{1} Queued...{0} Deleted...", deleted, queue );
            
            string SavePath = Path.Combine( m_SavePath, "forumdata.sig" );

            if( !Directory.Exists( m_SavePath ) )
                Directory.CreateDirectory( m_SavePath );

            GenericWriter bin = new BinaryFileWriter( SavePath, true );
            
            try
            {
                bin.Write( ( int )0 );//Versioning

                WritePlayerStatistics( bin );
            
                bin.Write( ( int )( m_Threads.Count ) );
                foreach( ThreadEntry te in m_Threads )
                {
                    te.Serialize( bin );
                }

                bin.WriteMobileList( m_Moderators );
                bin.Write( ( int )m_ThreadDeleteAccessLevel );
                bin.Write( ( int )m_ThreadLockAccesLevel );
                bin.Write( ( bool )m_AutoCleanup );
                bin.Write( ( int )m_AutoCleanupDays );
                bin.Write( ( int )m_MinPostCharactersCount );
                bin.Write( ( int )m_MaxPostCharactersCount );
                bin.Close();
                
                DateTime end = DateTime.Now;
                Console.WriteLine( "done in {0:F1} seconds.", ( end - start ).TotalSeconds );
                Console.Write( "World: " );
            }
            catch( Exception err )
            {
                bin.Close();

                Console.Write( "An error occurred while trying to save the forums. {0}", err.ToString());
            }
        }        
Beispiel #36
0
		private static void EventSink_WorldSave( WorldSaveEventArgs args)
		{
			GrowAll();
		}
Beispiel #37
0
 public static void InvokeWorldSave(WorldSaveEventArgs e)
 {
     WorldSave?.Invoke(e);
 }