53 lines
1.3 KiB
C#
53 lines
1.3 KiB
C#
|
|
using Server;
|
||
|
|
using Server.Items;
|
||
|
|
using Server.Engines.XmlSpawner2;
|
||
|
|
|
||
|
|
namespace Server.Custom
|
||
|
|
{
|
||
|
|
public static class DurabilityExtensions
|
||
|
|
{
|
||
|
|
private static DurabilityAttachment GetAttach(Item item)
|
||
|
|
{
|
||
|
|
var att = XmlAttach.FindAttachment(item, typeof(DurabilityAttachment)) as DurabilityAttachment;
|
||
|
|
|
||
|
|
if (att == null)
|
||
|
|
{
|
||
|
|
att = new DurabilityAttachment();
|
||
|
|
XmlAttach.AttachTo(item, att);
|
||
|
|
}
|
||
|
|
|
||
|
|
return att;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static bool GetRepairLocked(this Item item)
|
||
|
|
{
|
||
|
|
return GetAttach(item).RepairLocked;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void SetRepairLocked(this Item item, bool value)
|
||
|
|
{
|
||
|
|
GetAttach(item).RepairLocked = value;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static int GetPoFUses(this Item item)
|
||
|
|
{
|
||
|
|
return GetAttach(item).PoFUses;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void SetPoFUses(this Item item, int value)
|
||
|
|
{
|
||
|
|
GetAttach(item).PoFUses = value;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static int GetMaxPoFUses(this Item item)
|
||
|
|
{
|
||
|
|
return GetAttach(item).MaxPoFUses;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void SetMaxPoFUses(this Item item, int value)
|
||
|
|
{
|
||
|
|
GetAttach(item).MaxPoFUses = value;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|