## Summary - Adds `public virtual bool Murderer => Kills >= 5` property to `Mobile`, replacing ~30 scattered `Kills >= 5` / `Kills < 5` magic-number checks across the codebase - `BaseCreature` overrides `Murderer` to also return `true` when `AlwaysMurderer` is set - Updates `Corpse` serialization to v15, storing `_murderer` as a `bool` field (migrated from `int Kills >= 5` in earlier versions)
66 lines
1.5 KiB
C#
66 lines
1.5 KiB
C#
using System;
|
|
using ModernUO.Serialization;
|
|
using Server.Engines.PartySystem;
|
|
|
|
namespace Server.Items;
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class MoonstoneGate : Moongate
|
|
{
|
|
private Mobile _caster;
|
|
|
|
public MoonstoneGate(Point3D loc, Map map, Map targetMap, Mobile caster, int hue) : base(loc, targetMap)
|
|
{
|
|
MoveToWorld(loc, map);
|
|
Dispellable = false;
|
|
Hue = hue;
|
|
|
|
_caster = caster;
|
|
|
|
new InternalTimer(this).Start();
|
|
Effects.PlaySound(loc, map, 0x20E);
|
|
}
|
|
|
|
public override bool SkipSerialization => true;
|
|
|
|
public override void CheckGate(Mobile m, int range)
|
|
{
|
|
if (m.Murderer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var casterParty = Party.Get(_caster);
|
|
var userParty = Party.Get(m);
|
|
|
|
if (m == _caster || casterParty != null && userParty == casterParty)
|
|
{
|
|
base.CheckGate(m, range);
|
|
}
|
|
}
|
|
|
|
public override void UseGate(Mobile m)
|
|
{
|
|
if (m.Murderer)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var casterParty = Party.Get(_caster);
|
|
var userParty = Party.Get(m);
|
|
|
|
if (m == _caster || casterParty != null && userParty == casterParty)
|
|
{
|
|
base.UseGate(m);
|
|
}
|
|
}
|
|
|
|
private class InternalTimer : Timer
|
|
{
|
|
private Item _item;
|
|
|
|
public InternalTimer(Item item) : base(TimeSpan.FromSeconds(30.0)) => _item = item;
|
|
|
|
protected override void OnTick() => _item.Delete();
|
|
}
|
|
}
|