1
This commit is contained in:
parent
6c9aa323c9
commit
4cf121426d
@ -3513,6 +3513,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
|
||||
}
|
||||
}
|
||||
}
|
||||
room->GetInGameVoice()->OnHumanRevive(this);
|
||||
SendViewerUiMemberUpdate({GetUniId()});
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,13 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
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()) {
|
||||
@ -296,16 +304,21 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
{
|
||||
bool is_first_boold = global_kills_ == 1;
|
||||
bool sent = false;
|
||||
std::function<bool (Human*)> filter_cb =
|
||||
[] (Human*) -> bool
|
||||
{
|
||||
return true;
|
||||
};
|
||||
{
|
||||
int val = global_kills_;
|
||||
mt::InGameVoice::Traverse
|
||||
(
|
||||
room_->IsMobaModeRoom(),
|
||||
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)) {
|
||||
Notify(killer, deader, meta);
|
||||
Notify(killer, deader, meta, filter_cb);
|
||||
sent = true;
|
||||
}
|
||||
return true;
|
||||
@ -324,10 +337,10 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
(
|
||||
room_->IsMobaModeRoom(),
|
||||
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)) {
|
||||
Notify(killer, deader, meta);
|
||||
Notify(killer, deader, meta, filter_cb);
|
||||
sent = true;
|
||||
}
|
||||
return true;
|
||||
@ -337,6 +350,7 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
if (sent) {
|
||||
return;
|
||||
}
|
||||
std::map<int, long long> killer_flags;
|
||||
{
|
||||
{
|
||||
int val = GetIntMap(personal_series_kills_, killer->GetUniId());
|
||||
@ -344,10 +358,10 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
(
|
||||
room_->IsMobaModeRoom(),
|
||||
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)) {
|
||||
Notify(killer, deader, meta);
|
||||
Notify(killer, deader, meta, filter_cb);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -360,10 +374,10 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
(
|
||||
room_->IsMobaModeRoom(),
|
||||
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)) {
|
||||
Notify(killer, deader, meta);
|
||||
Notify(killer, deader, meta, filter_cb);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -375,9 +389,9 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
(
|
||||
room_->IsMobaModeRoom(),
|
||||
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;
|
||||
});
|
||||
} else {
|
||||
@ -385,12 +399,17 @@ void InGameVoice::TriggerEvent(Human* killer, Human* deader)
|
||||
(
|
||||
room_->IsMobaModeRoom(),
|
||||
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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void InGameVoice::OnHumanRevive(Human* hum)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -14,13 +14,15 @@ class InGameVoice : public std::enable_shared_from_this<InGameVoice>
|
||||
void UnInit();
|
||||
|
||||
void OnHumanBeKill(int killer_id, Human* deader);
|
||||
void OnHumanRevive(Human* hum);
|
||||
|
||||
private:
|
||||
void UpdateTeamBeKillLastTime(int team_id);
|
||||
a8::Attacher* GetNoDeadTimerAttacher(int killer_id);
|
||||
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:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user