Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -5,23 +5,13 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
public class HornOfRetreat : Item
|
||||
{
|
||||
private Point3D m_DestLoc;
|
||||
private Map m_DestMap;
|
||||
private int m_Charges;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D DestLoc
|
||||
{
|
||||
get => m_DestLoc;
|
||||
set => m_DestLoc = value;
|
||||
}
|
||||
public Point3D DestLoc { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map DestMap
|
||||
{
|
||||
get => m_DestMap;
|
||||
set => m_DestMap = value;
|
||||
}
|
||||
public Map DestMap { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Charges
|
||||
|
|
@ -116,8 +106,8 @@ namespace Server.Engines.Quests
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_DestLoc );
|
||||
writer.Write( m_DestMap );
|
||||
writer.Write( DestLoc );
|
||||
writer.Write( DestMap );
|
||||
writer.Write( m_Charges );
|
||||
}
|
||||
|
||||
|
|
@ -131,8 +121,8 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_DestLoc = reader.ReadPoint3D();
|
||||
m_DestMap = reader.ReadMap();
|
||||
DestLoc = reader.ReadPoint3D();
|
||||
DestMap = reader.ReadMap();
|
||||
m_Charges = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,25 +6,14 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
public abstract class QuestConversation
|
||||
{
|
||||
private QuestSystem m_System;
|
||||
private bool m_HasBeenRead;
|
||||
|
||||
public abstract object Message{ get; }
|
||||
|
||||
public virtual QuestItemInfo[] Info => null;
|
||||
public virtual bool Logged => true;
|
||||
|
||||
public QuestSystem System
|
||||
{
|
||||
get => m_System;
|
||||
set => m_System = value;
|
||||
}
|
||||
public QuestSystem System { get; set; }
|
||||
|
||||
public bool HasBeenRead
|
||||
{
|
||||
get => m_HasBeenRead;
|
||||
set => m_HasBeenRead = value;
|
||||
}
|
||||
public bool HasBeenRead { get; set; }
|
||||
|
||||
public QuestConversation()
|
||||
{
|
||||
|
|
@ -38,7 +27,7 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_HasBeenRead = reader.ReadBool();
|
||||
HasBeenRead = reader.ReadBool();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -56,7 +45,7 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_HasBeenRead );
|
||||
writer.Write( (bool) HasBeenRead );
|
||||
|
||||
ChildSerialize( writer );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,25 +4,14 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
public class QuestItemInfo
|
||||
{
|
||||
private object m_Name;
|
||||
private int m_ItemID;
|
||||
public object Name { get; set; }
|
||||
|
||||
public object Name
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
|
||||
public int ItemID
|
||||
{
|
||||
get => m_ItemID;
|
||||
set => m_ItemID = value;
|
||||
}
|
||||
public int ItemID { get; set; }
|
||||
|
||||
public QuestItemInfo( object name, int itemID )
|
||||
{
|
||||
m_Name = name;
|
||||
m_ItemID = itemID;
|
||||
Name = name;
|
||||
ItemID = itemID;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,27 +8,16 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
public abstract class QuestObjective
|
||||
{
|
||||
private QuestSystem m_System;
|
||||
private bool m_HasBeenRead;
|
||||
private int m_CurProgress;
|
||||
private bool m_HasCompleted;
|
||||
|
||||
public abstract object Message{ get; }
|
||||
|
||||
public virtual int MaxProgress => 1;
|
||||
public virtual QuestItemInfo[] Info => null;
|
||||
|
||||
public QuestSystem System
|
||||
{
|
||||
get => m_System;
|
||||
set => m_System = value;
|
||||
}
|
||||
public QuestSystem System { get; set; }
|
||||
|
||||
public bool HasBeenRead
|
||||
{
|
||||
get => m_HasBeenRead;
|
||||
set => m_HasBeenRead = value;
|
||||
}
|
||||
public bool HasBeenRead { get; set; }
|
||||
|
||||
public int CurProgress
|
||||
{
|
||||
|
|
@ -36,11 +25,7 @@ namespace Server.Engines.Quests
|
|||
set{ m_CurProgress = value; CheckCompletionStatus(); }
|
||||
}
|
||||
|
||||
public bool HasCompleted
|
||||
{
|
||||
get => m_HasCompleted;
|
||||
set => m_HasCompleted = value;
|
||||
}
|
||||
public bool HasCompleted { get; set; }
|
||||
|
||||
public virtual bool Completed => m_CurProgress >= MaxProgress;
|
||||
|
||||
|
|
@ -58,13 +43,13 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_HasBeenRead = reader.ReadBool();
|
||||
HasBeenRead = reader.ReadBool();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_CurProgress = reader.ReadEncodedInt();
|
||||
m_HasCompleted = reader.ReadBool();
|
||||
HasCompleted = reader.ReadBool();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -82,9 +67,9 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( (bool) m_HasBeenRead );
|
||||
writer.Write( (bool) HasBeenRead );
|
||||
writer.WriteEncodedInt( (int) m_CurProgress );
|
||||
writer.Write( (bool) m_HasCompleted );
|
||||
writer.Write( (bool) HasCompleted );
|
||||
|
||||
ChildSerialize( writer );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,39 +4,28 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
public class QuestRestartInfo
|
||||
{
|
||||
private Type m_QuestType;
|
||||
private DateTime m_RestartTime;
|
||||
public Type QuestType { get; set; }
|
||||
|
||||
public Type QuestType
|
||||
{
|
||||
get => m_QuestType;
|
||||
set => m_QuestType = value;
|
||||
}
|
||||
|
||||
public DateTime RestartTime
|
||||
{
|
||||
get => m_RestartTime;
|
||||
set => m_RestartTime = value;
|
||||
}
|
||||
public DateTime RestartTime { get; set; }
|
||||
|
||||
public void Reset( TimeSpan restartDelay )
|
||||
{
|
||||
if ( restartDelay < TimeSpan.MaxValue )
|
||||
m_RestartTime = DateTime.UtcNow + restartDelay;
|
||||
RestartTime = DateTime.UtcNow + restartDelay;
|
||||
else
|
||||
m_RestartTime = DateTime.MaxValue;
|
||||
RestartTime = DateTime.MaxValue;
|
||||
}
|
||||
|
||||
public QuestRestartInfo( Type questType, TimeSpan restartDelay )
|
||||
{
|
||||
m_QuestType = questType;
|
||||
QuestType = questType;
|
||||
Reset( restartDelay );
|
||||
}
|
||||
|
||||
public QuestRestartInfo( Type questType, DateTime restartTime )
|
||||
{
|
||||
m_QuestType = questType;
|
||||
m_RestartTime = restartTime;
|
||||
QuestType = questType;
|
||||
RestartTime = restartTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,27 +37,11 @@ namespace Server.Engines.Quests
|
|||
|
||||
public abstract Type[] TypeReferenceTable{ get; }
|
||||
|
||||
private PlayerMobile m_From;
|
||||
private ArrayList m_Objectives;
|
||||
private ArrayList m_Conversations;
|
||||
public PlayerMobile From { get; set; }
|
||||
|
||||
public PlayerMobile From
|
||||
{
|
||||
get => m_From;
|
||||
set => m_From = value;
|
||||
}
|
||||
public ArrayList Objectives { get; set; }
|
||||
|
||||
public ArrayList Objectives
|
||||
{
|
||||
get => m_Objectives;
|
||||
set => m_Objectives = value;
|
||||
}
|
||||
|
||||
public ArrayList Conversations
|
||||
{
|
||||
get => m_Conversations;
|
||||
set => m_Conversations = value;
|
||||
}
|
||||
public ArrayList Conversations { get; set; }
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
|
|
@ -78,9 +62,9 @@ namespace Server.Engines.Quests
|
|||
|
||||
public virtual void Slice()
|
||||
{
|
||||
for ( int i = m_Objectives.Count - 1; i >= 0; --i )
|
||||
for ( int i = Objectives.Count - 1; i >= 0; --i )
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)m_Objectives[i];
|
||||
QuestObjective obj = (QuestObjective)Objectives[i];
|
||||
|
||||
if ( obj.GetTimerEvent() )
|
||||
obj.CheckProgress();
|
||||
|
|
@ -89,9 +73,9 @@ namespace Server.Engines.Quests
|
|||
|
||||
public virtual void OnKill( BaseCreature creature, Container corpse )
|
||||
{
|
||||
for ( int i = m_Objectives.Count - 1; i >= 0; --i )
|
||||
for ( int i = Objectives.Count - 1; i >= 0; --i )
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)m_Objectives[i];
|
||||
QuestObjective obj = (QuestObjective)Objectives[i];
|
||||
|
||||
if ( obj.GetKillEvent( creature, corpse ) )
|
||||
obj.OnKill( creature, corpse );
|
||||
|
|
@ -100,9 +84,9 @@ namespace Server.Engines.Quests
|
|||
|
||||
public virtual bool IgnoreYoungProtection( Mobile from )
|
||||
{
|
||||
for ( int i = m_Objectives.Count - 1; i >= 0; --i )
|
||||
for ( int i = Objectives.Count - 1; i >= 0; --i )
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)m_Objectives[i];
|
||||
QuestObjective obj = (QuestObjective)Objectives[i];
|
||||
|
||||
if ( obj.IgnoreYoungProtection( from ) )
|
||||
return true;
|
||||
|
|
@ -113,9 +97,9 @@ namespace Server.Engines.Quests
|
|||
|
||||
public QuestSystem( PlayerMobile from )
|
||||
{
|
||||
m_From = from;
|
||||
m_Objectives = new ArrayList();
|
||||
m_Conversations = new ArrayList();
|
||||
From = from;
|
||||
Objectives = new ArrayList();
|
||||
Conversations = new ArrayList();
|
||||
}
|
||||
|
||||
public QuestSystem()
|
||||
|
|
@ -134,7 +118,7 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Objectives = new ArrayList( count );
|
||||
Objectives = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
@ -143,13 +127,13 @@ namespace Server.Engines.Quests
|
|||
if ( obj != null )
|
||||
{
|
||||
obj.System = this;
|
||||
m_Objectives.Add( obj );
|
||||
Objectives.Add( obj );
|
||||
}
|
||||
}
|
||||
|
||||
count = reader.ReadEncodedInt();
|
||||
|
||||
m_Conversations = new ArrayList( count );
|
||||
Conversations = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
@ -158,7 +142,7 @@ namespace Server.Engines.Quests
|
|||
if ( conv != null )
|
||||
{
|
||||
conv.System = this;
|
||||
m_Conversations.Add( conv );
|
||||
Conversations.Add( conv );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -180,15 +164,15 @@ namespace Server.Engines.Quests
|
|||
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Objectives.Count );
|
||||
writer.WriteEncodedInt( (int) Objectives.Count );
|
||||
|
||||
for ( int i = 0; i < m_Objectives.Count; ++i )
|
||||
QuestSerializer.Serialize( referenceTable, (QuestObjective) m_Objectives[i], writer );
|
||||
for ( int i = 0; i < Objectives.Count; ++i )
|
||||
QuestSerializer.Serialize( referenceTable, (QuestObjective) Objectives[i], writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Conversations.Count );
|
||||
writer.WriteEncodedInt( (int) Conversations.Count );
|
||||
|
||||
for ( int i = 0; i < m_Conversations.Count; ++i )
|
||||
QuestSerializer.Serialize( referenceTable, (QuestConversation) m_Conversations[i], writer );
|
||||
for ( int i = 0; i < Conversations.Count; ++i )
|
||||
QuestSerializer.Serialize( referenceTable, (QuestConversation) Conversations[i], writer );
|
||||
|
||||
ChildSerialize( writer );
|
||||
}
|
||||
|
|
@ -207,9 +191,9 @@ namespace Server.Engines.Quests
|
|||
|
||||
public QuestObjective FindObjective( Type type )
|
||||
{
|
||||
for ( int i = m_Objectives.Count - 1; i >= 0; --i )
|
||||
for ( int i = Objectives.Count - 1; i >= 0; --i )
|
||||
{
|
||||
QuestObjective obj = (QuestObjective)m_Objectives[i];
|
||||
QuestObjective obj = (QuestObjective)Objectives[i];
|
||||
|
||||
if ( obj.GetType() == type )
|
||||
return obj;
|
||||
|
|
@ -220,15 +204,15 @@ namespace Server.Engines.Quests
|
|||
|
||||
public virtual void SendOffer()
|
||||
{
|
||||
m_From.SendGump( new QuestOfferGump( this ) );
|
||||
From.SendGump( new QuestOfferGump( this ) );
|
||||
}
|
||||
|
||||
public virtual void GetContextMenuEntries( List<ContextMenuEntry> list )
|
||||
{
|
||||
if ( m_Objectives.Count > 0 )
|
||||
if ( Objectives.Count > 0 )
|
||||
list.Add( new QuestCallbackEntry( 6154, ShowQuestLog ) ); // View Quest Log
|
||||
|
||||
if ( m_Conversations.Count > 0 )
|
||||
if ( Conversations.Count > 0 )
|
||||
list.Add( new QuestCallbackEntry( 6156, ShowQuestConversation ) ); // Quest Conversation
|
||||
|
||||
list.Add( new QuestCallbackEntry( 6155, BeginCancelQuest ) ); // Cancel Quest
|
||||
|
|
@ -236,63 +220,63 @@ namespace Server.Engines.Quests
|
|||
|
||||
public virtual void ShowQuestLogUpdated()
|
||||
{
|
||||
m_From.CloseGump( typeof( QuestLogUpdatedGump ) );
|
||||
m_From.SendGump( new QuestLogUpdatedGump( this ) );
|
||||
From.CloseGump( typeof( QuestLogUpdatedGump ) );
|
||||
From.SendGump( new QuestLogUpdatedGump( this ) );
|
||||
}
|
||||
|
||||
public virtual void ShowQuestLog()
|
||||
{
|
||||
if ( m_Objectives.Count > 0 )
|
||||
if ( Objectives.Count > 0 )
|
||||
{
|
||||
m_From.CloseGump( typeof( QuestItemInfoGump ) );
|
||||
m_From.CloseGump( typeof( QuestLogUpdatedGump ) );
|
||||
m_From.CloseGump( typeof( QuestObjectivesGump ) );
|
||||
m_From.CloseGump( typeof( QuestConversationsGump ) );
|
||||
From.CloseGump( typeof( QuestItemInfoGump ) );
|
||||
From.CloseGump( typeof( QuestLogUpdatedGump ) );
|
||||
From.CloseGump( typeof( QuestObjectivesGump ) );
|
||||
From.CloseGump( typeof( QuestConversationsGump ) );
|
||||
|
||||
m_From.SendGump( new QuestObjectivesGump( m_Objectives ) );
|
||||
From.SendGump( new QuestObjectivesGump( Objectives ) );
|
||||
|
||||
QuestObjective last = (QuestObjective)m_Objectives[m_Objectives.Count - 1];
|
||||
QuestObjective last = (QuestObjective)Objectives[Objectives.Count - 1];
|
||||
|
||||
if ( last.Info != null )
|
||||
m_From.SendGump( new QuestItemInfoGump( last.Info ) );
|
||||
From.SendGump( new QuestItemInfoGump( last.Info ) );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ShowQuestConversation()
|
||||
{
|
||||
if ( m_Conversations.Count > 0 )
|
||||
if ( Conversations.Count > 0 )
|
||||
{
|
||||
m_From.CloseGump( typeof( QuestItemInfoGump ) );
|
||||
m_From.CloseGump( typeof( QuestObjectivesGump ) );
|
||||
m_From.CloseGump( typeof( QuestConversationsGump ) );
|
||||
From.CloseGump( typeof( QuestItemInfoGump ) );
|
||||
From.CloseGump( typeof( QuestObjectivesGump ) );
|
||||
From.CloseGump( typeof( QuestConversationsGump ) );
|
||||
|
||||
m_From.SendGump( new QuestConversationsGump( m_Conversations ) );
|
||||
From.SendGump( new QuestConversationsGump( Conversations ) );
|
||||
|
||||
QuestConversation last = (QuestConversation)m_Conversations[m_Conversations.Count - 1];
|
||||
QuestConversation last = (QuestConversation)Conversations[Conversations.Count - 1];
|
||||
|
||||
if ( last.Info != null )
|
||||
m_From.SendGump( new QuestItemInfoGump( last.Info ) );
|
||||
From.SendGump( new QuestItemInfoGump( last.Info ) );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void BeginCancelQuest()
|
||||
{
|
||||
m_From.SendGump( new QuestCancelGump( this ) );
|
||||
From.SendGump( new QuestCancelGump( this ) );
|
||||
}
|
||||
|
||||
public virtual void EndCancelQuest( bool shouldCancel )
|
||||
{
|
||||
if ( m_From.Quest != this )
|
||||
if ( From.Quest != this )
|
||||
return;
|
||||
|
||||
if ( shouldCancel )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1049015 ); // You have canceled your quest.
|
||||
From.SendLocalizedMessage( 1049015 ); // You have canceled your quest.
|
||||
Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1049014 ); // You have chosen not to cancel your quest.
|
||||
From.SendLocalizedMessage( 1049014 ); // You have chosen not to cancel your quest.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -310,18 +294,18 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
StopTimer();
|
||||
|
||||
if ( m_From.Quest == this )
|
||||
if ( From.Quest == this )
|
||||
{
|
||||
m_From.Quest = null;
|
||||
From.Quest = null;
|
||||
|
||||
TimeSpan restartDelay = RestartDelay;
|
||||
|
||||
if ( ( completed && restartDelay > TimeSpan.Zero ) || ( !completed && restartDelay == TimeSpan.MaxValue ) )
|
||||
{
|
||||
List<QuestRestartInfo> doneQuests = m_From.DoneQuests;
|
||||
List<QuestRestartInfo> doneQuests = From.DoneQuests;
|
||||
|
||||
if ( doneQuests == null )
|
||||
m_From.DoneQuests = doneQuests = new List<QuestRestartInfo>();
|
||||
From.DoneQuests = doneQuests = new List<QuestRestartInfo>();
|
||||
|
||||
bool found = false;
|
||||
|
||||
|
|
@ -350,43 +334,43 @@ namespace Server.Engines.Quests
|
|||
conv.System = this;
|
||||
|
||||
if ( conv.Logged )
|
||||
m_Conversations.Add( conv );
|
||||
Conversations.Add( conv );
|
||||
|
||||
m_From.CloseGump( typeof( QuestItemInfoGump ) );
|
||||
m_From.CloseGump( typeof( QuestObjectivesGump ) );
|
||||
m_From.CloseGump( typeof( QuestConversationsGump ) );
|
||||
From.CloseGump( typeof( QuestItemInfoGump ) );
|
||||
From.CloseGump( typeof( QuestObjectivesGump ) );
|
||||
From.CloseGump( typeof( QuestConversationsGump ) );
|
||||
|
||||
if ( conv.Logged )
|
||||
m_From.SendGump( new QuestConversationsGump( m_Conversations ) );
|
||||
From.SendGump( new QuestConversationsGump( Conversations ) );
|
||||
else
|
||||
m_From.SendGump( new QuestConversationsGump( conv ) );
|
||||
From.SendGump( new QuestConversationsGump( conv ) );
|
||||
|
||||
if ( conv.Info != null )
|
||||
m_From.SendGump( new QuestItemInfoGump( conv.Info ) );
|
||||
From.SendGump( new QuestItemInfoGump( conv.Info ) );
|
||||
}
|
||||
|
||||
public virtual void AddObjective( QuestObjective obj )
|
||||
{
|
||||
obj.System = this;
|
||||
m_Objectives.Add( obj );
|
||||
Objectives.Add( obj );
|
||||
|
||||
ShowQuestLogUpdated();
|
||||
}
|
||||
|
||||
public virtual void Accept()
|
||||
{
|
||||
if ( m_From.Quest != null )
|
||||
if ( From.Quest != null )
|
||||
return;
|
||||
|
||||
m_From.Quest = this;
|
||||
m_From.SendLocalizedMessage( 1049019 ); // You have accepted the Quest.
|
||||
From.Quest = this;
|
||||
From.SendLocalizedMessage( 1049019 ); // You have accepted the Quest.
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
public virtual void Decline()
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1049018 ); // You have declined the Quest.
|
||||
From.SendLocalizedMessage( 1049018 ); // You have declined the Quest.
|
||||
}
|
||||
|
||||
public static bool CanOfferQuest( Mobile check, Type questType )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue