1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-02 17:27:23 -04:00
OpenDiablo2/d2common/d2enum/hero.go
Intyre 9e58b134e5
Refactored d2enum (#567)
* Refactored animation mode enum

* More d2enum changes

* Refactored tile enum

* Refactored weapon class enum

* Refactored more enums

* Refactored item event enum

* Fixed init_functions animation mode

* Removed string2enum from MonsterAnimationMode

* Refactored ItemStatCost description

* Last enum lint errors

* Regenerated monster stringer file
2020-07-09 23:12:28 -04:00

46 lines
926 B
Go

package d2enum
import "log"
//go:generate stringer -linecomment -type Hero
//go:generate string2enum -samepkg -linecomment -type Hero
// Hero is used for different types of hero's
type Hero int
// Heroes
const (
HeroNone Hero = iota //
HeroBarbarian // Barbarian
HeroNecromancer // Necromancer
HeroPaladin // Paladin
HeroAssassin // Assassin
HeroSorceress // Sorceress
HeroAmazon // Amazon
HeroDruid // Druid
)
// GetToken returns a 2 letter token
func (h Hero) GetToken() string {
switch h {
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:
log.Fatalf("Unknown hero token: %d", h)
}
return ""
}