1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-16 17:35:57 -05:00
OpenDiablo2/d2core/d2records/item_quality_loader.go
2020-12-18 18:46:34 +01:00

52 lines
1.2 KiB
Go

package d2records
import (
"strconv"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
func itemQualityLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(ItemQualities)
for d.Next() {
qual := &ItemQualityRecord{
NumMods: d.Number("nummods"),
Mod1Code: d.String("mod1code"),
Mod1Param: d.Number("mod1param"),
Mod1Min: d.Number("mod1min"),
Mod1Max: d.Number("mod1max"),
Mod2Code: d.String("mod2code"),
Mod2Param: d.Number("mod2param"),
Mod2Min: d.Number("mod2min"),
Mod2Max: d.Number("mod2max"),
Armor: d.Bool("armor"),
Weapon: d.Bool("weapon"),
Shield: d.Bool("shield"),
Thrown: d.Bool("thrown"),
Scepter: d.Bool("scepter"),
Wand: d.Bool("wand"),
Staff: d.Bool("staff"),
Bow: d.Bool("bow"),
Boots: d.Bool("boots"),
Gloves: d.Bool("gloves"),
Belt: d.Bool("belt"),
Level: d.Number("level"),
Multiply: d.Number("multiply"),
Add: d.Number("add"),
}
records[strconv.Itoa(len(records))] = qual
}
if d.Err != nil {
return d.Err
}
r.Item.Quality = records
r.Debugf("Loaded %d ItemQuality records", len(records))
return nil
}