1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-09-06 19:44:15 -04:00
OpenDiablo2/OpenDiablo2.Common/Enums/eArmorType.cs

29 lines
839 B
C#

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenDiablo2.Common.Enums
{
public enum eArmorType
{
Lite,
Medium,
Heavy
}
public static class eArmorTypeHelper
{
private static readonly ImmutableDictionary<eArmorType, string> tokens = new Dictionary<eArmorType, string>()
{
{ eArmorType.Lite , "lit" },
{ eArmorType.Medium , "med" },
{ eArmorType.Heavy , "hvy" }
}.ToImmutableDictionary();
public static string ToToken(this eArmorType armorType) => tokens[armorType];
public static eArmorType ToArmorType(this string source) => tokens.First(x => x.Value.ToUpper() == source.ToUpper()).Key;
}
}