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
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
|||
[SerializationGenerator(2, false)]
|
||||
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)
|
||||
{
|
||||
Stackable = true;
|
||||
|
|
@ -21,6 +16,24 @@ public abstract partial class BaseIngot : Item, ICommodity
|
|||
|
||||
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
|
||||
{
|
||||
get
|
||||
|
|
@ -162,4 +175,4 @@ public partial class ValoriteIngot : BaseIngot
|
|||
public ValoriteIngot(int amount = 1) : base(CraftResource.Valorite, amount)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,23 @@ public abstract partial class BaseOre : Item
|
|||
_resource = resource;
|
||||
}
|
||||
|
||||
[InvalidateProperties]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
[SerializableField(0)]
|
||||
private CraftResource _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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
|||
[SerializationGenerator(1, false)]
|
||||
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)
|
||||
{
|
||||
Stackable = true;
|
||||
|
|
@ -19,6 +14,24 @@ public abstract partial class BaseScales : Item, ICommodity
|
|||
_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 double DefaultWeight => 0.1;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
|||
[SerializationGenerator(2, false)]
|
||||
public abstract partial class BaseGranite : Item
|
||||
{
|
||||
[InvalidateProperties]
|
||||
[SerializableField(0)]
|
||||
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
||||
private CraftResource _resource;
|
||||
|
||||
public BaseGranite(CraftResource resource) : base(0x1779)
|
||||
{
|
||||
Hue = CraftResources.GetHue(resource);
|
||||
|
|
@ -20,6 +15,24 @@ public abstract partial class BaseGranite : Item
|
|||
|
||||
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
|
||||
|
||||
private void Deserialize(IGenericReader reader, int version)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,11 @@
|
|||
using ModernUO.Serialization;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items;
|
||||
|
||||
[SerializationGenerator(2, false)]
|
||||
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)
|
||||
{
|
||||
Stackable = true;
|
||||
|
|
@ -20,6 +16,24 @@ public abstract partial class BaseHides : Item, ICommodity
|
|||
_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
|
||||
{
|
||||
get
|
||||
|
|
@ -183,4 +197,4 @@ public partial class BarbedHides : BaseHides, IScissorable
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@ namespace Server.Items;
|
|||
[SerializationGenerator(2, false)]
|
||||
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)
|
||||
{
|
||||
Stackable = true;
|
||||
|
|
@ -20,6 +15,24 @@ public abstract partial class BaseLeather : Item, ICommodity
|
|||
_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
|
||||
{
|
||||
get
|
||||
|
|
@ -111,4 +124,4 @@ public partial class BarbedLeather : BaseLeather
|
|||
public BarbedLeather(int amount = 1) : base(CraftResource.BarbedLeather, amount)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue