This commit is contained in:
gravestench 2020-10-10 20:31:12 -07:00 committed by GitHub
parent 88326b5278
commit 7fb57a273b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,12 @@ import "github.com/OpenDiablo2/OpenDiablo2/d2core/d2asset"
func HydrateSkills(skills map[int]*HeroSkill, asset *d2asset.AssetManager) {
for skillID := range skills {
heroSkill := skills[skillID]
// TODO: figure out why these are nil sometimes
if heroSkill == nil {
continue
}
heroSkill.SkillRecord = asset.Records.Skill.Details[skillID]
heroSkill.SkillDescriptionRecord = asset.Records.Skill.Descriptions[heroSkill.SkillRecord.Skilldesc]
heroSkill.SkillPoints = skills[skillID].SkillPoints

View File

@ -187,6 +187,12 @@ func (f *HeroStateFactory) LoadHeroState(filePath string) *HeroState {
// We cant do this while unmarshalling because there is no reference to the asset manager.
for idx := range result.Skills {
hs := result.Skills[idx]
// TODO: figure out why this can be nil
if hs == nil {
continue
}
hs.SkillRecord = f.asset.Records.Skill.Details[hs.shallow.SkillID]
hs.SkillDescriptionRecord = f.asset.Records.Skill.Descriptions[hs.SkillRecord.Skilldesc]
hs.SkillPoints = hs.shallow.SkillPoints