diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index aac657b0..fc4da9e9 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -43,6 +43,7 @@ #include "stats.h" #include "hero.h" #include "bornpoint.h" +#include "ingamevoice.h" #include "buff/sprint.h" @@ -3557,6 +3558,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we } SendViewerUiMemberUpdate({GetUniId(), killer_id, real_killer_id}); room->NotifyUiUpdate(); + room->GetInGameVoice()->OnHumanBeKill(real_killer_id, this); } int Human::GetTeamMode() diff --git a/server/gameserver/ingamevoice.cc b/server/gameserver/ingamevoice.cc index 8821c776..cc3bda89 100644 --- a/server/gameserver/ingamevoice.cc +++ b/server/gameserver/ingamevoice.cc @@ -2,7 +2,7 @@ #include "ingamevoice.h" #include "room.h" -#include "player.h" +#include "human.h" InGameVoice::InGameVoice(Room* room) { @@ -23,3 +23,19 @@ void InGameVoice::UnInit() { } + +void InGameVoice::OnHumanBeKill(int killer_id, Human* deader) +{ + if (killer_id == deader->GetUniId()) { + return; + } + Human* killer = room_->GetHumanByUniId(killer_id); + if (!killer) { + return; + } + ++global_times_; + if (global_times_ == 1) { + room_->SendGlobalInGameVoice(killer_id, 1, deader->GetUniId()); + return; + } +} diff --git a/server/gameserver/ingamevoice.h b/server/gameserver/ingamevoice.h index e1f556e4..3da9e639 100644 --- a/server/gameserver/ingamevoice.h +++ b/server/gameserver/ingamevoice.h @@ -1,7 +1,7 @@ #pragma once class Room; - +class Human; class InGameVoice : public std::enable_shared_from_this { public: @@ -11,6 +11,9 @@ class InGameVoice : public std::enable_shared_from_this void Init(); void UnInit(); + void OnHumanBeKill(int killer_id, Human* deader); + private: Room* room_ = nullptr; + int global_times_ = 0; };