This commit is contained in:
aozhiwei 2023-04-06 13:58:57 +08:00
parent cdf7bdab85
commit 0ffc80f5a9
9 changed files with 96 additions and 31 deletions

View File

@ -16,7 +16,7 @@ bool Collision::CheckBullet(IBullet* bullet, Creature* c)
{ {
return a8::IntersectCylinderCylinder return a8::IntersectCylinderCylinder
( (
bullet->GetPos().ToGlmVec3(), bullet->GetHitRadius() * 0.6, 10, bullet->GetPos().ToGlmVec3(), bullet->GetHitRadius() * 1.0, 10,
c->GetPos().ToGlmVec3(), c->GetHitRadius(), 10 c->GetPos().ToGlmVec3(), c->GetHitRadius(), 10
); );
} }

View File

@ -260,9 +260,9 @@ enum ObjectFlags_e
enum RoomMode_e enum RoomMode_e
{ {
kChiJiMode = 0, kPvpMode = 0,
kDestoryMode = 2, kPveMode = 1,
kSurvivalMode = 1, kPvpRankMode = 2,
kRoomModeEnd kRoomModeEnd
}; };

View File

@ -35,17 +35,12 @@ void MapMgr::Init()
} }
} }
}); });
#if 0 if (mode_hash_.find(kPvpMode) == mode_hash_.end()) {
if (mode_hash_.find(kZombieMode) == mode_hash_.end()) {
A8_ABORT(); A8_ABORT();
} }
#endif if (mode_hash_.find(kPveMode) == mode_hash_.end()) {
if (mode_hash_.find(kChiJiMode) == mode_hash_.end()) {
A8_ABORT(); A8_ABORT();
} }
#ifdef DMAP3D
MetaMgr::Instance()->CheckMapSpawnPoint();
#endif
} }
void MapMgr::UnInit() void MapMgr::UnInit()
@ -59,7 +54,7 @@ void MapMgr::UnInit()
void MapMgr::AttachRoom(Room* room, RoomInitInfo& init_info) void MapMgr::AttachRoom(Room* room, RoomInitInfo& init_info)
{ {
if (init_info.pve_instance_id) { if (init_info.pve_instance_id) {
init_info.room_mode = kSurvivalMode; init_info.room_mode = kPveMode;
room->pve_mode_meta = mt::PveGeminiMode::GetById(init_info.room_mode); room->pve_mode_meta = mt::PveGeminiMode::GetById(init_info.room_mode);
if (!room->pve_mode_meta) { if (!room->pve_mode_meta) {
abort(); abort();

View File

@ -67,7 +67,7 @@ namespace mt
abort(); abort();
} }
} }
. } }
int PveGeminiMode::CalcStar(int score) const int PveGeminiMode::CalcStar(int score) const
{ {

View File

@ -926,12 +926,6 @@ bool Room::CanJoin(const std::string& accountid,
int init_map_id, int init_map_id,
const cs::CMJoin& msg) const cs::CMJoin& msg)
{ {
if (self_room_mode < kChiJiMode) {
self_room_mode = kChiJiMode;
}
if (self_room_mode > kRoomModeEnd) {
self_room_mode = kChiJiMode;
}
if (room_mode_ != self_room_mode) { if (room_mode_ != self_room_mode) {
return false; return false;
} }
@ -946,7 +940,17 @@ bool Room::CanJoin(const std::string& accountid,
return false; return false;
} }
#if 1 #if 1
Team* team = GetAliveTeam();
if (!team) {
return false; return false;
}
Human* hum = team->GetOneAliveMember(nullptr);
if (!hum) {
return false;
}
if (hum->team_uuid != msg.team_uuid()) {
return false;
}
#endif #endif
} }
if (init_map_id != 0) { if (init_map_id != 0) {
@ -3646,3 +3650,13 @@ void Room::UpdateFrameCall()
delete pdelnode; delete pdelnode;
}//end while }//end while
} }
int Room::GetReportRoomMode()
{
return IsPveRoom() ? 1 : 0;
}
int Room::GetPvpMatchMode()
{
return GetRoomMode() == kPvpRankMode ? 1 : 0;
}

View File

@ -229,6 +229,8 @@ public:
void AddFrameCall(FrameCallCb cb, void* context); void AddFrameCall(FrameCallCb cb, void* context);
void SetVictoryTeam(Team* team) { victory_team_ = team;}; void SetVictoryTeam(Team* team) { victory_team_ = team;};
Team* GetVictoryTeam() { return victory_team_;}; Team* GetVictoryTeam() { return victory_team_;};
int GetReportRoomMode();
int GetPvpMatchMode();
private: private:
void ShuaAndroid(); void ShuaAndroid();
@ -318,7 +320,7 @@ private:
bool destorying_ = false; bool destorying_ = false;
std::vector<int> poly_ext_datas_; std::vector<int> poly_ext_datas_;
int room_idx_ = 0; int room_idx_ = 0;
RoomMode_e room_mode_ = kChiJiMode; RoomMode_e room_mode_ = kPvpMode;
long long room_uuid_ = 0; long long room_uuid_ = 0;
const mt::Map* map_meta_ = nullptr; const mt::Map* map_meta_ = nullptr;
std::string map_tpl_name_; std::string map_tpl_name_;

View File

@ -16,10 +16,15 @@
#include "matchmgr.h" #include "matchmgr.h"
#include "matchteam.h" #include "matchteam.h"
#include "httpproxy.h" #include "httpproxy.h"
#include "mapmgr.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Text.h" #include "mt/Text.h"
#include "mt/Hero.h" #include "mt/Hero.h"
#include "mt/Map.h"
#include "mt/PveGemini.h"
#include "mt/PveGeminiMode.h"
#include "mt/PveGeminiContent.h"
#include <f8/httpclientpool.h> #include <f8/httpclientpool.h>
#include <f8/utils.h> #include <f8/utils.h>
@ -142,14 +147,17 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
JoinErrorHandle(msg, 2, hdr.socket_handle); JoinErrorHandle(msg, 2, hdr.socket_handle);
return; return;
} }
#if 1
{ {
cs::CMJoin* mutable_msg = (cs::CMJoin*)&msg; cs::CMJoin* mutable_msg = (cs::CMJoin*)&msg;
if (mutable_msg->room_mode() != kChiJiMode) { AdjustCMJoin(mutable_msg);
mutable_msg->set_room_mode(kChiJiMode); #ifdef DEBUG
a8::XPrintf("AdjustCMJoinAfter room_mode:%d pve_instance_id:%d\n",
{
msg.room_mode(),
msg.pve_instance_id()
});
#endif
} }
}
#endif
if (MatchMgr::Instance()->NeedMatch(msg)) { if (MatchMgr::Instance()->NeedMatch(msg)) {
MatchMgr::Instance()->_CMJoin(hdr, msg); MatchMgr::Instance()->_CMJoin(hdr, msg);
return; return;
@ -271,7 +279,7 @@ void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
}); });
return; return;
} }
if (room->GetRoomMode() != kChiJiMode) { if (room->GetRoomMode() != kPvpMode) {
send_reconnect_failed(hdr.socket_handle, 1, send_reconnect_failed(hdr.socket_handle, 1,
TEXT("battle_server_reconnect_failreason_only_chiji", "只有吃鸡模式支持重连")); TEXT("battle_server_reconnect_failreason_only_chiji", "只有吃鸡模式支持重连"));
return; return;
@ -846,3 +854,48 @@ void RoomMgr::SetMatchMode(int mode)
{ {
match_mode_ = mode; match_mode_ = mode;
} }
void RoomMgr::AdjustCMJoin(cs::CMJoin* msg)
{
if (msg->room_mode() < kPvpMode ||
msg->room_mode() >= kRoomModeEnd) {
#ifdef DEBUG
a8::XPrintf("AdjustCMJoin room_mode:%d pve_instance_id:%d\n",
{
msg->room_mode(),
msg->pve_instance_id()
});
#endif
msg->set_room_mode(kPvpMode);
msg->set_pve_instance_id(0);
return;
}
if (msg->room_mode() != kPveMode) {
#ifdef DEBUG
a8::XPrintf("AdjustCMJoin room_mode:%d pve_instance_id:%d\n",
{
msg->room_mode(),
msg->pve_instance_id()
});
#endif
msg->set_pve_instance_id(0);
return;
}
if (msg->room_mode() == kPveMode) {
auto mode_meta = mt::PveGeminiMode::GetById(msg->room_mode());
auto pve_instance = mt::PveGemini::GetById(msg->pve_instance_id());
auto map_meta = MapMgr::Instance()->GetMapInstance(mode_meta ? mode_meta->map_id() : 0);
if (!mode_meta || !pve_instance || !map_meta) {
#ifdef DEBUG
a8::XPrintf("AdjustCMJoin room_mode:%d pve_instance_id:%d\n",
{
msg->room_mode(),
msg->pve_instance_id()
});
#endif
msg->set_room_mode(kPvpMode);
msg->set_pve_instance_id(0);
return;
}
}
}

View File

@ -27,7 +27,7 @@ class Building;
struct RoomInitInfo struct RoomInitInfo
{ {
int room_idx = 0; int room_idx = 0;
RoomMode_e room_mode = kChiJiMode; RoomMode_e room_mode = kPvpMode;
long long room_uuid = 0; long long room_uuid = 0;
RoomType_e room_type = RT_NewBrid; RoomType_e room_type = RT_NewBrid;
int creator_game_times = 0; int creator_game_times = 0;
@ -112,6 +112,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
std::string GenTeamHashData(const std::string& team_uuid, std::map<std::string, long long>* team_hash); std::string GenTeamHashData(const std::string& team_uuid, std::map<std::string, long long>* team_hash);
void OnJoinRoomOk(const cs::CMJoin& msg, Player* hum); void OnJoinRoomOk(const cs::CMJoin& msg, Player* hum);
void TeamRoomTimeOut(const std::string& team_uuid); void TeamRoomTimeOut(const std::string& team_uuid);
void AdjustCMJoin(cs::CMJoin* msg);
private: private:
int current_room_idx_ = 0; int current_room_idx_ = 0;

View File

@ -261,7 +261,7 @@ void Team::GenBattleReportData(Human* player, a8::MutableXObject* params)
params->SetVal("version", 2023030201); params->SetVal("version", 2023030201);
params->SetVal("battle_uuid", a8::XValue(player->battle_uuid)); params->SetVal("battle_uuid", a8::XValue(player->battle_uuid));
params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid())); params->SetVal("room_uuid", a8::XValue(room->GetRoomUuid()));
params->SetVal("room_mode", room->IsPveRoom() ? 1 : 0); params->SetVal("room_mode", room->GetReportRoomMode());
params->SetVal("team_id", GetTeamId()); params->SetVal("team_id", GetTeamId());
params->SetVal("team_mode", 1); params->SetVal("team_mode", 1);
params->SetVal("map_id", room->GetMapMeta()->map_id()); params->SetVal("map_id", room->GetMapMeta()->map_id());
@ -283,7 +283,7 @@ void Team::GenBattleReportData(Human* player, a8::MutableXObject* params)
params->SetVal("pvp_total_human_num", room->GetHumanNum()); params->SetVal("pvp_total_human_num", room->GetHumanNum());
params->SetVal("pvp_alive_human_num", room->AliveCount()); params->SetVal("pvp_alive_human_num", room->AliveCount());
params->SetVal("pvp_total_team_num", room->GetTeamNum()); params->SetVal("pvp_total_team_num", room->GetTeamNum());
params->SetVal("pvp_match_mode", 0); params->SetVal("pvp_match_mode", room->GetPvpMatchMode());
params->SetVal("pvp_team_kills", 0); // params->SetVal("pvp_team_kills", 0); //
} }