73 lines
1.5 KiB
C#
73 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace Server.Engines.MLQuests
|
|
{
|
|
public class QuestArea
|
|
{
|
|
private TextDefinition m_Name; // So we can add custom names, different from the Region name
|
|
private string m_RegionName;
|
|
private Map m_ForceMap;
|
|
|
|
public TextDefinition Name
|
|
{
|
|
get { return m_Name; }
|
|
set { m_Name = value; }
|
|
}
|
|
|
|
public string RegionName
|
|
{
|
|
get { return m_RegionName; }
|
|
set { m_RegionName = value; }
|
|
}
|
|
|
|
public Map ForceMap
|
|
{
|
|
get { return m_ForceMap; }
|
|
set { m_ForceMap = value; }
|
|
}
|
|
|
|
public QuestArea( TextDefinition name, string region )
|
|
: this( name, region, null )
|
|
{
|
|
}
|
|
|
|
public QuestArea( TextDefinition name, string region, Map forceMap )
|
|
{
|
|
m_Name = name;
|
|
m_RegionName = region;
|
|
m_ForceMap = forceMap;
|
|
|
|
if ( MLQuestSystem.Debug )
|
|
{
|
|
bool found = false;
|
|
|
|
foreach ( Region r in Region.Regions )
|
|
{
|
|
if ( r.Name == region && ( forceMap == null || r.Map == forceMap ) )
|
|
{
|
|
found = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ( !found )
|
|
Console.WriteLine( "Warning: QuestArea region '{0}' does not exist (ForceMap = {1})", region, ( forceMap == null ) ? "-null-" : forceMap.ToString() );
|
|
}
|
|
}
|
|
|
|
public bool Contains( Mobile mob )
|
|
{
|
|
return Contains( mob.Region );
|
|
}
|
|
|
|
public bool Contains( Region reg )
|
|
{
|
|
if ( reg == null || ( m_ForceMap != null && reg.Map != m_ForceMap ) )
|
|
return false;
|
|
|
|
return reg.IsPartOf( m_RegionName );
|
|
}
|
|
}
|
|
}
|