ModernUO/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HonorCandle.cs
Kamron Batman e994505ad0
fix: Adds safety to corpses and cleans up quests (#1685)
### 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.
2024-02-18 19:33:08 -08:00

63 lines
1.3 KiB
C#

using System;
using ModernUO.Serialization;
using Server.Items;
using Server.Mobiles;
namespace Server.Engines.Quests.Samurai;
[SerializationGenerator(0)]
public partial class HonorCandle : CandleLong
{
private static readonly TimeSpan LitDuration = TimeSpan.FromSeconds(20.0);
[Constructible]
public HonorCandle()
{
Movable = false;
Duration = LitDuration;
}
public override int LitSound => 0;
public override int UnlitSound => 0;
public override void OnDoubleClick(Mobile from)
{
var wasBurning = Burning;
base.OnDoubleClick(from);
if (!wasBurning && Burning)
{
if (from is not PlayerMobile player)
{
return;
}
var qs = player.Quest;
if (qs is HaochisTrialsQuest)
{
var obj = qs.FindObjective<SixthTrialIntroObjective>();
if (obj?.Completed == false)
{
obj.Complete();
}
SendLocalizedMessageTo(from, 1063251); // You light a candle in honor.
}
}
}
public override void Burn()
{
Douse();
}
public override void Douse()
{
base.Douse();
Duration = LitDuration;
}
}