diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 13315a7..114a29e 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -2103,7 +2103,11 @@ void Human::GenBattleReportData(a8::MutableXObject* params) stats.pass_score = MetaMgr::Instance()->GetKillPointParam1(stats.kills); stats.pass_score += MetaMgr::Instance()->GetRankPointParam1(rank); stats.rank_score = MetaMgr::Instance()->GetKillPointParam2(stats.kills); - stats.rank_score += MetaMgr::Instance()->GetRankPointParam2(rank); + if (room->IsMiniRoom()) { + stats.rank_score += MetaMgr::Instance()->GetRankPointParam3(rank); + } else { + stats.rank_score += MetaMgr::Instance()->GetRankPointParam2(rank); + } } params->SetVal("score", 0); params->SetVal("pass_score", has_pass ? stats.pass_score * 2 : stats.pass_score); diff --git a/server/gameserver/metamgr.cc b/server/gameserver/metamgr.cc index 3d9e3fe..ddd2eac 100755 --- a/server/gameserver/metamgr.cc +++ b/server/gameserver/metamgr.cc @@ -762,6 +762,12 @@ int MetaMgr::GetRankPointParam2(int rank) return itr != loader_->rankpoint_hash.end() ? itr->second->i->parameter2() : 0; } +int MetaMgr::GetRankPointParam3(int rank) +{ + auto itr = loader_->rankpoint_hash.find(rank); + return itr != loader_->rankpoint_hash.end() ? itr->second->i->parameter3() : 0; +} + int MetaMgr::GetKillPointParam1(int kill_num) { auto itr = loader_->killpoint_hash.find(kill_num); diff --git a/server/gameserver/metamgr.h b/server/gameserver/metamgr.h index f925473..3d743b2 100755 --- a/server/gameserver/metamgr.h +++ b/server/gameserver/metamgr.h @@ -42,6 +42,7 @@ class MetaMgr : public a8::Singleton float GetKillRewardParam(int kill_num); int GetRankPointParam1(int rank); int GetRankPointParam2(int rank); + int GetRankPointParam3(int rank); int GetKillPointParam1(int kill_num); int GetKillPointParam2(int kill_num); MetaData::Robot* RandRobot(std::set& refreshed_robot_set); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 43db83e..daccbb9 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -49,6 +49,7 @@ void Room::InitData(RoomInitInfo& init_info) room_type_ = init_info.room_type; creator_game_times_ = init_info.creator_game_times; creator_register_time_ = init_info.creator_register_time; + force_entry_newbie_room_ = init_info.force_entry_newbie_room; map_tpl_name_ = init_info.map_tpl_name; grid_service = init_info.grid_service; diff --git a/server/gameserver/room.h b/server/gameserver/room.h index f3b5b4a..861f6cb 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -122,6 +122,7 @@ public: void GetAlivePlayers(std::vector& humans, size_t num); int GetCanShuaNum(int shua_num); void AdjustPosInnerMap(a8::Vec2& pos, float radius); + bool IsMiniRoom(); private: int AllocUniid(); @@ -196,7 +197,6 @@ private: void CheckShowHand(); void ShowHand(); void ShuaLastGas(); - bool IsMiniRoom(); size_t GetRoomMaxPlayerNum(); void InitAndroidAI(); @@ -237,6 +237,7 @@ private: bool show_handed_ = false; int creator_game_times_ = 0; int creator_register_time_ = 0; + bool force_entry_newbie_room_ = false; int current_teamid_ = 0; int current_uniid_ = FIXED_OBJECT_MAXID; diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index 2d453bf..0f4ed2d 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -43,20 +43,13 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) } #endif - if (msg.force_entry_newbie_room()) { - if (msg.team_uuid().empty()) { - return RT_NewBrid; - } else { - RoomMgr::Instance()->AddProtectTeam(msg.team_uuid()); - return RT_MidBrid; - } - } if (!msg.team_uuid().empty()) { if (RoomMgr::Instance()->IsProtectTeam(msg.team_uuid())) { return RT_MidBrid; } bool has_mid_brid = false; bool has_old_brid1 = false; + bool has_old_brid2 = false; for (auto& team_member : msg.team_members()) { if (team_member.game_times() >= 1 && team_member.game_times() <= 1) { has_mid_brid = true; @@ -64,6 +57,12 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) if (team_member.game_times() >= 2 && team_member.game_times() <= 2) { has_old_brid1 = true; } + if (team_member.rank() > 6) { + has_old_brid2 = true; + } + } + if (has_old_brid2) { + return RT_OldBrid2; } if (has_mid_brid) { return RT_MidBrid; @@ -71,6 +70,10 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) if (has_old_brid1) { return RT_OldBrid1; } + } else { + if (msg.force_entry_newbie_room()) { + return RT_NewBrid; + } } if (game_times <= 0) { @@ -119,7 +122,7 @@ static RoomType_e GetHumanRoomType(const cs::CMJoin& msg, int& game_times) } } #else - if (rank >= 0 && rank <= 10) { + if (rank >= 0 && rank <= 6) { return RT_OldBrid1; } else { return RT_OldBrid2; @@ -165,7 +168,12 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg) int game_times = 0; RoomType_e self_room_type = GetHumanRoomType(msg, game_times); time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id()); - Room* room = GetJoinableRoom(msg, self_room_type, game_times, register_time); + Room* room = GetJoinableRoom(msg, + self_room_type, + game_times, + register_time, + msg.force_entry_newbie_room() + ); if (!room) { JoinErrorHandle(msg, 3, hdr.socket_handle); return; @@ -176,7 +184,8 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg) CreatePlayerByCMJoin(hum, hdr.ip_saddr, hdr.socket_handle, - msg); + msg + ); hum->meta = MetaMgr::Instance()->human_meta; hum->room = room; hum->ProcPrepareItems(msg.prepare_items()); @@ -198,7 +207,9 @@ int RoomMgr::OverRoomNum() Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type, int game_times, - int creator_register_time) + int creator_register_time, + bool force_entry_newbie_room + ) { std::vector> group_rooms; for (int i = 0; i < RT_Max; ++i) { @@ -218,10 +229,16 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, 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, creator_register_time); + return CreateRoom(self_room_type, + game_times, + creator_register_time, + force_entry_newbie_room); } if (self_room_type == RT_MidBrid) { - return CreateRoom(self_room_type, game_times, creator_register_time); + return CreateRoom(self_room_type, + game_times, + creator_register_time, + force_entry_newbie_room); } for (int i = 0; i < RT_Max; ++i) { for (Room* room : group_rooms[i]) { @@ -230,7 +247,10 @@ Room* RoomMgr::GetJoinableRoom(const cs::CMJoin& msg, } } } - return CreateRoom(self_room_type, game_times, creator_register_time); + return CreateRoom(self_room_type, + game_times, + creator_register_time, + force_entry_newbie_room); } Room* RoomMgr::GetRoomByUuid(long long room_uuid) @@ -403,7 +423,10 @@ int RoomMgr::AllocRoomIdx() return current_room_idx_; } -Room* RoomMgr::CreateRoom(RoomType_e room_type, int game_times, int creator_register_time) +Room* RoomMgr::CreateRoom(RoomType_e room_type, + int game_times, + int creator_register_time, + bool force_entry_newbie_room) { int room_idx = AllocRoomIdx(); if (room_idx < 1) { @@ -416,6 +439,7 @@ Room* RoomMgr::CreateRoom(RoomType_e room_type, int game_times, int creator_regi init_info.room_type = room_type; init_info.creator_game_times = game_times; init_info.creator_register_time = creator_register_time; + init_info.force_entry_newbie_room = force_entry_newbie_room; if (GetRoomByUuid(init_info.room_uuid)) { abort(); } diff --git a/server/gameserver/roommgr.h b/server/gameserver/roommgr.h index 7f3a843..0e435de 100644 --- a/server/gameserver/roommgr.h +++ b/server/gameserver/roommgr.h @@ -38,13 +38,17 @@ class RoomMgr : public a8::Singleton Room* GetJoinableRoom(const cs::CMJoin& msg, const RoomType_e self_room_type, int game_times, - int creator_register_time); + int creator_register_time, + bool force_entry_newbie_room); 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, int creator_register_time); + Room* CreateRoom(RoomType_e room_type, + int game_times, + int creator_register_time, + bool force_entry_newbie_room); 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 86a4ac1..caae554 100755 --- a/server/gameserver/types.h +++ b/server/gameserver/types.h @@ -155,6 +155,7 @@ struct RoomInitInfo RoomType_e room_type = RT_NewBrid; int creator_game_times = 0; int creator_register_time = 0; + bool force_entry_newbie_room = false; const MetaData::Map* map_meta = nullptr; std::string map_tpl_name; diff --git a/server/tools/protobuild/metatable.proto b/server/tools/protobuild/metatable.proto index 17f949a..ece95cd 100755 --- a/server/tools/protobuild/metatable.proto +++ b/server/tools/protobuild/metatable.proto @@ -220,6 +220,7 @@ message RankPoint optional int32 rank = 1; optional int32 parameter = 2; optional int32 parameter2 = 3; + optional int32 parameter3 = 4; } message KillReward