This commit is contained in:
aozhiwei 2024-04-01 16:34:02 +08:00
parent 6c9aa323c9
commit 4cf121426d
3 changed files with 36 additions and 14 deletions

View File

@ -3513,6 +3513,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
} }
} }
} }
room->GetInGameVoice()->OnHumanRevive(this);
SendViewerUiMemberUpdate({GetUniId()}); SendViewerUiMemberUpdate({GetUniId()});
} }
} }

View File

@ -7,6 +7,13 @@
#include "mt/InGameVoice.h" #include "mt/InGameVoice.h"
enum KillerVoiceFlags_e
{
KVF_SeriesKills = 1,
KVF_NoDeadSeriesKills,
KVF_ExceptFirstBoold,
};
static void IncIntMap(std::map<int, int>& int_map, int key) static void IncIntMap(std::map<int, int>& int_map, int key)
{ {
auto itr = int_map.find(key); auto itr = int_map.find(key);
@ -102,7 +109,8 @@ void InGameVoice::OnHumanBeKill(int killer_id, Human* deader)
} }
} }
void InGameVoice::Notify(Human* killer, Human* deader, const mt::InGameVoice* meta) void InGameVoice::Notify(Human* killer, Human* deader, const mt::InGameVoice* meta,
std::function<bool (Human*)>& filter_cb)
{ {
{ {
switch (meta->play_scene()) { switch (meta->play_scene()) {
@ -296,16 +304,21 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
{ {
bool is_first_boold = global_kills_ == 1; bool is_first_boold = global_kills_ == 1;
bool sent = false; bool sent = false;
std::function<bool (Human*)> filter_cb =
[] (Human*) -> bool
{
return true;
};
{ {
int val = global_kills_; int val = global_kills_;
mt::InGameVoice::Traverse mt::InGameVoice::Traverse
( (
room_->IsMobaModeRoom(), room_->IsMobaModeRoom(),
InGameVoiceEventType_e::kGlobalKills, InGameVoiceEventType_e::kGlobalKills,
[this, killer, deader, val, &sent] (const mt::InGameVoice* meta) -> bool [this, killer, deader, val, &sent, &filter_cb] (const mt::InGameVoice* meta) -> bool
{ {
if (meta->MatchCond(val)) { if (meta->MatchCond(val)) {
Notify(killer, deader, meta); Notify(killer, deader, meta, filter_cb);
sent = true; sent = true;
} }
return true; return true;
@ -324,10 +337,10 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
( (
room_->IsMobaModeRoom(), room_->IsMobaModeRoom(),
InGameVoiceEventType_e::kNoDeadSeriesKills, InGameVoiceEventType_e::kNoDeadSeriesKills,
[this, killer, deader, val, &sent] (const mt::InGameVoice* meta) -> bool [this, killer, deader, val, &sent, &filter_cb] (const mt::InGameVoice* meta) -> bool
{ {
if (meta->MatchCond(val)) { if (meta->MatchCond(val)) {
Notify(killer, deader, meta); Notify(killer, deader, meta, filter_cb);
sent = true; sent = true;
} }
return true; return true;
@ -337,6 +350,7 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
if (sent) { if (sent) {
return; return;
} }
std::map<int, long long> killer_flags;
{ {
{ {
int val = GetIntMap(personal_series_kills_, killer->GetUniId()); int val = GetIntMap(personal_series_kills_, killer->GetUniId());
@ -344,10 +358,10 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
( (
room_->IsMobaModeRoom(), room_->IsMobaModeRoom(),
InGameVoiceEventType_e::kSeriesKills, InGameVoiceEventType_e::kSeriesKills,
[this, killer, deader, val, &sent] (const mt::InGameVoice* meta) -> bool [this, killer, deader, val, &sent, &filter_cb] (const mt::InGameVoice* meta) -> bool
{ {
if (meta->MatchCond(val)) { if (meta->MatchCond(val)) {
Notify(killer, deader, meta); Notify(killer, deader, meta, filter_cb);
} }
return true; return true;
}); });
@ -360,10 +374,10 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
( (
room_->IsMobaModeRoom(), room_->IsMobaModeRoom(),
InGameVoiceEventType_e::kPersonalExceptFirstBooldKills, InGameVoiceEventType_e::kPersonalExceptFirstBooldKills,
[this, killer, deader, val] (const mt::InGameVoice* meta) -> bool [this, killer, deader, val, &filter_cb] (const mt::InGameVoice* meta) -> bool
{ {
if (meta->MatchCond(val)) { if (meta->MatchCond(val)) {
Notify(killer, deader, meta); Notify(killer, deader, meta, filter_cb);
} }
return true; return true;
}); });
@ -375,9 +389,9 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
( (
room_->IsMobaModeRoom(), room_->IsMobaModeRoom(),
InGameVoiceEventType_e::kTeamAllDead, InGameVoiceEventType_e::kTeamAllDead,
[this, killer, deader] (const mt::InGameVoice* meta) -> bool [this, killer, deader, &filter_cb] (const mt::InGameVoice* meta) -> bool
{ {
Notify(killer, deader, meta); Notify(killer, deader, meta, filter_cb);
return true; return true;
}); });
} else { } else {
@ -385,12 +399,17 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
( (
room_->IsMobaModeRoom(), room_->IsMobaModeRoom(),
InGameVoiceEventType_e::kHeroBeKill, InGameVoiceEventType_e::kHeroBeKill,
[this, killer, deader] (const mt::InGameVoice* meta) -> bool [this, killer, deader, &filter_cb] (const mt::InGameVoice* meta) -> bool
{ {
Notify(killer, deader, meta); Notify(killer, deader, meta, filter_cb);
return true; return true;
}); });
} }
} }
} }
void InGameVoice::OnHumanRevive(Human* hum)
{
}

View File

@ -14,13 +14,15 @@ class InGameVoice : public std::enable_shared_from_this<InGameVoice>
void UnInit(); void UnInit();
void OnHumanBeKill(int killer_id, Human* deader); void OnHumanBeKill(int killer_id, Human* deader);
void OnHumanRevive(Human* hum);
private: private:
void UpdateTeamBeKillLastTime(int team_id); void UpdateTeamBeKillLastTime(int team_id);
a8::Attacher* GetNoDeadTimerAttacher(int killer_id); a8::Attacher* GetNoDeadTimerAttacher(int killer_id);
void TriggerEvent(Human* killer, Human* deader); void TriggerEvent(Human* killer, Human* deader);
void Notify(Human* killer, Human* deader, const mt::InGameVoice* meta); void Notify(Human* killer, Human* deader, const mt::InGameVoice* meta,
std::function<bool (Human*)>& filter_cb);
private: private: