remove human netdata battle_uniid

This commit is contained in:
aozhiwei 2024-04-03 21:45:17 +08:00
parent ef1aa7343c
commit 09f3687e24
7 changed files with 8 additions and 48 deletions

View File

@ -991,7 +991,7 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
params->SetVal("team_id", team_id);
params->SetVal("pve_instance_id", room->IsPveRoom() ? room->pve_instance->gemini_id() : 0);
params->SetVal("pve_instance_mode", room->IsPveRoom() ? room->pve_mode_meta->id() : 0);
params->SetVal("battle_uuid", battle_uuid);
params->SetVal("battle_uuid", GetTeam()->GetBattleUuid());
params->SetVal("match_mode", room->IsPveRoom() ? 2 : 0);
params->SetVal("is_valid_battle", is_valid_battle);
params->SetVal("payload", payload);
@ -3950,7 +3950,7 @@ void Human::SendPersonalBattleReport()
params->SetVal("session_id", session_id);
params->SetVal("version", 2023030201);
params->SetVal("battle_uuid", a8::XValue(battle_uuid));
params->SetVal("battle_uuid", a8::XValue(GetTeam()->GetBattleUuid()));
params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid()));
params->SetVal("room_mode", room->GetReportRoomMode());
params->SetVal("team_id", GetTeam()->GetTeamId());

View File

@ -62,7 +62,6 @@ class Human : public Creature
int today_enter_times = 0;
int account_registertime = 0;
int channel = 0;
std::string battle_uuid;
int is_valid_battle = 0;
std::string payload;
HumanBehavior behavior;

View File

@ -18,7 +18,6 @@ class Skill;
struct BattleDataContext
{
std::shared_ptr<cs::CMJoin> join_msg;
std::string battle_uuid;
int is_valid_battle = 0;
std::string payload;
int errcode = 0;

View File

@ -143,7 +143,6 @@ static Player* InternalCreatePlayer(std::shared_ptr<CustomBattle> p,
#if 0
hum->hero_uniid = a8::XValue(join_msg->hero_uniid());
#endif
hum->battle_uuid = m->GetNetData()->battle_uuid;
hum->is_valid_battle = m->GetNetData()->is_valid_battle;
hum->payload = m->GetNetData()->payload;
PlayerMgr::Instance()->
@ -1095,7 +1094,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
data->SetVal("room_mode", room->GetReportRoomMode());
data->SetVal("team_id", GetTeam()->GetTeamId());
data->SetVal("map_id", room->GetMapMeta()->map_id());
data->SetVal("battle_uuid", a8::XValue(battle_uuid).GetString());
data->SetVal("battle_uuid", GetTeam()->GetBattleUuid());
std::string custom_data = a8::openssl::md5
(data->ToJsonStr() + "520d8eAbB(8cf1^#$^&!@d833a42c820432PDAFE^^)") + "|" +
data->ToJsonStr();
@ -1113,7 +1112,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
p->set_victory(stats->victory ? 1 : 0);
p->set_watchable(false);
p->set_map_id(room->GetMapMeta()->map_id());
p->set_battle_uuid(a8::XValue(battle_uuid).GetString());
p->set_battle_uuid(GetTeam()->GetBattleUuid());
if (room->IsPveRoom()) {
p->set_pve_settlement_color(stats->settlement_color);
@ -1167,7 +1166,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
}
p->set_map_id(room->GetMapMeta()->map_id());
p->set_battle_uuid(a8::XValue(battle_uuid).GetString());
p->set_battle_uuid(GetTeam()->GetBattleUuid());
if (room->IsPveRoom()) {
p->set_pve_settlement_color(stats->settlement_color);
@ -1840,7 +1839,7 @@ void Human::SendBattleSettlement()
{
params->SetVal("account_id", account_id);
params->SetVal("session_id", session_id);
params->SetVal("battle_uuid", battle_uuid);
params->SetVal("battle_uuid", GetTeam()->GetBattleUuid());
params->SetVal("__POST", f8::PbToJson(p->settlement.get()));
}

View File

@ -1692,7 +1692,6 @@ void Room::UpdateGasInactiveMoba()
(
[this] (Team* ele_team) -> bool
{
ele_team->GenBattleUuid();
if (ele_team->HasPlayer()) {
batch_sync_->AddTeam(ele_team);
}
@ -2110,7 +2109,6 @@ void Room::FillTeam()
(
[this] (Team* ele_team) -> bool
{
ele_team->GenBattleUuid();
if (ele_team->HasPlayer()) {
batch_sync_->AddTeam(ele_team);
}

View File

@ -25,6 +25,7 @@
Team::Team()
{
battle_uuid_ = f8::App::Instance()->NewGlobalUuid();
}
Team::~Team()
@ -273,7 +274,6 @@ void Team::SendTeamBattleReport(Human* sender)
void Team::GenBattleReportData(Human* player, a8::MutableXObject* params)
{
CheckBattleUuid();
params->SetVal("version", 2023030201);
params->SetVal("battle_uuid", a8::XValue(battle_uuid_));
params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid()));
@ -487,26 +487,6 @@ void Team::GenBattleReportData(Human* player, a8::MutableXObject* params)
}
void Team::GenBattleUuid()
{
std::string battle_uuid;
for (Human* hum : members_) {
if (!hum->battle_uuid.empty()) {
battle_uuid = hum->battle_uuid;
break;
}
}
if (battle_uuid.empty()) {
battle_uuid = f8::App::Instance()->NewGlobalUuid();
}
for (Human* hum : members_) {
hum->battle_uuid = battle_uuid;
hum->GetNetData()->battle_uuid = battle_uuid;
}
battle_uuid_ = battle_uuid;
}
void Team::RunAway(Human* hum)
{
@ -634,7 +614,6 @@ void Team::TrySendTeamBattleReport(Human* sender)
void Team::GenRoomReportData(a8::MutableXObject* params)
{
CheckBattleUuid();
params->SetVal("battle_uuid", battle_uuid_);
params->SetVal("team_id", GetTeamId());
@ -843,16 +822,3 @@ 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

@ -51,7 +51,6 @@ class Team : public std::enable_shared_from_this<Team>
void FillSMGameOver(cs::SMGameOver& msg);
void GenBattleReportData(Human* player, a8::MutableXObject* params);
void GenRoomReportData(a8::MutableXObject* params);
void GenBattleUuid();
void RunAway(Human* hum);
bool AllIsRunAway();
bool IsViewTeam() { return is_view_; }
@ -65,10 +64,10 @@ class Team : public std::enable_shared_from_this<Team>
bool AllIsDead();
void TrySendTeamBattleReport(Human* sender);
bool IsAlreadyReportBattle() { return already_report_battle_;}
const std::string& GetBattleUuid() { return battle_uuid_; }
private:
void SendTeamBattleReport(Human* sender);
void CheckBattleUuid();
private:
int team_id_ = 0;