mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-03 15:17:04 -05:00
b13175b070
* added loader for ItemTypes.txt * added loader for bodylocs.txt * lint fix for item_types loader * adding loader for sets.txt * minor edit * adding loader for SetItems.txt * added loader for automagic.txt
38 lines
846 B
Go
38 lines
846 B
Go
package d2datadict
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
|
)
|
|
|
|
// BodyLocationRecord describes a body location that items can be equipped to
|
|
type BodyLocationRecord struct {
|
|
Name string
|
|
Code string
|
|
}
|
|
|
|
// BodyLocations contains the body location records
|
|
//nolint:gochecknoglobals // Currently global by design, only written once
|
|
var BodyLocations map[string]*BodyLocationRecord
|
|
|
|
// LoadBodyLocations loads body locations from
|
|
func LoadBodyLocations(file []byte) {
|
|
BodyLocations = make(map[string]*BodyLocationRecord)
|
|
|
|
d := d2common.LoadDataDictionary(file)
|
|
for d.Next() {
|
|
location := &BodyLocationRecord{
|
|
Name: d.String("Name"),
|
|
Code: d.String("Code"),
|
|
}
|
|
BodyLocations[location.Code] = location
|
|
}
|
|
|
|
if d.Err != nil {
|
|
panic(d.Err)
|
|
}
|
|
|
|
log.Printf("Loaded %d Body Location records", len(BodyLocations))
|
|
}
|