From ab9571b8e8f652bbee643544aaa79447f6beb114 Mon Sep 17 00:00:00 2001 From: dk Date: Sun, 21 Jun 2020 15:43:09 -0700 Subject: [PATCH] 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! --- d2common/d2data/d2datadict/levels.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/d2common/d2data/d2datadict/levels.go b/d2common/d2data/d2datadict/levels.go index e7a43957..5a255d63 100644 --- a/d2common/d2data/d2datadict/levels.go +++ b/d2common/d2data/d2datadict/levels.go @@ -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)) }