diff --git a/d2app/app.go b/d2app/app.go index dce7557f..0a00f9ff 100644 --- a/d2app/app.go +++ b/d2app/app.go @@ -254,6 +254,7 @@ func (a *App) loadDataDict() error { {d2resource.TreasureClass, d2datadict.LoadTreasureClassRecords}, {d2resource.States, d2datadict.LoadStates}, {d2resource.SoundEnvirons, d2datadict.LoadSoundEnvirons}, + {d2resource.Shrines, d2datadict.LoadShrines}, } d2datadict.InitObjectRecords() diff --git a/d2common/d2data/d2datadict/shrines.go b/d2common/d2data/d2datadict/shrines.go new file mode 100644 index 00000000..ad7779da --- /dev/null +++ b/d2common/d2data/d2datadict/shrines.go @@ -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)) +} diff --git a/d2common/d2resource/resource_paths.go b/d2common/d2resource/resource_paths.go index 1fe66a89..db9691c2 100644 --- a/d2common/d2resource/resource_paths.go +++ b/d2common/d2resource/resource_paths.go @@ -197,8 +197,8 @@ const ( TreasureClass = "/data/global/excel/TreasureClassEx.txt" States = "/data/global/excel/states.txt" SoundEnvirons = "/data/global/excel/soundenviron.txt" - - MonProp = "/data/global/excel/Monprop.txt" + Shrines = "/data/global/excel/shrines.txt" + MonProp = "/data/global/excel/Monprop.txt" // --- Animations ---