1
This commit is contained in:
parent
04c55edcd0
commit
41cb389ed2
@ -158,6 +158,10 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
if (msg.force_enter_newbie_room()) {
|
||||||
|
EnterNewBie(hdr, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (MatchMgr::Instance()->NeedMatch(msg)) {
|
if (MatchMgr::Instance()->NeedMatch(msg)) {
|
||||||
MatchMgr::Instance()->_CMJoin(hdr, msg);
|
MatchMgr::Instance()->_CMJoin(hdr, msg);
|
||||||
return;
|
return;
|
||||||
@ -861,6 +865,9 @@ void RoomMgr::SetMatchMode(int mode)
|
|||||||
|
|
||||||
void RoomMgr::AdjustCMJoin(cs::CMJoin* msg)
|
void RoomMgr::AdjustCMJoin(cs::CMJoin* msg)
|
||||||
{
|
{
|
||||||
|
#ifdef NEWBIE_ROOM
|
||||||
|
msg->set_force_enter_newbie_room(true);
|
||||||
|
#endif
|
||||||
if (msg->room_mode() < kPvpMode ||
|
if (msg->room_mode() < kPvpMode ||
|
||||||
msg->room_mode() >= kRoomModeEnd) {
|
msg->room_mode() >= kRoomModeEnd) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -903,3 +910,73 @@ void RoomMgr::AdjustCMJoin(cs::CMJoin* msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RoomMgr::EnterNewBie(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||||
|
{
|
||||||
|
int game_times = 0;
|
||||||
|
RoomType_e self_room_type = GetHumanRoomType(msg, game_times);
|
||||||
|
if (self_room_type < RT_OldBrid1) {
|
||||||
|
self_room_type = RT_OldBrid1;
|
||||||
|
}
|
||||||
|
time_t register_time = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
|
||||||
|
int proto_version = msg.proto_version();
|
||||||
|
int channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
|
||||||
|
Room* room = RoomMgr::Instance()->GetJoinableRoom
|
||||||
|
(
|
||||||
|
msg,
|
||||||
|
self_room_type,
|
||||||
|
game_times,
|
||||||
|
register_time,
|
||||||
|
proto_version,
|
||||||
|
channel
|
||||||
|
);
|
||||||
|
Player* hum = room->NewPlayer();
|
||||||
|
hum->proto_version = msg.proto_version();
|
||||||
|
#if 0
|
||||||
|
hum->hero_uniid = a8::XValue(msg.hero_uniid());
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
hum->battle_uuid = results.at(0)->battle_uuid;
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
hum->is_valid_battle = results.at(0)->is_valid_battle;
|
||||||
|
hum->payload = results.at(0)->payload;
|
||||||
|
#endif
|
||||||
|
PlayerMgr::Instance()->
|
||||||
|
CreatePlayerByCMJoin(hum,
|
||||||
|
hdr.ip_saddr,
|
||||||
|
hdr.socket_handle,
|
||||||
|
msg
|
||||||
|
);
|
||||||
|
hum->meta = mt::Hero::GetById(msg.hero_id());
|
||||||
|
if (!hum->meta) {
|
||||||
|
hum->meta = mt::Param::s().human_meta;
|
||||||
|
}
|
||||||
|
hum->room = room;
|
||||||
|
#if 0
|
||||||
|
hum->SetBattleContext(results.at(0));
|
||||||
|
#endif
|
||||||
|
hum->GetBattleContext()->Init(hum);
|
||||||
|
{
|
||||||
|
long long hero_uniid = 0;
|
||||||
|
int hero_lv = 1;
|
||||||
|
int quality = 1;
|
||||||
|
hum->GetBattleContext()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
|
||||||
|
hum->hero_uniid = hero_uniid;
|
||||||
|
}
|
||||||
|
room->AddPlayer(hum);
|
||||||
|
hum->ProcSkillList();
|
||||||
|
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
|
||||||
|
hum->SetMaxHP(hum->GetHP());
|
||||||
|
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||||
|
if (JsonDataMgr::Instance()->channel != 0 &&
|
||||||
|
JsonDataMgr::Instance()->channel != channel) {
|
||||||
|
f8::UdpLog::Instance()->Warning
|
||||||
|
("join room channel not match channel:%d account_id:%s",
|
||||||
|
{
|
||||||
|
JsonDataMgr::Instance()->channel,
|
||||||
|
msg.account_id()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
RoomMgr::Instance()->OnJoinRoomOk(msg, hum);
|
||||||
|
}
|
||||||
|
@ -100,6 +100,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
|||||||
void ReportServerState(int instance_id, const std::string& host, int port);
|
void ReportServerState(int instance_id, const std::string& host, int port);
|
||||||
void FreeOverRoom(long long room_uuid);
|
void FreeOverRoom(long long room_uuid);
|
||||||
bool IsLimitJoin();
|
bool IsLimitJoin();
|
||||||
|
void EnterNewBie(f8::MsgHdr& hdr, const cs::CMJoin& msg);
|
||||||
|
|
||||||
int AllocRoomIdx();
|
int AllocRoomIdx();
|
||||||
Room* CreateRoom(const cs::CMJoin& msg,
|
Room* CreateRoom(const cs::CMJoin& msg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user