fix: Codegens guards (#1474)
This commit is contained in:
parent
877595c513
commit
daa154d6de
6 changed files with 752 additions and 792 deletions
|
|
@ -1,91 +1,74 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Mobiles
|
||||
namespace Server.Mobiles;
|
||||
|
||||
[SerializationGenerator(0)]
|
||||
public abstract partial class BaseGuard : Mobile
|
||||
{
|
||||
public abstract class BaseGuard : Mobile
|
||||
public BaseGuard(Mobile target)
|
||||
{
|
||||
public BaseGuard(Mobile target)
|
||||
if (target != null)
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
Location = target.Location;
|
||||
Map = target.Map;
|
||||
Location = target.Location;
|
||||
Map = target.Map;
|
||||
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(Location, Map, EffectItem.DefaultDuration),
|
||||
0x3728,
|
||||
10,
|
||||
10,
|
||||
5023
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public BaseGuard(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract Mobile Focus { get; set; }
|
||||
|
||||
public static void Spawn(Mobile caller, Mobile target, int amount = 1, bool onlyAdditional = false)
|
||||
{
|
||||
if (target?.Deleted != false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var m in target.GetMobilesInRange(15))
|
||||
{
|
||||
if (m is BaseGuard g)
|
||||
{
|
||||
if (g.Focus == null) // idling
|
||||
{
|
||||
g.Focus = target;
|
||||
|
||||
--amount;
|
||||
}
|
||||
else if (g.Focus == target && !onlyAdditional)
|
||||
{
|
||||
--amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (amount-- > 0)
|
||||
{
|
||||
caller.Region.MakeGuard(target);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(Location, Map, EffectItem.DefaultDuration),
|
||||
0x3728,
|
||||
10,
|
||||
10,
|
||||
2023
|
||||
5023
|
||||
);
|
||||
|
||||
PlaySound(0x1FE);
|
||||
|
||||
Delete();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Mobile Focus { get; set; }
|
||||
|
||||
public static void Spawn(Mobile caller, Mobile target, int amount = 1, bool onlyAdditional = false)
|
||||
{
|
||||
if (target?.Deleted != false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var m in target.GetMobilesInRange(15))
|
||||
{
|
||||
if (m is BaseGuard g)
|
||||
{
|
||||
if (g.Focus == null) // idling
|
||||
{
|
||||
g.Focus = target;
|
||||
|
||||
--amount;
|
||||
}
|
||||
else if (g.Focus == target && !onlyAdditional)
|
||||
{
|
||||
--amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (amount-- > 0)
|
||||
{
|
||||
caller.Region.MakeGuard(target);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(Location, Map, EffectItem.DefaultDuration),
|
||||
0x3728,
|
||||
10,
|
||||
10,
|
||||
2023
|
||||
);
|
||||
|
||||
PlaySound(0x1FE);
|
||||
|
||||
Delete();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue