From dbe6a5eb35a7f888eb4a1e29c1eb1f4e4c3732c6 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] 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."),
+ };
}