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

+34 -16
View File
@@ -18,16 +18,18 @@ const maxPacketSize = 1400
// PropEntry mirrors PlayerSession.prop_entities: entity_id -> (prop_id, inst_id, state).
type PropEntry struct {
PropID uint32
InstID uint32
State uint32
GroupID uint32
PropID uint32
InstID uint32
State uint32
}
// Session is the Go port of PlayerSession.
type Session struct {
Token uint32
ConvID uint32
Addr string
Token uint32
ConvID uint32
Addr string
publicSDKURL string
jsonMu sync.RWMutex
stateMu sync.Mutex // serializes packet handlers and hot reload mutations
@@ -36,16 +38,18 @@ type Session struct {
kcpMu sync.Mutex
kcp *kcplib.KCP
startTime time.Time
nextSceneSave int64
battleProbeMu sync.Mutex
battleProbe []byte
PropEntities map[uint32]PropEntry
startTime time.Time
nextSceneSave int64
battleProbeMu sync.Mutex
battleProbe []byte
PropEntities map[uint32]PropEntry
CurrentSceneFloor uint32
// MonsterEntities tracks real overworld monster entities (entity_id -> event_id)
// spawned in the current scene. Used by SceneCastSkill to decide whether an
// attack actually hit a monster (the camera-detach bug fix).
MonsterEntities map[uint32]uint32
partyActorSlots map[uint32]bool
MonsterEntities map[uint32]uint32
SceneMonsterIdentities map[uint32]sceneMonsterIdentity
partyActorSlots map[uint32]bool
// Set by the challenge scene loader, cleared when loading an overworld scene.
ChallengeStageID uint32
ChallengeBattleConfig *common.BattleConfig
@@ -53,6 +57,8 @@ type Session struct {
PeakHardModes map[uint32]bool
TierceTeams map[uint32][][]uint32
TierceBuffs map[uint32][]uint32
currencyWarsRevision uint64
currencyWarsOpen bool
pendingExRankSync map[uint32]bool
techniqueMP *uint32
leaderSlot uint32
@@ -216,6 +222,14 @@ func (s *Session) SyncPlayer() error {
Log("data is not init!")
return nil
}
materials, err := bagMaterials(player)
if err != nil {
return err
}
supportedRelics, err := supportedRelicIDs()
if err != nil {
return err
}
// clear relics & lightcones
del := &goproto.PlayerSyncScNotify{
@@ -244,7 +258,9 @@ func (s *Session) SyncPlayer() error {
// sync new relics & lightcones
sync := &goproto.PlayerSyncScNotify{}
for i := range player.Relics {
sync.RelicList = append(sync.RelicList, player.Relics[i].ToProtoRelic())
if _, supported := supportedRelics[player.Relics[i].RelicID]; supported {
sync.RelicList = append(sync.RelicList, player.Relics[i].ToProtoRelic())
}
}
for i := range player.Lightcones {
sync.EquipmentList = append(sync.EquipmentList, player.Lightcones[i].ToProtoEquipment())
@@ -263,9 +279,11 @@ func (s *Session) SyncPlayer() error {
}
for _, av := range player.Avatars {
avatarSync2.AvatarPathDataInfoList = append(avatarSync2.AvatarPathDataInfoList,
av.ToAvatarPathDataProto(player.FindLightconeFor(av.AvatarID), player.FindRelicsFor(av.AvatarID), player.DressedSkins[av.AvatarID]))
av.ToAvatarPathDataProto(player.FindLightconeFor(av.AvatarID), filterSupportedRelics(player.FindRelicsFor(av.AvatarID), supportedRelics), player.DressedSkins[av.AvatarID]))
}
return s.Send(&goproto.PlayerSyncScNotify{AvatarSync: avatarSync2})
// FreeSR imports can change ranks as well as equipment. Publish the same
// material quantities as GetBag, without deleting/recreating materials.
return s.Send(&goproto.PlayerSyncScNotify{AvatarSync: avatarSync2, MaterialList: materials})
}
func uint32Range(from, to uint32) []uint32 {