This commit is contained in:
aozhiwei 2024-03-26 21:27:10 +08:00
parent 17ad6805f1
commit 5e07199fe7
5 changed files with 43 additions and 53 deletions

View File

@ -146,23 +146,13 @@ static Player* InternalCreatePlayer(std::shared_ptr<CustomBattle> p,
hum->battle_uuid = m->GetNetData()->battle_uuid;
hum->is_valid_battle = m->GetNetData()->is_valid_battle;
hum->payload = m->GetNetData()->payload;
#if 1
join_msg.set_account_id(m->GetAccountId());
join_msg.set_session_id(m->GetSessionId());
join_msg.set_team_uuid(m->GetTeam()->GetTeamUuid());
join_msg.set_name(m->GetName());
join_msg.set_avatar_url(m->GetAvatarUrl());
join_msg.set_head_frame(m->GetHeadFrame());
join_msg.set_sex(m->GetSex());
join_msg.set_hero_id(m->GetNetData()->GetHeroId());
#endif
PlayerMgr::Instance()->
CreatePlayerByCMJoin(hum,
0,
0,
join_msg
);
hum->meta = mt::Hero::GetById(join_msg.hero_id());
CreatePlayerByCustomMember(hum,
0,
0,
m
);
hum->meta = mt::Hero::GetById(m->GetNetData()->GetHeroId());
if (!hum->meta) {
hum->meta = mt::Param::s().human_meta;
}
@ -2398,26 +2388,26 @@ void GGListener::ForceCloseChildSocket(int sockhandle)
SendProxyMsg(sockhandle, msg);
}
Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
long ip_saddr,
int socket,
const cs::CMJoin& msg)
Player* PlayerMgr::CreatePlayerByCustomMember(Player* hum,
long ip_saddr,
int socket,
std::shared_ptr<CustomMember> member)
{
hum->socket_handle = socket;
hum->ip_saddr = ip_saddr;
hum->account_id = msg.account_id();
hum->session_id = msg.session_id();
hum->name = msg.name();
hum->team_uuid = msg.team_uuid();
hum->team_mode = msg.team_mode();
hum->auto_fill = msg.auto_fill();
hum->avatar_url = msg.avatar_url();
hum->account_id = member->GetAccountId();
hum->session_id = member->GetSessionId();
hum->name = member->GetName();
hum->team_uuid = member->GetTeam()->GetTeamUuid();
hum->team_mode = 1;
hum->auto_fill = 1;
hum->avatar_url = member->GetAvatarUrl();
hum->create_tick = a8::XGetTickCount();
hum->account_registertime = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
hum->channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
hum->head_frame = msg.head_frame();
hum->sex = msg.sex();
hum->user_data = msg.user_data();
hum->account_registertime = f8::ExtractRegisterTimeFromSessionId(member->GetSessionId());
hum->channel = f8::ExtractChannelIdFromAccountId(member->GetAccountId());
hum->head_frame = member->GetHeadFrame();
hum->sex = member->GetSex();
hum->user_data = "";
#if 0
for (auto& weapon : msg.weapons()) {
if (weapon.weapon_id() != 0) {

View File

@ -14,6 +14,7 @@ namespace ss
}
class Player;
class CustomMember;
class PlayerMgr : public a8::Singleton<PlayerMgr>
{
public:
@ -31,7 +32,8 @@ class PlayerMgr : public a8::Singleton<PlayerMgr>
int OnlineNum();
Player* GetPlayerBySocket(int socket);
Player* CreatePlayerByCMJoin(Player* hum, long ip_saddr, int socket, const cs::CMJoin& msg);
Player* CreatePlayerByCustomMember(Player* hum, long ip_saddr, int socket,
std::shared_ptr<CustomMember> member);
size_t GetAccountNum() { return account_num_hash_.size(); }
void IncAccountNum(const std::string& account_id);
void DecAccountNum(const std::string& account_id);

View File

@ -1146,9 +1146,7 @@ bool Room::CanJoin(const std::string& accountid,
if (GetGasData().GetGasMode() != GasInactive) {
return false;
}
if (msg.pve_instance_id() && !pve_instance){
return false;
}
#if 0
if (pve_instance) {
if (pve_instance->gemini_id() != msg.pve_instance_id()) {
return false;
@ -1167,6 +1165,7 @@ bool Room::CanJoin(const std::string& accountid,
}
#endif
}
#endif
if (init_map_id != 0) {
auto map_instance = MapMgr::Instance()->GetMapInstance(init_map_id);
if (map_instance && map_instance->GetMapMeta()->map_mode() == room_mode_ &&

View File

@ -469,7 +469,6 @@ void RoomMgr::SetMatchMode(int mode)
void RoomMgr::AdjustCMJoin(cs::CMJoin* msg)
{
msg->set_pve_instance_id(0);
}
std::shared_ptr<CustomBattle> RoomMgr::GetCustomRoom(const std::string& room_uuid)

View File

@ -1541,24 +1541,24 @@ message CMJoin
optional int32 server_id = 1; //serverid
optional string team_uuid = 2; //id ()
optional string account_id = 3; //id account_id
optional int32 team_mode = 4; // 0: 1:
optional int32 _team_mode = 4; // 0: 1:
optional int32 proto_version = 5; //Constant_e.ProtoVersion
optional bool auto_fill = 6; //
optional string name = 8; //
optional string avatar_url = 11; //
repeated MFWeapon weapons = 17; //
optional bool _auto_fill = 6; //
optional string _name = 8; //
optional string _avatar_url = 11; //
repeated MFWeapon _weapons = 17; //
optional string session_id = 20; //session_id
optional int32 head_frame = 36 [default = 0]; //
optional int32 sex = 37 [default = 0]; //
repeated MFTeamMember team_members = 51; //
optional int32 room_mode = 52; //0: 1:pve 2: 3:moba
optional int32 mapid = 53; //id 0:
optional string user_data = 60 [default = ""]; //
optional int32 hero_id = 61; //id
optional string hero_uniid = 71; //id
optional int32 pve_instance_id = 72; //pve副本id
optional int32 team_slot_num = 73; //1-4
optional int32 force_enter_newbie_room = 74; //
optional int32 _head_frame = 36 [default = 0]; //
optional int32 _sex = 37 [default = 0]; //
repeated MFTeamMember _team_members = 51; //
optional int32 _room_mode = 52; //0: 1:pve 2: 3:moba
optional int32 _mapid = 53; //id 0:
optional string _user_data = 60 [default = ""]; //
optional int32 _hero_id = 61; //id
optional string _hero_uniid = 71; //id
optional int32 _pve_instance_id = 72; //pve副本id
optional int32 _team_slot_num = 73; //1-4
optional int32 _force_enter_newbie_room = 74; //
optional string payload_data = 75; //
}