### Summary - Adds some more checks in case a corpse's owner is somehow null. Would like to eventually allow null owner corpses, but more work is needed. - Cleans up variable unboxing and reassignment in quests. Also flattens quest logic. Still more work needs to be done. - Codegens more quest items/mobiles.
37 lines
1,017 B
C#
37 lines
1,017 B
C#
using System;
|
|
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)
|
|
{
|
|
var obj = player.Quest.FindObjective(Objective);
|
|
|
|
if (obj is { Completed: false })
|
|
{
|
|
obj.Complete();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|