2020-01-26 00:39:13 -05:00
|
|
|
package d2enum
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
|
2020-07-09 23:12:28 -04:00
|
|
|
//go:generate stringer -linecomment -type Hero
|
|
|
|
//go:generate string2enum -samepkg -linecomment -type Hero
|
|
|
|
|
|
|
|
// Hero is used for different types of hero's
|
2020-01-26 00:39:13 -05:00
|
|
|
type Hero int
|
|
|
|
|
2020-07-09 23:12:28 -04:00
|
|
|
// Heroes
|
2020-01-26 00:39:13 -05:00
|
|
|
const (
|
2020-07-09 23:12:28 -04:00
|
|
|
HeroNone Hero = iota //
|
|
|
|
HeroBarbarian // Barbarian
|
|
|
|
HeroNecromancer // Necromancer
|
|
|
|
HeroPaladin // Paladin
|
|
|
|
HeroAssassin // Assassin
|
|
|
|
HeroSorceress // Sorceress
|
|
|
|
HeroAmazon // Amazon
|
|
|
|
HeroDruid // Druid
|
2020-01-26 00:39:13 -05:00
|
|
|
)
|
|
|
|
|
2020-07-09 23:12:28 -04:00
|
|
|
// GetToken returns a 2 letter token
|
2020-02-01 21:51:49 -05:00
|
|
|
func (h Hero) GetToken() string {
|
|
|
|
switch h {
|
2020-01-26 00:39:13 -05:00
|
|
|
case HeroBarbarian:
|
|
|
|
return "BA"
|
|
|
|
case HeroNecromancer:
|
|
|
|
return "NE"
|
|
|
|
case HeroPaladin:
|
|
|
|
return "PA"
|
|
|
|
case HeroAssassin:
|
|
|
|
return "AI"
|
|
|
|
case HeroSorceress:
|
|
|
|
return "SO"
|
|
|
|
case HeroAmazon:
|
|
|
|
return "AM"
|
|
|
|
case HeroDruid:
|
|
|
|
return "DZ"
|
|
|
|
default:
|
2020-02-01 21:51:49 -05:00
|
|
|
log.Fatalf("Unknown hero token: %d", h)
|
2020-01-26 00:39:13 -05:00
|
|
|
}
|
2020-07-09 23:12:28 -04:00
|
|
|
|
2020-01-26 00:39:13 -05:00
|
|
|
return ""
|
|
|
|
}
|