1
This commit is contained in:
parent
5b19ab416a
commit
10bd20fc0c
@ -2535,6 +2535,66 @@ int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<c
|
|||||||
auto hum = GetPlayerByAccountId(msg->account_id());
|
auto hum = GetPlayerByAccountId(msg->account_id());
|
||||||
if (hum) {
|
if (hum) {
|
||||||
hum->ReJoin(ip_saddr, socket_handle, msg, p);
|
hum->ReJoin(ip_saddr, socket_handle, msg, p);
|
||||||
|
} else {
|
||||||
|
auto m = p->GetObByAccountId(msg->account_id());
|
||||||
|
if (m) {
|
||||||
|
Player* hum = p->GetRoom()->NewPlayer();
|
||||||
|
//hum->ip_saddr = ip_saddr;
|
||||||
|
//hum->socket_handle = socket_handle;
|
||||||
|
hum->name = m->GetName();
|
||||||
|
hum->room = p->GetRoom();
|
||||||
|
hum->proto_version = join_msg.proto_version();
|
||||||
|
#if 0
|
||||||
|
hum->hero_uniid = a8::XValue(join_msg->hero_uniid());
|
||||||
|
#endif
|
||||||
|
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());
|
||||||
|
if (!hum->meta) {
|
||||||
|
hum->meta = mt::Param::s().human_meta;
|
||||||
|
}
|
||||||
|
hum->SetNetData(m->GetNetData());
|
||||||
|
hum->GetNetData()->Init(hum);
|
||||||
|
{
|
||||||
|
long long hero_uniid = 0;
|
||||||
|
int hero_lv = 1;
|
||||||
|
int quality = 1;
|
||||||
|
hum->GetNetData()->GetHeroLvQuality(hero_uniid, hero_lv, quality);
|
||||||
|
hum->hero_uniid = hero_uniid;
|
||||||
|
}
|
||||||
|
p->GetRoom()->AddPlayer(hum);
|
||||||
|
hum->ProcSkillList();
|
||||||
|
hum->SetHP(hum->GetNetData()->GetMaxHP());
|
||||||
|
hum->SetMaxHP(hum->GetHP());
|
||||||
|
PlayerMgr::Instance()->IncAccountNum(join_msg.account_id());
|
||||||
|
RoomMgr::Instance()->OnJoinRoomOk(join_msg, hum);
|
||||||
|
//new_team->AddMember(hum);
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
a8::XPrintf("moba init1 uniid:%d team_id:%d side:%d\n",
|
||||||
|
{
|
||||||
|
hum->GetUniId(),
|
||||||
|
hum->GetTeam()->GetTeamId(),
|
||||||
|
hum->side
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user