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,40 +1,38 @@
using System;
using System.Xml;
using Server.Regions;
using Server.Mobiles;
using Server.Regions;
namespace Server.Engines.Quests
{
public class QuestOfferRegion : BaseRegion
{
private Type m_Quest;
public class QuestOfferRegion : BaseRegion
{
private Type m_Quest;
public Type Quest => m_Quest;
public QuestOfferRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
{
ReadType(xml["quest"], "type", ref m_Quest);
}
public QuestOfferRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
{
ReadType( xml["quest"], "type", ref m_Quest );
}
public Type Quest => m_Quest;
public override void OnEnter( Mobile m )
{
base.OnEnter( m );
public override void OnEnter(Mobile m)
{
base.OnEnter(m);
if ( m_Quest == null )
return;
if (m_Quest == null)
return;
if ( m is PlayerMobile player && player.Quest == null && QuestSystem.CanOfferQuest( m, m_Quest ) )
{
try
{
QuestSystem qs = (QuestSystem) Activator.CreateInstance( m_Quest, new object[] { player } );
qs.SendOffer();
}
catch ( Exception ex )
{
Console.WriteLine( "Error creating quest {0}: {1}", m_Quest, ex );
}
}
}
}
}
if (m is PlayerMobile player && player.Quest == null && QuestSystem.CanOfferQuest(m, m_Quest))
try
{
QuestSystem qs = (QuestSystem)Activator.CreateInstance(m_Quest, player);
qs.SendOffer();
}
catch (Exception ex)
{
Console.WriteLine("Error creating quest {0}: {1}", m_Quest, ex);
}
}
}
}