From 88bebccc5405bb19d0dd7795571e33c3ace45028 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 15:35:16 +0800 Subject: [PATCH 1/8] 1 --- server/gameserver/roommgr.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index acd75b5..b9b499f 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -87,6 +87,14 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) } } + time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); + #if 1 + if (a8::BetweenDays(Global::g_nowtime, register_time) <= 0) { + return RT_OldBrid1; + } else { + return RT_OldBrid2; + } + #else if (rank >= 0 && rank <= 10) { return RT_OldBrid1; } else if (rank >= 11 && rank <= 17) { @@ -96,6 +104,7 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) } else { return RT_OldBrid1; } + #endif } void RoomMgr::Init() From cadc317deb93ae07571cc5e6cb3105cbbcff46df Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 16:26:11 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=A9=E4=BD=99?= =?UTF-8?q?=E4=BA=BA=E6=95=B0=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/room.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index dfb548d..3650b19 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -908,8 +908,8 @@ void Room::UpdateGasInactive() battle_start_frameno_ = GetFrameNo(); if (human_hash_.size() < GetRoomMaxPlayerNum()) { CreateAndroid(GetRoomMaxPlayerNum() - human_hash_.size()); - NotifyUiUpdate(); } + NotifyUiUpdate(); CombineTeam(); NotifyGameStart(); NotifyWxVoip(); From 1960dbcd33080a1f0c8246f814b7d90e8b6ae9ed Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 16:55:33 +0800 Subject: [PATCH 3/8] 1 --- server/gameserver/roommgr.cc | 15 +++++++++------ server/tools/protobuild/cs_proto.proto | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index b9b499f..5a48f1d 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -88,13 +88,16 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) } time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); - #if 1 - if (a8::BetweenDays(Global::g_nowtime, register_time) <= 0) { - return RT_OldBrid1; +#if 1 + if (!msg.team_uuid().empty()) { } else { - return RT_OldBrid2; + if (a8::BetweenDays(Global::g_nowtime, register_time) <= 0) { + return RT_OldBrid1; + } else { + return RT_OldBrid2; + } } - #else +#else if (rank >= 0 && rank <= 10) { return RT_OldBrid1; } else if (rank >= 11 && rank <= 17) { @@ -104,7 +107,7 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) } else { return RT_OldBrid1; } - #endif +#endif } void RoomMgr::Init() diff --git a/server/tools/protobuild/cs_proto.proto b/server/tools/protobuild/cs_proto.proto index f223dff..2167084 100755 --- a/server/tools/protobuild/cs_proto.proto +++ b/server/tools/protobuild/cs_proto.proto @@ -671,6 +671,7 @@ message MFTeamMember optional int32 game_times = 4; //游戏次数 optional int32 win_times = 5; //吃鸡次数 optional int32 kill_times = 6; //击杀数 + optional int32 create_time = 7; //账号创建时间 } //end mfmsg From 5163e9ddde9261beb856864d2d9b5aa4ed88afdf Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 17:01:26 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E9=98=9F?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/roommgr.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 5a48f1d..965ad5e 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -90,6 +90,19 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); #if 1 if (!msg.team_uuid().empty()) { + bool has_new_brid = false; + for (auto& team_member : msg.team_members()) { + if (team_member.create_time() != 0 && + a8::BetweenDays(Global::g_nowtime, team_member.create_time()) <= 0) { + has_new_brid = true; + break; + } + } + if (has_new_brid) { + return RT_OldBrid1; + } else { + return RT_OldBrid2; + } } else { if (a8::BetweenDays(Global::g_nowtime, register_time) <= 0) { return RT_OldBrid1; From 7ff6939e15c44f4381b06b7e9cb856d7f7831047 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 17:02:32 +0800 Subject: [PATCH 5/8] 1 --- server/gameserver/room.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 3650b19..dc3c966 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2390,7 +2390,7 @@ a8::Vec2 Room::GetDefaultBornPoint() void Room::AddPlayerPostProc(Player* hum) { if (room_type_ == RT_NewBrid) { - CreateAndroid(20 + rand() % 10); + CreateAndroid(10 + rand() % 5); xtimer.AddDeadLineTimerAndAttach(SERVER_FRAME_RATE * (1 + rand() % 3), a8::XParams() .SetSender(hum), From ef95db5b830070800b5b114c322c2715ea146c69 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 17:16:36 +0800 Subject: [PATCH 6/8] 1 --- server/gameserver/room.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index dc3c966..b9eb709 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2566,8 +2566,12 @@ void Room::NewBieRoomStart() first_newbie_ = pair.second; break; } + int protect_time = MetaMgr::Instance()->level0room_robot_protect_time; + if (creator_game_times_ <= 0) { + protect_time = 6; + } xtimer.AddDeadLineTimerAndAttach - (SERVER_FRAME_RATE * MetaMgr::Instance()->level0room_robot_protect_time, + (SERVER_FRAME_RATE * protect_time, a8::XParams() .SetSender(this), [] (const a8::XParams& param) From bb36534b5cced18113df6380da7d3adcace7df46 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 17:29:43 +0800 Subject: [PATCH 7/8] 1 --- server/gameserver/room.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index b9eb709..0d92d0b 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -2567,7 +2567,7 @@ void Room::NewBieRoomStart() break; } int protect_time = MetaMgr::Instance()->level0room_robot_protect_time; - if (creator_game_times_ <= 0) { + if (creator_game_times_ > 0) { protect_time = 6; } xtimer.AddDeadLineTimerAndAttach From aedbbe72d0b50a972f6e595621c22c34fb1554fa Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 9 Jul 2020 19:21:56 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=80=81=E7=94=A8=E6=88=B7=E8=BF=9B?= =?UTF-8?q?=EF=BC=94=EF=BC=90=E4=BA=BA=E6=88=BF=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/room.cc | 8 ++++++++ server/gameserver/room.h | 1 + server/gameserver/roommgr.cc | 17 +++++++++++------ server/gameserver/roommgr.h | 7 +++++-- server/gameserver/types.h | 1 + 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 0d92d0b..0f1d4a1 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -48,6 +48,7 @@ void Room::InitData(RoomInitInfo& init_info) room_uuid_ = init_info.room_uuid; room_type_ = init_info.room_type; creator_game_times_ = init_info.creator_game_times; + creator_register_time_ = init_info.creator_register_time; map_tpl_name_ = init_info.map_tpl_name; grid_service = init_info.grid_service; @@ -2852,6 +2853,13 @@ void Room::ShuaLastGas() bool Room::IsMiniRoom() { + if (GetRoomType() == RT_NewBrid || + GetRoomType() == RT_MidBrid) { + if (a8::BetweenDays(Global::g_nowtime, creator_register_time_) > 0) { + return false; + } + } + return GetRoomType() == RT_NewBrid || GetRoomType() == RT_MidBrid || diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 122b880..8810a28 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -235,6 +235,7 @@ private: int level1room_born_point_uniid_ = 0; bool show_handed_ = false; int creator_game_times_ = 0; + int creator_register_time_ = 0; int current_teamid_ = 0; int current_uniid_ = FIXED_OBJECT_MAXID; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 965ad5e..e0a9fd1 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -160,7 +160,8 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg) } int game_times = 0; RoomType_e self_room_type = GetHumanRoomType(msg, game_times); - Room* room = GetJoinableRoom(msg, self_room_type, game_times); + time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); + Room* room = GetJoinableRoom(msg, self_room_type, game_times, register_time); if (!room) { JoinErrorHandle(msg, 3, hdr.socket_handle); return; @@ -190,7 +191,10 @@ int RoomMgr::OverRoomNum() return over_room_hash_.size(); } -Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type, int game_times) +Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, + const RoomType_e self_room_type, + int game_times, + int creator_register_time) { std::vector> group_rooms; for (int i = 0; i < RT_Max; ++i) { @@ -210,10 +214,10 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room return group_rooms[self_room_type][rand() % group_rooms[self_room_type].size()]; } if (self_room_type == RT_NewBrid) { - return CreateRoom(self_room_type, game_times); + return CreateRoom(self_room_type, game_times, creator_register_time); } if (self_room_type == RT_MidBrid) { - return CreateRoom(self_room_type, game_times); + return CreateRoom(self_room_type, game_times, creator_register_time); } for (int i = 0; i < RT_Max; ++i) { for (Room* room : group_rooms[i]) { @@ -222,7 +226,7 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room } } } - return CreateRoom(self_room_type, game_times); + return CreateRoom(self_room_type, game_times, creator_register_time); } Room* RoomMgr::GetRoomByUuid(long long room_uuid) @@ -395,7 +399,7 @@ int RoomMgr::AllocRoomIdx() return current_room_idx_; } -Room* RoomMgr::CreateRoom(RoomType_e room_type, int game_times) +Room* RoomMgr::CreateRoom(RoomType_e room_type, int game_times, int creator_register_time) { int room_idx = AllocRoomIdx(); if (room_idx < 1) { @@ -407,6 +411,7 @@ Room* RoomMgr::CreateRoom(RoomType_e room_type, int game_times) init_info.room_uuid = App::Instance()->NewUuid(); init_info.room_type = room_type; init_info.creator_game_times = game_times; + init_info.creator_register_time = creator_register_time; if (GetRoomByUuid(init_info.room_uuid)) { abort(); } diff --git a/server/gameserver/roommgr.h b/server/gameserver/roommgr.h index 1a325a6..311aa38 100644 --- a/server/gameserver/roommgr.h +++ b/server/gameserver/roommgr.h @@ -33,13 +33,16 @@ class RoomMgr : public a8::Singleton private: void InstallReportStateTimer(); Room* GetRoomByIdx(int room_idx); - Room* GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type, int game_times); + Room* GetJoinableRoom(const cs::CMJoin& msg, + const RoomType_e self_room_type, + int game_times, + int creator_register_time); void ReportServerState(int instance_id, const std::string& host, int port); void FreeOverRoom(long long room_uuid); bool IsLimitJoin(); int AllocRoomIdx(); - Room* CreateRoom(RoomType_e room_type, int game_times); + Room* CreateRoom(RoomType_e room_type, int game_times, int creator_register_time); void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle); private: diff --git a/server/gameserver/types.h b/server/gameserver/types.h index ccfa369..86a4ac1 100755 --- a/server/gameserver/types.h +++ b/server/gameserver/types.h @@ -154,6 +154,7 @@ struct RoomInitInfo long long room_uuid = 0; RoomType_e room_type = RT_NewBrid; int creator_game_times = 0; + int creator_register_time = 0; const MetaData::Map* map_meta = nullptr; std::string map_tpl_name;