Uh oh!
There was an error while loading. Please reload this page.
forked from kOchirasu/Maple2.File
- Notifications
You must be signed in to change notification settings - Fork 8
Parse Limit Break Table, misc fixes on Shops#30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -40,6 +40,7 @@ public class ServerTableParser { | ||
| private readonly XmlSerializer timeEventDataSerializer; | ||
| private readonly XmlSerializer oxQuizSerializer; | ||
| private readonly XmlSerializer gameEventSerializer; | ||
| private readonly XmlSerializer unlimitedEnchantOptionSerializer; | ||
| public ServerTableParser(M2dReader xmlReader) { | ||
| this.xmlReader = xmlReader; | ||
| @@ -73,6 +74,7 @@ public ServerTableParser(M2dReader xmlReader) { | ||
| timeEventDataSerializer = new XmlSerializer(typeof(TimeEventDataRoot)); | ||
| oxQuizSerializer = new XmlSerializer(typeof(OxQuizRoot)); | ||
| gameEventSerializer = new XmlSerializer(typeof(GameEventRoot)); | ||
| unlimitedEnchantOptionSerializer = new XmlSerializer(typeof(UnlimitedEnchantOptionRoot)); | ||
| // var seen = new HashSet<string>(); | ||
| // this.bankTypeSerializer.UnknownAttribute += (sender, args) => { | ||
| @@ -565,4 +567,15 @@ public ServerTableParser(M2dReader xmlReader) { | ||
| yield return (entry.gameEventID, entry); | ||
| } | ||
| } | ||
| public IEnumerable<(int Slot, IDictionary<int[], UnlimitedEnchantOption> EnchantOptions)> ParseUnlimitedEnchantOption() { | ||
| string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/UnlimitedEnchantOption.xml"))); | ||
| var reader = XmlReader.Create(new StringReader(xml)); | ||
| var data = unlimitedEnchantOptionSerializer.Deserialize(reader) as UnlimitedEnchantOptionRoot; | ||
| Debug.Assert(data != null); | ||
| foreach (IGrouping<int, UnlimitedEnchantOption> group in data.option.GroupBy(option => option.slot)) { | ||
| yield return (group.Key, group.ToDictionary(option => option.grade)); | ||
| } | ||
| } | ||
AngeloTadeucci marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
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
35 changes: 35 additions & 0 deletions
35 Maple2.File.Parser/Xml/Table/Server/UnlimitedEnchantOption.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| using System.Xml.Serialization; | ||
| using M2dXmlGenerator; | ||
| using Maple2.File.Parser.Enum; | ||
| using DayOfWeek = Maple2.File.Parser.Enum.DayOfWeek; | ||
| namespace Maple2.File.Parser.Xml.Table.Server; | ||
| // ./data/server/table/Server/UnlimitedEnchantOption.xml | ||
| [XmlRoot("ms2")] | ||
| public partial class UnlimitedEnchantOptionRoot { | ||
| [M2dFeatureLocale(Selector = "slot|grade")] private IList<UnlimitedEnchantOption> _option; | ||
| } | ||
AngeloTadeucci marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| public partial class UnlimitedEnchantOption : IFeatureLocale { | ||
| [XmlAttribute] public int slot; | ||
| [M2dArray(Delimiter = '-')] public int[] grade = Array.Empty<int>(); | ||
| [XmlAttribute] public int option1; | ||
| [XmlAttribute] public float rate1; | ||
| [XmlAttribute] public int value1; | ||
| [XmlAttribute] public int option2; | ||
| [XmlAttribute] public float rate2; | ||
| [XmlAttribute] public int value2; | ||
| [XmlAttribute] public int option3; | ||
| [XmlAttribute] public float rate3; | ||
| [XmlAttribute] public int value3; | ||
| [XmlAttribute] public int option4; | ||
| [XmlAttribute] public float rate4; | ||
| [XmlAttribute] public int value4; | ||
| [XmlAttribute] public int sa_option1; | ||
| [XmlAttribute] public float sa_rate1; | ||
| [XmlAttribute] public int sa_value1; | ||
| [XmlAttribute] public int sa_option2; | ||
| [XmlAttribute] public float sa_rate2; | ||
| [XmlAttribute] public int sa_value2; | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -354,4 +354,13 @@ public void TestGameEvent() { | ||
| continue; | ||
| } | ||
| } | ||
| [TestMethod] | ||
| public void TestUnlimitedEnchantOption() { | ||
| var parser = new ServerTableParser(TestUtils.ServerReader); | ||
| foreach ((_, _) in parser.ParseUnlimitedEnchantOption()) { | ||
| continue; | ||
| } | ||
| } | ||
AngeloTadeucci marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.