From 10a74eb413b9840cf12f7bede557fcd50134995a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 2 Jun 2020 16:51:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0gm=E8=B4=A6=E5=8F=B7=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/roommgr.cc | 28 +++++++++++++++++++++------- server/gameserver/roommgr.h | 2 ++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 6ae68cd..9fa3605 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -31,13 +31,10 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg) } //游戏次数,吃鸡数,击杀数 int game_times = a8::XValue(tmp_strings[0]); - if (!f8::IsOnlineEnv()) { - int channel = f8::ExtractChannelIdFromAccountId(msg.account_id()); - if (channel != 6000) { - game_times = 0; - if (!msg.team_uuid().empty()) { - game_times = 1; - } + if (RoomMgr::Instance()->IsGM(msg)) { + game_times = 0; + if (!msg.team_uuid().empty()) { + game_times = 1; } } #if 0 @@ -55,6 +52,7 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg) void RoomMgr::Init() { InstallReportStateTimer(); + gm_hash_["6001_2004_oTR6b5d0UzpqJ1w-QbdUawWimgz0"] = 1; } void RoomMgr::UnInit() @@ -385,3 +383,19 @@ void RoomMgr::JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_ PlayerMgr::Instance()->OnlineNum(), }); } + +bool RoomMgr::IsGM(const cs::CMJoin& msg) +{ + if (gm_hash_.find(msg.account_id()) == gm_hash_.end()) { + return false; + } + for (int equip_id : msg.prepare_items()) { + MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(equip_id); + if (item_meta) { + if (item_meta->i->equip_type() == EQUIP_TYPE_CAR) { + return true; + } + } + } + return false; +} diff --git a/server/gameserver/roommgr.h b/server/gameserver/roommgr.h index 0ad6c58..565251f 100644 --- a/server/gameserver/roommgr.h +++ b/server/gameserver/roommgr.h @@ -28,6 +28,7 @@ class RoomMgr : public a8::Singleton int OverRoomNum(); Room* GetRoomByUuid(long long uuid); void AddOverRoom(long long room_uuid); + bool IsGM(const cs::CMJoin& msg); private: void InstallReportStateTimer(); @@ -49,4 +50,5 @@ class RoomMgr : public a8::Singleton std::map room_idx_hash_; std::map over_room_hash_; a8::TimerAttacher reportstate_timer_attacher_; + std::map gm_hash_; };