mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-19 19:06:45 -05:00
d2datadict: Add Montype.txt loader (#637)
This commit is contained in:
parent
b7f8aa8e90
commit
78470431d6
@ -223,6 +223,7 @@ func (a *App) loadDataDict() error {
|
||||
{d2resource.MonStats2, d2datadict.LoadMonStats2},
|
||||
{d2resource.MonPreset, d2datadict.LoadMonPresets},
|
||||
{d2resource.MonProp, d2datadict.LoadMonProps},
|
||||
{d2resource.MonType, d2datadict.LoadMonTypes},
|
||||
{d2resource.MagicPrefix, d2datadict.LoadMagicPrefix},
|
||||
{d2resource.MagicSuffix, d2datadict.LoadMagicSuffix},
|
||||
{d2resource.ItemStatCost, d2datadict.LoadItemStatCosts},
|
||||
|
48
d2common/d2data/d2datadict/montype.go
Normal file
48
d2common/d2data/d2datadict/montype.go
Normal file
@ -0,0 +1,48 @@
|
||||
package d2datadict
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||
)
|
||||
|
||||
// MonTypeRecord is a representation of a single row of MonType.txt.
|
||||
type MonTypeRecord struct {
|
||||
Type string
|
||||
Equiv1 string
|
||||
Equiv2 string
|
||||
Equiv3 string
|
||||
// StrSing is the string displayed for the singular form (Skeleton), note
|
||||
// that this is unused in the original engine, since the only modifier
|
||||
// display code that accesses MonType uses StrPlur.
|
||||
StrSing string
|
||||
StrPlural string
|
||||
// EOL int // unused
|
||||
}
|
||||
|
||||
// MonTypes stores all of the MonTypeRecords
|
||||
var MonTypes map[string]*MonTypeRecord //nolint:gochecknoglobals // Currently global by design, only written once
|
||||
|
||||
// LoadMonTypes loads MonType records into a map[string]*MonTypeRecord
|
||||
func LoadMonTypes(file []byte) {
|
||||
MonTypes = make(map[string]*MonTypeRecord)
|
||||
|
||||
d := d2common.LoadDataDictionary(file)
|
||||
for d.Next() {
|
||||
record := &MonTypeRecord{
|
||||
Type: d.String("type"),
|
||||
Equiv1: d.String("equiv1"),
|
||||
Equiv2: d.String("equiv2"),
|
||||
Equiv3: d.String("equiv3"),
|
||||
StrSing: d.String("strsing"),
|
||||
StrPlural: d.String("strplur"),
|
||||
}
|
||||
MonTypes[record.Type] = record
|
||||
}
|
||||
|
||||
if d.Err != nil {
|
||||
panic(d.Err)
|
||||
}
|
||||
|
||||
log.Printf("Loaded %d MonType records", len(MonTypes))
|
||||
}
|
@ -301,6 +301,7 @@ const (
|
||||
MonStats = "/data/global/excel/monstats.txt"
|
||||
MonStats2 = "/data/global/excel/monstats2.txt"
|
||||
MonPreset = "/data/global/excel/monpreset.txt"
|
||||
MonType = "/data/global/excel/Montype.txt"
|
||||
SuperUniques = "/data/global/excel/SuperUniques.txt"
|
||||
|
||||
// --- Skill Data ---
|
||||
|
Loading…
Reference in New Issue
Block a user