mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-09-28 22:26:30 -04:00
7661b81576
- Clicking the active left/right skill now opens a skill select panel. Only the available skills for the hero, which are valid for the panel type are shown. Clicking on a skill from the skill select panel makes it the new active skill for the hero. - Hovering a skill in the skill select panel shows the skill name + skill description. - New command which learns all skills for a specific class(not persisted to a save file yet) - e.g. `learnskills ama` will learn skills for the Amazon class. - Initialize HeroSkill.shallowHeroSkill struct in the hero state factory, so we can use it when we serialize the HeroSkill to packets/game save files. - The parsed Skill.ListRow is now a number instead of string. Co-authored-by: Presiyan Ivanov <presiyan-ivanov@users.noreply.github.com>
74 lines
1.4 KiB
Go
74 lines
1.4 KiB
Go
package d2enum
|
|
|
|
import "log"
|
|
|
|
type SkillClass int
|
|
|
|
const (
|
|
// SkillClassGeneric is ""
|
|
SkillClassGeneric SkillClass = iota
|
|
SkillClassBarbarian
|
|
SkillClassNecromancer
|
|
SkillClassPaladin
|
|
SkillClassAssassin
|
|
SkillClassSorceress
|
|
SkillClassAmazon
|
|
SkillClassDruid
|
|
)
|
|
|
|
// FromToken returns the enum which corresponds to the given class token
|
|
func (sc *SkillClass) FromToken(classToken string) SkillClass {
|
|
resource := SkillClassGeneric
|
|
|
|
switch classToken {
|
|
case "":
|
|
return SkillClassGeneric
|
|
case "bar":
|
|
return SkillClassBarbarian
|
|
case "nec":
|
|
return SkillClassNecromancer
|
|
case "pal":
|
|
return SkillClassPaladin
|
|
case "ass":
|
|
return SkillClassAssassin
|
|
case "sor":
|
|
return SkillClassSorceress
|
|
case "ama":
|
|
return SkillClassAmazon
|
|
case "dru":
|
|
return SkillClassDruid
|
|
default:
|
|
log.Fatalf("Unknown skill class token: '%s'", classToken)
|
|
}
|
|
|
|
// should not be reached
|
|
return resource
|
|
}
|
|
|
|
// GetToken returns a string token for the enum
|
|
func (sc SkillClass) GetToken() string {
|
|
switch sc {
|
|
case SkillClassGeneric:
|
|
return ""
|
|
case SkillClassBarbarian:
|
|
return "bar"
|
|
case SkillClassNecromancer:
|
|
return "nec"
|
|
case SkillClassPaladin:
|
|
return "pal"
|
|
case SkillClassAssassin:
|
|
return "ass"
|
|
case SkillClassSorceress:
|
|
return "sor"
|
|
case SkillClassAmazon:
|
|
return "ama"
|
|
case SkillClassDruid:
|
|
return "dru"
|
|
default:
|
|
log.Fatalf("Unknown skill class token: %v", sc)
|
|
}
|
|
|
|
// should not be reached
|
|
return ""
|
|
}
|