feat: capture in-game battle damage statistics & add battle_report API endpoints
This commit is contained in:
1 parent
5c4d0d4149
commit
365e66ffe0
5 files changed
+415
No files matched your search
@@ -113,6 +113,23 @@ func init() {
|
||||
rsp.EndStatus = req.EndStatus
|
||||
rsp.BattleId = req.BattleId
|
||||
rsp.StageId = req.StageId
|
||||
|
||||
if req.Stt != nil {
|
||||
statusStr := "WIN"
|
||||
switch req.EndStatus {
|
||||
case goproto.BattleEndStatus_BATTLE_END_LOSE:
|
||||
statusStr = "LOSE"
|
||||
case goproto.BattleEndStatus_BATTLE_END_QUIT:
|
||||
statusStr = "QUIT"
|
||||
}
|
||||
report := common.BattleReportFromStatistics(req.Stt, req.BattleId, req.StageId, statusStr)
|
||||
if err := common.SaveBattleReport(report); err != nil {
|
||||
Log(fmt.Sprintf("[DAMAGE_ANALYST] Failed to save battle report: %v", err))
|
||||
} else {
|
||||
Log(fmt.Sprintf("[DAMAGE_ANALYST] Battle report captured: BattleID=%d Dmg=%.1f Cycles=%d Turns=%d Status=%s",
|
||||
req.BattleId, report.TeamTotalDamage, report.RoundCnt, report.TotalBattleTurns, statusStr))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user