Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 8
Parse Server Item Options Tables#38
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -45,6 +45,9 @@ public class ServerTableParser { | ||
| private readonly XmlSerializer enchantOptionSerializer; | ||
| private readonly XmlSerializer shopMeretSerializer; | ||
| private readonly XmlSerializer shopMeretCustomSerializer; | ||
| private readonly XmlSerializer itemOptionProbabilitySerializer; | ||
| private readonly XmlSerializer itemOptionVariationSerializer; | ||
| private readonly XmlSerializer itemOptionRandomSerializer; | ||
| public ServerTableParser(M2dReader xmlReader) { | ||
| this.xmlReader = xmlReader; | ||
| @@ -83,6 +86,9 @@ public ServerTableParser(M2dReader xmlReader) { | ||
| enchantOptionSerializer = new XmlSerializer(typeof(EnchantOptionRoot)); | ||
| shopMeretSerializer = new XmlSerializer(typeof(ShopMeretRoot)); | ||
| shopMeretCustomSerializer = new XmlSerializer(typeof(ShopMeretCustomRoot)); | ||
| itemOptionProbabilitySerializer = new XmlSerializer(typeof(ItemOptionProbabilityRoot)); | ||
| itemOptionVariationSerializer = new XmlSerializer(typeof(ItemOptionVariationRoot)); | ||
| itemOptionRandomSerializer = new XmlSerializer(typeof(ItemOptionRandomRoot)); | ||
| // var seen = new HashSet<string>(); | ||
| // this.bankTypeSerializer.UnknownAttribute += (sender, args) => { | ||
| @@ -640,4 +646,37 @@ public ServerTableParser(M2dReader xmlReader) { | ||
| yield return (shopMeret.id, shopMeret); | ||
| } | ||
| } | ||
| public IEnumerable<(string Name, ItemOptionProbability Option)> ParseItemOptionProbability() { | ||
| string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/itemOptionProbability.xml"))); | ||
| var reader = XmlReader.Create(new StringReader(xml)); | ||
| var data = itemOptionProbabilitySerializer.Deserialize(reader) as ItemOptionProbabilityRoot; | ||
| Debug.Assert(data != null); | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| foreach (ItemOptionProbability option in data.option) { | ||
AngeloTadeucci marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| yield return (option.name, option); | ||
| } | ||
| } | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| public IEnumerable<(int Id, ItemOptionVariation Option)> ParseItemOptionVariation() { | ||
| string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/itemOptionVariation.xml"))); | ||
AngeloTadeucci marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| var reader = XmlReader.Create(new StringReader(xml)); | ||
| var data = itemOptionVariationSerializer.Deserialize(reader) as ItemOptionVariationRoot; | ||
| Debug.Assert(data != null); | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| foreach (ItemOptionVariation option in data.option) { | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| yield return (option.id, option); | ||
| } | ||
| } | ||
| public IEnumerable<(int Id, ItemOptionRandom Option)> ParseItemOptionRandom() { | ||
| string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/ItemOptionRandom.xml"))); | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| var reader = XmlReader.Create(new StringReader(xml)); | ||
| var data = itemOptionRandomSerializer.Deserialize(reader) as ItemOptionRandomRoot; | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Debug.Assert(data != null); | ||
| foreach (ItemOptionRandom option in data.option) { | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| yield return (option.code, option); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| using System.Xml.Serialization; | ||
| namespace Maple2.File.Parser.Xml.Table.Server; | ||
| // ./data/server/table/Server/itemOptionProbability.xml | ||
| [XmlRoot("ms2")] | ||
| public class ItemOptionProbabilityRoot { | ||
| [XmlElement] public List<ItemOptionProbability> option; | ||
| } | ||
| public partial class ItemOptionProbability { | ||
| [XmlAttribute] public string name = string.Empty; | ||
| [XmlAttribute] public int weaponProbability; | ||
| [XmlAttribute] public int armorProbability; | ||
| [XmlAttribute] public int accProbability; | ||
| [XmlAttribute] public int petProbability; | ||
| } | ||
AngeloTadeucci marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System.Xml.Serialization; | ||
| namespace Maple2.File.Parser.Xml.Table.Server; | ||
| // ./data/server/table/Server/itemOptionRandom.xml | ||
| [XmlRoot("ms2")] | ||
| public class ItemOptionRandomRoot { | ||
| [XmlElement] public List<ItemOptionRandom> option; | ||
| } | ||
| public class ItemOptionRandom { | ||
| [XmlAttribute] public int code; | ||
| [XmlAttribute] public int statGroup; | ||
| [XmlAttribute] public int levelGroupID; | ||
| [XmlAttribute] public int pickCount; | ||
| [XmlAttribute] public bool isRarePickOne; | ||
| [XmlAttribute] public int copyID; | ||
| [XmlElement] public List<ItemOptionStat> v; | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| public class ItemOptionStat { | ||
| [XmlAttribute] public string name = string.Empty; | ||
| [XmlAttribute] public int weight = 1; | ||
| [XmlAttribute] public int statID; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using System.Xml.Serialization; | ||
| namespace Maple2.File.Parser.Xml.Table.Server; | ||
| // ./data/server/table/Server/itemOptionVariation.xml | ||
| [XmlRoot("ms2")] | ||
| public class ItemOptionVariationRoot { | ||
| [XmlElement] public List<ItemOptionVariation> option; | ||
| } | ||
| public class ItemOptionVariation { | ||
| [XmlAttribute] public int id; | ||
| [XmlAttribute] public int multipleID; | ||
| [XmlAttribute] public int groupType; | ||
| [XmlAttribute] public string name = string.Empty; | ||
| [XmlAttribute] public int levelGroupID; | ||
| [XmlAttribute] public int highStat; | ||
| [XmlAttribute] public int isRateType; | ||
| [XmlElement] public List<ItemOptionStat> v; | ||
| public class ItemOptionStat { | ||
| [XmlAttribute] public int stat; | ||
| [XmlAttribute] public int weight = 1; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -408,4 +408,31 @@ public void TestMeretShopCustom() { | ||
| continue; | ||
| } | ||
| } | ||
| [TestMethod] | ||
| public void TestItemOptionProbability() { | ||
| var parser = new ServerTableParser(TestUtils.ServerReader); | ||
| foreach ((_, _) in parser.ParseItemOptionProbability()) { | ||
| continue; | ||
| } | ||
| } | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| [TestMethod] | ||
| public void TestItemOptionVariation() { | ||
| var parser = new ServerTableParser(TestUtils.ServerReader); | ||
| foreach ((_, _) in parser.ParseItemOptionVariation()) { | ||
| continue; | ||
| } | ||
| } | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| [TestMethod] | ||
| public void TestItemOptionRandom() { | ||
| var parser = new ServerTableParser(TestUtils.ServerReader); | ||
| foreach ((_, _) in parser.ParseItemOptionRandom()) { | ||
| continue; | ||
| } | ||
| } | ||
Zintixx marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.