From 99995ee3ddb91c0a23787724abec8960cd16ccab Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 18 Nov 2022 15:34:07 +0800 Subject: [PATCH] 1 --- server/gameserver/human.cc | 62 +++++++++++++++++++++++++- server/gameserver/human.h | 1 + server/tools/protobuild/cs_proto.proto | 2 + 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 1667e697..946520c3 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1133,7 +1133,12 @@ void Human::FillSMGameOver(cs::SMGameOver& msg) } #endif if (IsPlayer()) { - + Player* p = (Player*)this; + if (!p->settlement) { + p->settlement = std::make_shared(); + FillMFSettlement(&msg, p->settlement.get()); + } + *msg.mutable_settlement() = *p->settlement; } } @@ -2194,6 +2199,7 @@ void Human::GenBattleReportData(a8::MutableXObject* params) } params->SetVal("account_id", account_id); params->SetVal("session_id", session_id); + params->SetVal("team_id", team_id); params->SetVal("pve_instance_id", room->IsPveRoom() ? room->pve_instance->pb->gemini_id() : 0); params->SetVal("pve_instance_mode", room->IsPveRoom() ? room->pve_mode_meta->pb->id() : 0); params->SetVal("battle_uuid", battle_uuid); @@ -4541,3 +4547,57 @@ int Human::GetTeamMode() { return GetTeam()->GetMemberNum() <= 1 ? 0 : 1; } + + +void Human::FillMFSettlement(cs::SMGameOver* msg, cs::MFSettlement* s) +{ + s->set_version(2022111801); + s->set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString()); + s->set_room_mode(room->GetRoomMode()); + s->set_match_mode(GetBattleContext()->GetMatchMode()); + s->set_team_mode(GetTeamMode()); + s->set_game_over(msg->game_over() ? 1 : 0); + s->set_victory(stats.victory); + if (stats.victory) { + s->set_watchable(false); + } else { + if (room->GetAliveTeamNum() > 1) { + s->set_watchable(true); + } else { + if (room->IsPveRoom()) { + s->set_watchable(!room->IsGameOver()); + } else { + s->set_watchable(false); + } + } + } + s->set_team_id(team_id); + s->set_account_id(account_id); + s->set_temmate_all_dead(1); + + s->set_map_id(room->GetMapMeta()->i->map_id()); + s->set_map_name(""); + s->set_rank_chg(0); + for (auto item : msg->spoils_items()) { + auto p = s->add_spoils_items(); + p->set_item_id(a8::XValue(item.values(0))); + p->set_item_num(a8::XValue(item.values(1))); + } + + if (room->IsPveRoom()) { + s->set_pve_wave(room->pve_data.GetWave() + 1); + s->set_pve_max_wave(room->pve_data.max_wave); + s->set_pve_instance_id(room->pve_instance->pb->gemini_id()); + s->set_pve_boss_killed(room->pve_data.boss_state == 2 ? 1 : 0); + } else { + s->set_pvp_team_rank(GetTeam()->team_rank); + s->set_pvp_personal_rank(stats.rank); + s->set_pvp_my_rank(msg->my_rank()); + s->set_pvp_max_rank(msg->max_rank()); + s->set_pvp_total_human_num(msg->total_human_num()); + s->set_pvp_alive_human_num(msg->alive_human_num()); + s->set_pvp_total_team_num(msg->total_team_num()); + } + + *s->mutable_reward() = msg->reward(); +} diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 81919b79..f669a43f 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -405,6 +405,7 @@ private: virtual void OnBuffRemove(Buff& buff) override; virtual void DoSkillPreProc(int skill_id, int target_id, const a8::Vec2& target_pos) override; virtual void DoSkillPostProc(bool used, int skill_id, int target_id, const a8::Vec2& target_pos) override; + void FillMFSettlement(cs::SMGameOver* msg, cs::MFSettlement* settlement); protected: long long hide_frameno_ = 0; diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index dc5c0d69..a0022bdf 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -948,6 +948,8 @@ message MFSettlement optional int32 victory = 7; //是否胜利 optional int32 watchable = 8; //是否可观战 optional int32 team_id = 9; //队伍id + optional string account_id = 50; //自己的账号id + optional int32 temmate_all_dead = 51; //队友是否全部阵亡 optional int32 map_id = 10; //地图id optional string map_name = 12; //地图名称