From 5d9de283df0970ea9e685768f125bc46fa61551c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 29 Mar 2024 17:25:37 +0800 Subject: [PATCH] 1 --- server/gameserver/ingamevoice.cc | 19 +++++++++++++------ server/gameserver/mt/InGameVoice.cc | 24 ++++++++++++++++++++++++ server/gameserver/mt/InGameVoice.h | 12 ++++++++++++ server/gameserver/mtb/InGameVoice.h | 4 ++-- server/gameserver/mtb/mtb.all.cc | 2 +- server/tools/protobuild/mt.proto | 2 +- 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/server/gameserver/ingamevoice.cc b/server/gameserver/ingamevoice.cc index d417c709..556e4d1c 100644 --- a/server/gameserver/ingamevoice.cc +++ b/server/gameserver/ingamevoice.cc @@ -5,6 +5,8 @@ #include "human.h" #include "team.h" +#include "mt/InGameVoice.h" + InGameVoice::InGameVoice(Room* room) { room_ = room; @@ -27,7 +29,6 @@ void InGameVoice::UnInit() void InGameVoice::OnHumanBeKill(int killer_id, Human* deader) { - #if 0 if (killer_id == deader->GetUniId()) { return; } @@ -35,13 +36,20 @@ void InGameVoice::OnHumanBeKill(int killer_id, Human* deader) if (!killer) { return; } - personal_nodead_series_kills_.erase(killer_id); + personal_nodead_series_kills_.erase(deader->GetUniId()); IncGlobalKills(); IncPersonalKills(killer_id); - if (global_times_ == 1) { - room_->SendGlobalInGameVoice(killer_id, 1, deader->GetUniId()); - return; + { + mt::InGameVoice::Traverse + ( + room_->IsMobaModeRoom(), + InGameVoiceEventType_e::kGlobalKills, + [this] (const mt::InGameVoice* meta) -> bool + { + return true; + }); } + if (GetPersonalKills(killer_id) == 1) { room_->SendSelfInGameVoice(killer_id, 2); } @@ -62,7 +70,6 @@ void InGameVoice::OnHumanBeKill(int killer_id, Human* deader) if (!killer->dead) { IncPersonalNoDeadSeriesKills(killer_id); } - #endif } void InGameVoice::IncGlobalKills() diff --git a/server/gameserver/mt/InGameVoice.cc b/server/gameserver/mt/InGameVoice.cc index 31f887e2..fbd8256a 100644 --- a/server/gameserver/mt/InGameVoice.cc +++ b/server/gameserver/mt/InGameVoice.cc @@ -59,6 +59,20 @@ namespace mt if (series_kill_interval() > 0) { s_series_kill_interval = series_kill_interval(); } + _cond_val = a8::XValue(cond()); + if (!cond().empty()) { + switch (cond().at(0)) { + case '>': + { + } + break; + default: + { + _cond_type = InGameVoiceCondType_e::kEq; + } + break; + } + } } void InGameVoice::Init2() @@ -105,4 +119,14 @@ namespace mt } } + InGameVoiceCondType_e InGameVoice::CondType() const + { + return _cond_type; + } + + int InGameVoice::CondVal() const + { + return _cond_val; + } + } diff --git a/server/gameserver/mt/InGameVoice.h b/server/gameserver/mt/InGameVoice.h index 0bf2d8ce..6cad8f16 100644 --- a/server/gameserver/mt/InGameVoice.h +++ b/server/gameserver/mt/InGameVoice.h @@ -30,6 +30,13 @@ A8_DECLARE_ENUM(InGameVoiceNotifyObject_e, kTeammateExcludeDead ); +A8_DECLARE_ENUM(InGameVoiceCondType_e, + kNone, + kEq, + kGT, + kGE +); + namespace mt { @@ -43,11 +50,16 @@ namespace mt void Init1(); void Init2(); InGameVoiceNotifyObject_e GetNotifyObject() const; + InGameVoiceCondType_e CondType() const; + int CondVal() const; static void Traverse(bool is_moba_room, int event_type, std::function cb); private: InGameVoiceNotifyObject_e _notify_object; + InGameVoiceCondType_e _cond_type = InGameVoiceCondType_e::kNone; + int _cond_val = 0; + static std::map> s_type_hash_; }; diff --git a/server/gameserver/mtb/InGameVoice.h b/server/gameserver/mtb/InGameVoice.h index 312657a0..5ba71f92 100644 --- a/server/gameserver/mtb/InGameVoice.h +++ b/server/gameserver/mtb/InGameVoice.h @@ -13,7 +13,7 @@ namespace mtb int event_type() const { return event_type_; }; int moba_is_play() const { return moba_is_play_; }; int sound_id() const { return sound_id_; }; - int cond() const { return cond_; }; + const std::string cond() const { return cond_; }; const std::string notify_object() const { return notify_object_; }; int notify_fields() const { return notify_fields_; }; int play_interval() const { return play_interval_; }; @@ -35,7 +35,7 @@ namespace mtb int event_type_ = 0; int moba_is_play_ = 0; int sound_id_ = 0; - int cond_ = 0; + std::string cond_; std::string notify_object_; int notify_fields_ = 0; int play_interval_ = 0; diff --git a/server/gameserver/mtb/mtb.all.cc b/server/gameserver/mtb/mtb.all.cc index d042e83a..d057f568 100644 --- a/server/gameserver/mtb/mtb.all.cc +++ b/server/gameserver/mtb/mtb.all.cc @@ -137,7 +137,7 @@ namespace mtb meta_class->SetSimpleField(0, "event_type", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, event_type_)); meta_class->SetSimpleField(1, "moba_is_play", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, moba_is_play_)); meta_class->SetSimpleField(2, "sound_id", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, sound_id_)); - meta_class->SetSimpleField(3, "cond", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, cond_)); + meta_class->SetSimpleField(3, "cond", a8::reflect::ET_STRING, my_offsetof2(InGameVoice, cond_)); meta_class->SetSimpleField(4, "notify_object", a8::reflect::ET_STRING, my_offsetof2(InGameVoice, notify_object_)); meta_class->SetSimpleField(5, "notify_fields", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, notify_fields_)); meta_class->SetSimpleField(6, "play_interval", a8::reflect::ET_INT32, my_offsetof2(InGameVoice, play_interval_)); diff --git a/server/tools/protobuild/mt.proto b/server/tools/protobuild/mt.proto index 310bec90..209852d7 100755 --- a/server/tools/protobuild/mt.proto +++ b/server/tools/protobuild/mt.proto @@ -63,7 +63,7 @@ message InGameVoice optional int32 event_type = 1; optional int32 moba_is_play = 2; optional int32 sound_id = 3; - optional int32 cond = 4; + optional string cond = 4; optional string notify_object = 5; optional int32 notify_fields = 6; optional int32 play_interval = 7;