Repository navigation
Conversation
Spawn.DefensiveElement counts Defense.Elements, but it reads Damage.Elements. A spawn with <Defense> and no <Damage> throws an exception. A spawn with different lists gets its defensive element from the damage list. OffensiveElement and DefensiveElement now use one helper. The helper reads the list of the property. It returns None when the list is absent or empty.
ElementTable.xsd requires exactly 9 Source rows, each with exactly 9 Target entries. The world and ceridwen tables have 10 rows, because they include Undead. Both tables fail validation for this reason. This change does these things: - Source and Target accept 1 or more entries. - A new DefaultMultiplier attribute (default 1) applies to each pair that the table does not declare. - xs:unique rejects two Source rows with the same element. It also rejects two Target entries with the same element in one Source row. - ElementTable.GetMultiplier(source, target) returns the declared multiplier. It returns DefaultMultiplier if the Source row, the Target entry or the Multiplier attribute is missing. The test project copies the XSD files to its output directory. The tests use these files to validate tables against the schema.
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes two changes. Neither change breaks existing data or code.
1. Spawn.DefensiveElement reads the wrong list (HXML-25)
Spawn.DefensiveElementcountsDefense.Elements, but it readsDamage.Elements. The server uses this property inMonolith.csto set the defensive element of a spawned monster. The results are:<Defense>and no<Damage>throwsNullReferenceException.InvalidOperationException.Current content does not cause these errors. In
worldandceridwen, each spawn has the same elements in<Damage>and<Defense>.OffensiveElementandDefensiveElementnow use one helper. The helper reads the list of the property. It returnsNonewhen the list is absent or empty.2. Variable-size element table (HXML-24, part A)
ElementTable.xsdrequires exactly 9Sourcerows, each with exactly 9Targetentries. The element tables inworldandceridwenhave 10 rows, because they includeUndead. Both tables fail schema validation for this reason.SourceandTargetaccept 1 or more entries.DefaultMultiplierattribute on<ElementTable>(default1) applies to each pair that the table does not declare.xs:uniquerejects twoSourcerows with the same element. It also rejects twoTargetentries with the same element in one row.ElementTable.GetMultiplier(source, target), returns the declared multiplier. It returnsDefaultMultiplierif the row, the entry or theMultiplierattribute is missing.The
ElementTypeenum does not change in this PR. A later PR changes the element set.Generated code
tools/regenerate.shregeneratessrc/Objects/ElementTable.cs. The only change is the newDefaultMultiplierproperty (17 lines).The regeneration ran on Windows. On Windows, the script writes a different header path and different line endings (HXML-26). These differences were removed, so the file is the same as the output of a Linux run.
Tests
main.GetMultiplier. The test project now copiessrc/XSD/*.xsdto its output directory, so the tests validate against the schema that ships.main:LoadDataContainsExpectedData,LoadDataAsyncContainsExpectedDataandGetTotal. They expect 176 variant items, but the currentceridwendata gives 621.worldandceridwenelement tables pass validation against the new schema.Not in this PR
1.0.0-alpha2..First()and a fixed table name (HXML-7). After this PR is released, the server can useGetMultiplier.