fix: Fixes regions having the wrong type (#1260)
## Possible Breaking Change * Reverted regions.json back to RunUO until newer regions are implemented and proper expansion checks are added. ### Other Changes - [X] Adds `Region.IsPartOf<T1, T2>()` to check for multiple types. - [X] Fixes regions.json being wrong - [X] Adds lots of missing regions. **They are not implemented properly yet** - [X] Adds regions.xml -> regions.json (check ModernUO Discord) - [X] Adds expansion specific regions.
This commit is contained in:
parent
f9c72a62df
commit
1f778cfacf
38 changed files with 3424 additions and 2949 deletions
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests;
|
||||
|
||||
public class CancelQuestRegion : BaseRegion
|
||||
{
|
||||
public CancelQuestRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
|
||||
{
|
||||
}
|
||||
|
||||
public CancelQuestRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
|
||||
{
|
||||
}
|
||||
|
||||
public Type Quest { get; set; }
|
||||
|
||||
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 (Quest == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == Quest)
|
||||
{
|
||||
if (!player.HasGump<QuestCancelGump>())
|
||||
{
|
||||
player.Quest.BeginCancelQuest();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests;
|
||||
|
||||
public class QuestCompleteObjectiveRegion : BaseRegion
|
||||
{
|
||||
public QuestCompleteObjectiveRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestCompleteObjectiveRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
|
||||
{
|
||||
}
|
||||
|
||||
public Type Quest { get; set; }
|
||||
public Type Objective { get; set; }
|
||||
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
base.OnEnter(m);
|
||||
|
||||
if (Quest != null && Objective != null)
|
||||
{
|
||||
if (m is PlayerMobile player && player?.Quest != null && player.Quest.GetType() == Quest)
|
||||
{
|
||||
QuestObjective obj = player.Quest.FindObjective(Objective);
|
||||
|
||||
if (obj is { Completed: false })
|
||||
{
|
||||
obj.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Quests;
|
||||
|
||||
public class QuestNoEntryRegion : BaseRegion
|
||||
{
|
||||
public Type Quest { get; set; }
|
||||
|
||||
public Type MinObjective { get; set; }
|
||||
|
||||
public Type MaxObjective { get; set; }
|
||||
|
||||
public int Message { get; set; }
|
||||
|
||||
public QuestNoEntryRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestNoEntryRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
|
||||
{
|
||||
}
|
||||
|
||||
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 { Controlled: false, Summoned: false })
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Quest == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m is PlayerMobile player && player.Quest != null && player.Quest.GetType() == Quest
|
||||
&& (MinObjective == null || player.Quest.FindObjective(MinObjective) != null)
|
||||
&& (MaxObjective == null || player.Quest.FindObjective(MaxObjective) == null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Message != 0)
|
||||
{
|
||||
m.SendLocalizedMessage(Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
using Server;
|
||||
using Server.Logging;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Engines.Quests;
|
||||
|
||||
public class QuestOfferRegion : BaseRegion
|
||||
{
|
||||
private static readonly ILogger logger = LogFactory.GetLogger(typeof(QuestOfferRegion));
|
||||
|
||||
public QuestOfferRegion(string name, Map map, Region parent, int priority, params Rectangle3D[] area) : base(name, map, parent, priority, area)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestOfferRegion(string name, Map map, Region parent, params Rectangle3D[] area) : base(name, map, parent, area)
|
||||
{
|
||||
}
|
||||
|
||||
public Type Quest { get; set; }
|
||||
|
||||
public override void OnEnter(Mobile m)
|
||||
{
|
||||
base.OnEnter(m);
|
||||
|
||||
if (Quest == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m is PlayerMobile player && player.Quest == null && QuestSystem.CanOfferQuest(m, Quest))
|
||||
{
|
||||
try
|
||||
{
|
||||
QuestSystem qs = Quest.CreateInstance<QuestSystem>(player);
|
||||
qs.SendOffer();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, "Error creating quest {Quest}", Quest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue