fix: Codegens corpses (#1287)
This commit is contained in:
parent
c8a804d0b1
commit
0b4cd460de
7 changed files with 1250 additions and 1339 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,12 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Server
|
namespace Server;
|
||||||
{
|
|
||||||
[AttributeUsage(AttributeTargets.Class)]
|
|
||||||
public class CorpseNameAttribute : Attribute
|
|
||||||
{
|
|
||||||
public CorpseNameAttribute(string name) => Name = name;
|
|
||||||
|
|
||||||
public string Name { get; }
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
}
|
public class CorpseNameAttribute : Attribute
|
||||||
|
{
|
||||||
|
public CorpseNameAttribute(string name) => Name = name;
|
||||||
|
|
||||||
|
public string Name { get; }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,143 +17,142 @@ using System.Buffers;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
|
|
||||||
namespace Server.Network
|
namespace Server.Network;
|
||||||
|
|
||||||
|
public static class CorpsePackets
|
||||||
{
|
{
|
||||||
public static class CorpsePackets
|
public static void SendCorpseEquip(this NetState ns, Mobile beholder, Corpse beheld)
|
||||||
{
|
{
|
||||||
public static void SendCorpseEquip(this NetState ns, Mobile beholder, Corpse beheld)
|
if (ns.CannotSendPackets())
|
||||||
{
|
{
|
||||||
if (ns.CannotSendPackets())
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = beheld.EquipItems;
|
||||||
|
|
||||||
|
var maxLength = 8 + (list.Count + 2) * 5;
|
||||||
|
var writer = new SpanWriter(stackalloc byte[maxLength]);
|
||||||
|
writer.Write((byte)0x89);
|
||||||
|
writer.Seek(2, SeekOrigin.Current);
|
||||||
|
writer.Write(beheld.Serial);
|
||||||
|
|
||||||
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
|
var item = list[i];
|
||||||
|
|
||||||
|
if (!item.Deleted && beholder.CanSee(item) && item.Parent == beheld)
|
||||||
{
|
{
|
||||||
return;
|
writer.Write((byte)(item.Layer + 1));
|
||||||
|
writer.Write(item.Serial);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var list = beheld.EquipItems;
|
if (beheld.Hair?.ItemID > 0)
|
||||||
|
{
|
||||||
|
writer.Write((byte)(Layer.Hair + 1));
|
||||||
|
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||||
|
}
|
||||||
|
|
||||||
var maxLength = 8 + (list.Count + 2) * 5;
|
if (beheld.FacialHair?.ItemID > 0)
|
||||||
var writer = new SpanWriter(stackalloc byte[maxLength]);
|
{
|
||||||
writer.Write((byte)0x89);
|
writer.Write((byte)(Layer.FacialHair + 1));
|
||||||
writer.Seek(2, SeekOrigin.Current);
|
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Write((byte)Layer.Invalid);
|
||||||
|
|
||||||
|
writer.WritePacketLength();
|
||||||
|
ns.Send(writer.Span);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SendCorpseContent(this NetState ns, Mobile beholder, Corpse beheld)
|
||||||
|
{
|
||||||
|
if (ns.CannotSendPackets())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var list = beheld.EquipItems;
|
||||||
|
var hairItemID = beheld.Hair?.ItemID ?? 0;
|
||||||
|
var facialHairItemID = beheld.FacialHair?.ItemID ?? 0;
|
||||||
|
var count = list.Count;
|
||||||
|
if (hairItemID > 0)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (facialHairItemID > 0)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
var maxLength = 5 + count * (ns.ContainerGridLines ? 20 : 19);
|
||||||
|
var writer = new SpanWriter(stackalloc byte[maxLength]);
|
||||||
|
writer.Write((byte)0x3C);
|
||||||
|
writer.Seek(4, SeekOrigin.Current); // Length and Count
|
||||||
|
|
||||||
|
var written = 0;
|
||||||
|
for (var i = 0; i < list.Count; ++i)
|
||||||
|
{
|
||||||
|
var child = list[i];
|
||||||
|
|
||||||
|
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||||
|
{
|
||||||
|
writer.Write(child.Serial);
|
||||||
|
writer.Write((ushort)child.ItemID);
|
||||||
|
writer.Write((byte)0); // signed, itemID offset
|
||||||
|
writer.Write((ushort)child.Amount);
|
||||||
|
writer.Write((short)child.X);
|
||||||
|
writer.Write((short)child.Y);
|
||||||
|
if (ns.ContainerGridLines)
|
||||||
|
{
|
||||||
|
writer.Write((byte)0); // Grid Location?
|
||||||
|
}
|
||||||
|
writer.Write(beheld.Serial);
|
||||||
|
writer.Write((ushort)child.Hue);
|
||||||
|
|
||||||
|
++written;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hairItemID > 0)
|
||||||
|
{
|
||||||
|
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||||
|
writer.Write((ushort)hairItemID);
|
||||||
|
writer.Write((byte)0); // signed, itemID offset
|
||||||
|
writer.Write((ushort)1);
|
||||||
|
writer.Write(0); // X/Y
|
||||||
|
if (ns.ContainerGridLines)
|
||||||
|
{
|
||||||
|
writer.Write((byte)0); // Grid Location?
|
||||||
|
}
|
||||||
writer.Write(beheld.Serial);
|
writer.Write(beheld.Serial);
|
||||||
|
writer.Write((ushort)beheld.Hair!.Hue);
|
||||||
|
|
||||||
for (var i = 0; i < list.Count; ++i)
|
++written;
|
||||||
{
|
|
||||||
var item = list[i];
|
|
||||||
|
|
||||||
if (!item.Deleted && beholder.CanSee(item) && item.Parent == beheld)
|
|
||||||
{
|
|
||||||
writer.Write((byte)(item.Layer + 1));
|
|
||||||
writer.Write(item.Serial);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (beheld.Hair?.ItemID > 0)
|
|
||||||
{
|
|
||||||
writer.Write((byte)(Layer.Hair + 1));
|
|
||||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (beheld.FacialHair?.ItemID > 0)
|
|
||||||
{
|
|
||||||
writer.Write((byte)(Layer.FacialHair + 1));
|
|
||||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.Write((byte)Layer.Invalid);
|
|
||||||
|
|
||||||
writer.WritePacketLength();
|
|
||||||
ns.Send(writer.Span);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendCorpseContent(this NetState ns, Mobile beholder, Corpse beheld)
|
if (facialHairItemID > 0)
|
||||||
{
|
{
|
||||||
if (ns.CannotSendPackets())
|
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
||||||
|
writer.Write((ushort)facialHairItemID);
|
||||||
|
writer.Write((byte)0); // signed, itemID offset
|
||||||
|
writer.Write((ushort)1);
|
||||||
|
writer.Write(0); // X/Y
|
||||||
|
if (ns.ContainerGridLines)
|
||||||
{
|
{
|
||||||
return;
|
writer.Write((byte)0); // Grid Location?
|
||||||
}
|
}
|
||||||
|
writer.Write(beheld.Serial);
|
||||||
|
writer.Write((ushort)beheld.FacialHair!.Hue);
|
||||||
|
|
||||||
var list = beheld.EquipItems;
|
++written;
|
||||||
var hairItemID = beheld.Hair?.ItemID ?? 0;
|
|
||||||
var facialHairItemID = beheld.FacialHair?.ItemID ?? 0;
|
|
||||||
var count = list.Count;
|
|
||||||
if (hairItemID > 0)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (facialHairItemID > 0)
|
|
||||||
{
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
var maxLength = 5 + count * (ns.ContainerGridLines ? 20 : 19);
|
|
||||||
var writer = new SpanWriter(stackalloc byte[maxLength]);
|
|
||||||
writer.Write((byte)0x3C);
|
|
||||||
writer.Seek(4, SeekOrigin.Current); // Length and Count
|
|
||||||
|
|
||||||
var written = 0;
|
|
||||||
for (var i = 0; i < list.Count; ++i)
|
|
||||||
{
|
|
||||||
var child = list[i];
|
|
||||||
|
|
||||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
|
||||||
{
|
|
||||||
writer.Write(child.Serial);
|
|
||||||
writer.Write((ushort)child.ItemID);
|
|
||||||
writer.Write((byte)0); // signed, itemID offset
|
|
||||||
writer.Write((ushort)child.Amount);
|
|
||||||
writer.Write((short)child.X);
|
|
||||||
writer.Write((short)child.Y);
|
|
||||||
if (ns.ContainerGridLines)
|
|
||||||
{
|
|
||||||
writer.Write((byte)0); // Grid Location?
|
|
||||||
}
|
|
||||||
writer.Write(beheld.Serial);
|
|
||||||
writer.Write((ushort)child.Hue);
|
|
||||||
|
|
||||||
++written;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hairItemID > 0)
|
|
||||||
{
|
|
||||||
writer.Write(HairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
|
||||||
writer.Write((ushort)hairItemID);
|
|
||||||
writer.Write((byte)0); // signed, itemID offset
|
|
||||||
writer.Write((ushort)1);
|
|
||||||
writer.Write(0); // X/Y
|
|
||||||
if (ns.ContainerGridLines)
|
|
||||||
{
|
|
||||||
writer.Write((byte)0); // Grid Location?
|
|
||||||
}
|
|
||||||
writer.Write(beheld.Serial);
|
|
||||||
writer.Write((ushort)beheld.Hair!.Hue);
|
|
||||||
|
|
||||||
++written;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (facialHairItemID > 0)
|
|
||||||
{
|
|
||||||
writer.Write(FacialHairInfo.FakeSerial(beheld.Owner.Serial) - 2);
|
|
||||||
writer.Write((ushort)facialHairItemID);
|
|
||||||
writer.Write((byte)0); // signed, itemID offset
|
|
||||||
writer.Write((ushort)1);
|
|
||||||
writer.Write(0); // X/Y
|
|
||||||
if (ns.ContainerGridLines)
|
|
||||||
{
|
|
||||||
writer.Write((byte)0); // Grid Location?
|
|
||||||
}
|
|
||||||
writer.Write(beheld.Serial);
|
|
||||||
writer.Write((ushort)beheld.FacialHair!.Hue);
|
|
||||||
|
|
||||||
++written;
|
|
||||||
}
|
|
||||||
|
|
||||||
writer.Seek(1, SeekOrigin.Begin);
|
|
||||||
writer.Write((ushort)writer.BytesWritten);
|
|
||||||
writer.Write((ushort)written);
|
|
||||||
writer.Seek(0, SeekOrigin.End);
|
|
||||||
ns.Send(writer.Span);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writer.Seek(1, SeekOrigin.Begin);
|
||||||
|
writer.Write((ushort)writer.BytesWritten);
|
||||||
|
writer.Write((ushort)written);
|
||||||
|
writer.Seek(0, SeekOrigin.End);
|
||||||
|
ns.Send(writer.Span);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,108 +1,74 @@
|
||||||
using System;
|
using System;
|
||||||
|
using ModernUO.Serialization;
|
||||||
|
|
||||||
namespace Server.Items
|
namespace Server.Items;
|
||||||
|
|
||||||
|
[SerializationGenerator(2, false)]
|
||||||
|
public partial class DecayedCorpse : Container
|
||||||
{
|
{
|
||||||
public class DecayedCorpse : Container
|
private static TimeSpan _defaultDecayTime = TimeSpan.FromMinutes(7.0);
|
||||||
|
|
||||||
|
[TimerDrift]
|
||||||
|
[SerializableField(0, getter: "private", setter: "private")]
|
||||||
|
private Timer _decayTimer;
|
||||||
|
|
||||||
|
[DeserializeTimerField(0)]
|
||||||
|
private void DeserializeDecayTimer(TimeSpan delay) => BeginDecay(delay);
|
||||||
|
|
||||||
|
public DecayedCorpse(string name) : base(Utility.Random(0xECA, 9))
|
||||||
{
|
{
|
||||||
private static readonly TimeSpan m_DefaultDecayTime = TimeSpan.FromMinutes(7.0);
|
Movable = false;
|
||||||
private DateTime m_DecayTime;
|
Name = name;
|
||||||
private Timer m_DecayTimer;
|
|
||||||
|
|
||||||
public DecayedCorpse(string name) : base(Utility.Random(0xECA, 9))
|
BeginDecay(_defaultDecayTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not display (x items, y stones)
|
||||||
|
public override bool DisplaysContent => false;
|
||||||
|
|
||||||
|
public void BeginDecay(TimeSpan delay)
|
||||||
|
{
|
||||||
|
_decayTimer?.Stop();
|
||||||
|
DecayTimer = new InternalTimer(this, delay);
|
||||||
|
DecayTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnAfterDelete()
|
||||||
|
{
|
||||||
|
_decayTimer?.Stop();
|
||||||
|
_decayTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not display (x items, y stones)
|
||||||
|
public override bool CheckContentDisplay(Mobile from) => false;
|
||||||
|
|
||||||
|
public override void AddNameProperty(IPropertyList list)
|
||||||
|
{
|
||||||
|
list.Add(1046414, Name); // the remains of ~1_NAME~
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnSingleClick(Mobile from)
|
||||||
|
{
|
||||||
|
LabelTo(from, 1046414, Name); // the remains of ~1_NAME~
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
|
{
|
||||||
|
if (reader.ReadBool())
|
||||||
{
|
{
|
||||||
Movable = false;
|
BeginDecay(reader.ReadDeltaTime() - Core.Now);
|
||||||
Name = name;
|
|
||||||
|
|
||||||
BeginDecay(m_DefaultDecayTime);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DecayedCorpse(Serial serial) : base(serial)
|
private class InternalTimer : Timer
|
||||||
|
{
|
||||||
|
private DecayedCorpse _corpse;
|
||||||
|
|
||||||
|
public InternalTimer(DecayedCorpse c, TimeSpan delay) : base(delay) => _corpse = c;
|
||||||
|
|
||||||
|
protected override void OnTick()
|
||||||
{
|
{
|
||||||
}
|
_corpse.Delete();
|
||||||
|
|
||||||
// Do not display (x items, y stones)
|
|
||||||
public override bool DisplaysContent => false;
|
|
||||||
|
|
||||||
public void BeginDecay(TimeSpan delay)
|
|
||||||
{
|
|
||||||
m_DecayTimer?.Stop();
|
|
||||||
|
|
||||||
m_DecayTime = Core.Now + delay;
|
|
||||||
|
|
||||||
m_DecayTimer = new InternalTimer(this, delay);
|
|
||||||
m_DecayTimer.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnAfterDelete()
|
|
||||||
{
|
|
||||||
m_DecayTimer?.Stop();
|
|
||||||
|
|
||||||
m_DecayTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not display (x items, y stones)
|
|
||||||
public override bool CheckContentDisplay(Mobile from) => false;
|
|
||||||
|
|
||||||
public override void AddNameProperty(IPropertyList list)
|
|
||||||
{
|
|
||||||
list.Add(1046414, Name); // the remains of ~1_NAME~
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnSingleClick(Mobile from)
|
|
||||||
{
|
|
||||||
LabelTo(from, 1046414, Name); // the remains of ~1_NAME~
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Serialize(IGenericWriter writer)
|
|
||||||
{
|
|
||||||
base.Serialize(writer);
|
|
||||||
|
|
||||||
writer.Write(1); // version
|
|
||||||
|
|
||||||
writer.Write(m_DecayTimer != null);
|
|
||||||
|
|
||||||
if (m_DecayTimer != null)
|
|
||||||
{
|
|
||||||
writer.WriteDeltaTime(m_DecayTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Deserialize(IGenericReader reader)
|
|
||||||
{
|
|
||||||
base.Deserialize(reader);
|
|
||||||
|
|
||||||
var version = reader.ReadInt();
|
|
||||||
|
|
||||||
switch (version)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
BeginDecay(m_DefaultDecayTime);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
if (reader.ReadBool())
|
|
||||||
{
|
|
||||||
BeginDecay(reader.ReadDeltaTime() - Core.Now);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class InternalTimer : Timer
|
|
||||||
{
|
|
||||||
private readonly DecayedCorpse m_Corpse;
|
|
||||||
|
|
||||||
public InternalTimer(DecayedCorpse c, TimeSpan delay) : base(delay) => m_Corpse = c;
|
|
||||||
|
|
||||||
protected override void OnTick()
|
|
||||||
{
|
|
||||||
m_Corpse.Delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
113
Projects/UOContent/Migrations/Server.Items.Corpse.v13.json
Normal file
113
Projects/UOContent/Migrations/Server.Items.Corpse.v13.json
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
{
|
||||||
|
"version": 13,
|
||||||
|
"type": "Server.Items.Corpse",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "RestoreEquip",
|
||||||
|
"type": "System.Collections.Generic.List\u003CServer.Item\u003E",
|
||||||
|
"rule": "ListMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Item",
|
||||||
|
"SerializableInterfaceMigrationRule"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Flags",
|
||||||
|
"type": "Server.Items.CorpseFlag",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "TimeOfDeath",
|
||||||
|
"type": "System.DateTime",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"DeltaTime"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "RestoreTable",
|
||||||
|
"type": "System.Collections.Generic.Dictionary\u003CServer.Item, Server.Point3D\u003E",
|
||||||
|
"rule": "DictionaryMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Item",
|
||||||
|
"SerializableInterfaceMigrationRule",
|
||||||
|
"0",
|
||||||
|
"Server.Point3D",
|
||||||
|
"PrimitiveUOTypeMigrationRule",
|
||||||
|
"1",
|
||||||
|
"Point3D"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "DecayTimer",
|
||||||
|
"type": "Server.Timer",
|
||||||
|
"rule": "TimerMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"@TimerDrift"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Looters",
|
||||||
|
"type": "System.Collections.Generic.HashSet\u003CServer.Mobile\u003E",
|
||||||
|
"rule": "HashSetMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Mobile",
|
||||||
|
"SerializableInterfaceMigrationRule"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Killer",
|
||||||
|
"type": "Server.Mobile",
|
||||||
|
"rule": "SerializableInterfaceMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Aggressors",
|
||||||
|
"type": "System.Collections.Generic.List\u003CServer.Mobile\u003E",
|
||||||
|
"rule": "ListMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Mobile",
|
||||||
|
"SerializableInterfaceMigrationRule"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Owner",
|
||||||
|
"type": "Server.Mobile",
|
||||||
|
"rule": "SerializableInterfaceMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CorpseName",
|
||||||
|
"type": "string",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "AccessLevel",
|
||||||
|
"type": "Server.AccessLevel",
|
||||||
|
"rule": "EnumMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Guild",
|
||||||
|
"type": "Server.Guilds.Guild",
|
||||||
|
"rule": "SerializableInterfaceMigrationRule"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Kills",
|
||||||
|
"type": "int",
|
||||||
|
"rule": "PrimitiveTypeMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EquipItems",
|
||||||
|
"type": "System.Collections.Generic.List\u003CServer.Item\u003E",
|
||||||
|
"rule": "ListMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"Server.Item",
|
||||||
|
"SerializableInterfaceMigrationRule"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"type": "Server.Items.DecayedCorpse",
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"name": "DecayTimer",
|
||||||
|
"type": "Server.Timer",
|
||||||
|
"rule": "TimerMigrationRule",
|
||||||
|
"ruleArguments": [
|
||||||
|
"@TimerDrift"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -46,50 +46,53 @@ namespace Server.SkillHandlers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(501001); // You cannot determain anything useful.
|
from.SendLocalizedMessage(501001); // You cannot determine anything useful.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target is Corpse c)
|
else if (target is Corpse c)
|
||||||
{
|
{
|
||||||
if (from.CheckTargetSkill(SkillName.Forensics, c, 0.0, 100.0))
|
if (from.CheckTargetSkill(SkillName.Forensics, c, 0.0, 100.0))
|
||||||
{
|
{
|
||||||
if (c.m_Forensicist != null)
|
if (c.Forensicist != null)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(
|
// The forensicist ~1_NAME~ has already discovered that:
|
||||||
1042750,
|
from.SendLocalizedMessage(1042750, c.Forensicist);
|
||||||
c.m_Forensicist
|
|
||||||
); // The forensicist ~1_NAME~ has already discovered that:
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c.m_Forensicist = from.Name;
|
c.Forensicist = from.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Body)c.Amount).IsHuman)
|
if (((Body)c.Amount).IsHuman)
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(
|
// This person was killed by ~1_KILLER_NAME~
|
||||||
1042751,
|
from.SendLocalizedMessage(1042751, c.Killer == null ? "no one" : c.Killer.Name);
|
||||||
c.Killer == null ? "no one" : c.Killer.Name
|
|
||||||
); // This person was killed by ~1_KILLER_NAME~
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.Looters.Count > 0)
|
if (c.Looters.Count > 0)
|
||||||
{
|
{
|
||||||
using var sb = new ValueStringBuilder(stackalloc char[128]);
|
using var sb = new ValueStringBuilder(stackalloc char[128]);
|
||||||
for (var i = 0; i < c.Looters.Count; i++)
|
int i = 0;
|
||||||
|
foreach (var looter in c.Looters)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i == c.Looters.Count - 1)
|
||||||
{
|
{
|
||||||
sb.Append(i == c.Looters.Count - 1 ? ", and " : ", ");
|
sb.Append($", and {looter.Name}");
|
||||||
|
}
|
||||||
|
else if (i > 0)
|
||||||
|
{
|
||||||
|
sb.Append($", {looter.Name}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append(looter.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.Append(c.Looters[i].Name);
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
from.SendLocalizedMessage(
|
// This body has been disturbed by ~1_PLAYER_NAMES~
|
||||||
1042752,
|
from.SendLocalizedMessage(1042752, sb.ToString());
|
||||||
sb.ToString()
|
|
||||||
); // This body has been disturbed by ~1_PLAYER_NAMES~
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -98,7 +101,7 @@ namespace Server.SkillHandlers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
from.SendLocalizedMessage(501001); // You cannot determain anything useful.
|
from.SendLocalizedMessage(501001); // You cannot determine anything useful.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (target is ILockpickable p)
|
else if (target is ILockpickable p)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue