From f14a41801bed66f8ccb6b44f0a68333719aab0b7 Mon Sep 17 00:00:00 2001 From: Zin <62830952+Zintixx@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:36:25 -0700 Subject: [PATCH 1/3] fix sanitize --- Maple2.File.Parser/Maple2.File.Parser.csproj | 2 +- Maple2.File.Parser/ServerTableParser.cs | 4 ++-- .../Xml/Table/Server/QuestScriptCondition.cs | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Maple2.File.Parser/Maple2.File.Parser.csproj b/Maple2.File.Parser/Maple2.File.Parser.csproj index cad8c65..70a3d6a 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.2.5 + 2.2.6 net8.0 README.md enable diff --git a/Maple2.File.Parser/ServerTableParser.cs b/Maple2.File.Parser/ServerTableParser.cs index 5519e48..ee0a914 100644 --- a/Maple2.File.Parser/ServerTableParser.cs +++ b/Maple2.File.Parser/ServerTableParser.cs @@ -100,7 +100,7 @@ public ServerTableParser(M2dReader xmlReader) { } public IEnumerable<(int NpcId, IDictionary ScriptConditions)> ParseNpcScriptCondition() { - string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/npcScriptCondition_Final.xml"))); + string xml = xmlReader.GetString(xmlReader.GetEntry("table/Server/npcScriptCondition_Final.xml")); var reader = XmlReader.Create(new StringReader(xml)); var data = npcScriptConditionSerializer.Deserialize(reader) as NpcScriptConditionRoot; Debug.Assert(data != null); @@ -111,7 +111,7 @@ public ServerTableParser(M2dReader xmlReader) { } public IEnumerable<(int QuestId, IDictionary ScriptConditions)> ParseQuestScriptCondition() { - string xml = Sanitizer.RemoveEmpty(xmlReader.GetString(xmlReader.GetEntry("table/Server/QuestScriptCondition_final.xml"))); + string xml = xmlReader.GetString(xmlReader.GetEntry("table/Server/QuestScriptCondition_final.xml")); var reader = XmlReader.Create(new StringReader(xml)); var data = questScriptConditionSerializer.Deserialize(reader) as QuestScriptConditionRoot; Debug.Assert(data != null); diff --git a/Maple2.File.Parser/Xml/Table/Server/QuestScriptCondition.cs b/Maple2.File.Parser/Xml/Table/Server/QuestScriptCondition.cs index 6c40a56..238957e 100644 --- a/Maple2.File.Parser/Xml/Table/Server/QuestScriptCondition.cs +++ b/Maple2.File.Parser/Xml/Table/Server/QuestScriptCondition.cs @@ -19,17 +19,17 @@ public partial class QuestScriptCondition : IFeatureLocale { [XmlAttribute] public string maid_mood_time = string.Empty; [XmlAttribute] public string maid_affinity_time = string.Empty; [XmlAttribute] public int maid_affinity_grade = 0; - [XmlAttribute] public int privilege; - [XmlAttribute] public int panelty; + [XmlAttribute] public int privilege = -1; + [XmlAttribute] public int panelty = -1; [M2dArray] public short[] job = Array.Empty(); [XmlAttribute] public string level = string.Empty; [M2dArray] public string[] quest_start = Array.Empty(); [M2dArray] public string[] quest_complete = Array.Empty(); [M2dArray] public string[] item = Array.Empty(); [M2dArray] public string[] itemCount = Array.Empty(); - [XmlAttribute] public int weddingState; - [XmlAttribute] public int weddingHallBooking; - [XmlAttribute] public int marriageDate; + [XmlAttribute] public int weddingState = -1; + [XmlAttribute] public int weddingHallBooking = -1; + [XmlAttribute] public int marriageDate = -1; [XmlAttribute] public string weddingHallEntryType = string.Empty; [XmlAttribute] public string weddingHallState = string.Empty; [XmlAttribute] public string coolingOff = string.Empty; From f3de6656fe800a205be614c3636a885a93277460 Mon Sep 17 00:00:00 2001 From: Zin <62830952+Zintixx@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:46:43 -0700 Subject: [PATCH 2/3] fix sanitize (#47) From a970bafd66c1ee457f52ee5adb7e47a26325feae Mon Sep 17 00:00:00 2001 From: Zin <62830952+Zintixx@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:23:26 -0700 Subject: [PATCH 3/3] Fix: Compare Range --- Maple2.File.Parser/Maple2.File.Parser.csproj | 2 +- Maple2.File.Parser/Xml/Skill/CompareRange.cs | 40 ++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Maple2.File.Parser/Maple2.File.Parser.csproj b/Maple2.File.Parser/Maple2.File.Parser.csproj index 70a3d6a..0ec45ff 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.2.6 + 2.2.7 net8.0 README.md enable diff --git a/Maple2.File.Parser/Xml/Skill/CompareRange.cs b/Maple2.File.Parser/Xml/Skill/CompareRange.cs index 94717b2..2a22d40 100644 --- a/Maple2.File.Parser/Xml/Skill/CompareRange.cs +++ b/Maple2.File.Parser/Xml/Skill/CompareRange.cs @@ -2,6 +2,7 @@ namespace Maple2.File.Parser.Xml.Skill; +[XmlType(Namespace = "Common")] public class CompareRange { [XmlAttribute] public float str; [XmlAttribute] public float dex; @@ -43,4 +44,43 @@ public class CompareRange { [XmlAttribute] public string func = string.Empty; [XmlAttribute] public int type; + + public float this[byte i] => i switch { + 0 => str, + 1 => dex, + 2 => @int, + 3 => luk, + 4 => hp, + 5 => hp_rgp, + 6 => hp_inv, + 7 => sp, + 8 => sp_rgp, + 9 => sp_inv, + 10 => ep, + 11 => ep_rgp, + 12 => ep_inv, + 13 => asp, + 14 => msp, + 15 => atp, + 16 => evp, + 17 => cap, + 18 => cad, + 19 => car, + 20 => ndd, + 21 => abp, + 22 => jmp, + 23 => pap, + 24 => map, + 25 => par, + 26 => mar, + 27 => wapmin, + 28 => wapmax, + 29 => dmg, + 30 => dmg, + 31 => pen, + 32 => rmsp, + 33 => bap, + 34 => bap_pet, + _ => throw new ArgumentOutOfRangeException(nameof(i), i, "Invalid CompareRange index."), + }; }