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

+12 -4
View File
@@ -32,6 +32,10 @@ func (s *Session) techniqueLineup() *goproto.LineupInfo {
}
return lineup
}
// PearlSR services/battle.zig uses this protocol entity namespace for techniques.
const techniqueAvatarEntityOffset uint32 = 100000
func (s *Session) techniqueAvatar(entity uint32) uint32 {
lineup := s.techniqueLineup()
if lineup == nil {
@@ -41,7 +45,7 @@ func (s *Session) techniqueAvatar(entity uint32) uint32 {
entity = lineup.LeaderSlot + 1
}
for _, a := range lineup.AvatarList {
if a.Slot+1 == entity {
if a.Slot+1 == entity || (entity >= techniqueAvatarEntityOffset && a.Id == entity-techniqueAvatarEntityOffset) {
return a.Id
}
}
@@ -109,7 +113,7 @@ func (s *Session) consumeTechniqueFood(id, count uint32) error {
SceneDebugLog("[TECHNIQUE] food=%d count=%d mp=%d/%d remaining=%d", id, count, *s.techniqueMP, lineup.MaxMp, p.TechniqueFoodStock[id])
return s.syncTechnique(goproto.SyncLineupReason_SyncLineupReason_SyncReasonMpAdd)
}
func (s *Session) payTechnique(castID, skillIndex uint32) (uint32, error) {
func (s *Session) payTechnique(castID, skillIndex uint32, actor ...uint32) (uint32, error) {
if s.paidTechniqueCasts[castID] {
return 0, nil
}
@@ -117,7 +121,11 @@ func (s *Session) payTechnique(castID, skillIndex uint32) (uint32, error) {
if err != nil {
return 0, err
}
avatar := s.techniqueAvatar(0)
entity := uint32(0)
if len(actor) > 0 {
entity = actor[0]
}
avatar := s.techniqueAvatar(entity)
skills := rules.Avatars[avatar]
if int(skillIndex) >= len(skills) {
return uint32(goproto.Retcode_RET_MAZE_NO_ABILITY), nil
@@ -158,7 +166,7 @@ func (s *Session) payTechnique(castID, skillIndex uint32) (uint32, error) {
}
s.paidTechniqueCasts[castID] = true
SceneDebugLog("[TECHNIQUE] cast=%d avatar=%d skill=%d cost=%d mp=%d/%d", castID, avatar, skillIndex, cost, *s.techniqueMP, lineup.MaxMp)
return 0, s.Send(&goproto.SceneCastSkillMpUpdateScNotify{CastEntityId: castID, Mp: *s.techniqueMP})
return 0, nil
}
func init() {
handle("UseItem", func(s *Session, req *goproto.UseItemCsReq, rsp *goproto.UseItemScRsp) error {