chore: checkpoint stable battle and eidolon progression

This commit is contained in:
CAtlas0784 committed 2026-10-17 16:38:03 +07:00
1 parent 365e66ffe0
commit a681affdb3
23 files changed
+34511 -11310

No files matched your search

+62
View File
@@ -1,6 +1,7 @@
package common
import (
"encoding/json"
"testing"
goproto "gac-hkrpg-go/protocol/proto"
@@ -33,3 +34,64 @@ func TestStandaloneBattleRelicWire(t *testing.T) {
t.Fatal("inventory and equipped relic references must retain their IDs")
}
}
func TestAvatarPathSkillTreePointIds(t *testing.T) {
// 1. avatar with explicit Skills map uses real PointIDs directly
av := AvatarJson{
AvatarID: 1213,
Data: AvatarData{
Rank: 0,
Skills: map[uint32]uint32{
1213001: 6,
1213002: 10,
},
SkillsByAnchorType: map[uint32]uint32{
1: 6,
2: 10,
},
},
}
proto := av.ToAvatarPathDataProto(nil, nil, 0)
if len(proto.AvatarPathSkillTree) != 2 {
t.Fatalf("expected 2 skill tree nodes, got %d", len(proto.AvatarPathSkillTree))
}
if proto.AvatarPathSkillTree[0].PointId != 1213001 || proto.AvatarPathSkillTree[1].PointId != 1213002 {
t.Fatalf("point ids must be real config point IDs, got %v", proto.AvatarPathSkillTree)
}
// 2. avatar with only SkillsByAnchorType resolves from AvatarSkillTreeConfig.json
avAnchorOnly := AvatarJson{
AvatarID: 1001,
Data: AvatarData{
Rank: 0,
SkillsByAnchorType: map[uint32]uint32{
1: 6,
},
},
}
protoAnchor := avAnchorOnly.ToAvatarPathDataProto(nil, nil, 0)
if len(protoAnchor.AvatarPathSkillTree) != 1 {
t.Fatalf("expected 1 skill tree node, got %d", len(protoAnchor.AvatarPathSkillTree))
}
if protoAnchor.AvatarPathSkillTree[0].PointId != 1001001 {
t.Fatalf("expected resolved point ID 1001001 for March Point01, got %d", protoAnchor.AvatarPathSkillTree[0].PointId)
}
}
func TestSubAffixUnmarshal(t *testing.T) {
var sub1 SubAffix
if err := json.Unmarshal([]byte(`{"sub_affix_id": 7, "cnt": 4, "step": 2}`), &sub1); err != nil {
t.Fatal(err)
}
if sub1.Count != 4 || sub1.SubAffixID != 7 || sub1.Step != 2 {
t.Fatalf("cnt alias failed: %+v", sub1)
}
var sub2 SubAffix
if err := json.Unmarshal([]byte(`{"sub_affix_id": 8, "count": 3, "step": 1}`), &sub2); err != nil {
t.Fatal(err)
}
if sub2.Count != 3 || sub2.SubAffixID != 8 || sub2.Step != 1 {
t.Fatalf("count parsing failed: %+v", sub2)
}
}