1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-11-02 17:27:23 -04:00
OpenDiablo2/d2core/d2records/object_mode_loader.go
Albin 8b2cc76c30
Added ObjectMode, StorePage and Colors.txt resource loaders (#771)
* add ObjMode.txt loader

* add colors.txt loader

* added storepage loader

* Update storepage_loader.go

removed printline

Co-authored-by: kottz <edward.kallstedt@gmail.com>
2020-10-21 11:05:53 -04:00

31 lines
494 B
Go

package d2records
import (
"log"
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
)
func objectModesLoader(r *RecordManager, d *d2txt.DataDictionary) error {
records := make(ObjectModes)
for d.Next() {
record := &ObjectModeRecord{
Name: d.String("Name"),
Token: d.String("Token"),
}
records[record.Name] = record
}
if d.Err != nil {
panic(d.Err)
}
r.Object.Modes = records
log.Printf("Loaded %d ObjectMode records", len(records))
return nil
}