mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-25 19:46:50 -05:00
Add PlayerClass.txt loader (#667)
This commit is contained in:
parent
524132c122
commit
efb554c42b
@ -269,6 +269,7 @@ func (a *App) loadDataDict() error {
|
||||
{d2resource.MonsterLevel, d2datadict.LoadMonsterLevels},
|
||||
{d2resource.MonsterSound, d2datadict.LoadMonsterSounds},
|
||||
{d2resource.MonsterSequence, d2datadict.LoadMonsterSequences},
|
||||
{d2resource.PlayerClass, d2datadict.LoadPlayerClasses},
|
||||
}
|
||||
|
||||
d2datadict.InitObjectRecords()
|
||||
|
43
d2common/d2data/d2datadict/player_class.go
Normal file
43
d2common/d2data/d2datadict/player_class.go
Normal file
@ -0,0 +1,43 @@
|
||||
package d2datadict
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
||||
)
|
||||
|
||||
//PlayerClassRecord represents a single line from PlayerClass.txt
|
||||
//Lookup table for class codes
|
||||
type PlayerClassRecord struct {
|
||||
//Class name
|
||||
Name string
|
||||
|
||||
//Class code
|
||||
Code string
|
||||
}
|
||||
|
||||
//PlayerClasses stores the PlayerClassRecords
|
||||
var PlayerClasses map[string]*PlayerClassRecord
|
||||
|
||||
//LoadPlayerClasses loads the PlayerClassRecords into PlayerClasses
|
||||
func LoadPlayerClasses(file []byte) {
|
||||
PlayerClasses = make(map[string]*PlayerClassRecord)
|
||||
|
||||
d := d2common.LoadDataDictionary(file)
|
||||
for d.Next() {
|
||||
record := &PlayerClassRecord{
|
||||
Name: d.String("Player Class"),
|
||||
Code: d.String("Code"),
|
||||
}
|
||||
if record.Name == "Expansion" {
|
||||
continue
|
||||
}
|
||||
PlayerClasses[record.Name] = record
|
||||
}
|
||||
|
||||
if d.Err != nil {
|
||||
panic(d.Err)
|
||||
}
|
||||
|
||||
log.Printf("Loaded %d PlayerClass records", len(PlayerClasses))
|
||||
}
|
@ -213,6 +213,7 @@ const (
|
||||
MonsterLevel = "/data/global/excel/monlvl.txt"
|
||||
MonsterSound = "/data/global/excel/monsounds.txt"
|
||||
MonsterSequence = "/data/global/excel/monseq.txt"
|
||||
PlayerClass = "/data/global/excel/PlayerClass.txt"
|
||||
|
||||
// --- Animations ---
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user