Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -1,63 +1,63 @@
namespace Server.Engines.MLQuests
{
public class MLQuestPersistence : Item
{
private static MLQuestPersistence m_Instance;
public class MLQuestPersistence : Item
{
private static MLQuestPersistence m_Instance;
public static void EnsureExistence()
{
if ( m_Instance == null )
m_Instance = new MLQuestPersistence();
}
private MLQuestPersistence()
: base(1)
{
Movable = false;
}
public override string DefaultName => "ML quests persistence - Internal";
public MLQuestPersistence(Serial serial) : base(serial)
{
m_Instance = this;
}
private MLQuestPersistence()
: base( 1 )
{
Movable = false;
}
public override string DefaultName => "ML quests persistence - Internal";
public MLQuestPersistence( Serial serial ) : base( serial )
{
m_Instance = this;
}
public static void EnsureExistence()
{
if (m_Instance == null)
m_Instance = new MLQuestPersistence();
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 2 ); // version
writer.Write( MLQuestSystem.Contexts.Count );
writer.Write(2); // version
writer.Write(MLQuestSystem.Contexts.Count);
foreach ( MLQuestContext context in MLQuestSystem.Contexts.Values )
context.Serialize( writer );
foreach (MLQuestContext context in MLQuestSystem.Contexts.Values)
context.Serialize(writer);
writer.Write( MLQuestSystem.Quests.Count );
writer.Write(MLQuestSystem.Quests.Count);
foreach ( MLQuest quest in MLQuestSystem.Quests.Values )
MLQuest.Serialize( writer, quest );
}
foreach (MLQuest quest in MLQuestSystem.Quests.Values)
MLQuest.Serialize(writer, quest);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
int contexts = reader.ReadInt();
int version = reader.ReadInt();
int contexts = reader.ReadInt();
for ( int i = 0; i < contexts; ++i )
{
MLQuestContext context = new MLQuestContext( reader, version );
for (int i = 0; i < contexts; ++i)
{
MLQuestContext context = new MLQuestContext(reader, version);
if ( context.Owner != null )
MLQuestSystem.Contexts[context.Owner] = context;
}
if (context.Owner != null)
MLQuestSystem.Contexts[context.Owner] = context;
}
int quests = reader.ReadInt();
int quests = reader.ReadInt();
for ( int i = 0; i < quests; ++i )
MLQuest.Deserialize( reader, version );
}
}
}
for (int i = 0; i < quests; ++i)
MLQuest.Deserialize(reader, version);
}
}
}