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

38 lines
1.0 KiB
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 eHero
{
Barbarian,
Necromancer,
Paladin,
Assassin,
Sorceress,
Amazon,
Druid
}
public static class eHeroExtensions
{
public readonly static ImmutableDictionary<eHero, string> tokens = new Dictionary<eHero, string>
{
{ eHero.Amazon , "AM" },
{ eHero.Sorceress , "SO" },
{ eHero.Necromancer , "NE" },
{ eHero.Paladin , "PA" },
{ eHero.Barbarian , "BA" },
{ eHero.Druid , "DZ" },
{ eHero.Assassin , "AI" }
}.ToImmutableDictionary();
public static string ToToken(this eHero source) => tokens[source];
public static eHero ToHero(this string source) => tokens.First(x => x.Value.ToUpper() == source.ToUpper()).Key;
}
}