1
1
mirror of https://github.com/OpenDiablo2/OpenDiablo2 synced 2024-06-04 23:10:42 +00:00

Add shrines.txt loader (#642)

This commit is contained in:
Andrew Doing 2020-07-29 15:03:06 -07:00 committed by GitHub
parent 50fd6608cf
commit cec3fb91d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 2 deletions

View File

@ -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()

View 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))
}

View File

@ -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 ---