mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2025-02-06 00:26:40 -05:00
Add shrines.txt loader (#642)
This commit is contained in:
parent
50fd6608cf
commit
cec3fb91d8
@ -254,6 +254,7 @@ func (a *App) loadDataDict() error {
|
|||||||
{d2resource.TreasureClass, d2datadict.LoadTreasureClassRecords},
|
{d2resource.TreasureClass, d2datadict.LoadTreasureClassRecords},
|
||||||
{d2resource.States, d2datadict.LoadStates},
|
{d2resource.States, d2datadict.LoadStates},
|
||||||
{d2resource.SoundEnvirons, d2datadict.LoadSoundEnvirons},
|
{d2resource.SoundEnvirons, d2datadict.LoadSoundEnvirons},
|
||||||
|
{d2resource.Shrines, d2datadict.LoadShrines},
|
||||||
}
|
}
|
||||||
|
|
||||||
d2datadict.InitObjectRecords()
|
d2datadict.InitObjectRecords()
|
||||||
|
51
d2common/d2data/d2datadict/shrines.go
Normal file
51
d2common/d2data/d2datadict/shrines.go
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
package d2datadict
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ShrineRecord is a representation of a row from shrines.txt
|
||||||
|
type ShrineRecord struct {
|
||||||
|
ShrineType string // None, Recharge, Booster, or Magic
|
||||||
|
ShrineName string // Name of the Shrine
|
||||||
|
Effect string // Effect on the player
|
||||||
|
Code int // Unique identifier
|
||||||
|
Arg0 int // ? (0-400)
|
||||||
|
Arg1 int // ? (0-2000)
|
||||||
|
DurationFrames int // How long the shrine lasts in frames
|
||||||
|
ResetTimeMinutes int // How many minutes until the shrine resets?
|
||||||
|
Rarity int // 1-3
|
||||||
|
EffectClass int // 0-4
|
||||||
|
LevelMin int // 0-32
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shrines contains the Unique Appellations
|
||||||
|
//nolint:gochecknoglobals // Currently global by design, only written once
|
||||||
|
var Shrines map[string]*ShrineRecord
|
||||||
|
|
||||||
|
// LoadShrines loads Shrines from the supplied file
|
||||||
|
func LoadShrines(file []byte) {
|
||||||
|
Shrines = make(map[string]*ShrineRecord)
|
||||||
|
|
||||||
|
d := d2common.LoadDataDictionary(file)
|
||||||
|
for d.Next() {
|
||||||
|
record := &ShrineRecord{
|
||||||
|
ShrineType: d.String("Shrine Type"),
|
||||||
|
ShrineName: d.String("Shrine name"),
|
||||||
|
Effect: d.String("Effect"),
|
||||||
|
Code: d.Number("Code"),
|
||||||
|
Arg0: d.Number("Arg0"),
|
||||||
|
Arg1: d.Number("Arg1"),
|
||||||
|
DurationFrames: d.Number("Duration in frames"),
|
||||||
|
ResetTimeMinutes: d.Number("reset time in minutes"),
|
||||||
|
Rarity: d.Number("rarity"),
|
||||||
|
EffectClass: d.Number("effectclass"),
|
||||||
|
LevelMin: d.Number("LevelMin"),
|
||||||
|
}
|
||||||
|
Shrines[record.ShrineName] = record
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Printf("Loaded %d shrines", len(Shrines))
|
||||||
|
}
|
@ -197,8 +197,8 @@ const (
|
|||||||
TreasureClass = "/data/global/excel/TreasureClassEx.txt"
|
TreasureClass = "/data/global/excel/TreasureClassEx.txt"
|
||||||
States = "/data/global/excel/states.txt"
|
States = "/data/global/excel/states.txt"
|
||||||
SoundEnvirons = "/data/global/excel/soundenviron.txt"
|
SoundEnvirons = "/data/global/excel/soundenviron.txt"
|
||||||
|
Shrines = "/data/global/excel/shrines.txt"
|
||||||
MonProp = "/data/global/excel/Monprop.txt"
|
MonProp = "/data/global/excel/Monprop.txt"
|
||||||
|
|
||||||
// --- Animations ---
|
// --- Animations ---
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user