mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-02 09:17:19 -04:00
d2datadict: Add Monmode.txt loader (#638)
This commit is contained in:
parent
6f30dffa1c
commit
a31fb173eb
@ -224,6 +224,7 @@ func (a *App) loadDataDict() error {
|
||||
{d2resource.MonPreset, d2datadict.LoadMonPresets},
|
||||
{d2resource.MonProp, d2datadict.LoadMonProps},
|
||||
{d2resource.MonType, d2datadict.LoadMonTypes},
|
||||
{d2resource.MonMode, d2datadict.LoadMonModes},
|
||||
{d2resource.MagicPrefix, d2datadict.LoadMagicPrefix},
|
||||
{d2resource.MagicSuffix, d2datadict.LoadMagicSuffix},
|
||||
{d2resource.ItemStatCost, d2datadict.LoadItemStatCosts},
|
||||
|
38
d2common/d2data/d2datadict/monmode.go
Normal file
38
d2common/d2data/d2datadict/monmode.go
Normal file
@ -0,0 +1,38 @@
|
||||
package d2datadict
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||
)
|
||||
|
||||
// MonModeRecord is a representation of a single row of Monmode.txt
|
||||
type MonModeRecord struct {
|
||||
Name string
|
||||
Token string
|
||||
Code string
|
||||
}
|
||||
|
||||
// MonModes stores all of the GemsRecords
|
||||
var MonModes map[string]*MonModeRecord //nolint:gochecknoglobals // Currently global by design, only written once
|
||||
|
||||
// LoadMonModes loads gem records into a map[string]*MonModeRecord
|
||||
func LoadMonModes(file []byte) {
|
||||
MonModes = make(map[string]*MonModeRecord)
|
||||
|
||||
d := d2common.LoadDataDictionary(file)
|
||||
for d.Next() {
|
||||
record := &MonModeRecord{
|
||||
Name: d.String("name"),
|
||||
Token: d.String("token"),
|
||||
Code: d.String("code"),
|
||||
}
|
||||
MonModes[record.Name] = record
|
||||
}
|
||||
|
||||
if d.Err != nil {
|
||||
panic(d.Err)
|
||||
}
|
||||
|
||||
log.Printf("Loaded %d MonMode records", len(MonModes))
|
||||
}
|
@ -304,6 +304,7 @@ const (
|
||||
MonPreset = "/data/global/excel/monpreset.txt"
|
||||
MonType = "/data/global/excel/Montype.txt"
|
||||
SuperUniques = "/data/global/excel/SuperUniques.txt"
|
||||
MonMode = "/data/global/excel/monmode.txt"
|
||||
|
||||
// --- Skill Data ---
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user