From 67a2018ddaa8ebf53b5edeeed5822b3e3047332a Mon Sep 17 00:00:00 2001 From: lastbattle <4586194+lastbattle@users.noreply.github.com> Date: Sat, 2 Nov 2024 14:58:14 +0800 Subject: [PATCH] Create QuestMedalType -- quest medal category --- .../Data/ItemStructure/ItemIdsCategory.cs | 1 + .../Data/QuestStructure/QuestMedalType.cs | 92 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 MapleLib/WzLib/WzStructure/Data/QuestStructure/QuestMedalType.cs diff --git a/MapleLib/WzLib/WzStructure/Data/ItemStructure/ItemIdsCategory.cs b/MapleLib/WzLib/WzStructure/Data/ItemStructure/ItemIdsCategory.cs index 9df6c68..eae3f41 100644 --- a/MapleLib/WzLib/WzStructure/Data/ItemStructure/ItemIdsCategory.cs +++ b/MapleLib/WzLib/WzStructure/Data/ItemStructure/ItemIdsCategory.cs @@ -10,6 +10,7 @@ namespace MapleLib.WzLib.WzStructure.Data.ItemStructure public class ItemIdsCategory { public static int + MEDAL_CATEGORY = 114, BUFF_CATEGORY = 202, PET_CATEGORY = 500; diff --git a/MapleLib/WzLib/WzStructure/Data/QuestStructure/QuestMedalType.cs b/MapleLib/WzLib/WzStructure/Data/QuestStructure/QuestMedalType.cs new file mode 100644 index 0000000..2734ca4 --- /dev/null +++ b/MapleLib/WzLib/WzStructure/Data/QuestStructure/QuestMedalType.cs @@ -0,0 +1,92 @@ +/*Copyright(c) 2024, LastBattle https://github.com/lastbattle/Harepacker-resurrected + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +using System; +namespace MapleLib.WzLib.WzStructure.Data.QuestStructure +{ + public enum QuestMedalType + { + NoneOrUnknown = 0, + Job = 1, + Normal = 2, + Challenge = 3, + Event = 4, + NO = 5, + } + + public static class QuestMedalTypeExt + { + /// + /// Human readable string + /// + /// + /// + public static string ToReadableString(this QuestMedalType state) + { + return state.ToString().Replace("_", " "); + } + + /// + /// Converts from the string name back to enum + /// + /// + /// + public static QuestMedalType ToEnum(this string name) + { + // Try to parse the string to enum + if (Enum.TryParse(name.Replace(" ", "_"), out QuestMedalType result)) + { + return (QuestMedalType)result; + } + return QuestMedalType.NoneOrUnknown; + } + + /// + /// Converts from the area code value to enum type + /// + /// + /// + public static QuestMedalType ToEnum(int value) + { + if (Enum.IsDefined(typeof(QuestMedalType), value)) + { + return (QuestMedalType)value; + } + else + { + //Console.WriteLine($"Warning: Invalid QuestAreaCodeType value {value}. Defaulting to Unknown."); + return QuestMedalType.NoneOrUnknown; + } + } + } +} + +/* 692 */ +/* +enum $8B10128932F884E0B385C45C2A832C21 +{ + NOT_MEDAL_QUEST = 0x0, + MEDAL_QUEST_JOB = 0x1, + MEDAL_QUEST_NORMAL = 0x2, + MEDAL_QUEST_CHALLENGE = 0x3, + MEDAL_QUEST_EVENT = 0x4, + MEDAL_QUEST_NO = 0x5, +};*/ \ No newline at end of file