Files
abysmal-isle/Scripts/Items/Internal/ItemSockets/SlayerSocket.cs
Unstable Kitsune b918192e4e Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
2023-11-28 23:20:26 -05:00

73 lines
1.8 KiB
C#

using System;
namespace Server.Items
{
public class SlayerSocket : ItemSocket
{
public SlayerName Slayer { get; set; }
public SlayerSocket()
{
}
public SlayerSocket(SlayerName slayer, TimeSpan duration)
: base(duration)
{
Slayer = slayer;
}
public override void GetProperties(ObjectPropertyList list)
{
list.Add(1155617); // Silvered
}
public override void OnRemoved()
{
if (Owner != null && !Owner.Deleted && Owner.RootParent is Mobile)
{
((Mobile)Owner.RootParent).SendLocalizedMessage(1155618, String.IsNullOrEmpty(Owner.Name) ? String.Format("#{0}", Owner.LabelNumber) : Owner.Name); // Your ~1_name~'s Tincture of Silver has worn off.
}
}
public static SlayerName GetSlayer(Item item)
{
if (item == null)
{
return SlayerName.None;
}
var socket = item.GetSocket<SlayerSocket>();
if (socket != null)
{
return socket.Slayer;
}
return SlayerName.None;
}
public override void OnAfterDuped(ItemSocket oldSocket)
{
if (oldSocket is SlayerSocket)
{
Slayer = ((SlayerSocket)oldSocket).Slayer;
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)Slayer);
}
public override void Deserialize(Item owner, GenericReader reader)
{
base.Deserialize(owner, reader);
reader.ReadInt(); // version
Slayer = (SlayerName)reader.ReadInt();
}
}
}