fix: Codegens rares and solen items (#1371)
This commit is contained in:
parent
3514651c3c
commit
6fcd606947
228 changed files with 2921 additions and 4460 deletions
|
|
@ -1,138 +1,103 @@
|
|||
namespace Server.Items
|
||||
using System;
|
||||
using ModernUO.Serialization;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(0, false)]
|
||||
public abstract partial class BaseWaterContainer : Container, IHasQuantity
|
||||
{
|
||||
public abstract class BaseWaterContainer : Container, IHasQuantity
|
||||
public BaseWaterContainer(int item_Id, bool filled) : base(item_Id) =>
|
||||
_quantity = filled ? MaxQuantity : 0;
|
||||
|
||||
public abstract int EmptyItemId { get; }
|
||||
public abstract int FullItemId { get; }
|
||||
public abstract int MaxQuantity { get; }
|
||||
|
||||
public override int DefaultGumpID => 0x3e;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool IsEmpty => _quantity <= 0;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool IsFull => _quantity >= MaxQuantity;
|
||||
|
||||
[SerializableProperty(0)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int Quantity
|
||||
{
|
||||
private int m_Quantity;
|
||||
|
||||
public BaseWaterContainer(int item_Id, bool filled)
|
||||
: base(item_Id) =>
|
||||
m_Quantity = filled ? MaxQuantity : 0;
|
||||
|
||||
public BaseWaterContainer(Serial serial)
|
||||
: base(serial)
|
||||
get => _quantity;
|
||||
set
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int voidItem_ID { get; }
|
||||
public abstract int fullItem_ID { get; }
|
||||
public abstract int MaxQuantity { get; }
|
||||
|
||||
public override int DefaultGumpID => 0x3e;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool IsEmpty => m_Quantity <= 0;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool IsFull => m_Quantity >= MaxQuantity;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int Quantity
|
||||
{
|
||||
get => m_Quantity;
|
||||
set
|
||||
if (value != _quantity)
|
||||
{
|
||||
if (value != m_Quantity)
|
||||
_quantity = Math.Clamp(value, 0, MaxQuantity);
|
||||
|
||||
Movable = !IsLockedDown && IsEmpty;
|
||||
ItemID = IsEmpty ? EmptyItemId : FullItemId;
|
||||
|
||||
if (!IsEmpty)
|
||||
{
|
||||
m_Quantity = value < 1 ? 0 :
|
||||
value > MaxQuantity ? MaxQuantity : value;
|
||||
var rootParent = RootParent;
|
||||
|
||||
Movable = !IsLockedDown ? IsEmpty : false;
|
||||
|
||||
ItemID = IsEmpty ? voidItem_ID : fullItem_ID;
|
||||
|
||||
if (!IsEmpty)
|
||||
if (rootParent?.Map != null && rootParent.Map != Map.Internal)
|
||||
{
|
||||
var rootParent = RootParent;
|
||||
|
||||
if (rootParent?.Map != null && rootParent.Map != Map.Internal)
|
||||
{
|
||||
MoveToWorld(rootParent.Location, rootParent.Map);
|
||||
}
|
||||
MoveToWorld(rootParent.Location, rootParent.Map);
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
|
||||
InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Name == null)
|
||||
{
|
||||
LabelTo(from, LabelNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAosSingleClick(Mobile from)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.OnAosSingleClick(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Name == null)
|
||||
{
|
||||
LabelTo(from, LabelNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
if (!IsEmpty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.OnDragDropInto(from, item, p);
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
writer.Write(m_Quantity);
|
||||
}
|
||||
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
var version = reader.ReadInt();
|
||||
m_Quantity = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.OnSingleClick(from);
|
||||
}
|
||||
else if (Name == null)
|
||||
{
|
||||
LabelTo(from, LabelNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAosSingleClick(Mobile from)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.OnAosSingleClick(from);
|
||||
}
|
||||
else if (Name == null)
|
||||
{
|
||||
LabelTo(from, LabelNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
LabelTo(from, Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties(IPropertyList list)
|
||||
{
|
||||
if (IsEmpty)
|
||||
{
|
||||
base.GetProperties(list);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p) => IsEmpty && base.OnDragDropInto(from, item, p);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue