From f06d4b2c68784a2ccd6bb1677c88197e2ceaf0ba Mon Sep 17 00:00:00 2001 From: dk Date: Thu, 18 Jun 2020 19:39:57 -0700 Subject: [PATCH] Feature item stat cost (#338) * adding rules for swap files to .gitignore * 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 * adding ItemStatCost data dict loader * removed call to append, added records to exported array --- d2common/d2data/d2datadict/itemstatcost.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/d2common/d2data/d2datadict/itemstatcost.go b/d2common/d2data/d2datadict/itemstatcost.go index 5a9b9f3b..ac21a373 100644 --- a/d2common/d2data/d2datadict/itemstatcost.go +++ b/d2common/d2data/d2datadict/itemstatcost.go @@ -241,9 +241,9 @@ stuff var ItemStatCosts map[string]*ItemStatCostRecord func LoadItemStatCosts(file []byte) { - ItemStatCosts = make(map[string]*ItemStatCostRecord, 0) d := d2common.LoadDataDictionary(string(file)) - r := make([]*ItemStatCostRecord, 0) + numRecords := len(d.Data) + ItemStatCosts = make(map[string]*ItemStatCostRecord, numRecords) for idx, _ := range d.Data { record := &ItemStatCostRecord{ @@ -314,7 +314,7 @@ func LoadItemStatCosts(file []byte) { Stuff: d.GetString("stuff", idx), } - r = append(r, record) + ItemStatCosts[record.Name] = record } - log.Printf("Loaded %d ItemStatCost records", len(r)) + log.Printf("Loaded %d ItemStatCost records", len(ItemStatCosts)) }