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

@ -190,7 +190,7 @@ namespace SerializationGenerator
) != null ) != null
) : null; ) : null;
var serializablePropertySet = new SortedSet<SerializableProperty>(new SerializablePropertyComparer()); var serializablePropertySet = new SortedDictionary<SerializableProperty, ISymbol>(new SerializablePropertyComparer());
foreach (var fieldOrPropertySymbol in fieldsAndProperties) foreach (var fieldOrPropertySymbol in fieldsAndProperties)
{ {
@ -267,10 +267,16 @@ namespace SerializationGenerator
serializableFieldSaveFlagMethods serializableFieldSaveFlagMethods
); );
serializablePropertySet.Add(serializableProperty); serializablePropertySet.Add(serializableProperty, fieldOrPropertySymbol);
} }
var serializableProperties = serializablePropertySet.ToImmutableArray(); var serializableFields = serializablePropertySet.Keys.ToImmutableArray();
var serializableProperties = serializablePropertySet.Select(
kvp => kvp.Key with
{
Name = (kvp.Value as IFieldSymbol)?.GetPropertyName() ?? ((IPropertySymbol)kvp.Value).Name
}
).ToImmutableArray();
// If we are not inheriting ISerializable, then we need to define some stuff // If we are not inheriting ISerializable, then we need to define some stuff
if (!(isOverride || embedded)) if (!(isOverride || embedded))
@ -323,6 +329,7 @@ namespace SerializationGenerator
indent, indent,
isOverride, isOverride,
encodedVersion, encodedVersion,
serializableFields,
serializableProperties, serializableProperties,
serializableFieldSaveFlags serializableFieldSaveFlags
); );
@ -337,6 +344,7 @@ namespace SerializationGenerator
version, version,
encodedVersion, encodedVersion,
migrations, migrations,
serializableFields,
serializableProperties, serializableProperties,
parentFieldOrProperty, parentFieldOrProperty,
serializableFieldSaveFlags serializableFieldSaveFlags

View file

@ -33,6 +33,7 @@ namespace SerializationGenerator
int version, int version,
bool encodedVersion, bool encodedVersion,
ImmutableArray<SerializableMetadata> migrations, ImmutableArray<SerializableMetadata> migrations,
ImmutableArray<SerializableProperty> fields,
ImmutableArray<SerializableProperty> properties, ImmutableArray<SerializableProperty> properties,
ISymbol parentFieldOrProperty, ISymbol parentFieldOrProperty,
SortedDictionary<int, SerializableFieldSaveFlagMethods> serializableFieldSaveFlagMethodsDictionary SortedDictionary<int, SerializableFieldSaveFlagMethods> serializableFieldSaveFlagMethodsDictionary
@ -124,11 +125,12 @@ namespace SerializationGenerator
source.AppendLine($"{bodyIndent}var saveFlags = reader.ReadEnum<SaveFlag>();"); source.AppendLine($"{bodyIndent}var saveFlags = reader.ReadEnum<SaveFlag>();");
} }
foreach (var property in properties) for (var i = 0; i < properties.Length; i++)
{ {
var field = fields[i];
var property = properties[i];
var rule = SerializableMigrationRulesEngine.Rules[property.Rule]; var rule = SerializableMigrationRulesEngine.Rules[property.Rule];
if (serializableFieldSaveFlagMethodsDictionary.TryGetValue( if (serializableFieldSaveFlagMethodsDictionary.TryGetValue(
property.Order, property.Order,
out var serializableFieldSaveFlagMethods out var serializableFieldSaveFlagMethods
@ -138,7 +140,7 @@ namespace SerializationGenerator
// Special case // Special case
if (property.Type == "bool") if (property.Type == "bool")
{ {
source.AppendLine($"{bodyIndent}{property.Name} = (saveFlags & SaveFlag.{property.Name}) != 0;"); source.AppendLine($"{bodyIndent}{field.Name} = (saveFlags & SaveFlag.{property.Name}) != 0;");
} }
else else
{ {
@ -146,16 +148,22 @@ namespace SerializationGenerator
rule.GenerateDeserializationMethod( rule.GenerateDeserializationMethod(
source, source,
innerIndent, innerIndent,
property, field,
parentFieldOrProperty?.Name ?? "this" parentFieldOrProperty?.Name ?? "this"
); );
(rule as IPostDeserializeMethod)?.PostDeserializeMethod(source, innerIndent, property, compilation, classSymbol); (rule as IPostDeserializeMethod)?.PostDeserializeMethod(
source,
innerIndent,
field,
compilation,
classSymbol
);
if (serializableFieldSaveFlagMethods.GetFieldDefaultValue != null) if (serializableFieldSaveFlagMethods.GetFieldDefaultValue != null)
{ {
source.AppendLine($"{bodyIndent}}}\n{bodyIndent}else\n{bodyIndent}{{"); source.AppendLine($"{bodyIndent}}}\n{bodyIndent}else\n{bodyIndent}{{");
source.AppendLine( source.AppendLine(
$"{bodyIndent} {property.Name} = {serializableFieldSaveFlagMethods.GetFieldDefaultValue.Name}();" $"{bodyIndent} {field.Name} = {serializableFieldSaveFlagMethods.GetFieldDefaultValue.Name}();"
); );
} }
@ -168,10 +176,16 @@ namespace SerializationGenerator
rule.GenerateDeserializationMethod( rule.GenerateDeserializationMethod(
source, source,
bodyIndent, bodyIndent,
property, field,
parentFieldOrProperty?.Name ?? "this" parentFieldOrProperty?.Name ?? "this"
); );
(rule as IPostDeserializeMethod)?.PostDeserializeMethod(source, bodyIndent, property, compilation, classSymbol); (rule as IPostDeserializeMethod)?.PostDeserializeMethod(
source,
bodyIndent,
field,
compilation,
classSymbol
);
} }
} }

View file

@ -29,6 +29,7 @@ namespace SerializationGenerator
string indent, string indent,
bool isOverride, bool isOverride,
bool encodedVersion, bool encodedVersion,
ImmutableArray<SerializableProperty> fields,
ImmutableArray<SerializableProperty> properties, ImmutableArray<SerializableProperty> properties,
SortedDictionary<int, SerializableFieldSaveFlagMethods> serializableFieldSaveFlagMethodsDictionary SortedDictionary<int, SerializableFieldSaveFlagMethods> serializableFieldSaveFlagMethodsDictionary
) )
@ -74,30 +75,34 @@ namespace SerializationGenerator
source.AppendLine($"{bodyIndent}writer.WriteEnum(saveFlags);"); source.AppendLine($"{bodyIndent}writer.WriteEnum(saveFlags);");
} }
foreach (var property in properties) for (var i = 0; i < properties.Length; i++)
{ {
var field = fields[i];
var property = properties[i];
if (serializableFieldSaveFlagMethodsDictionary.ContainsKey(property.Order)) if (serializableFieldSaveFlagMethodsDictionary.ContainsKey(property.Order))
{ {
// Special case // Special case
if (property.Type != "bool") if (property.Type != "bool")
{ {
source.AppendLine($"\n{bodyIndent}if ((saveFlags & SaveFlag.{property.Name}) != 0)\n{bodyIndent}{{"); source.AppendLine($"\n{bodyIndent}if ((saveFlags & SaveFlag.{property.Name}) != 0)\n{bodyIndent}{{");
SerializableMigrationRulesEngine.Rules[property.Rule].GenerateSerializationMethod( SerializableMigrationRulesEngine.Rules[property.Rule]
source, .GenerateSerializationMethod(
innerIndent, source,
property innerIndent,
); field
);
source.AppendLine($"{bodyIndent}}}"); source.AppendLine($"{bodyIndent}}}");
} }
} }
else else
{ {
source.AppendLine(); source.AppendLine();
SerializableMigrationRulesEngine.Rules[property.Rule].GenerateSerializationMethod( SerializableMigrationRulesEngine.Rules[property.Rule]
source, .GenerateSerializationMethod(
bodyIndent, source,
property bodyIndent,
); field
);
} }
} }

View file

@ -64,7 +64,7 @@ namespace SerializableMigration
if (fieldOrPropertySymbol is IFieldSymbol fieldSymbol) if (fieldOrPropertySymbol is IFieldSymbol fieldSymbol)
{ {
propertyName = fieldSymbol.GetPropertyName(); propertyName = fieldSymbol.Name;
propertyType = fieldSymbol.Type; propertyType = fieldSymbol.Type;
} }
else if (fieldOrPropertySymbol is IPropertySymbol propertySymbol) else if (fieldOrPropertySymbol is IPropertySymbol propertySymbol)

View file

@ -125,7 +125,6 @@ namespace Server.Network
return outputIdx; return outputIdx;
} }
public static int Compress(CircularBuffer<byte> input, CircularBuffer<byte> output) public static int Compress(CircularBuffer<byte> input, CircularBuffer<byte> output)
{ {
if (input.Length > DefiniteOverflow) if (input.Length > DefiniteOverflow)

View file

@ -110,7 +110,6 @@ namespace Server.Network
parentSerial = Serial.Zero; parentSerial = Serial.Zero;
} }
var writer = new SpanWriter(stackalloc byte[15]); var writer = new SpanWriter(stackalloc byte[15]);
writer.Write((byte)0x2E); // Packet ID writer.Write((byte)0x2E); // Packet ID
writer.Write(item.Serial); writer.Write(item.Serial);

View file

@ -484,7 +484,6 @@ namespace Server
break; break;
} }
num = BinaryPrimitives.ReadUInt16BigEndian(ip.Slice(byteIndex, 2)); num = BinaryPrimitives.ReadUInt16BigEndian(ip.Slice(byteIndex, 2));
byteIndex += 2; byteIndex += 2;

View file

@ -404,7 +404,6 @@ namespace Server.Commands
TryParse(p.PropertyType, value, out var toSet) ?? TryParse(p.PropertyType, value, out var toSet) ??
SetDirect(from, logobj, o, p, pname, toSet, shouldLog); SetDirect(from, logobj, o, p, pname, toSet, shouldLog);
private class PropsTarget : Target private class PropsTarget : Target
{ {
public PropsTarget() : base(-1, true, TargetFlags.None) public PropsTarget() : base(-1, true, TargetFlags.None)

View file

@ -69,7 +69,7 @@ namespace Server.Compression
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = $"{_pathToZstd}\\zstd.exe", FileName = Path.Combine(_pathToZstd, "zstd.exe"),
Arguments = $"--no-progress -10 \"{tempTarArchive}\" -o \"{destinationArchiveFileName}\"" Arguments = $"--no-progress -10 \"{tempTarArchive}\" -o \"{destinationArchiveFileName}\""
} }
}; };
@ -89,7 +89,7 @@ namespace Server.Compression
} }
} }
return TarArchive.CreateFromPaths(paths, destinationArchiveFileName, $"zstd -10", _pathToZstd); return TarArchive.CreateFromPaths(paths, destinationArchiveFileName, "zstd -10", _pathToZstd);
} }
} }
} }

View file

@ -31,7 +31,7 @@ namespace Server.Engines.BulkOrders
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
private bool _requireExceptional; private bool _requireExceptional;
[SerializableField(1)] [SerializableField(2)]
[InvalidateProperties] [InvalidateProperties]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster)]")]
private BulkMaterialType _material; private BulkMaterialType _material;

View file

@ -410,7 +410,6 @@ namespace Server.Engines.CannedEvil
} }
} }
// Justice reward // Justice reward
var pm = (PlayerMobile)killer; var pm = (PlayerMobile)killer;
for (var j = 0; j < pm.JusticeProtectors.Count; ++j) for (var j = 0; j < pm.JusticeProtectors.Count; ++j)

View file

@ -117,7 +117,6 @@ namespace Server.Gumps
} }
} }
public override void OnResponse(NetState sender, RelayInfo info) public override void OnResponse(NetState sender, RelayInfo info)
{ {
object toSet = null; object toSet = null;

View file

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

View file

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

View file

@ -114,7 +114,11 @@ namespace Server.Items
private ArmorProtectionLevel _protection = ArmorProtectionLevel.Regular; private ArmorProtectionLevel _protection = ArmorProtectionLevel.Regular;
// Field 14 // Field 14
private CraftResource _resource; [SerializableField(14, "private", "private")]
private CraftResource _rawResource;
[SerializableFieldSaveFlag(14)]
private bool ShouldSerializeResource() => _rawResource != DefaultResource;
// Field 15 // Field 15
private int _armorBase = -1; private int _armorBase = -1;
@ -163,8 +167,8 @@ namespace Server.Items
{ {
_crafter = null; _crafter = null;
_resource = DefaultResource; _rawResource = DefaultResource;
Hue = CraftResources.GetHue(_resource); Hue = CraftResources.GetHue(_rawResource);
_hitPoints = _maxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits); _hitPoints = _maxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
@ -268,41 +272,31 @@ namespace Server.Items
[SerializableFieldSaveFlag(13)] [SerializableFieldSaveFlag(13)]
private bool ShouldSerializeProtectionLevel() => _protection != ArmorProtectionLevel.Regular; private bool ShouldSerializeProtectionLevel() => _protection != ArmorProtectionLevel.Regular;
[SerializableField(14)]
[CommandProperty(AccessLevel.GameMaster)] [CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource public CraftResource Resource
{ {
get => _resource; get => _rawResource;
set set
{ {
if (_resource != value) if (_rawResource != value)
{ {
if (!World.Loading) UnscaleDurability();
{
UnscaleDurability();
}
RawResource = value;
_resource = value;
if (CraftItem.RetainsColor(GetType())) if (CraftItem.RetainsColor(GetType()))
{ {
Hue = CraftResources.GetHue(_resource); Hue = CraftResources.GetHue(_rawResource);
} }
Invalidate(); Invalidate();
(Parent as Mobile)?.UpdateResistances(); (Parent as Mobile)?.UpdateResistances();
if (!World.Loading)
{ ScaleDurability();
ScaleDurability();
}
} }
} }
} }
[SerializableFieldSaveFlag(14)]
private bool ShouldSerializeResource() => _resource != DefaultResource;
[SerializableFieldDefault(14)] [SerializableFieldDefault(14)]
private CraftResource ResourceDefaultValue() => DefaultResource; private CraftResource ResourceDefaultValue() => DefaultResource;
@ -339,7 +333,7 @@ namespace Server.Items
ar += 10 + 5 * (int)_protection; ar += 10 + 5 * (int)_protection;
} }
ar += _resource switch ar += _rawResource switch
{ {
CraftResource.DullCopper => 2, CraftResource.DullCopper => 2,
CraftResource.ShadowIron => 4, CraftResource.ShadowIron => 4,
@ -557,7 +551,6 @@ namespace Server.Items
public virtual CraftResource DefaultResource => CraftResource.Iron; public virtual CraftResource DefaultResource => CraftResource.Iron;
[Hue] [Hue]
[CommandProperty(AccessLevel.GameMaster)] [CommandProperty(AccessLevel.GameMaster)]
public override int Hue public override int Hue
@ -681,7 +674,7 @@ namespace Server.Items
{ {
try try
{ {
var res = CraftResources.GetInfo(_resource).ResourceTypes[0].CreateInstance<Item>(); var res = CraftResources.GetInfo(_rawResource).ResourceTypes[0].CreateInstance<Item>();
ScissorHelper(from, res, PlayerConstructed ? item.Resources[0].Amount / 2 : 1); ScissorHelper(from, res, PlayerConstructed ? item.Resources[0].Amount / 2 : 1);
return true; return true;
@ -887,7 +880,7 @@ namespace Server.Items
} }
public CraftAttributeInfo GetResourceAttrs() => public CraftAttributeInfo GetResourceAttrs() =>
CraftResources.GetInfo(_resource)?.AttributeInfo ?? CraftAttributeInfo.Blank; CraftResources.GetInfo(_rawResource)?.AttributeInfo ?? CraftAttributeInfo.Blank;
public int GetProtOffset() public int GetProtOffset()
{ {
@ -919,7 +912,7 @@ namespace Server.Items
{ {
bonus += ArmorAttributes.DurabilityBonus; bonus += ArmorAttributes.DurabilityBonus;
var resInfo = CraftResources.GetInfo(_resource); var resInfo = CraftResources.GetInfo(_rawResource);
CraftAttributeInfo attrInfo = null; CraftAttributeInfo attrInfo = null;
if (resInfo != null) if (resInfo != null)
@ -992,7 +985,7 @@ namespace Server.Items
var v = ArmorAttributes.LowerStatReq; var v = ArmorAttributes.LowerStatReq;
var info = CraftResources.GetInfo(_resource); var info = CraftResources.GetInfo(_rawResource);
var attrInfo = info?.AttributeInfo; var attrInfo = info?.AttributeInfo;
@ -1051,9 +1044,9 @@ namespace Server.Items
SkillBonuses.AddTo(m); SkillBonuses.AddTo(m);
} }
if (_resource == CraftResource.None) if (_rawResource == CraftResource.None)
{ {
_resource = DefaultResource; _rawResource = DefaultResource;
} }
var strBonus = ComputeStatBonus(StatType.Str); var strBonus = ComputeStatBonus(StatType.Str);
@ -1164,7 +1157,7 @@ namespace Server.Items
if (GetSaveFlag(flags, OldSaveFlag.Resource)) if (GetSaveFlag(flags, OldSaveFlag.Resource))
{ {
_resource = (CraftResource)reader.ReadEncodedInt(); _rawResource = (CraftResource)reader.ReadEncodedInt();
} }
if (GetSaveFlag(flags, OldSaveFlag.BaseArmor)) if (GetSaveFlag(flags, OldSaveFlag.BaseArmor))
@ -1370,7 +1363,7 @@ namespace Server.Items
public override void AddNameProperty(ObjectPropertyList list) public override void AddNameProperty(ObjectPropertyList list)
{ {
var oreType = _resource switch var oreType = _rawResource switch
{ {
CraftResource.DullCopper => 1053108, CraftResource.DullCopper => 1053108,
CraftResource.ShadowIron => 1053107, CraftResource.ShadowIron => 1053107,
@ -1430,7 +1423,7 @@ namespace Server.Items
return Attributes.SpellChanneling != 0; return Attributes.SpellChanneling != 0;
} }
public virtual int GetLuckBonus() => CraftResources.GetInfo(_resource)?.AttributeInfo?.ArmorLuck ?? 0; public virtual int GetLuckBonus() => CraftResources.GetInfo(_rawResource)?.AttributeInfo?.ArmorLuck ?? 0;
public override void GetProperties(ObjectPropertyList list) public override void GetProperties(ObjectPropertyList list)
{ {

View file

@ -25,8 +25,11 @@ namespace Server.Items
[Serializable(6, false)] [Serializable(6, false)]
public abstract partial class BaseClothing : Item, IDyable, IScissorable, IFactionItem, ICraftable, IWearableDurability public abstract partial class BaseClothing : Item, IDyable, IScissorable, IFactionItem, ICraftable, IWearableDurability
{ {
// Field 0 [SerializableField(0, "private", "private")]
private CraftResource _resource; private CraftResource _rawResource;
[SerializableFieldSaveFlag(0)]
private bool ShouldSerializeResource() => _rawResource != DefaultResource;
[SerializableField(1, setter: "private")] [SerializableField(1, setter: "private")]
[SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster, canModify: true)]")] [SerializableFieldAttr("[CommandProperty(AccessLevel.GameMaster, canModify: true)]")]
@ -113,7 +116,7 @@ namespace Server.Items
Layer = layer; Layer = layer;
Hue = hue; Hue = hue;
_resource = DefaultResource; _rawResource = DefaultResource;
_hitPoints = _maxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits); _hitPoints = _maxHitPoints = Utility.RandomMinMax(InitMinHits, InitMaxHits);
@ -123,23 +126,19 @@ namespace Server.Items
Resistances = new AosElementAttributes(this); Resistances = new AosElementAttributes(this);
} }
[SerializableField(0)]
[CommandProperty(AccessLevel.GameMaster)] [CommandProperty(AccessLevel.GameMaster)]
public CraftResource Resource public CraftResource Resource
{ {
get => _resource; get => _rawResource;
set set
{ {
_resource = value; RawResource = value;
Hue = CraftResources.GetHue(_resource); Hue = CraftResources.GetHue(_rawResource);
InvalidateProperties(); InvalidateProperties();
this.MarkDirty(); this.MarkDirty();
} }
} }
[SerializableFieldSaveFlag(0)]
private bool ShouldSerializeResource() => _resource != DefaultResource;
[SerializableField(10)] [SerializableField(10)]
[CommandProperty(AccessLevel.GameMaster)] [CommandProperty(AccessLevel.GameMaster)]
public int StrRequirement public int StrRequirement
@ -275,7 +274,7 @@ namespace Server.Items
{ {
try try
{ {
var info = CraftResources.GetInfo(_resource); var info = CraftResources.GetInfo(_rawResource);
var resourceType = info.ResourceTypes?[0] ?? item.Resources[0].ItemType; var resourceType = info.ResourceTypes?[0] ?? item.Resources[0].ItemType;
@ -658,7 +657,7 @@ namespace Server.Items
public override void AddNameProperty(ObjectPropertyList list) public override void AddNameProperty(ObjectPropertyList list)
{ {
var oreType = _resource switch var oreType = _rawResource switch
{ {
CraftResource.DullCopper => 1053108, CraftResource.DullCopper => 1053108,
CraftResource.ShadowIron => 1053107, CraftResource.ShadowIron => 1053107,
@ -971,11 +970,11 @@ namespace Server.Items
if (GetSaveFlag(flags, OldSaveFlag.Resource)) if (GetSaveFlag(flags, OldSaveFlag.Resource))
{ {
_resource = (CraftResource)reader.ReadEncodedInt(); _rawResource = (CraftResource)reader.ReadEncodedInt();
} }
else else
{ {
_resource = DefaultResource; _rawResource = DefaultResource;
} }
Attributes = new AosAttributes(this); Attributes = new AosAttributes(this);

View file

@ -975,7 +975,6 @@ namespace Server.Items
m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed); m_Blessed = GetSaveFlag(flags, SaveFlag.Blessed);
if (Parent is Mobile m) if (Parent is Mobile m)
{ {
Attributes.AddStatBonuses(m); Attributes.AddStatBonuses(m);

View file

@ -17,6 +17,11 @@
"ruleArguments": [ "ruleArguments": [
"" ""
] ]
},
{
"name": "Material",
"type": "Server.Engines.BulkOrders.BulkMaterialType",
"rule": "EnumMigrationRule"
} }
] ]
} }

View file

@ -13,7 +13,7 @@
] ]
}, },
{ {
"name": "Resource", "name": "RawResource",
"type": "Server.Items.CraftResource", "type": "Server.Items.CraftResource",
"rule": "EnumMigrationRule" "rule": "EnumMigrationRule"
} }

View file

@ -13,7 +13,7 @@
] ]
}, },
{ {
"name": "Resource", "name": "RawResource",
"type": "Server.Items.CraftResource", "type": "Server.Items.CraftResource",
"rule": "EnumMigrationRule" "rule": "EnumMigrationRule"
} }

View file

@ -117,7 +117,7 @@
"rule": "EnumMigrationRule" "rule": "EnumMigrationRule"
}, },
{ {
"name": "Resource", "name": "RawResource",
"type": "Server.Items.CraftResource", "type": "Server.Items.CraftResource",
"usesSaveFlag": true, "usesSaveFlag": true,
"rule": "EnumMigrationRule" "rule": "EnumMigrationRule"

View file

@ -3,7 +3,7 @@
"type": "Server.Items.BaseClothing", "type": "Server.Items.BaseClothing",
"properties": [ "properties": [
{ {
"name": "Resource", "name": "RawResource",
"type": "Server.Items.CraftResource", "type": "Server.Items.CraftResource",
"usesSaveFlag": true, "usesSaveFlag": true,
"rule": "EnumMigrationRule" "rule": "EnumMigrationRule"

View file

@ -719,7 +719,6 @@ namespace Server.Misc
public static bool VerifyProfession(int profession) => public static bool VerifyProfession(int profession) =>
profession >= 0 && (profession < 4 || Core.AOS && profession < 6 || Core.SE && profession < 8); profession >= 0 && (profession < 4 || Core.AOS && profession < 6 || Core.SE && profession < 8);
private static CityInfo GetStartLocation(CharacterCreatedEventArgs args, bool isYoung) private static CityInfo GetStartLocation(CharacterCreatedEventArgs args, bool isYoung)
{ {
if (Core.ML) if (Core.ML)
@ -1012,7 +1011,7 @@ namespace Server.Misc
//EquipItem(new DreadSword()); //NOT IMPLEMENTED //EquipItem(new DreadSword()); //NOT IMPLEMENTED
EquipItem(new GargishLeatherChestType1()); EquipItem(new GargishLeatherChestType1());
EquipItem(new GargishLeatherArmsType1()); EquipItem(new GargishLeatherArmsType1());
EquipItem(new GargishLeatherKiltType1()); EquipItem(new GargishLeatherKiltType1());
EquipItem(new GargishLeatherLegsType1()); EquipItem(new GargishLeatherLegsType1());
} }
else else
@ -1060,7 +1059,7 @@ namespace Server.Misc
//EquipItem(new GlassSword()); //NOT IMPLEMENTED //EquipItem(new GlassSword()); //NOT IMPLEMENTED
EquipItem(new GargishLeatherChestType1()); EquipItem(new GargishLeatherChestType1());
EquipItem(new GargishLeatherArmsType1()); EquipItem(new GargishLeatherArmsType1());
EquipItem(new GargishLeatherKiltType1()); EquipItem(new GargishLeatherKiltType1());
EquipItem(new GargishLeatherLegsType1()); EquipItem(new GargishLeatherLegsType1());
} }
else else
@ -1106,7 +1105,7 @@ namespace Server.Misc
//EquipItem(new GlassSword()); // IMPLEMENTION NEEDED //EquipItem(new GlassSword()); // IMPLEMENTION NEEDED
//EquipItem(new GargishStoneChestType1()); //EquipItem(new GargishStoneChestType1());
//EquipItem(new GargishStoneArmsType1()); //EquipItem(new GargishStoneArmsType1());
//EquipItem(new GargishStoneKiltType1()); //EquipItem(new GargishStoneKiltType1());
//EquipItem(new GargishStoneLegsType1()); //EquipItem(new GargishStoneLegsType1());
} }
else else
@ -1152,7 +1151,7 @@ namespace Server.Misc
//EquipItem(new GargishTalwar()); // IMPLEMENTION NEEDED //EquipItem(new GargishTalwar()); // IMPLEMENTION NEEDED
EquipItem(new GargishLeatherChestType1()); EquipItem(new GargishLeatherChestType1());
EquipItem(new GargishLeatherArmsType1()); EquipItem(new GargishLeatherArmsType1());
EquipItem(new GargishLeatherKiltType1()); EquipItem(new GargishLeatherKiltType1());
EquipItem(new GargishLeatherLegsType1()); EquipItem(new GargishLeatherLegsType1());
} }
else else
@ -1176,7 +1175,7 @@ namespace Server.Misc
case 7: // Ninja case 7: // Ninja
{ {
addSkillItems = false; addSkillItems = false;
int[] hues = { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89 }; int[] hues = { 0x1A8, 0xEC, 0x99, 0x90, 0xB5, 0x336, 0x89 };
// TODO: Verify that's ALL the hues for that above. // TODO: Verify that's ALL the hues for that above.
@ -1194,7 +1193,7 @@ namespace Server.Misc
//EquipItem(new DualPointedSpear()); //IMPLEMENTION NEEDED //EquipItem(new DualPointedSpear()); //IMPLEMENTION NEEDED
EquipItem(new GargishLeatherChestType1()); EquipItem(new GargishLeatherChestType1());
EquipItem(new GargishLeatherArmsType1()); EquipItem(new GargishLeatherArmsType1());
EquipItem(new GargishLeatherKiltType1()); EquipItem(new GargishLeatherKiltType1());
EquipItem(new GargishLeatherLegsType1()); EquipItem(new GargishLeatherLegsType1());
} }
else else

View file

@ -72,7 +72,6 @@ namespace Server.Network
return; return;
} }
e.Mobile.SendMessage("Packet 0x{0:X} throttle is currently {1}ms.", packetID, Delays[packetID]); e.Mobile.SendMessage("Packet 0x{0:X} throttle is currently {1}ms.", packetID, Delays[packetID]);
} }
@ -95,7 +94,6 @@ namespace Server.Network
return; return;
} }
if (delay > 5000) if (delay > 5000)
{ {
e.Mobile.SendMessage("Invalid Command Format. Delay cannot exceed 5000 milliseconds."); e.Mobile.SendMessage("Invalid Command Format. Delay cannot exceed 5000 milliseconds.");

View file

@ -767,7 +767,6 @@ namespace Server.Mobiles
} }
} }
public void ClearQuestArrow() => m_QuestArrow = null; public void ClearQuestArrow() => m_QuestArrow = null;
public override void ToggleFlying() public override void ToggleFlying()

View file

@ -37,7 +37,6 @@ namespace Server.Network
writer.Write((byte)0xBA); // Packet ID writer.Write((byte)0xBA); // Packet ID
writer.Write(command); writer.Write(command);
if (ns.HighSeas) if (ns.HighSeas)
{ {
writer.Write((short)x); writer.Write((short)x);

View file

@ -257,7 +257,6 @@ namespace Server.Spells
return false; return false;
} }
public static bool GetEastToWest(IPoint3D from,IPoint3D target) public static bool GetEastToWest(IPoint3D from,IPoint3D target)
{ {
var dx = from.X - target.X; var dx = from.X - target.X;

View file

@ -290,10 +290,10 @@ namespace Server.Saves
return; return;
} }
var extension = _compressionFormat.GetFileExtension();
var archivePath = Path.Combine(ArchivePath, archivePeriodStr); var archivePath = Path.Combine(ArchivePath, archivePeriodStr);
AssemblyHandler.EnsureDirectory(archivePath); AssemblyHandler.EnsureDirectory(archivePath);
var extension = _compressionFormat.GetFileExtension();
var archiveFilePath = Path.Combine(archivePath, $"{archiveNameNoExtension}{extension}"); var archiveFilePath = Path.Combine(archivePath, $"{archiveNameNoExtension}{extension}");
logger.Information($"Creating {archivePeriodStrLower} archive"); logger.Information($"Creating {archivePeriodStrLower} archive");