- 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)
118 lines
3.7 KiB
Go
118 lines
3.7 KiB
Go
package gameserver
|
|
|
|
import (
|
|
"os"
|
|
|
|
goproto "gac-hkrpg-go/protocol/proto"
|
|
)
|
|
|
|
func init() {
|
|
// The three optional PlayerSettingInfo sub-messages are required by the
|
|
// 4.6.51 client: leaving them unset NREs inside _CmdGetBasicInfoScRsp.
|
|
handle("GetBasicInfo", func(s *Session, req *goproto.GetBasicInfoCsReq, rsp *goproto.GetBasicInfoScRsp) error {
|
|
rsp.Retcode = 0
|
|
rsp.Gender = 2
|
|
rsp.IsGenderSet = true
|
|
rsp.PlayerSettingInfo = &goproto.PlayerSettingInfo{
|
|
OJPAODIHAJE: &goproto.PNOLLIAKGDB{
|
|
BELKCBAGMFC: false,
|
|
JHJKCJKDHIB: 0,
|
|
MLPGDPGIFCJ: false,
|
|
},
|
|
ANKIDJJINEI: &goproto.LJFJOGEEGPJ{
|
|
MBIAIMKHNDB: false,
|
|
},
|
|
CMFCOOEEECB: &goproto.JPGACKPLGCD{
|
|
KALACJBAPOA: false,
|
|
FOKJIPGMKAN: false,
|
|
IBLGOCFBOCO: false,
|
|
},
|
|
}
|
|
return nil
|
|
})
|
|
|
|
handle("PlayerHeartBeat", func(s *Session, req *goproto.PlayerHeartBeatCsReq, rsp *goproto.PlayerHeartBeatScRsp) error {
|
|
rsp.ClientTimeMs = req.ClientTimeMs
|
|
rsp.ServerTimeMs = req.ClientTimeMs
|
|
|
|
var finalData []byte
|
|
finalData = append(finalData, heartbeatLua...)
|
|
if freecam, err := os.ReadFile("scripts/freecam.lua"); err == nil {
|
|
finalData = append(finalData, '\n')
|
|
finalData = append(finalData, freecam...)
|
|
}
|
|
|
|
rsp.DownloadData = &goproto.ClientDownloadData{
|
|
Version: 51,
|
|
Time: int64(rsp.ServerTimeMs),
|
|
Data: finalData,
|
|
}
|
|
return nil
|
|
})
|
|
|
|
handle("PlayerLoginFinish", func(s *Session, req *goproto.PlayerLoginFinishCsReq, rsp *goproto.PlayerLoginFinishScRsp) error {
|
|
rsp.Retcode = 0
|
|
|
|
notify := &goproto.ContentPackageSyncDataScNotify{
|
|
Data: &goproto.ContentPackageData{},
|
|
}
|
|
for _, v := range contentPackageIDs {
|
|
notify.Data.ContentPackageList = append(notify.Data.ContentPackageList, &goproto.ContentPackageInfo{
|
|
Status: goproto.ContentPackageStatus_ContentPackageStatus_Finished,
|
|
ContentId: v,
|
|
})
|
|
}
|
|
return s.Send(notify)
|
|
})
|
|
|
|
handle("SyncClientResVersion", func(s *Session, req *goproto.SyncClientResVersionCsReq, rsp *goproto.SyncClientResVersionScRsp) error {
|
|
rsp.Retcode = 0
|
|
rsp.LJKMPIMKOMO = req.LJKMPIMKOMO
|
|
return nil
|
|
})
|
|
|
|
handle("GetPlayerBoardData", func(s *Session, req *goproto.GetPlayerBoardDataCsReq, rsp *goproto.GetPlayerBoardDataScRsp) error {
|
|
rsp.Retcode = 0
|
|
rsp.CurrentHeadIconId = 200001
|
|
rsp.CurrentPersonalCardId = 253001
|
|
rsp.Signature = "Trailblazer"
|
|
rsp.JJDDEKIAOFC = []uint32{200001, 200002, 200101, 200102, 200103, 200104}
|
|
rsp.KJAABDABLJJ = []uint32{253001, 253002}
|
|
SceneDebugLog("GET_PLAYER_BOARD_DATA sent")
|
|
return nil
|
|
})
|
|
|
|
handle("GetPhoneData", func(s *Session, req *goproto.GetPhoneDataCsReq, rsp *goproto.GetPhoneDataScRsp) error {
|
|
rsp.Retcode = 0
|
|
rsp.CurPhoneTheme = 1
|
|
rsp.CurPhoneCase = 200001
|
|
rsp.CurChatBubble = 220001
|
|
rsp.OwnedPhoneThemes = []uint32{1}
|
|
rsp.OwnedPhoneCases = []uint32{200001}
|
|
rsp.OwnedChatBubbles = []uint32{220001}
|
|
SceneDebugLog("GET_PHONE_DATA sent")
|
|
return nil
|
|
})
|
|
}
|
|
|
|
var contentPackageIDs = []uint32{
|
|
200001, 200002, 200003, 200004, 200005, 200006, 200007, 200008, 200009, 200010,
|
|
200011, 200012, 200013, 200014, 150017, 150015, 150021, 150018, 130011, 130012,
|
|
130013, 150025, 140006, 150026, 130014, 150034, 150029, 150035, 150041, 150039,
|
|
150045, 150057, 150042, 150067, 150064, 150063, 150024, 171002, 150068, 150070,
|
|
150071, 150073, 150074, 150075, 150076, 150077, 150078, 150079, 150132, 150134,
|
|
150135,
|
|
}
|
|
|
|
const heartbeatLua = `local function beta_text()
|
|
local gameObject = CS.UnityEngine.GameObject.Find("UIRoot/AboveDialog/BetaHintDialog(Clone)")
|
|
if gameObject then
|
|
local textComponent = gameObject:GetComponentInChildren(typeof(CS.RPG.Client.LocalizedText))
|
|
if textComponent then
|
|
textComponent.text = "<color=#FF2D00><b>GaC hkrpg GO server</b></color>"
|
|
end
|
|
end
|
|
end
|
|
beta_text()
|
|
`
|