fix(server): restore achievements, progress, claims and experience
Load ordinary achievements and send transactional gameplay progress notifications. Restore main-story clears and recorded gacha history without duplicate credit. Validate claim thresholds and prior tiers, credit wallet rewards and persist achievement experience in login responses.
This commit is contained in:
@@ -25,6 +25,27 @@ func TestEncode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotifyIsPlainBase64SeparateFromEncryptedResponse(t *testing.T) {
|
||||
key := []byte("0123456789abcdef0123456789abcdef")
|
||||
notify := []byte{0x12, 6, 8, 42, 16, 7, 24, 1}
|
||||
raw, err := EncodeWithNotify(167, nil, key, 123, notify)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var envelope Envelope
|
||||
if err := json.Unmarshal(raw, &envelope); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
decoded, err := base64.StdEncoding.DecodeString(envelope.Notify)
|
||||
if err != nil || string(decoded) != string(notify) {
|
||||
t.Fatalf("notify=%x err=%v", decoded, err)
|
||||
}
|
||||
response, err := cryptox.DecryptBase64Payload(envelope.Data, key)
|
||||
if err != nil || len(response) != 0 {
|
||||
t.Fatalf("response=%x err=%v", response, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBatchPreservesOrderAndRejectsDuplicates(t *testing.T) {
|
||||
key := []byte("0123456789abcdef0123456789abcdef")
|
||||
input := []BatchRequest{{Path: "/B", RequestData: base64.StdEncoding.EncodeToString([]byte{8, 1})}, {Path: "/A", RequestData: base64.StdEncoding.EncodeToString([]byte{8, 2})}}
|
||||
|
||||
Reference in New Issue
Block a user