40 lines
946 B
Go
40 lines
946 B
Go
package gameserver
|
|
|
|
import (
|
|
"time"
|
|
|
|
goproto "gac-hkrpg-go/protocol/proto"
|
|
)
|
|
|
|
// Loaded from the shared runtime configuration before the gateway accepts sessions.
|
|
var playerUID uint32
|
|
var playerName string
|
|
var playerWorldLevel uint32
|
|
|
|
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: playerName,
|
|
Level: 70,
|
|
WorldLevel: playerWorldLevel,
|
|
Stamina: 240,
|
|
Mcoin: 9999999,
|
|
Hcoin: 9999999,
|
|
Scoin: 9999999,
|
|
}
|
|
return nil
|
|
})
|
|
}
|