mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-25 19:46:50 -05:00
Add monpreset.txt loader (#675)
This commit is contained in:
parent
f49770a0d7
commit
c216ddab53
@ -270,6 +270,7 @@ func (a *App) loadDataDict() error {
|
||||
{d2resource.MonsterSound, d2datadict.LoadMonsterSounds},
|
||||
{d2resource.MonsterSequence, d2datadict.LoadMonsterSequences},
|
||||
{d2resource.PlayerClass, d2datadict.LoadPlayerClasses},
|
||||
{d2resource.MonsterPlacement, d2datadict.LoadMonsterPlacements},
|
||||
}
|
||||
|
||||
d2datadict.InitObjectRecords()
|
||||
|
27
d2common/d2data/d2datadict/monster_placement.go
Normal file
27
d2common/d2data/d2datadict/monster_placement.go
Normal file
@ -0,0 +1,27 @@
|
||||
package d2datadict
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||
)
|
||||
|
||||
// MonsterPlacementRecord represents a line from MonPlace.txt.
|
||||
type MonsterPlacementRecord string
|
||||
|
||||
// MonsterPlacements stores the MonsterPlacementRecords.
|
||||
var MonsterPlacements []MonsterPlacementRecord //nolint:gochecknoglobals // Currently global by design
|
||||
|
||||
// LoadMonsterPlacements loads the MonsterPlacementRecords into MonsterPlacements.
|
||||
func LoadMonsterPlacements(file []byte) {
|
||||
d := d2common.LoadDataDictionary(file)
|
||||
for d.Next() {
|
||||
MonsterPlacements = append(MonsterPlacements, MonsterPlacementRecord(d.String("code")))
|
||||
}
|
||||
|
||||
if d.Err != nil {
|
||||
panic(d.Err)
|
||||
}
|
||||
|
||||
log.Printf("Loaded %d MonsterPlacement records", len(MonsterPlacements))
|
||||
}
|
@ -322,6 +322,7 @@ const (
|
||||
MonType = "/data/global/excel/Montype.txt"
|
||||
SuperUniques = "/data/global/excel/SuperUniques.txt"
|
||||
MonMode = "/data/global/excel/monmode.txt"
|
||||
MonsterPlacement = "/data/global/excel/MonPlace.txt"
|
||||
|
||||
// --- Skill Data ---
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user