Fix: bad naming in levels.txt loader (#376)

* main, d2common: load Magic/Rare/Unique Affix

* d2common: item affixes only

removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.

* removed debug print from item_affix.go

* changed item affix type names for clarity, removed debug print from data_dictionary

* d2common: item affix datadict and records

Item Affixes are defined in `/data/global/excel/Magic{Prefix,Suffix}.txt`
Rare and Unique Pre/Suffixes seem to be for monsters, not items.

d2common: item affixes only

removed Rare/Unique Prefix/Suffix as those are related to monsters, not items.

removed debug print from item_affix.go

changed item affix type names for clarity, removed debug print from data_dictionary

* reverting to pre-allocating memory for parsing txt lines

* removing the rest of the rare/unique definitions

* removing the rest of the rare/unique definitions

* mend

* adding datadict loader for levels.txt

* adding comments from PK forums in the added d2enum files

* fixed bad naming. doh!
This commit is contained in:
dk 2020-06-21 15:43:09 -07:00 committed by GitHub
parent 5260ce3c87
commit ab9571b8e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -7,7 +7,7 @@ import (
"github.com/OpenDiablo2/OpenDiablo2/d2common/d2enum"
)
type LevelDetails struct {
type LevelDetailsRecord struct {
// This column has no function, it only serves as a comment field to make it
// easier to identify the Level name
@ -375,15 +375,15 @@ type LevelDetails struct {
// Beta
}
var Levels map[int]*LevelDetails
var LevelDetails map[int]*LevelDetailsRecord
func LoadLevelDetails(file []byte) {
dict := d2common.LoadDataDictionary(string(file))
numRecords := len(dict.Data)
Levels = make(map[int]*LevelDetails, numRecords)
LevelDetails = make(map[int]*LevelDetailsRecord, numRecords)
for idx, _ := range dict.Data {
record := &LevelDetails{
record := &LevelDetailsRecord{
Name: dict.GetString("Name ", idx),
Id: dict.GetNumber("Id", idx),
Palette: dict.GetNumber("Pal", idx),
@ -530,7 +530,7 @@ func LoadLevelDetails(file []byte) {
ObjectGroupSpawnChance6: dict.GetNumber("ObjPrb6", idx),
ObjectGroupSpawnChance7: dict.GetNumber("ObjPrb7", idx),
}
Levels[idx] = record
LevelDetails[idx] = record
}
log.Printf("Loaded %d Level records", len(Levels))
log.Printf("Loaded %d LevelDetails records", len(LevelDetails))
}