Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class CancelQuestRegion : BaseRegion
|
||||
{
|
||||
private Type m_Quest;
|
||||
|
||||
public CancelQuestRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
ReadType(xml["quest"], "type", ref m_Quest);
|
||||
}
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
{
|
||||
if (!base.OnMoveInto(m, d, newLocation, oldLocation))
|
||||
return false;
|
||||
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
if (m_Quest == null)
|
||||
return true;
|
||||
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest)
|
||||
{
|
||||
if (!player.HasGump<QuestCancelGump>())
|
||||
player.Quest.BeginCancelQuest();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestCompleteObjectiveRegion : BaseRegion
|
||||
{
|
||||
private Type m_Objective;
|
||||
private Type m_Quest;
|
||||
|
||||
public QuestCompleteObjectiveRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
XmlElement questEl = xml["quest"];
|
||||
|
||||
ReadType(questEl, "type", ref m_Quest);
|
||||
ReadType(questEl, "complete", ref m_Objective);
|
||||
}
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
public Type Objective => m_Objective;
|
||||
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
base.OnEnter(m);
|
||||
|
||||
if (m_Quest != null && m_Objective != null)
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest)
|
||||
{
|
||||
QuestObjective obj = player.Quest.FindObjective(m_Objective);
|
||||
|
||||
if (obj?.Completed == false)
|
||||
obj.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestNoEntryRegion : BaseRegion
|
||||
{
|
||||
private Type m_MaxObjective;
|
||||
private int m_Message;
|
||||
private Type m_MinObjective;
|
||||
private Type m_Quest;
|
||||
|
||||
public QuestNoEntryRegion(XmlElement xml, Map map, Region parent) : base(xml, map, parent)
|
||||
{
|
||||
XmlElement questEl = xml["quest"];
|
||||
|
||||
ReadType(questEl, "type", ref m_Quest);
|
||||
ReadType(questEl, "min", ref m_MinObjective, false);
|
||||
ReadType(questEl, "max", ref m_MaxObjective, false);
|
||||
ReadInt32(questEl, "message", ref m_Message, false);
|
||||
}
|
||||
|
||||
public Type Quest => m_Quest;
|
||||
public Type MinObjective => m_MinObjective;
|
||||
public Type MaxObjective => m_MaxObjective;
|
||||
public int Message => m_Message;
|
||||
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
{
|
||||
if (!base.OnMoveInto(m, d, newLocation, oldLocation))
|
||||
return false;
|
||||
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
if (m is BaseCreature bc && !bc.Controlled && !bc.Summoned)
|
||||
return true;
|
||||
|
||||
if (m_Quest == null)
|
||||
return true;
|
||||
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == m_Quest
|
||||
&& (m_MinObjective == null || player.Quest.FindObjective(m_MinObjective) != null)
|
||||
&& (m_MaxObjective == null || player.Quest.FindObjective(m_MaxObjective) == null))
|
||||
return true;
|
||||
|
||||
if (m_Message != 0)
|
||||
m.SendLocalizedMessage(m_Message);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server.Mobiles;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Engines.Quests
|
||||
{
|
||||
public class QuestOfferRegion : BaseRegion
|
||||
{
|
||||
private Type 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);
|
||||
|
||||
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, player);
|
||||
qs.SendOffer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error creating quest {0}: {1}", m_Quest, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue