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
64 changes: 48 additions & 16 deletions scripts/charstat/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,61 +41,93 @@
return
}

var avatars map[string]AvatarInfo
var skills map[string]SkillTreeConfig
var promotions map[string]PromotionConfig
var avatars []AvatarInfo
var skills map[string]SkillTreeConfig = make(map[string]SkillTreeConfig)

Check failure on line 45 in scripts/charstat/generate.go

View workflow job for this annotation

GitHub Actions / lint

var-declaration: should omit type map[string]SkillTreeConfig from declaration of var skills; it will be inferred from the right-hand side (revive)
var skilllist []TraceConfig
var promotions map[string]PromotionConfig = make(map[string]PromotionConfig)

Check failure on line 47 in scripts/charstat/generate.go

View workflow job for this annotation

GitHub Actions / lint

var-declaration: should omit type map[string]PromotionConfig from declaration of var promotions; it will be inferred from the right-hand side (revive)
var promotionlist []PromotionDataConfig
var textMap map[string]string
var avatarSkills map[string]SkillConfig
var avatarSkills map[string]SkillConfig = make(map[string]SkillConfig)

Check failure on line 50 in scripts/charstat/generate.go

View workflow job for this annotation

GitHub Actions / lint

var-declaration: should omit type map[string]SkillConfig from declaration of var avatarSkills; it will be inferred from the right-hand side (revive)
var avatarSkillList []AvatarSkillConfig

err := OpenConfig(&avatars, dmPath, "ExcelOutput", "AvatarConfig.json")
if err != nil {
fmt.Println(err)
return
}
err = OpenConfig(&skills, dmPath, "ExcelOutput", "AvatarSkillTreeConfig.json")
err = OpenConfig(&skilllist, dmPath, "ExcelOutput", "AvatarSkillTreeConfig.json")
if err != nil {
fmt.Println(err)
return
}
err = OpenConfig(&promotions, dmPath, "ExcelOutput", "AvatarPromotionConfig.json")
// take every trace in trace list and convert it into old format kyle used
for _, skill := range skilllist {
strid := strconv.Itoa(skill.PointID)
val, ok := skills[strid]
if ok {
val[strconv.Itoa(skill.Level)] = skill
} else {
skills[strid] = make(SkillTreeConfig)
skills[strid][strconv.Itoa(skill.Level)] = skill
}
}

err = OpenConfig(&promotionlist, dmPath, "ExcelOutput", "AvatarPromotionConfig.json")
if err != nil {
fmt.Println(err)
return
}
for _, promotion := range promotionlist {
strid := strconv.Itoa(promotion.AvatarID)
val, ok := promotions[strid]
if ok {
val[strconv.Itoa(promotion.Promotion)] = promotion
} else {
promotions[strid] = make(PromotionConfig)
promotions[strid][strconv.Itoa(promotion.Promotion)] = promotion
}
}

err = OpenConfig(&textMap, dmPath, "TextMap", "TextMapEN.json")
if err != nil {
fmt.Println(err)
return
}
err = OpenConfig(&avatarSkills, dmPath, "ExcelOutput", "AvatarSkillConfig.json")
err = OpenConfig(&avatarSkillList, dmPath, "ExcelOutput", "AvatarSkillConfig.json")
if err != nil {
fmt.Println(err)
return
}

for key, value := range avatars {
id, err := strconv.Atoi(key)
if err != nil {
fmt.Println(err)
return
for _, skill := range avatarSkillList {
strid := strconv.Itoa(skill.SkillID)
val, ok := avatarSkills[strid]
if ok {
val[strconv.Itoa(skill.Level)] = skill
} else {
avatarSkills[strid] = make(SkillConfig)
avatarSkills[strid][strconv.Itoa(skill.Level)] = skill
}
}

for _, value := range avatars {
id := value.AvatarID

charName := GetCharacterName(textMap, value.AvatarName.Hash)
switch charName {
case "":
continue
case "{NICKNAME}":
charName = "Trailblazer" + value.DamageType
}

var avatarConfig AvatarConfig
err = OpenConfig(&avatarConfig, dmPath, value.JSONPath)
if err != nil {
fmt.Println(err)
continue
}

info := FindSkillInfo(avatarSkills, avatarConfig, key)
ProcessCharacter(charName, value, FindCharSkills(skills, id), info, promotions[key])
info := FindSkillInfo(avatarSkills, avatarConfig, strconv.Itoa(value.AvatarID))
ProcessCharacter(charName, value, FindCharSkills(skills, id), info, promotions[strconv.Itoa(value.AvatarID)])
}
}

Expand Down
5 changes: 5 additions & 0 deletions scripts/charstat/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type TargetInfo struct {

//nolint:tagliatelle // need to match datamine
type AvatarInfo struct {
AvatarID int `json:"AvatarID"`
AvatarName HashInfo `json:"AvatarName"`
Rarity string `json:"Rarity"`
UIAvatarModelPath string `json:"UIAvatarModelPath"`
Expand Down Expand Up @@ -65,6 +66,7 @@ type AvatarSkillMetadata struct {

//nolint:tagliatelle // need to match datamine
type TraceConfig struct {
Level int `json:"Level"`
PointID int `json:"PointID"`
PointType SkillConfigType `json:"PointType"`
AvatarID int `json:"AvatarID"`
Expand All @@ -76,6 +78,7 @@ type TraceConfig struct {

//nolint:tagliatelle // need to match datamine
type PromotionDataConfig struct {
Promotion int `json:"Promotion"`
AvatarID int `json:"AvatarID"`
MaxLevel int `json:"MaxLevel"`
AttackBase ValueInfo `json:"AttackBase"`
Expand All @@ -93,6 +96,8 @@ type PromotionDataConfig struct {

//nolint:tagliatelle // need to match datamine
type AvatarSkillConfig struct {
Level int `json:"Level"`
SkillID int `json:"SkillID"`
BPNeed ValueInfo `json:"BPNeed"`
BPAdd ValueInfo `json:"BPAdd"`
SkillEffect string `json:"SkillEffect"`
Expand Down
Loading