diff --git a/server/gameserver/human.h b/server/gameserver/human.h index 95d8a911..e96fff3e 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -270,6 +270,7 @@ class Human : public Creature void LootInteraction(Loot* entity); void ObstacleInteraction(Obstacle* entity); void SendMobaTeamNotify(); + void PushJoinRoomMsg(); void ReJoin(long ip_saddr, int socket_handle, std::shared_ptr msg, std::shared_ptr p); diff --git a/server/gameserver/pbutils.cc b/server/gameserver/pbutils.cc index 089dff53..5bf77ffc 100644 --- a/server/gameserver/pbutils.cc +++ b/server/gameserver/pbutils.cc @@ -1997,11 +1997,61 @@ void Human::SendMobaTeamNotify() SendNotifyMsg(notify_msg); } +void Human::PushJoinRoomMsg() +{ + if (!a8::HasBitFlag(status, CS_ForceTeam)) { + cs::SMJoinedNotify notifymsg; + notifymsg.set_error_code(0); + notifymsg.set_server_info(JsonDataMgr::Instance()->server_info); + room->FillSMJoinedNotify(this, notifymsg); + #ifdef MYDEBUG + //notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot); + #else + notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot); + #endif + GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg); + } + { + cs::SMMapInfo notifymsg; + notifymsg.set_map_id(room->GetMapMeta()->map_id()); +#ifdef MYDEBUG +#else + if (proto_version < cs::ProtoVersion) { +#if 0 + notifymsg.set_map_id(1001); +#endif + } +#endif + notifymsg.set_map_width(room->GetMapMeta()->map_width()); + notifymsg.set_map_height(room->GetMapMeta()->map_height()); + notifymsg.set_room_mode((int)room->GetRoomMode()); + notifymsg.set_server_info(JsonDataMgr::Instance()->server_info); + notifymsg.set_player_id(GetUniId()); + notifymsg.set_started(false); + notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString()); + notifymsg.set_match_mode(GetBattleContext()->GetMatchMode()); + notifymsg.set_pve_instance_id(room->pve_instance ? room->pve_instance->gemini_id() : 0); + notifymsg.set_mapid(room->GetMapMeta()->map_id()); + if (room->IsMobaModeRoom()){ + notifymsg.set_side(side); + } else { + notifymsg.set_side(0); + } + GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg); + #ifdef MYDEBUG + a8::XPrintf("PushJoinRooMmsg %d side:%d\n", {GetUniId(), side}); + #endif + } +} + void Human::ReJoin(long ip_saddr, int socket_handle, std::shared_ptr msg, std::shared_ptr p) { this->ip_saddr = ip_saddr; this->socket_handle = socket_handle; + PushJoinRoomMsg(); + RefreshView(); + room->NotifyUiUpdate(); } void GGListener::SendError(int sockhandle, unsigned int seqid, diff --git a/server/gameserver/player.cc b/server/gameserver/player.cc index bdf6390d..dcd7dcfc 100644 --- a/server/gameserver/player.cc +++ b/server/gameserver/player.cc @@ -1449,53 +1449,6 @@ void Player::_CMTeamMarkTargetPos(f8::MsgHdr* hdr, const cs::CMTeamMarkTargetPos NotifyTeamMarkTargetPos(); } -void Player::PushJoinRoomMsg() -{ - if (!a8::HasBitFlag(status, CS_ForceTeam)) { - cs::SMJoinedNotify notifymsg; - notifymsg.set_error_code(0); - notifymsg.set_server_info(JsonDataMgr::Instance()->server_info); - room->FillSMJoinedNotify(this, notifymsg); - #ifdef MYDEBUG - //notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot); - #else - notifymsg.set_pre_client_shot(mt::Param::s().pre_client_shot); - #endif - GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg); - } - { - cs::SMMapInfo notifymsg; - notifymsg.set_map_id(room->GetMapMeta()->map_id()); -#ifdef MYDEBUG -#else - if (proto_version < cs::ProtoVersion) { -#if 0 - notifymsg.set_map_id(1001); -#endif - } -#endif - notifymsg.set_map_width(room->GetMapMeta()->map_width()); - notifymsg.set_map_height(room->GetMapMeta()->map_height()); - notifymsg.set_room_mode((int)room->GetRoomMode()); - notifymsg.set_server_info(JsonDataMgr::Instance()->server_info); - notifymsg.set_player_id(GetUniId()); - notifymsg.set_started(false); - notifymsg.set_room_uuid(a8::XValue(room->GetRoomUuid()).GetString()); - notifymsg.set_match_mode(GetBattleContext()->GetMatchMode()); - notifymsg.set_pve_instance_id(room->pve_instance ? room->pve_instance->gemini_id() : 0); - notifymsg.set_mapid(room->GetMapMeta()->map_id()); - if (room->IsMobaModeRoom()){ - notifymsg.set_side(side); - } else { - notifymsg.set_side(0); - } - GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg); - #ifdef MYDEBUG - a8::XPrintf("PushJoinRooMmsg %d side:%d\n", {GetUniId(), side}); - #endif - } -} - void Player::ProcPreSettlementInfo(const std::string& pre_settlement_info) { std::vector tmp_strings; diff --git a/server/gameserver/player.h b/server/gameserver/player.h index d0c55d24..0fe15500 100644 --- a/server/gameserver/player.h +++ b/server/gameserver/player.h @@ -123,7 +123,6 @@ class Player : public Human void HumanInteraction(Human* hum); void ProcPreSettlementInfo(const std::string& pre_settlement_info); void ProcSkillList(); - void PushJoinRoomMsg(); void _CMReconnect(f8::MsgHdr* hdr, const cs::CMReconnect& msg); void _CMMove(f8::MsgHdr* hdr, const cs::CMMove& msg); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index 5d8bd8e5..b53049b5 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -523,7 +523,7 @@ void Room::CreateAndroid(int robot_num, std::shared_ptr team) NotifyUiUpdate(); } -void Room::FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg) +void Room::FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg) { msg.set_team_mode(msg.team_mode()); msg.set_adjust_bullet(1); diff --git a/server/gameserver/room.h b/server/gameserver/room.h index 2445ebb8..e34940cf 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -149,7 +149,7 @@ public: void RemoveObjectLater(RoomEntity* entity); void RemoveObjectLater(RoomObstacle* entity); - void FillSMJoinedNotify(Player* self_hum, cs::SMJoinedNotify& msg); + void FillSMJoinedNotify(Human* self_hum, cs::SMJoinedNotify& msg); void TraversePlayerList(std::function func); void TraverseHumanList(std::function func);