Skip to content

Commit

Permalink
small corrections for restrictions; additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baughj committed Aug 21, 2023
1 parent 2c4106d commit faf672f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Hybrasyl.Xml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<TargetFramework>net7.0</TargetFramework>
<AssemblyName>Hybrasyl.Xml</AssemblyName>
<RootNamespace>Hybrasyl.Xml</RootNamespace>
<PackageVersion>0.9.3.15</PackageVersion>
<Version>0.9.3.15</Version>
<PackageVersion>0.9.3.17</PackageVersion>
<Version>0.9.3.17</Version>
<BuildDocFx Condition="'$(Configuration)'=='Debug'">false</BuildDocFx>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Authors>ERISCO LLC</Authors>
Expand All @@ -15,6 +15,7 @@
<Tags>Hybrasyl</Tags>
<PackageLicenseExpression>AGPL-3.0-only</PackageLicenseExpression>
<Icon>hybrasyl-512x512.png</Icon>
<PackageIcon>hybrasyl-512x512.png</PackageIcon>
<Copyright>Copyright (C) ERISCO LLC</Copyright>
<Title>Hybrasyl XML Entities</Title>
<Description>Hybrasyl's data model &amp; XML entities, used to deserialize and work with Hybrasyl game data.</Description>
Expand Down
9 changes: 8 additions & 1 deletion src/Objects/EquipmentRestriction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// Generated by Xsd2Code++. Version 6.0.74.0. www.xsd2code.com
// </auto-generated>
// ------------------------------------------------------------------------------

using System.Linq;

#pragma warning disable
namespace Hybrasyl.Xml.Objects
{
Expand Down Expand Up @@ -34,7 +37,11 @@ public partial class EquipmentRestriction : HybrasylEntity<EquipmentRestriction>
private string _value;
#endregion


public EquipmentRestriction()
{
_weaponType = Objects.WeaponType.None;
}

[XmlAttribute]
public WeaponType WeaponType
{
Expand Down
4 changes: 2 additions & 2 deletions src/XSD/Castable.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@
<xs:complexType name="EquipmentRestriction">
<xs:simpleContent>
<xs:extension base="hyb:String8">
<xs:attribute name="WeaponType" type="hyb:WeaponType" use="optional"/>
<xs:attribute name="WeaponType" type="hyb:WeaponType" use="optional" default="None"/>
<xs:attribute name="Slot" type="hyb:EquipmentSlot" use="required" />
<xs:attribute name="RestrictionType" type="hyb:RestrictionType" use="optional" />
<xs:attribute name="RestrictionType" type="hyb:RestrictionType" use="required" />
<xs:attribute name="Message" type="hyb:String8" use="optional" />
</xs:extension>
</xs:simpleContent>
Expand Down
9 changes: 9 additions & 0 deletions tests/XmlEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,13 @@ public void VariantBeltElementalTest()
Assert.True(belt.Properties.StatModifiers.BaseDefensiveElement == ElementType.Light );
}

[Fact]
public void EquipmentRestrictionWeaponTypeDefaultNone()
{
var restriction = new EquipmentRestriction();
Assert.Equal(WeaponType.None, restriction.WeaponType);
var castable = fixture.SyncManager.GetByIndex<Castable>("TestRequireWeapon");
Assert.Equal(WeaponType.None, castable.Restrictions.First().WeaponType);
}

}
2 changes: 1 addition & 1 deletion tests/XmlManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private void ContainsExpectedData(XmlDataManager manager)
$"Element Tables: {manager.Count<ElementTable>()} Server Configs: {manager.Count<ServerConfig>()} Localization Files: {manager.Count<Localization>()}");
Assert.Equal(Directory.GetFiles(Path.Join(manager.RootPath, "castables"), "*.xml").Length,
manager.Count<Castable>());
Assert.Equal(163, manager.Count<Item>());
Assert.Equal(167, manager.Count<Item>());
Assert.Equal(Directory.GetFiles(Path.Join(manager.RootPath, "npcs"), "*.xml").Length, manager.Count<Npc>());
Assert.Equal(Directory.GetFiles(Path.Join(manager.RootPath, "maps"), "*.xml").Length, manager.Count<Map>());
Assert.Equal(17, manager.Count<Creature>());
Expand Down

0 comments on commit faf672f

Please sign in to comment.