fix: Fixes murder context getting lost (#2198)
This commit is contained in:
parent
c5c647bf77
commit
902797bee0
2 changed files with 12 additions and 8 deletions
|
|
@ -79,11 +79,7 @@ public partial class MurderContext
|
|||
|
||||
if (_player.Kills > 0)
|
||||
{
|
||||
var timeUntilLong = now + (LongTermElapse - gameTime);
|
||||
if (_nextElapse > timeUntilLong)
|
||||
{
|
||||
_nextElapse = timeUntilLong;
|
||||
}
|
||||
_nextElapse = Utility.Min(_nextElapse, now + (LongTermElapse - gameTime));
|
||||
}
|
||||
|
||||
return _nextElapse != DateTime.MaxValue;
|
||||
|
|
|
|||
|
|
@ -101,9 +101,17 @@ public class PlayerMurderSystem : GenericPersistence
|
|||
|
||||
private static void OnDisconnected(Mobile m)
|
||||
{
|
||||
if (m is PlayerMobile pm && _murderContexts.Remove(pm, out var context))
|
||||
if (m is not PlayerMobile pm || !_murderContexts.TryGetValue(pm, out var context))
|
||||
{
|
||||
_contextTerms.Remove(context);
|
||||
return;
|
||||
}
|
||||
|
||||
_contextTerms.Remove(context);
|
||||
UpdateMurderContext(context);
|
||||
|
||||
if (pm.Kills <= 0 && context.ShortTermMurders <= 0)
|
||||
{
|
||||
_murderContexts.Remove(pm);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,13 +181,13 @@ public class PlayerMurderSystem : GenericPersistence
|
|||
context.ShortTermMurders++;
|
||||
player.Kills++;
|
||||
|
||||
context.ResetKillTime();
|
||||
UpdateMurderContext(context);
|
||||
}
|
||||
|
||||
private static void UpdateMurderContext(MurderContext context)
|
||||
{
|
||||
var player = context.Player;
|
||||
context.ResetKillTime();
|
||||
|
||||
if (!context.CheckStart())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue