fix: Fixes code genning armor, clothing, and BODs (#810)

* Fixes code genning clothing
* Fixes code genning armor
* Fixes code genning BODs
This commit is contained in:
Kamron Batman 2021-09-28 22:09:34 -07:00 • committed by GitHub
parent 990d151ef3
commit 8eaa859332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 122 additions and 111 deletions

View file

@ -23,7 +23,8 @@ namespace Server.Items
[Serializable(3, false)]
public abstract partial class BaseAddon : Item, IChoppable, IAddon
{
private CraftResource _resource;
[SerializableField(1, "private", "private")]
private CraftResource _rawResource;
public BaseAddon() : base(1)
{
@ -65,16 +66,15 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
[SerializableField(1)]
public CraftResource Resource
{
get => _resource;
get => _rawResource;
set
{
if (_resource != value)
if (_rawResource != value)
{
_resource = value;
Hue = CraftResources.GetHue(_resource);
RawResource = value;
Hue = CraftResources.GetHue(_rawResource);
InvalidateProperties();
this.MarkDirty();
@ -284,7 +284,7 @@ namespace Server.Items
if (version == 2)
{
_resource = (CraftResource)reader.ReadEncodedInt();
_rawResource = (CraftResource)reader.ReadEncodedInt();
}
}
}

View file

@ -9,7 +9,8 @@ namespace Server.Items
[SerializableField(0, setter: "private")]
private List<AddonContainerComponent> _components;
private CraftResource _resource;
[SerializableField(1, "private", "private")]
private CraftResource _rawResource;
public BaseAddonContainer(int itemID) : base(itemID)
{
@ -42,17 +43,16 @@ namespace Server.Items
}
}
[SerializableField(1)]
[CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource
{
get => _resource;
get => _rawResource;
set
{
if (_resource != value)
if (_rawResource != value)
{
_resource = value;
Hue = CraftResources.GetHue(_resource);
RawResource = value;
Hue = CraftResources.GetHue(_rawResource);
InvalidateProperties();
this.MarkDirty();
@ -171,9 +171,9 @@ namespace Server.Items
{
base.GetProperties(list);
if (!CraftResources.IsStandard(_resource))
if (!CraftResources.IsStandard(_rawResource))
{
list.Add(CraftResources.GetLocalizationNumber(_resource));
list.Add(CraftResources.GetLocalizationNumber(_rawResource));
}
}
@ -204,7 +204,7 @@ namespace Server.Items
private void Deserialize(IGenericReader reader, int version)
{
_components = reader.ReadEntityList<AddonContainerComponent>();
_resource = version == 1 ? reader.ReadEnum<CraftResource>() : (CraftResource)reader.ReadInt();
_rawResource = version == 1 ? reader.ReadEnum<CraftResource>() : (CraftResource)reader.ReadInt();
}
[AfterDeserialization]