fix: Fixes commodity resource property hue (#1875)
### Summary - Fixes resource commodities so the hue changes when setting the resource - Fixes some commodities not being able to be modified in-game.
This commit is contained in:
parent
eed11be012
commit
3cb688a2fb
12 changed files with 151 additions and 45 deletions
|
|
@ -6,10 +6,6 @@ namespace Server.Items;
|
|||
[SerializationGenerator(4, false)]
|
||||
public partial class Board : Item, ICommodity
|
||||
{
|
||||
[InvalidateProperties]
|
||||
[SerializableField(0)]
|
||||
private CraftResource _resource;
|
||||
|
||||
[Constructible]
|
||||
public Board(int amount = 1) : this(CraftResource.RegularWood, amount)
|
||||
{
|
||||
|
|
@ -25,6 +21,24 @@ public partial class Board : Item, ICommodity
|
|||
Hue = CraftResources.GetHue(resource);
|
||||
}
|
||||
|
||||
[SerializableProperty(0)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get => _resource;
|
||||
set
|
||||
{
|
||||
if (_resource != value)
|
||||
{
|
||||
_resource = value;
|
||||
Hue = CraftResources.GetHue(value);
|
||||
|
||||
InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ICommodity.DescriptionNumber
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ public partial class MessageInABottle : Item
|
|||
|
||||
public override int LabelNumber => 1041080; // a message in a bottle
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableProperty(0)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Level
|
||||
{
|
||||
get => _level;
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ public partial class SOS : Item
|
|||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool IsAncient => _level >= 4;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableProperty(0)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Level
|
||||
{
|
||||
get => _level;
|
||||
|
|
|
|||
|
|
@ -6,11 +6,6 @@ namespace Server.Items;
|
|||
[Flippable(0x1bdd, 0x1be0)]
|
||||
public partial class Log : Item, ICommodity, IAxe
|
||||
{
|
||||
[InvalidateProperties]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableField(0)]
|
||||
private CraftResource _resource;
|
||||
|
||||
[Constructible]
|
||||
public Log(int amount = 1) : this(CraftResource.RegularWood, amount)
|
||||
{
|
||||
|
|
@ -32,6 +27,24 @@ public partial class Log : Item, ICommodity, IAxe
|
|||
Hue = CraftResources.GetHue(resource);
|
||||
}
|
||||
|
||||
[SerializableProperty(0)]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public CraftResource Resource
|
||||
{
|
||||
get => _resource;
|
||||
set
|
||||
{
|
||||
if (_resource != value)
|
||||
{
|
||||
_resource = value;
|
||||
Hue = CraftResources.GetHue(value);
|
||||
|
||||
InvalidateProperties();
|
||||
this.MarkDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool Axe(Mobile from, BaseAxe axe) => TryCreateBoards(from, 0, new Board());
|
||||
|
||||
int ICommodity.DescriptionNumber => CraftResources.IsStandard(_resource)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue