1
This commit is contained in:
parent
f7a5e8cf8a
commit
ed6a817056
@ -44,6 +44,8 @@
|
||||
#include "sandtable.h"
|
||||
#include "frameeventdata.h"
|
||||
#include "batchsync.h"
|
||||
#include "mobabattle.h"
|
||||
#include "roommgr.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Buff.h"
|
||||
@ -2242,6 +2244,49 @@ void Room::NotifyKillList(const std::vector<int>& uniid_list)
|
||||
int Room::InitWithMobaBattle(long ip_saddr, int socket_handle, std::shared_ptr<cs::CMJoin> msg,
|
||||
std::shared_ptr<MobaBattle> p)
|
||||
{
|
||||
p->TraverseMemberList
|
||||
(
|
||||
[p, msg, ip_saddr, socket_handle] (MobaMember* m) -> bool
|
||||
{
|
||||
Player* hum = p->GetRoom()->NewPlayer();
|
||||
hum->room = p->GetRoom();
|
||||
hum->proto_version = msg->proto_version();
|
||||
#if 0
|
||||
hum->hero_uniid = a8::XValue(msg.hero_uniid());
|
||||
#endif
|
||||
//hum->battle_uuid = member->GetNetData()->battle_uuid;
|
||||
//hum->is_valid_battle = member->GetNetData()->is_valid_battle;
|
||||
//hum->payload = member->GetNetData()->payload;
|
||||
//msg.set_session_id(member->GetSessionId());
|
||||
//msg.set_team_uuid(team->GetTeamUuid());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
ip_saddr,
|
||||
socket_handle,
|
||||
*msg
|
||||
);
|
||||
hum->meta = mt::Hero::GetById(msg->hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = mt::Param::s().human_meta;
|
||||
}
|
||||
//hum->SetBattleContext(member->GetNetData());
|
||||
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;
|
||||
}
|
||||
p->GetRoom()->AddPlayer(hum);
|
||||
hum->ProcSkillList();
|
||||
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
|
||||
hum->SetMaxHP(hum->GetHP());
|
||||
//member->Join(hum);
|
||||
PlayerMgr::Instance()->IncAccountNum(msg->account_id());
|
||||
RoomMgr::Instance()->OnJoinRoomOk(*msg, hum);
|
||||
return true;
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1189,49 +1189,7 @@ void RoomMgr::_CMJoinMoba(f8::MsgHdr* hdr, const cs::CMJoin& msg)
|
||||
msg.mapid(),
|
||||
nullptr);
|
||||
p->SetRoom(room.get());
|
||||
p->TraverseMemberList
|
||||
(
|
||||
[p, msg, ip_saddr, socket_handle] (MobaMember* m) -> bool
|
||||
{
|
||||
Player* hum = p->GetRoom()->NewPlayer();
|
||||
hum->room = p->GetRoom();
|
||||
hum->proto_version = msg.proto_version();
|
||||
#if 0
|
||||
hum->hero_uniid = a8::XValue(msg.hero_uniid());
|
||||
#endif
|
||||
//hum->battle_uuid = member->GetNetData()->battle_uuid;
|
||||
//hum->is_valid_battle = member->GetNetData()->is_valid_battle;
|
||||
//hum->payload = member->GetNetData()->payload;
|
||||
//msg.set_session_id(member->GetSessionId());
|
||||
//msg.set_team_uuid(team->GetTeamUuid());
|
||||
PlayerMgr::Instance()->
|
||||
CreatePlayerByCMJoin(hum,
|
||||
ip_saddr,
|
||||
socket_handle,
|
||||
msg
|
||||
);
|
||||
hum->meta = mt::Hero::GetById(msg.hero_id());
|
||||
if (!hum->meta) {
|
||||
hum->meta = mt::Param::s().human_meta;
|
||||
}
|
||||
//hum->SetBattleContext(member->GetNetData());
|
||||
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;
|
||||
}
|
||||
p->GetRoom()->AddPlayer(hum);
|
||||
hum->ProcSkillList();
|
||||
hum->SetHP(hum->GetBattleContext()->GetMaxHP());
|
||||
hum->SetMaxHP(hum->GetHP());
|
||||
//member->Join(hum);
|
||||
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||
RoomMgr::Instance()->OnJoinRoomOk(msg, hum);
|
||||
return true;
|
||||
});
|
||||
room->InitWithMobaBattle(ip_saddr, socket_handle, join_msg, p);
|
||||
};
|
||||
SendGetMobaBattleData(join_msg, cb);
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
int GetMatchMode() { return match_mode_; };
|
||||
void SetMatchMode(int mode);
|
||||
bool HasTask();
|
||||
void OnJoinRoomOk(const cs::CMJoin& msg, Player* hum);
|
||||
|
||||
private:
|
||||
void InstallReportStateTimer();
|
||||
@ -116,7 +117,6 @@ class RoomMgr : public a8::Singleton<RoomMgr>
|
||||
std::shared_ptr<CustomBattle> custom_battle);
|
||||
void JoinErrorHandle(const cs::CMJoin& msg, int error_code, int socket_handle);
|
||||
std::string GenTeamHashData(const std::string& team_uuid, std::map<std::string, std::string>* team_hash);
|
||||
void OnJoinRoomOk(const cs::CMJoin& msg, Player* hum);
|
||||
void TeamRoomTimeOut(const std::string& team_uuid);
|
||||
void AdjustCMJoin(cs::CMJoin* msg);
|
||||
std::shared_ptr<CustomBattle> GetCustomRoom(const std::string& room_uuid);
|
||||
|
Loading…
x
Reference in New Issue
Block a user