Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions scripts/weapstat/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ func main() {
return
}

var cones map[string]EquipmentConfig
var promotions map[string]PromotionConfig
var cones []EquipmentConfig
var promotions []PromotionDataConfig
var textMap map[string]string

err := OpenConfig(&cones, dmPath, "ExcelOutput", "EquipmentConfig.json")
Expand All @@ -57,12 +57,18 @@ func main() {
return
}

for key, value := range cones {
promotionMap := make(map[string][]PromotionDataConfig)
for _, promo := range promotions {
key := strconv.Itoa(promo.EquipmentID)
promotionMap[key] = append(promotionMap[key], promo)
}

for _, value := range cones {
coneName := GetName(textMap, value.EquipmentName.Hash)
if coneName == "" {
continue
}
ProcessLightCone(coneName, value, promotions[key])
ProcessLightCone(coneName, value, promotionMap[strconv.Itoa(value.EquipmentID)])
}
}

Expand Down Expand Up @@ -90,7 +96,7 @@ func GetName(textMap map[string]string, hash int) string {
return textMap[strconv.Itoa(hash)]
}

func ProcessLightCone(name string, cone EquipmentConfig, promotions PromotionConfig) {
func ProcessLightCone(name string, cone EquipmentConfig, promotions []PromotionDataConfig) {
//nolint:exhaustruct // values initialized below
data := dataTmpl{}
data.Key = keyRegex.ReplaceAllString(name, "")
Expand All @@ -99,19 +105,15 @@ func ProcessLightCone(name string, cone EquipmentConfig, promotions PromotionCon
data.Path = cone.GetPath()

data.PromotionData = make([]lightcone.PromotionData, len(promotions))
for i := 0; i < len(promotions); i++ {
val, ok := promotions[strconv.Itoa(i)]
if !ok {
break
}
for i, promo := range promotions {
data.PromotionData[i] = lightcone.PromotionData{
MaxLevel: val.MaxLevel,
ATKBase: val.BaseAttack.Value,
ATKAdd: val.BaseAttackAdd.Value,
DEFBase: val.BaseDefence.Value,
DEFAdd: val.BaseDefenceAdd.Value,
HPBase: val.BaseHP.Value,
HPAdd: val.BaseHPAdd.Value,
MaxLevel: promo.MaxLevel,
ATKBase: promo.BaseAttack.Value,
ATKAdd: promo.BaseAttackAdd.Value,
DEFBase: promo.BaseDefence.Value,
DEFAdd: promo.BaseDefenceAdd.Value,
HPBase: promo.BaseHP.Value,
HPAdd: promo.BaseHPAdd.Value,
}
}

Expand Down
1 change: 1 addition & 0 deletions scripts/weapstat/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type ValueInfo struct {

//nolint:tagliatelle // need to match datamine
type EquipmentConfig struct {
EquipmentID int `json:"EquipmentID"`
EquipmentName HashInfo `json:"EquipmentName"`
Rarity string `json:"Rarity"`
AvatarBaseType string `json:"AvatarBaseType"`
Expand Down
Loading