diff --git a/server/gameserver/hero.h b/server/gameserver/hero.h index 351a2c75..cf289c7b 100644 --- a/server/gameserver/hero.h +++ b/server/gameserver/hero.h @@ -20,6 +20,7 @@ public: CreatureWeakPtr master; MetaData::Player* meta = nullptr; bool shot_hold = false; + bool is_pve_boss = false; Hero(); virtual ~Hero() override; diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 4c5616fb..364e3be2 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -697,7 +697,7 @@ void Human::FillMFTeamData(Human* hum, cs::MFTeamData* team_data, bool is_game_o team_data->set_team_id(team_id); team_data->set_player_id(GetUniId()); team_data->set_hero_id(meta->i->id()); - team_data->set_score(stats.pve_score); + team_data->set_score(stats.pve_rank_score); if (is_game_over || !real_dead || room->GetFrameNo() - GetRealDeadFrameNo(room) < 4) { TypeConvert::ToPb(GetPos(), team_data->mutable_pos()); TypeConvert::ToPb(GetAttackDir(), team_data->mutable_dir()); @@ -1875,7 +1875,7 @@ void Human::SendUIUpdate() notifymsg.set_kill_count(stats.kills); room->FillSMUiUpdate(notifymsg); if (room->IsPveRoom()) { - notifymsg.set_score(stats.pve_score); + notifymsg.set_score(stats.pve_rank_score); notifymsg.set_wave(room->pve_data.wave + 1); notifymsg.set_max_wave(room->pve_data.max_wave); notifymsg.set_mon_num(room->pve_data.mon_num); @@ -2082,6 +2082,10 @@ void Human::GenBattleReportData(a8::MutableXObject* params) params->SetVal("ride_car_move_distance", stats.ride_car_move_distance); params->SetVal("ride_car_kills", stats.ride_car_kills); params->SetVal("max_hero_skill_lv", stats.max_hero_skill_lv); + { + params->SetVal("pve_rank_score", stats.pve_rank_score); + params->SetVal("pve_kill_boss", stats.pve_kill_boss); + } { std::string weapons_type; std::string weapons_slot; @@ -4246,5 +4250,5 @@ void Human::DecOxygen(int val) void Human::WinPveScore(int score) { - stats.pve_score += score; + stats.pve_rank_score += score; } diff --git a/server/gameserver/human.h b/server/gameserver/human.h index bef27661..65c09611 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -88,7 +88,8 @@ struct PlayerStats int pass_score = 0; int rank_score = 0; - int pve_score = 0; + int pve_rank_score = 0; + int pve_kill_boss = 0; std::vector> extra_drop; diff --git a/server/gameserver/incubator.cc b/server/gameserver/incubator.cc index f9ef74dc..1a483c1e 100644 --- a/server/gameserver/incubator.cc +++ b/server/gameserver/incubator.cc @@ -4,6 +4,7 @@ #include "room.h" #include "human.h" #include "metamgr.h" +#include "hero.h" void Incubator::Init() { @@ -325,6 +326,10 @@ void Incubator::SpawnWaveMon(int wave) if (!hero) { A8_ABORT(); } + if (wave + 1 == room->pve_mode_meta->waves.size()) { + hero->is_pve_boss = true; + } + ++room->pve_data.mon_num; room->NotifyUiUpdate(); } diff --git a/server/gameserver/metadata.cc b/server/gameserver/metadata.cc index e83dd77a..b94949c2 100644 --- a/server/gameserver/metadata.cc +++ b/server/gameserver/metadata.cc @@ -1626,6 +1626,11 @@ namespace MetaData abort(); } waves[content.pb->round() - 1].push_back(&content); + if (content.pb->round() +1 >= waves.size()) { + if (content.enemys.size() != 1) { + abort(); + } + } } { std::vector strings; diff --git a/server/gameserver/pvedata.cc b/server/gameserver/pvedata.cc index d168cca6..ac44fd79 100644 --- a/server/gameserver/pvedata.cc +++ b/server/gameserver/pvedata.cc @@ -51,6 +51,19 @@ void PveData::OnBeKill(Hero* hero) room->NotifyUiUpdate(); } + + if (hero->is_pve_boss) { + room->TraverseHumanList + ( + a8::XParams(), + [] (Human* hum, a8::XParams& param) -> bool + { + hum->stats.pve_kill_boss = true; + return true; + } + ); + } + #ifdef DEBUG a8::XPrintf("PveData::OnBeKill wave:%d refreshed_mon:%d killed_num:%d\n", {