diff --git a/Maple2.File.Parser/Maple2.File.Parser.csproj b/Maple2.File.Parser/Maple2.File.Parser.csproj index 015673c..50686d0 100644 --- a/Maple2.File.Parser/Maple2.File.Parser.csproj +++ b/Maple2.File.Parser/Maple2.File.Parser.csproj @@ -13,7 +13,7 @@ MapleStory2, File, Parser, m2d, xml true - 2.3.1 + 2.3.2 net8.0 README.md enable diff --git a/Maple2.File.Parser/TableParser.cs b/Maple2.File.Parser/TableParser.cs index f7394c0..d81b1a7 100644 --- a/Maple2.File.Parser/TableParser.cs +++ b/Maple2.File.Parser/TableParser.cs @@ -101,6 +101,7 @@ public class TableParser { private readonly XmlSerializer smartPushSerializer; private readonly XmlSerializer seasonDataSerializer; private readonly XmlSerializer statStringSerializer; + private readonly XmlSerializer autoActionPricePackageSerializer; private readonly string locale; private readonly string language; @@ -196,6 +197,7 @@ public TableParser(M2dReader xmlReader, string language) { smartPushSerializer = new XmlSerializer(typeof(SmartPushRoot)); seasonDataSerializer = new XmlSerializer(typeof(SeasonDataRoot)); statStringSerializer = new XmlSerializer(typeof(StatStringRoot)); + autoActionPricePackageSerializer = new XmlSerializer(typeof(AutoActionPricePackageRoot)); locale = FeatureLocaleFilter.Locale.ToLower(); this.language = language; @@ -1539,4 +1541,15 @@ public IEnumerable ParseJobTableNew() { yield return (entry.id, entry); } } + + public IEnumerable<(int Id, AutoActionPricePackage Data)> ParseAutoActionPricePackage() { + string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry($"table/{locale}/autoactionpricepackage.xml"))); + var reader = XmlReader.Create(new StringReader(xml)); + var data = autoActionPricePackageSerializer.Deserialize(reader) as AutoActionPricePackageRoot; + Debug.Assert(data != null); + + foreach (AutoActionPricePackage entry in data.package) { + yield return (entry.id, entry); + } + } } diff --git a/Maple2.File.Parser/Xml/Table/AutoActionPricePackage.cs b/Maple2.File.Parser/Xml/Table/AutoActionPricePackage.cs new file mode 100644 index 0000000..6da642d --- /dev/null +++ b/Maple2.File.Parser/Xml/Table/AutoActionPricePackage.cs @@ -0,0 +1,17 @@ +using System.Xml.Serialization; + +namespace Maple2.File.Parser.Xml.Table; + +// ./data/xml/table/{locale}/autoactionpricepackage.xml +[XmlRoot("ms2")] +public class AutoActionPricePackageRoot { + [XmlElement] public List package; +} + +public class AutoActionPricePackage { + [XmlAttribute] public string content = string.Empty; + [XmlAttribute] public int id; + [XmlAttribute] public int duration; + [XmlAttribute] public long merat; + [XmlAttribute] public long meso; +} diff --git a/Maple2.File.Tests/TableParserTest.cs b/Maple2.File.Tests/TableParserTest.cs index ec779ba..3930e64 100644 --- a/Maple2.File.Tests/TableParserTest.cs +++ b/Maple2.File.Tests/TableParserTest.cs @@ -718,5 +718,12 @@ public void TestSeasonData() { continue; } } + + [TestMethod] + public void TestAutoActionPackage() { + foreach ((_, _) in _parser.ParseAutoActionPricePackage()) { + continue; + } + } }