本文整理汇总了C#中Server.WorldSaveEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# WorldSaveEventArgs类的具体用法?C# WorldSaveEventArgs怎么用?C# WorldSaveEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldSaveEventArgs类属于Server命名空间,在下文中一共展示了WorldSaveEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSave
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");
}
}
示例2: OnSave
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);
});
}
示例3: World_Save
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;
}
}
示例4: OnSave
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;
}
}
示例5: OnSave
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);
}
}
示例6: OnSave
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);
}
});
}
示例7: OnSave
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);
}
};
});
}
示例8: OnSave
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" ); } }
示例9: event_worldSave
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();
}
}
示例10: OnSave
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();
}
示例11: Event_WorldSave
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."); }
}
示例12: EventSink_WorldSave
private static void EventSink_WorldSave( WorldSaveEventArgs e )
{
Save();
}
示例13: EventSink_WorldSave
private static void EventSink_WorldSave(WorldSaveEventArgs e)
{
// Args: bool e.Message
SR_Save.WriteData();
}
示例14: Save
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
//.........这里部分代码省略.........
示例15: OnShardSave
private static void OnShardSave(WorldSaveEventArgs e)
{
CustomSave();
}