This commit is contained in:
aozhiwei 2022-10-27 19:14:21 +08:00
parent eb00b5b41e
commit 630b620c18
2 changed files with 28 additions and 13 deletions

View File

@ -621,11 +621,17 @@ void Human::FillMFPlayerStats(cs::MFPlayerStats* stats_pb)
stats_pb->set_team_id(team_id);
stats_pb->set_nickname(name);
int alive_time = room->GetFrameNo() * FRAME_RATE_MS;
if (!dead) {
stats_pb->set_time_alive(room->GetFrameNo() * 1000.0f / SERVER_FRAME_RATE);
stats_pb->set_time_alive(alive_time);
} else {
stats_pb->set_time_alive(dead_frameno * 1000.0f / SERVER_FRAME_RATE);
alive_time = (dead_frameno - room->GetBattleStartFrameNo()) * FRAME_RATE_MS;
if (room->GetBattleStartFrameNo() <= 0) {
alive_time = 0;
}
stats_pb->set_time_alive(alive_time);
}
stats_pb->set_kills(stats.kills);
stats_pb->set_damage_amount(stats.damage_amount_out);
stats_pb->set_heal_amount(stats.heal_amount);
@ -1111,6 +1117,12 @@ void Human::FillSMGameOver(cs::SMGameOver& msg)
}
}
}
#if 1
if (room->GetBattleStartFrameNo() <= 0) {
msg.set_team_rank(0);
msg.set_personal_rank(0);
}
#endif
}
void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
@ -2164,6 +2176,9 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
params->SetVal("alive_time", alive_time);
} else {
alive_time = (dead_frameno - room->GetBattleStartFrameNo()) * FRAME_RATE_MS;
if (room->GetBattleStartFrameNo() <= 0) {
alive_time = 0;
}
params->SetVal("alive_time", alive_time);
}
params->SetVal("weapon_uuid1", spec_weapons.size() > 0 ? spec_weapons[0].weapon_uniid : 0);

View File

@ -801,12 +801,12 @@ void Player::_CMMove(f8::MsgHdr& hdr, const cs::CMMove& msg)
}
}
} else {
#ifdef DEBUG
#ifdef DEBUG1
a8::XPrintf("attack_dir 0,0\n", {});
#endif
}
} else {
#ifdef DEBUG
#ifdef DEBUG1
a8::XPrintf("moving:%d times:%d\n", {moving ? 1 : 0, GetDisableAttackDirTimes()});
#endif
if (moving && GetDisableAttackDirTimes() <= 0) {
@ -1103,15 +1103,15 @@ void Player::_CMVoice(f8::MsgHdr& hdr, const cs::CMVoice& msg)
void Player::_CMGameOver(f8::MsgHdr& hdr, const cs::CMGameOver& msg)
{
CancelRevive();
if (!dead) {
BeKill(GetUniId(), name, 0);
}
if (room->GetGasData().GetGasMode() == GasInactive ||
HasBuffEffect(kBET_Fly) ||
HasBuffEffect(kBET_Jump)) {
stats.is_run_away = true;
}
CancelRevive();
if (!dead) {
BeKill(GetUniId(), name, 0);
}
SendGameOver();
}
@ -1122,6 +1122,11 @@ void Player::_CMWatchWar(f8::MsgHdr& hdr, const cs::CMWatchWar& msg)
void Player::_CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg)
{
if (room->GetGasData().GetGasMode() == GasInactive ||
HasBuffEffect(kBET_Fly) ||
HasBuffEffect(kBET_Jump)) {
stats.is_run_away = true;
}
if (!leave_) {
if (room->BattleStarted()) {
//如果战斗已经开始算自杀
@ -1130,11 +1135,6 @@ void Player::_CMLeave(f8::MsgHdr& hdr, const cs::CMLeave& msg)
leave_ = true;
leave_frameno_ = room->GetFrameNo();
}
if (room->GetGasData().GetGasMode() == GasInactive ||
HasBuffEffect(kBET_Fly) ||
HasBuffEffect(kBET_Jump)) {
stats.is_run_away = true;
}
cs::SMLeave respmsg;
SendNotifyMsg(respmsg);
}