pre cw with probe and a bunch script to read game behavior

This commit is contained in:
CAtlas0784 committed 2026-10-21 20:40:13 +07:00
1 parent 5120219ae2
commit da8a32f60d
310 files changed
+219693 -872

No files matched your search

+58 -29
View File
@@ -1,6 +1,7 @@
package gameserver
import (
"fmt"
"os"
"path/filepath"
"sort"
@@ -14,7 +15,11 @@ func init() {
// Client requires these when processing _CmdGetBasicInfoScRsp.
handle("GetBasicInfo", func(s *Session, req *goproto.GetBasicInfoCsReq, rsp *goproto.GetBasicInfoScRsp) error {
rsp.Retcode = 0
rsp.Gender = 2
player := s.JSON()
if player == nil {
return fmt.Errorf("GetBasicInfo requires player data")
}
rsp.Gender = uint32(player.MainCharacter.Gender())
rsp.IsGenderSet = true
rsp.PlayerSettingInfo = &goproto.PlayerSettingInfo{
OJPAODIHAJE: &goproto.PNOLLIAKGDB{
@@ -35,11 +40,25 @@ func init() {
})
handle("PlayerHeartBeat", func(s *Session, req *goproto.PlayerHeartBeatCsReq, rsp *goproto.PlayerHeartBeatScRsp) error {
if err := s.applyCurrencyWarsCommands(); err != nil {
PacketLog("CW_GM deferred: " + err.Error())
}
rsp.ClientTimeMs = req.ClientTimeMs
rsp.ServerTimeMs = req.ClientTimeMs
var finalData []byte
finalData = append(finalData, heartbeatLua...)
if s.publicSDKURL != "" {
finalData = append(finalData, []byte("\n_G.__GAC_SRTOOL_LIVE_URL = "+luaQuotedString(s.publicSDKURL)+"\n")...)
}
profiles, err := loadNavigationProfiles()
if err != nil {
return err
}
finalData = append(finalData, profiles...)
if player := s.JSON(); player != nil {
finalData = append(finalData, []byte(fmt.Sprintf("\n_G.__GAC_NAVIGATION_CURRENT_ENTRY=%d\n", player.Scene.EntryID))...)
}
if probe := s.takeBattleProbe(); len(probe) > 0 {
finalData = append(finalData, '\n')
finalData = append(finalData, probe...)
@@ -100,28 +119,11 @@ func init() {
return err
}
rsp.Retcode = 0
rsp.CurrentHeadIconId = profile.Icons[0]
rsp.CurrentPersonalCardId = profile.CurrentPersonalCard
rsp.HeadFrameInfo = profile.HeadFrame
rsp.NBIEJKLENOB = &goproto.DisplayAvatarVec{IsDisplay: true}
rsp.Signature = "Trailblazer"
// PearlSR 005d2c1 GetPlayerBoardDataScRsp: field 4 is personal
// cards, field 8 is head icons, and field 9 is assist avatar IDs.
rsp.JJDDEKIAOFC = profile.PersonalCards
for _, id := range profile.Icons {
rsp.KNINLDPFLMA = append(rsp.KNINLDPFLMA, &goproto.HeadIconData{Id: id})
}
if player := s.JSON(); player != nil {
for _, slot := range player.SortedLineupKeys() {
id := player.Lineups[slot]
if _, ok := player.Avatars[id]; !ok {
continue
}
rsp.KJAABDABLJJ = append(rsp.KJAABDABLJJ, id)
rsp.NBIEJKLENOB.DisplayAvatarList = append(rsp.NBIEJKLENOB.DisplayAvatarList,
&goproto.DisplayAvatarData{AvatarId: id, Pos: slot})
}
player, err := profilePlayer(s)
if err != nil {
return err
}
fillPlayerBoard(player, profile, rsp)
SceneDebugLog("GET_PLAYER_BOARD_DATA sent")
return nil
})
@@ -132,12 +134,11 @@ func init() {
return err
}
rsp.Retcode = 0
rsp.CurPhoneTheme = profile.CurrentPhoneTheme
rsp.CurPhoneCase = profile.CurrentPhoneCase
rsp.CurChatBubble = profile.CurrentChatBubble
rsp.OwnedPhoneThemes = profile.PhoneThemes
rsp.OwnedPhoneCases = profile.PhoneCases
rsp.OwnedChatBubbles = profile.ChatBubbles
player, err := profilePlayer(s)
if err != nil {
return err
}
fillPhoneData(player, profile, rsp)
SceneDebugLog("GET_PHONE_DATA sent")
return nil
})
@@ -157,9 +158,37 @@ const heartbeatLua = `local function beta_text()
if gameObject then
local textComponent = gameObject:GetComponentInChildren(typeof(CS.RPG.Client.LocalizedText))
if textComponent then
textComponent.text = "<color=#3E6BE6><b>GaC hkrpg GO แล้วเรามาเกกันนะ</b></color>"
textComponent.text = "<color=#5C82DB><b>GaC hkrpg GO แล้วเรามาเกกันนะ</b></color>"
end
end
end
beta_text()
`
func luaQuotedString(value string) string {
var out strings.Builder
out.Grow(len(value) + 2)
out.WriteByte('\'')
for _, r := range value {
switch r {
case '\\':
out.WriteString("\\\\")
case '\'':
out.WriteString("\\'")
case '\n':
out.WriteString("\\n")
case '\r':
out.WriteString("\\r")
case '\t':
out.WriteString("\\t")
default:
if r < 0x20 {
fmt.Fprintf(&out, "\\%03d", r)
} else {
out.WriteRune(r)
}
}
}
out.WriteByte('\'')
return out.String()
}