- mihoyo-variant KCP in pure Go (28-byte conv+token header), UDP gateway with 0xFF/0x145/0x194 handshake, ms-precision KCP clock + retransmit ticker - protobuf for 4.6.51 generated from the AstralOS StarRail.proto (4932 messages) plus CmdID map from // CmdID: comments (2114 ids) - sdkserver port: query_dispatch/query_gateway (Gateserver pb + base64), hotfix fetch, auth endpoints, SRTools freesr-data.json upload - gameserver handlers: login flow, scene load/spawn with real monster entity tracking, lineup, avatar/skin, missions, tutorials (1249+855), bag/equip, challenge incl. StartChallenge 1787 layout + Tierce 8973 + peak 8948, all raw tierce replies - SceneCastSkill camera bug fix: only real scene monsters (tracked per session) trigger battle; attacking props/NPCs/air replies retcode 0 without battle_info so the camera stays locked on the character - end-to-end smoke test simulating a client over real UDP: handshake, PlayerGetToken, and both SceneCastSkill paths - reuses the Rust PS data files unchanged (freesr-data.json, persistent, res.json, teleports.json, challenge_data.json, mission_unlocks.json)
37 lines
804 B
Go
37 lines
804 B
Go
package gameserver
|
|
|
|
import (
|
|
"time"
|
|
|
|
goproto "gac-hkrpg-go/protocol/proto"
|
|
)
|
|
|
|
const playerUID uint32 = 1337
|
|
|
|
func init() {
|
|
handle("PlayerGetToken", func(s *Session, req *goproto.PlayerGetTokenCsReq, rsp *goproto.PlayerGetTokenScRsp) error {
|
|
rsp.Retcode = 0
|
|
rsp.Msg = "OK"
|
|
rsp.Uid = playerUID
|
|
return nil
|
|
})
|
|
|
|
handle("PlayerLogin", func(s *Session, req *goproto.PlayerLoginCsReq, rsp *goproto.PlayerLoginScRsp) error {
|
|
rsp.Retcode = 0
|
|
rsp.CurTimezone = 8
|
|
rsp.LoginRandom = req.LoginRandom
|
|
rsp.ServerTimestampMs = uint64(time.Now().UnixMilli())
|
|
rsp.Stamina = 240
|
|
rsp.BasicInfo = &goproto.PlayerBasicInfo{
|
|
Nickname: "RobinSR",
|
|
Level: 70,
|
|
WorldLevel: 6,
|
|
Stamina: 240,
|
|
Mcoin: 9999999,
|
|
Hcoin: 9999999,
|
|
Scoin: 9999999,
|
|
}
|
|
return nil
|
|
})
|
|
}
|