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
|
|
@ -65,8 +65,8 @@ public partial class SackFlour : Item, IHasQuantity
|
||||||
_quantity = 20;
|
_quantity = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableProperty(0)]
|
[SerializableProperty(0)]
|
||||||
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Quantity
|
public int Quantity
|
||||||
{
|
{
|
||||||
get => _quantity;
|
get => _quantity;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
||||||
[SerializationGenerator(2, false)]
|
[SerializationGenerator(2, false)]
|
||||||
public abstract partial class BaseIngot : Item, ICommodity
|
public abstract partial class BaseIngot : Item, ICommodity
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableField(0)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
public BaseIngot(CraftResource resource, int amount = 1) : base(0x1BF2)
|
public BaseIngot(CraftResource resource, int amount = 1) : base(0x1BF2)
|
||||||
{
|
{
|
||||||
Stackable = true;
|
Stackable = true;
|
||||||
|
|
@ -21,6 +16,24 @@ public abstract partial class BaseIngot : Item, ICommodity
|
||||||
|
|
||||||
public override double DefaultWeight => 0.1;
|
public override double DefaultWeight => 0.1;
|
||||||
|
|
||||||
|
[SerializableProperty(0)]
|
||||||
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
public CraftResource Resource
|
||||||
|
{
|
||||||
|
get => _resource;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_resource != value)
|
||||||
|
{
|
||||||
|
_resource = value;
|
||||||
|
Hue = CraftResources.GetHue(value);
|
||||||
|
|
||||||
|
InvalidateProperties();
|
||||||
|
this.MarkDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int LabelNumber
|
public override int LabelNumber
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,23 @@ public abstract partial class BaseOre : Item
|
||||||
_resource = resource;
|
_resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
[InvalidateProperties]
|
[SerializableProperty(0)]
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
[SerializableField(0)]
|
public CraftResource Resource
|
||||||
private CraftResource _resource;
|
{
|
||||||
|
get => _resource;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_resource != value)
|
||||||
|
{
|
||||||
|
_resource = value;
|
||||||
|
Hue = CraftResources.GetHue(value);
|
||||||
|
|
||||||
|
InvalidateProperties();
|
||||||
|
this.MarkDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int LabelNumber
|
public override int LabelNumber
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
||||||
[SerializationGenerator(1, false)]
|
[SerializationGenerator(1, false)]
|
||||||
public abstract partial class BaseScales : Item, ICommodity
|
public abstract partial class BaseScales : Item, ICommodity
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializableField(0)]
|
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
public BaseScales(CraftResource resource, int amount = 1) : base(0x26B4)
|
public BaseScales(CraftResource resource, int amount = 1) : base(0x26B4)
|
||||||
{
|
{
|
||||||
Stackable = true;
|
Stackable = true;
|
||||||
|
|
@ -19,6 +14,24 @@ public abstract partial class BaseScales : Item, ICommodity
|
||||||
_resource = resource;
|
_resource = 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 override int LabelNumber => 1053139; // dragon scales
|
public override int LabelNumber => 1053139; // dragon scales
|
||||||
|
|
||||||
public override double DefaultWeight => 0.1;
|
public override double DefaultWeight => 0.1;
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
||||||
[SerializationGenerator(2, false)]
|
[SerializationGenerator(2, false)]
|
||||||
public abstract partial class BaseGranite : Item
|
public abstract partial class BaseGranite : Item
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializableField(0)]
|
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
public BaseGranite(CraftResource resource) : base(0x1779)
|
public BaseGranite(CraftResource resource) : base(0x1779)
|
||||||
{
|
{
|
||||||
Hue = CraftResources.GetHue(resource);
|
Hue = CraftResources.GetHue(resource);
|
||||||
|
|
@ -20,6 +15,24 @@ public abstract partial class BaseGranite : Item
|
||||||
|
|
||||||
public override double DefaultWeight => Core.ML ? 1.0 : 10.0;
|
public override double DefaultWeight => Core.ML ? 1.0 : 10.0;
|
||||||
|
|
||||||
|
[SerializableProperty(0)]
|
||||||
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
|
public CraftResource Resource
|
||||||
|
{
|
||||||
|
get => _resource;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_resource != value)
|
||||||
|
{
|
||||||
|
_resource = value;
|
||||||
|
Hue = CraftResources.GetHue(value);
|
||||||
|
|
||||||
|
InvalidateProperties();
|
||||||
|
this.MarkDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int LabelNumber => 1044607; // high quality granite
|
public override int LabelNumber => 1044607; // high quality granite
|
||||||
|
|
||||||
private void Deserialize(IGenericReader reader, int version)
|
private void Deserialize(IGenericReader reader, int version)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,11 @@
|
||||||
using ModernUO.Serialization;
|
using ModernUO.Serialization;
|
||||||
|
using Server.Engines.Craft;
|
||||||
|
|
||||||
namespace Server.Items;
|
namespace Server.Items;
|
||||||
|
|
||||||
[SerializationGenerator(2, false)]
|
[SerializationGenerator(2, false)]
|
||||||
public abstract partial class BaseHides : Item, ICommodity
|
public abstract partial class BaseHides : Item, ICommodity
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableField(0)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
public BaseHides(CraftResource resource, int amount = 1) : base(0x1079)
|
public BaseHides(CraftResource resource, int amount = 1) : base(0x1079)
|
||||||
{
|
{
|
||||||
Stackable = true;
|
Stackable = true;
|
||||||
|
|
@ -20,6 +16,24 @@ public abstract partial class BaseHides : Item, ICommodity
|
||||||
_resource = resource;
|
_resource = 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 override int LabelNumber
|
public override int LabelNumber
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
||||||
[SerializationGenerator(2, false)]
|
[SerializationGenerator(2, false)]
|
||||||
public abstract partial class BaseLeather : Item, ICommodity
|
public abstract partial class BaseLeather : Item, ICommodity
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableField(0)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
public BaseLeather(CraftResource resource, int amount = 1) : base(0x1081)
|
public BaseLeather(CraftResource resource, int amount = 1) : base(0x1081)
|
||||||
{
|
{
|
||||||
Stackable = true;
|
Stackable = true;
|
||||||
|
|
@ -20,6 +15,24 @@ public abstract partial class BaseLeather : Item, ICommodity
|
||||||
_resource = resource;
|
_resource = 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 override int LabelNumber
|
public override int LabelNumber
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,6 @@ namespace Server.Items;
|
||||||
[SerializationGenerator(4, false)]
|
[SerializationGenerator(4, false)]
|
||||||
public partial class Board : Item, ICommodity
|
public partial class Board : Item, ICommodity
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializableField(0)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public Board(int amount = 1) : this(CraftResource.RegularWood, amount)
|
public Board(int amount = 1) : this(CraftResource.RegularWood, amount)
|
||||||
{
|
{
|
||||||
|
|
@ -25,6 +21,24 @@ public partial class Board : Item, ICommodity
|
||||||
Hue = CraftResources.GetHue(resource);
|
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
|
int ICommodity.DescriptionNumber
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ public partial class MessageInABottle : Item
|
||||||
|
|
||||||
public override int LabelNumber => 1041080; // a message in a bottle
|
public override int LabelNumber => 1041080; // a message in a bottle
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableProperty(0)]
|
[SerializableProperty(0)]
|
||||||
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Level
|
public int Level
|
||||||
{
|
{
|
||||||
get => _level;
|
get => _level;
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,8 @@ public partial class SOS : Item
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public bool IsAncient => _level >= 4;
|
public bool IsAncient => _level >= 4;
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableProperty(0)]
|
[SerializableProperty(0)]
|
||||||
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public int Level
|
public int Level
|
||||||
{
|
{
|
||||||
get => _level;
|
get => _level;
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@ namespace Server.Items;
|
||||||
[Flippable(0x1bdd, 0x1be0)]
|
[Flippable(0x1bdd, 0x1be0)]
|
||||||
public partial class Log : Item, ICommodity, IAxe
|
public partial class Log : Item, ICommodity, IAxe
|
||||||
{
|
{
|
||||||
[InvalidateProperties]
|
|
||||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableField(0)]
|
|
||||||
private CraftResource _resource;
|
|
||||||
|
|
||||||
[Constructible]
|
[Constructible]
|
||||||
public Log(int amount = 1) : this(CraftResource.RegularWood, amount)
|
public Log(int amount = 1) : this(CraftResource.RegularWood, amount)
|
||||||
{
|
{
|
||||||
|
|
@ -32,6 +27,24 @@ public partial class Log : Item, ICommodity, IAxe
|
||||||
Hue = CraftResources.GetHue(resource);
|
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());
|
public virtual bool Axe(Mobile from, BaseAxe axe) => TryCreateBoards(from, 0, new Board());
|
||||||
|
|
||||||
int ICommodity.DescriptionNumber => CraftResources.IsStandard(_resource)
|
int ICommodity.DescriptionNumber => CraftResources.IsStandard(_resource)
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ public partial class MiniHouseAddon : BaseAddon
|
||||||
Construct();
|
Construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandProperty(AccessLevel.GameMaster)]
|
|
||||||
[SerializableProperty(0)]
|
[SerializableProperty(0)]
|
||||||
|
[CommandProperty(AccessLevel.GameMaster)]
|
||||||
public MiniHouseType Type
|
public MiniHouseType Type
|
||||||
{
|
{
|
||||||
get => _type;
|
get => _type;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue