diff --git a/Maple2.File.Parser/Maple2.File.Parser.csproj b/Maple2.File.Parser/Maple2.File.Parser.csproj index b69f6ef..785b24a 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.1.27 + 2.1.28 net8.0 README.md enable diff --git a/Maple2.File.Parser/TableParser.cs b/Maple2.File.Parser/TableParser.cs index 1f48d78..72b03c4 100644 --- a/Maple2.File.Parser/TableParser.cs +++ b/Maple2.File.Parser/TableParser.cs @@ -62,6 +62,7 @@ public class TableParser { private readonly XmlSerializer individualItemDropSerializer; private readonly XmlSerializer gachaInfoSerializer; private readonly XmlSerializer shopBeautyCouponSerializer; + private readonly XmlSerializer shopFurnishingSerializer; private readonly XmlSerializer meretmarketCategorySerializer; private readonly XmlSerializer expBaseSerializer; private readonly XmlSerializer nextExpSerializer; @@ -141,6 +142,7 @@ public TableParser(M2dReader xmlReader) { individualItemDropSerializer = new XmlSerializer(typeof(IndividualItemDropRoot)); gachaInfoSerializer = new XmlSerializer(typeof(GachaInfoRoot)); shopBeautyCouponSerializer = new XmlSerializer(typeof(ShopBeautyCouponRoot)); + shopFurnishingSerializer = new XmlSerializer(typeof(ShopFurnishingRoot)); meretmarketCategorySerializer = new XmlSerializer(typeof(MeretMarketCategoryRoot)); expBaseSerializer = new XmlSerializer(typeof(ExpBaseRoot)); nextExpSerializer = new XmlSerializer(typeof(NextExpRoot)); @@ -885,6 +887,28 @@ public IEnumerable ParseJobTable() { } } + public IEnumerable<(int ItemId, ShopFurnishing UgcItem)> ParseFurnishingShopUgcAll() { + string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/na/shop_ugcall.xml"))); + var reader = XmlReader.Create(new StringReader(xml)); + var data = shopFurnishingSerializer.Deserialize(reader) as ShopFurnishingRoot; + Debug.Assert(data != null); + + foreach (ShopFurnishing shop in data.key) { + yield return (shop.id, shop); + } + } + + public IEnumerable<(int ItemId, ShopFurnishing UgcItem)> ParseFurnishingShopMaid() { + string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/na/shop_maid.xml"))); + var reader = XmlReader.Create(new StringReader(xml)); + var data = shopFurnishingSerializer.Deserialize(reader) as ShopFurnishingRoot; + Debug.Assert(data != null); + + foreach (ShopFurnishing shop in data.key) { + yield return (shop.id, shop); + } + } + public IEnumerable<(int CategoryId, MeretMarketCategory Category)> ParseMeretMarketCategory() { string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/na/meratmarketcategory.xml"))); var reader = XmlReader.Create(new StringReader(xml)); diff --git a/Maple2.File.Parser/Xml/Table/ShopFurnishing.cs b/Maple2.File.Parser/Xml/Table/ShopFurnishing.cs new file mode 100644 index 0000000..5d77701 --- /dev/null +++ b/Maple2.File.Parser/Xml/Table/ShopFurnishing.cs @@ -0,0 +1,23 @@ +using System.Xml.Serialization; +using M2dXmlGenerator; + +namespace Maple2.File.Parser.Xml.Table; + +// ./data/xml/table/na/shop_ugcall.xml +// ./data/xml/table/na/shop_maid.xml +[XmlRoot("ms2")] +public partial class ShopFurnishingRoot { + [M2dFeatureLocale(Selector = "id")] private IList _key; +} + +public partial class ShopFurnishing : IFeatureLocale { + [XmlAttribute] public int id; + [XmlAttribute] public bool ugcHousingBuy; + [M2dEnum] public HousingMoneyType ugcHousingMoneyType = HousingMoneyType.Meso; + [XmlAttribute] public int ugcHousingDefaultPrice; +} + +public enum HousingMoneyType { + Meso = 1, + Meret = 3, +} diff --git a/Maple2.File.Tests/TableParserTest.cs b/Maple2.File.Tests/TableParserTest.cs index 85d2f21..630a310 100644 --- a/Maple2.File.Tests/TableParserTest.cs +++ b/Maple2.File.Tests/TableParserTest.cs @@ -515,6 +515,24 @@ public void TestShopBeautyCoupon() { } } + [TestMethod] + public void TestShopFurnishingUgcAll() { + var parser = new TableParser(TestUtils.XmlReader); + + foreach ((_, _) in parser.ParseFurnishingShopUgcAll()) { + continue; + } + } + + [TestMethod] + public void TestShopFurnishingMaid() { + var parser = new TableParser(TestUtils.XmlReader); + + foreach ((_, _) in parser.ParseFurnishingShopMaid()) { + continue; + } + } + [TestMethod] public void TestMeretMarketCategory() { var parser = new TableParser(TestUtils.XmlReader);