1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-27 17:45:24 +00:00
OpenDiablo2/d2common/d2enum/hero.go
juander-ux e5dae4e5d8
Inital skilltree panel implementation (#782)
* d2ui/UIFrame: Refactor into its own class

it's not useful to have the handling of frames for the
inventory/herostate/skilltree/quest panels individually in each of
those.

* d2ui/button: Fix crash when a buttonlayout was not allowing FrameChange

When AllowFrameChange is false we do not create pressedSurface. So if we
press the button the game will crash.

* d2ui/button: Allow label-only buttons

At least for the skillmenu we need buttons were the graphic size does
not match the buttonsize. So let's render the graphic in there and make
the button label only.

* d2hero/hero_state_factory: Give all heroes their class specific skills

* d2player/gamecontrols: Fix wrong inventory/stats layouts for exp chars

For Druid/Assassin the inventory frame was rendered for a 640x480
resolution. This brings it in line with all other characters.

* d2player: Add inital Skilltree panel

* d2player/game_controls: Enable skilltree

Note here, that the inventory panel and skilltree panel can overlap.

* d2player/skilltree: Add skillicon rendering

Note here, that I couldn't figure out how to render them dark if no
skillpoints are invested.

Signed-off-by: juander <juander@rumtueddeln.de>
2020-10-22 12:54:45 -04:00

69 lines
1.3 KiB
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 ""
}
// GetToken3 returns a 3 letter token
func (h Hero) GetToken3() string {
switch h {
case HeroBarbarian:
return "BAR"
case HeroNecromancer:
return "NEC"
case HeroPaladin:
return "PAL"
case HeroAssassin:
return "ASS"
case HeroSorceress:
return "SOR"
case HeroAmazon:
return "AMA"
case HeroDruid:
return "DRU"
default:
log.Fatalf("Unknown hero token: %d", h)
}
return ""
}