87 lines
2.2 KiB
Go
87 lines
2.2 KiB
Go
package player
|
|
|
|
import (
|
|
"eq2emu/internal/skills"
|
|
)
|
|
|
|
// GetSkillByName returns a skill by name
|
|
func (p *Player) GetSkillByName(name string, checkUpdate bool) *skills.Skill {
|
|
return p.GetSkillByNameHelper(name, checkUpdate)
|
|
}
|
|
|
|
// GetSkillByID returns a skill by ID
|
|
func (p *Player) GetSkillByID(skillID int32, checkUpdate bool) *skills.Skill {
|
|
// TODO: Implement GetSkillByID when available in skills package
|
|
return nil
|
|
}
|
|
|
|
// AddSkill adds a skill to the player
|
|
func (p *Player) AddSkill(skillID int32, currentVal, maxVal int16, saveNeeded bool) {
|
|
p.AddSkillHelper(skillID, currentVal, maxVal, saveNeeded)
|
|
}
|
|
|
|
// RemovePlayerSkill removes a skill from the player
|
|
func (p *Player) RemovePlayerSkill(skillID int32, save bool) {
|
|
p.RemoveSkillHelper(skillID)
|
|
if save {
|
|
// TODO: Remove from database
|
|
// TODO: Implement RemoveSkillFromDB when available
|
|
// p.RemoveSkillFromDB(p.GetSkillByID(skillID, false), save)
|
|
}
|
|
}
|
|
|
|
// RemoveSkillFromDB removes a skill from the database
|
|
func (p *Player) RemoveSkillFromDB(skill *skills.Skill, save bool) {
|
|
if skill == nil {
|
|
return
|
|
}
|
|
// TODO: Remove skill from database
|
|
}
|
|
|
|
// AddSkillBonus adds a skill bonus from a spell
|
|
func (p *Player) AddSkillBonus(spellID, skillID int32, value float32) {
|
|
// Check if we already have this bonus
|
|
bonus := p.GetSkillBonus(spellID)
|
|
if bonus != nil {
|
|
// Update existing bonus
|
|
bonus.SkillID = skillID
|
|
bonus.Value = value
|
|
} else {
|
|
// Add new bonus
|
|
bonus = &SkillBonus{
|
|
SpellID: spellID,
|
|
SkillID: skillID,
|
|
Value: value,
|
|
}
|
|
// TODO: Add to skill bonus list
|
|
}
|
|
|
|
// Apply the bonus to the skill
|
|
skill := p.GetSkillByID(skillID, false)
|
|
if skill != nil {
|
|
// TODO: Apply bonus to skill value
|
|
}
|
|
}
|
|
|
|
// GetSkillBonus returns a skill bonus by spell ID
|
|
func (p *Player) GetSkillBonus(spellID int32) *SkillBonus {
|
|
// TODO: Look up skill bonus by spell ID
|
|
return nil
|
|
}
|
|
|
|
// RemoveSkillBonus removes a skill bonus
|
|
func (p *Player) RemoveSkillBonus(spellID int32) {
|
|
bonus := p.GetSkillBonus(spellID)
|
|
if bonus == nil {
|
|
return
|
|
}
|
|
|
|
// Remove the bonus from the skill
|
|
skill := p.GetSkillByID(bonus.SkillID, false)
|
|
if skill != nil {
|
|
// TODO: Remove bonus from skill value
|
|
}
|
|
|
|
// TODO: Remove from skill bonus list
|
|
}
|