mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-03 01:37:18 -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>
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package d2player
|
|
|
|
import (
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2geom"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2interface"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2hero"
|
|
)
|
|
|
|
// SkillListRow represents a row of skills that is shown when the skill select menu is rendered.
|
|
type SkillListRow struct {
|
|
Rectangle d2geom.Rectangle
|
|
Skills []*d2hero.HeroSkill
|
|
cachedImage d2interface.Surface
|
|
}
|
|
|
|
// AddSkill appends to the skills of the row.
|
|
func (s *SkillListRow) AddSkill(skill *d2hero.HeroSkill) {
|
|
s.Skills = append(s.Skills, skill)
|
|
}
|
|
|
|
// GetWidth returns the width based on the size of the skills.
|
|
func (s *SkillListRow) GetWidth() int {
|
|
return skillIconWidth * len(s.Skills)
|
|
}
|
|
|
|
// GetRectangle returns the rectangle of the list.
|
|
func (s *SkillListRow) GetRectangle() d2geom.Rectangle {
|
|
return s.Rectangle
|
|
}
|
|
|
|
// IsInRect returns true when the list has any skills and coordinates are in the rectangle of the list.
|
|
func (s *SkillListRow) IsInRect(X int, Y int) bool {
|
|
// if there are no skills, row won't be rendered and it shouldn't be considered visible
|
|
return len(s.Skills) > 0 && s.Rectangle.IsInRect(X, Y)
|
|
}
|