mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-02 17:27:23 -04:00
271673851a
* Added RecordManager implementation to remove d2datadict singletons * fix object lookup test
53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package d2records
|
|
|
|
import (
|
|
"log"
|
|
"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
|
|
|
|
log.Printf("Loaded %d ItemQualities records", len(records))
|
|
|
|
return nil
|
|
}
|