Cleanup and adds configuration for crashguard (#240)

This commit is contained in:
Kamron Batman 2020-09-12 01:57:07 -07:00 • committed by GitHub
parent 55ae0f8778
commit 7dbfa086bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 1248 additions and 97 deletions

View file

@ -108,36 +108,49 @@ namespace Server
public TextDefinition Args { get; }
public static void Initialize()
public static void Configure()
{
Enabled = ServerConfiguration.GetOrUpdateSetting("buffIcons.enable", Core.ML);
}
public static void Initialize()
{
if (Enabled)
{
EventSink.ClientVersionReceived += ResendBuffsOnClientVersionReceived;
}
}
public static void ResendBuffsOnClientVersionReceived(NetState ns, ClientVersion cv)
{
if (ns.Mobile is PlayerMobile pm)
{
Timer.DelayCall(pm.ResendBuffs);
}
}
public static void AddBuff(Mobile m, BuffInfo b)
{
if (m is PlayerMobile pm)
{
pm.AddBuff(b);
}
}
public static void RemoveBuff(Mobile m, BuffInfo b)
{
if (m is PlayerMobile pm)
{
pm.RemoveBuff(b);
}
}
public static void RemoveBuff(Mobile m, BuffIcon b)
{
if (m is PlayerMobile pm)
{
pm.RemoveBuff(b);
}
}
}
@ -235,7 +248,9 @@ namespace Server
Stream.Fill(4);
if (length < TimeSpan.Zero)
{
length = TimeSpan.Zero;
}
Stream.Write((short)length.TotalSeconds); // Time in seconds