feat: capture in-game battle damage statistics & add battle_report API endpoints

This commit is contained in:
CAtlas0784 committed 2026-10-17 13:08:13 +07:00
1 parent 5c4d0d4149
commit 365e66ffe0
5 files changed
+415

No files matched your search

+12
View File
@@ -1,6 +1,9 @@
package gameserver
import (
"fmt"
"gac-hkrpg-go/internal/common"
goproto "gac-hkrpg-go/protocol/proto"
)
@@ -33,6 +36,15 @@ func init() {
handle("QuitBattle", func(s *Session, req *goproto.QuitBattleCsReq, rsp *goproto.QuitBattleScRsp) error {
rsp.Retcode = 0
if req.Stt != nil {
report := common.BattleReportFromStatistics(req.Stt, 0, 0, "QUIT")
if err := common.SaveBattleReport(report); err != nil {
Log(fmt.Sprintf("[DAMAGE_ANALYST] Failed to save quit battle report: %v", err))
} else {
Log(fmt.Sprintf("[DAMAGE_ANALYST] Quit battle report captured: Dmg=%.1f Cycles=%d Turns=%d",
report.TeamTotalDamage, report.RoundCnt, report.TotalBattleTurns))
}
}
return nil
})