From 13482cb294272e18d55283c4ded0e9cc0c7e4be7 Mon Sep 17 00:00:00 2001 From: Zin <62830952+Zintixx@users.noreply.github.com> Date: Sun, 2 Aug 2026 14:55:59 -0700 Subject: [PATCH 1/2] ParseConstant: discover itemoptionconstant_* files instead of a hardcoded suffix list Enumerate all itemoption/constant/itemoptionconstant_* pack entries (matching the pattern already used by ItemParser/AchieveParser/MapParser/etc.) rather than iterating a fixed constantSuffix array. This auto-discovers any constant file (including custom merge files) with no list to maintain, and skips missing files instead of throwing on GetEntry. Removes the now-dead constantSuffix array and bumps the package to 2.4.20. Co-Authored-By: Claude Opus 4.8 (1M context) --- Maple2.File.Parser/ItemOptionParser.cs | 17 +++-------------- Maple2.File.Parser/Maple2.File.Parser.csproj | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Maple2.File.Parser/ItemOptionParser.cs b/Maple2.File.Parser/ItemOptionParser.cs index 681fbdd..f784114 100644 --- a/Maple2.File.Parser/ItemOptionParser.cs +++ b/Maple2.File.Parser/ItemOptionParser.cs @@ -2,6 +2,7 @@ using System.Xml; using System.Xml.Serialization; using Maple2.File.IO; +using Maple2.File.IO.Crypto.Common; using Maple2.File.Parser.Tools; using Maple2.File.Parser.Xml; using Maple2.File.Parser.Xml.Table; @@ -9,17 +10,6 @@ namespace Maple2.File.Parser; public class ItemOptionParser { - private readonly string[] constantSuffix = [ - "equip", - "equip_fighter", - "equip_pet", - "equip_s2", - "equipmanual", - "etc", - "gemstone", - "mergematerial", - "skin", - ]; private readonly string[] randomSuffix = [ "12", "13", @@ -114,9 +104,8 @@ public ItemOptionParser(M2dReader xmlReader) { } public IEnumerable ParseConstant() { - foreach (string suffix in constantSuffix) { - string filename = $"itemoption/constant/itemoptionconstant_{suffix}.xml"; - string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry(filename))); + foreach (PackFileEntry entry in xmlReader.Files.Where(entry => entry.Name.StartsWith("itemoption/constant/itemoptionconstant_"))) { + string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(entry)); var reader = XmlReader.Create(new StringReader(xml)); var root = itemOptionConstantSerializer.Deserialize(reader) as ItemOptionConstantRoot; Debug.Assert(root != null); diff --git a/Maple2.File.Parser/Maple2.File.Parser.csproj b/Maple2.File.Parser/Maple2.File.Parser.csproj index b9dd719..ca4bb7a 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.4.18 + 2.4.20 net8.0 README.md enable From f6a93dadee871e834257205ee559de6a8adeed5a Mon Sep 17 00:00:00 2001 From: Zintixx <62830952+Zintixx@users.noreply.github.com> Date: Sun, 2 Aug 2026 21:57:18 +0000 Subject: [PATCH 2/2] style: auto-format whitespace --- Maple2.File.Parser/Xml/Map/MapXBlock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maple2.File.Parser/Xml/Map/MapXBlock.cs b/Maple2.File.Parser/Xml/Map/MapXBlock.cs index fcf25d9..82cbe89 100644 --- a/Maple2.File.Parser/Xml/Map/MapXBlock.cs +++ b/Maple2.File.Parser/Xml/Map/MapXBlock.cs @@ -1,4 +1,4 @@ -using System.Numerics; +using System.Numerics; using System.Xml.Serialization; using M2dXmlGenerator;