pre cw with probe and a bunch script to read game behavior

This commit is contained in:
CAtlas0784 committed 2026-10-21 20:40:13 +07:00
1 parent 5120219ae2
commit da8a32f60d
310 files changed
+219693 -872

No files matched your search

+29 -8
View File
@@ -76,6 +76,19 @@ func (r *Relic) ToProtoRelic() *goproto.Relic {
// Avatar
// ---------------------------------------------------------------------------
// Gender and path values are defined in StarRail.proto at the command table's
// revision. Keep the login gender consistent with the selected persistent path.
func (m MultiPathAvatar) Gender() goproto.Gender {
switch m {
case MultiPathMalePhysical, MultiPathMalePreservation, MultiPathMaleHarmony, MultiPathMaleRemembrance, MultiPathMaleElation:
return goproto.Gender_GenderMan
case MultiPathFemalePhysical, MultiPathFemalePreservation, MultiPathFemaleHarmony, MultiPathFemaleRemembrance, MultiPathFemaleElation:
return goproto.Gender_GenderWoman
default:
return goproto.Gender_GenderNone
}
}
// ToAvatarProto serializes the "base avatar" entry (8001 for MC, 1001 for March).
func (a *AvatarJson) ToAvatarProto(lightcone *Lightcone, mcID, marchID uint32) *goproto.Avatar {
baseAvatarID := BaseAvatarID(a.AvatarID)
@@ -169,11 +182,14 @@ func (a *AvatarJson) ToAvatarPathDataProto(lightcone *Lightcone, relics []*Relic
points := res.AvatarSkillTreePoints[a.AvatarID]
for anchor, pointID := range points {
var level uint32
if len(a.Data.Skills) > 0 {
level = a.Data.Skills[pointID]
} else if len(a.Data.SkillsByAnchorType) > 0 {
level = a.Data.SkillsByAnchorType[anchor]
} else {
if saved, ok := a.Data.Skills[pointID]; ok {
level = saved
} else if saved, ok := a.Data.SkillsByAnchorType[anchor]; ok {
// SRTools and older FreeSR exports may only contain the anchor
// value for some nodes. Fall back per node so a partial Skills
// map does not hide the saved Trace state.
level = saved
} else if len(a.Data.Skills) == 0 && len(a.Data.SkillsByAnchorType) == 0 {
// Keep the existing no-import level behavior, using valid anchors.
level = 1
}
@@ -226,11 +242,11 @@ func (a *AvatarJson) ToBattleAvatarProto(index uint32, lightcone *Lightcone, rel
},
}
if len(a.Data.Skills) > 0 {
if len(a.Data.Skills) > 0 || len(a.Data.SkillsByAnchorType) > 0 {
levels := make(map[uint32]uint32, len(a.Data.Skills)+len(a.Data.SkillsByAnchorType))
for pointID, level := range a.Data.Skills {
ba.SkilltreeList = append(ba.SkilltreeList, &goproto.AvatarSkillTree{PointId: pointID, Level: level})
levels[pointID] = level
}
} else if len(a.Data.SkillsByAnchorType) > 0 {
res, _ := GameRes()
for anchorType, level := range a.Data.SkillsByAnchorType {
pointID := anchorType
@@ -239,6 +255,11 @@ func (a *AvatarJson) ToBattleAvatarProto(index uint32, lightcone *Lightcone, rel
pointID = pid
}
}
if _, exists := levels[pointID]; !exists {
levels[pointID] = level
}
}
for pointID, level := range levels {
ba.SkilltreeList = append(ba.SkilltreeList, &goproto.AvatarSkillTree{PointId: pointID, Level: level})
}
} else {