This commit is contained in:
aozhiwei 2024-04-02 20:19:23 +08:00
parent 26c38e41eb
commit ed389d54e6
3 changed files with 21 additions and 3 deletions

View File

@ -3922,6 +3922,7 @@ void Room::GenBattleRoomReportData(a8::MutableXObject* params)
[&teams_pb] (Team* team) -> bool
{
auto team_pb = a8::MutableXObject::CreateObject();
team->GenRoomReportData(team_pb.get());
teams_pb->Push(*team_pb);
return true;
}

View File

@ -273,8 +273,9 @@ void Team::SendTeamBattleReport(Human* sender)
void Team::GenBattleReportData(Human* player, a8::MutableXObject* params)
{
CheckBattleUuid();
params->SetVal("version", 2023030201);
params->SetVal("battle_uuid", a8::XValue(player->battle_uuid));
params->SetVal("battle_uuid", a8::XValue(battle_uuid_));
params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid()));
params->SetVal("room_mode", room->GetReportRoomMode());
params->SetVal("team_id", GetTeamId());
@ -503,6 +504,7 @@ void Team::GenBattleUuid()
hum->battle_uuid = battle_uuid;
hum->GetNetData()->battle_uuid = battle_uuid;
}
battle_uuid_ = battle_uuid;
}
void Team::RunAway(Human* hum)
@ -632,8 +634,8 @@ void Team::TrySendTeamBattleReport(Human* sender)
void Team::GenRoomReportData(a8::MutableXObject* params)
{
std::string battle_uuid;
params->SetVal("battle_uuid", battle_uuid);
CheckBattleUuid();
params->SetVal("battle_uuid", battle_uuid_);
params->SetVal("team_id", GetTeamId());
if (room->IsPveRoom()) {
@ -839,3 +841,16 @@ void Team::GenRoomReportData(a8::MutableXObject* params)
params->SetVal("pvp_team_kills", pvp_team_kills);
}
}
void Team::CheckBattleUuid()
{
TraverseMembers
(
[this] (Human* hum) -> bool
{
if (battle_uuid_ != hum->battle_uuid) {
abort();
}
return true;
});
}

View File

@ -67,6 +67,7 @@ class Team : public std::enable_shared_from_this<Team>
private:
void SendTeamBattleReport(Human* sender);
void CheckBattleUuid();
private:
int team_id_ = 0;
@ -80,5 +81,6 @@ private:
long long last_kill_frameno_ = 0;
bool sending_battlereport_ = false;
bool already_report_battle_ = false;
std::string battle_uuid_;
};