diff --git a/MapleLib/WzLib/Util/WzBinaryReader.cs b/MapleLib/WzLib/Util/WzBinaryReader.cs index a8d810f..9d59f40 100644 --- a/MapleLib/WzLib/Util/WzBinaryReader.cs +++ b/MapleLib/WzLib/Util/WzBinaryReader.cs @@ -154,7 +154,7 @@ private string DecodeUnicode(int length) /// /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - private unsafe string DecodeAscii(int length) + private string DecodeAscii(int length) { Span bytes = length <= STACKALLOC_SIZE_LIMIT_L1 ? stackalloc byte[length] : new byte[length]; byte mask = 0xAA; diff --git a/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterClassTypeInfo.cs b/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterClassTypeInfo.cs index bac9e91..2843bdd 100644 --- a/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterClassTypeInfo.cs +++ b/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterClassTypeInfo.cs @@ -1,10 +1,5 @@ using MapleLib.ClientLib; using MapleLib.WzLib.WzStructure.Data.ItemStructure; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace MapleLib.WzLib.WzStructure.Data.CharacterStructure { diff --git a/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterSubJobFlagType.cs b/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterSubJobFlagType.cs new file mode 100644 index 0000000..183f3dd --- /dev/null +++ b/MapleLib/WzLib/WzStructure/Data/CharacterStructure/CharacterSubJobFlagType.cs @@ -0,0 +1,60 @@ +using MapleLib.WzLib.WzStructure.Data.QuestStructure; +using System; +namespace MapleLib.WzLib.WzStructure.Data.CharacterStructure +{ + /// + /// Its the best guess so far, could not find it in KMST. + /// + public enum CharacterSubJobFlagType + { + Any = 0, + Adventurer = 1, + Adventurer_DualBlade = 2, + } + + public static class CharacterSubJobFlagTypeExt + { + /// + /// Human readable string + /// + /// + /// + public static string ToReadableString(this CharacterSubJobFlagType state) + { + return state.ToString().Replace("_", " "); + } + + /// + /// Converts from the string name back to enum + /// + /// + /// + public static CharacterSubJobFlagType ToEnum(this string name) + { + // Try to parse the string to enum + if (Enum.TryParse(name.Replace(" ", "_"), out CharacterSubJobFlagType result)) + { + return (CharacterSubJobFlagType)result; + } + return CharacterSubJobFlagType.Any; + } + + /// + /// Converts from the area code value to enum type + /// + /// + /// + public static CharacterSubJobFlagType ToEnum(int value) + { + if (Enum.IsDefined(typeof(CharacterSubJobFlagType), value)) + { + return (CharacterSubJobFlagType)value; + } + else + { + //Console.WriteLine($"Warning: Invalid CharacterSubJobFlagTypeExt value {value}. Defaulting to Any."); + return CharacterSubJobFlagType.Any; + } + } + } +}