Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Maple2.File.Parser/Maple2.File.Parser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageTags>MapleStory2, File, Parser, m2d, xml</PackageTags>
<!-- Use following lines to write the generated files to disk. -->
<EmitCompilerGeneratedFiles Condition=" '$(Configuration)' == 'Debug' ">true</EmitCompilerGeneratedFiles>
<PackageVersion>2.1.27</PackageVersion>
<PackageVersion>2.1.28</PackageVersion>
<TargetFramework>net8.0</TargetFramework>
<PackageReadmeFile>README.md</PackageReadmeFile>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
24 changes: 24 additions & 0 deletions Maple2.File.Parser/TableParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -885,6 +887,28 @@ public IEnumerable<JobTable> 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));
Expand Down
23 changes: 23 additions & 0 deletions Maple2.File.Parser/Xml/Table/ShopFurnishing.cs
Original file line number Diff line number Diff line change
@@ -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<ShopFurnishing> _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,
}
18 changes: 18 additions & 0 deletions Maple2.File.Tests/TableParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,24 @@ public void TestShopBeautyCoupon() {
}
}

[TestMethod]
public void TestShopFurnishingUgcAll() {
var parser = new TableParser(TestUtils.XmlReader);

foreach ((_, _) in parser.ParseFurnishingShopUgcAll()) {
continue;
}
}
Comment thread
AngeloTadeucci marked this conversation as resolved.

[TestMethod]
public void TestShopFurnishingMaid() {
var parser = new TableParser(TestUtils.XmlReader);

foreach ((_, _) in parser.ParseFurnishingShopMaid()) {
continue;
}
}
Comment thread
AngeloTadeucci marked this conversation as resolved.

[TestMethod]
public void TestMeretMarketCategory() {
var parser = new TableParser(TestUtils.XmlReader);
Expand Down