pre cw with probe and a bunch script to read game behavior
This commit is contained in:
1 parent
5120219ae2
commit
da8a32f60d
310 files changed
+219693
-872
No files matched your search
@@ -0,0 +1,69 @@
|
||||
package gameserver
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
goproto "gac-hkrpg-go/protocol/proto"
|
||||
)
|
||||
|
||||
func TestReadPrydwenLineupsUseCurrentClientAvatarResources(t *testing.T) {
|
||||
lineups, err := readPrydwenLineups()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(lineups) != 3 {
|
||||
t.Fatalf("want 3 MoC stage teams, got %d", len(lineups))
|
||||
}
|
||||
for stage, lineup := range lineups {
|
||||
if len(lineup.GetAvatarList()) != 4 {
|
||||
t.Fatalf("stage %d: want 4 avatars, got %d", stage+1, len(lineup.GetAvatarList()))
|
||||
}
|
||||
seen := map[uint32]bool{}
|
||||
for slot, avatar := range lineup.GetAvatarList() {
|
||||
if avatar.GetId() == 0 || avatar.GetAvatarType() != goproto.AvatarType_AVATAR_FORMAL_TYPE {
|
||||
t.Fatalf("stage %d slot %d has invalid avatar resource: %v", stage+1, slot, avatar)
|
||||
}
|
||||
if seen[avatar.GetId()] {
|
||||
t.Fatalf("stage %d repeats AvatarID %d", stage+1, avatar.GetId())
|
||||
}
|
||||
seen[avatar.GetId()] = true
|
||||
if avatar.GetIndex() != uint32(slot) {
|
||||
t.Fatalf("stage %d slot %d has index %d", stage+1, slot, avatar.GetIndex())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildPrydwenRecommendResponsePreservesRequestAndLineups(t *testing.T) {
|
||||
req := &goproto.GetFriendRecommendLineupCsReq{
|
||||
Type: goproto.JFNJKAPPNOF_JFNJKAPPNOF_JHOEBNNMKHB,
|
||||
Key: 101201,
|
||||
}
|
||||
rsp, err := buildPrydwenRecommendResponse(req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if rsp.GetType() != req.GetType() || rsp.GetKey() != req.GetKey() {
|
||||
t.Fatalf("response context does not match request: req=%v rsp=%v", req, rsp)
|
||||
}
|
||||
if len(rsp.GetMGKCKHIIICL()) != 1 {
|
||||
t.Fatalf("want one Prydwen recommendation group, got %d", len(rsp.GetMGKCKHIIICL()))
|
||||
}
|
||||
payload := rsp.GetMGKCKHIIICL()[0].GetNHKCFOALAPD()
|
||||
if payload == nil || len(payload.GetLineupList()) != 3 {
|
||||
t.Fatalf("want three stage lineups in the protocol recommendation oneof, got %v", payload)
|
||||
}
|
||||
encoded, err := proto.Marshal(rsp)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var decoded goproto.GetFriendRecommendLineupScRsp
|
||||
if err := proto.Unmarshal(encoded, &decoded); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(decoded.GetMGKCKHIIICL()[0].GetNHKCFOALAPD().GetLineupList()) != 3 {
|
||||
t.Fatal("wire round-trip lost recommended teams")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user