mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-20 07:27:19 -05:00
Add gamble.txt loader (#764)
This commit is contained in:
parent
d1d8a52810
commit
b5e052fc81
@ -228,7 +228,7 @@ const (
|
||||
ObjectGroup = "/data/global/excel/objgroup.txt"
|
||||
CompCode = "/data/global/excel/compcode.txt"
|
||||
Belts = "/data/global/excel/belts.txt"
|
||||
|
||||
Gamble = "/data/global/excel/gamble.txt"
|
||||
|
||||
// --- Animations ---
|
||||
|
||||
|
29
d2core/d2records/gamble_loader.go
Normal file
29
d2core/d2records/gamble_loader.go
Normal file
@ -0,0 +1,29 @@
|
||||
package d2records
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2fileformats/d2txt"
|
||||
)
|
||||
|
||||
func gambleLoader(r *RecordManager, d *d2txt.DataDictionary) error {
|
||||
records := make(Gamble)
|
||||
|
||||
for d.Next() {
|
||||
record := &GambleRecord{
|
||||
Name: d.String("name"),
|
||||
Code: d.String("code"),
|
||||
}
|
||||
records[record.Name] = record
|
||||
}
|
||||
|
||||
if d.Err != nil {
|
||||
return d.Err
|
||||
}
|
||||
|
||||
log.Printf("Loaded %d gamble records", len(records))
|
||||
|
||||
r.Gamble = records
|
||||
|
||||
return nil
|
||||
}
|
8
d2core/d2records/gamble_record.go
Normal file
8
d2core/d2records/gamble_record.go
Normal file
@ -0,0 +1,8 @@
|
||||
package d2records
|
||||
|
||||
type Gamble map[string]*GambleRecord
|
||||
|
||||
type GambleRecord struct {
|
||||
Name string
|
||||
Code string
|
||||
}
|
@ -45,6 +45,7 @@ type RecordManager struct {
|
||||
ComponentCodes
|
||||
DifficultyLevels
|
||||
ElemTypes
|
||||
Gamble
|
||||
Hirelings
|
||||
Item struct {
|
||||
All CommonItems // NOTE: populated when armor, weapons, and misc items are ALL loaded
|
||||
@ -167,6 +168,7 @@ func (r *RecordManager) init() error {
|
||||
{d2resource.ItemRatio, itemRatioLoader},
|
||||
{d2resource.Overlays, overlaysLoader},
|
||||
{d2resource.CharStats, charStatsLoader},
|
||||
{d2resource.Gamble, gambleLoader},
|
||||
{d2resource.Hireling, hirelingLoader},
|
||||
{d2resource.Experience, experienceLoader},
|
||||
{d2resource.Gems, gemsLoader},
|
||||
|
Loading…
x
Reference in New Issue
Block a user