diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index bc178587..9c9a19ee 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -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()); diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 1b8c0a2c..68c7b71b 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -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; diff --git a/server/gameserver/netdata.h b/server/gameserver/netdata.h index 52810723..d337f1d7 100644 --- a/server/gameserver/netdata.h +++ b/server/gameserver/netdata.h @@ -18,7 +18,6 @@ class Skill; struct BattleDataContext { std::shared_ptr join_msg; - std::string battle_uuid; int is_valid_battle = 0; std::string payload; int errcode = 0; diff --git a/server/gameserver/pbutils.cc b/server/gameserver/pbutils.cc index 243e7694..b05451ec 100644 --- a/server/gameserver/pbutils.cc +++ b/server/gameserver/pbutils.cc @@ -143,7 +143,6 @@ static Player* InternalCreatePlayer(std::shared_ptr 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())); } diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index cd3a255b..15b09f52 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -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); } diff --git a/server/gameserver/team.cc b/server/gameserver/team.cc index b666e0c9..2da7850a 100644 --- a/server/gameserver/team.cc +++ b/server/gameserver/team.cc @@ -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; - }); -} diff --git a/server/gameserver/team.h b/server/gameserver/team.h index 52da260f..28c3c0bb 100644 --- a/server/gameserver/team.h +++ b/server/gameserver/team.h @@ -51,7 +51,6 @@ class Team : public std::enable_shared_from_this 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 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;