ModernUO/Scripts/Engines/Virtues/Compassion.cs
2018-09-14 08:41:38 -07:00

40 lines
902 B
C#

using System;
using Server.Mobiles;
namespace Server
{
public class CompassionVirtue
{
private static TimeSpan LossDelay = TimeSpan.FromDays( 7.0 );
private const int LossAmount = 500;
public static void Initialize()
{
VirtueGump.Register( 105, new OnVirtueUsed( OnVirtueUsed ) );
}
public static void OnVirtueUsed( Mobile from )
{
from.SendLocalizedMessage( 1053001 ); // This virtue is not activated through the virtue menu.
}
public static void CheckAtrophy( Mobile from )
{
if ( !(from is PlayerMobile pm) )
return;
try
{
if ( (pm.LastCompassionLoss + LossDelay) < DateTime.UtcNow )
{
VirtueHelper.Atrophy( from, VirtueName.Compassion, LossAmount );
//OSI has no cliloc message for losing compassion. Weird.
pm.LastCompassionLoss = DateTime.UtcNow;
}
}
catch
{
}
}
}
}