feat(i18n): integrate i18next for internationalization support and add initial translation setup

This commit is contained in:
kever
2026-02-17 00:11:42 +08:00
parent dc73f6f6af
commit 9395f9d3af
8 changed files with 1081 additions and 445 deletions

106
internal/model/optimizer.go Normal file
View File

@@ -0,0 +1,106 @@
package model
// OptimizeStat represents a stat type/value pair.
type OptimizeStat struct {
Type string `json:"type"`
Value float64 `json:"value"`
}
// OptimizeItem represents the minimal item shape needed by the optimizer.
type OptimizeItem struct {
ID interface{} `json:"id"`
Gear string `json:"gear"`
Set string `json:"set"`
F string `json:"f"`
Main *OptimizeStat `json:"main,omitempty"`
Substats []OptimizeStat `json:"substats,omitempty"`
}
// OptimizeHero represents the minimal hero shape needed by the optimizer.
type OptimizeHero struct {
ID interface{} `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
Atk float64 `json:"atk"`
Def float64 `json:"def"`
Hp float64 `json:"hp"`
Spd float64 `json:"spd"`
Cr float64 `json:"cr"`
Cd float64 `json:"cd"`
Eff float64 `json:"eff"`
Res float64 `json:"res"`
BaseAtk float64 `json:"baseAtk"`
BaseDef float64 `json:"baseDef"`
BaseHp float64 `json:"baseHp"`
BaseSpd float64 `json:"baseSpd"`
BaseCr float64 `json:"baseCr"`
BaseCd float64 `json:"baseCd"`
BaseEff float64 `json:"baseEff"`
BaseRes float64 `json:"baseRes"`
}
// StatRange defines a min/max filter.
type StatRange struct {
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
}
// SetFilters defines set filter groups.
type SetFilters struct {
Set1 []string `json:"set1"`
Set2 []string `json:"set2"`
Set3 []string `json:"set3"`
}
// BonusStats are hero-specific bonus modifiers.
type BonusStats struct {
Atk float64 `json:"atk"`
Def float64 `json:"def"`
Hp float64 `json:"hp"`
AtkPct float64 `json:"atkPct"`
DefPct float64 `json:"defPct"`
HpPct float64 `json:"hpPct"`
Spd float64 `json:"spd"`
Cr float64 `json:"cr"`
Cd float64 `json:"cd"`
Eff float64 `json:"eff"`
Res float64 `json:"res"`
FinalAtkMultiplier float64 `json:"finalAtkMultiplier"`
FinalDefMultiplier float64 `json:"finalDefMultiplier"`
FinalHpMultiplier float64 `json:"finalHpMultiplier"`
}
// OptimizeRequest represents optimizer input.
type OptimizeRequest struct {
HeroID string `json:"heroId"`
SetFilters SetFilters `json:"setFilters"`
StatFilters map[string]StatRange `json:"statFilters"`
MainStatFilters map[string]string `json:"mainStatFilters"`
WeightValues map[string]float64 `json:"weightValues"`
BonusStats BonusStats `json:"bonusStats"`
MaxItemsPerSlot int `json:"maxItemsPerSlot"`
MaxCombos int `json:"maxCombos"`
MaxResults int `json:"maxResults"`
}
// OptimizeResult is a single build result.
type OptimizeResult struct {
Key string `json:"key"`
Sets string `json:"sets"`
Atk float64 `json:"atk"`
Def float64 `json:"def"`
Hp float64 `json:"hp"`
Spd float64 `json:"spd"`
Cr float64 `json:"cr"`
Cd float64 `json:"cd"`
Acc float64 `json:"acc"`
Res float64 `json:"res"`
Score float64 `json:"score"`
Items []OptimizeItem `json:"items"`
}
// OptimizeResponse is the optimizer output.
type OptimizeResponse struct {
TotalCombos int `json:"totalCombos"`
Results []OptimizeResult `json:"results"`
}