1
This commit is contained in:
parent
874b0935b9
commit
6a9340e084
@ -1784,6 +1784,7 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
|
|||||||
stats.rank = rank;
|
stats.rank = rank;
|
||||||
params->SetVal("account_id", account_id);
|
params->SetVal("account_id", account_id);
|
||||||
params->SetVal("session_id", session_id);
|
params->SetVal("session_id", session_id);
|
||||||
|
params->SetVal("battle_uuid", battle_uuid);
|
||||||
params->SetVal("map_id", room->GetMapMeta()->i->map_id());
|
params->SetVal("map_id", room->GetMapMeta()->i->map_id());
|
||||||
params->SetVal("map_name", room->GetMapMeta()->i->map_name());
|
params->SetVal("map_name", room->GetMapMeta()->i->map_name());
|
||||||
params->SetVal("team_mode", GetTeam() && GetTeam()->GetMemberNum() > 1 ? 1 : 0);
|
params->SetVal("team_mode", GetTeam() && GetTeam()->GetMemberNum() > 1 ? 1 : 0);
|
||||||
|
@ -616,6 +616,19 @@ void MatchTeam::StartGame()
|
|||||||
{
|
{
|
||||||
MatchTeam* team = MatchMgr::Instance()->GetTeam(team_uuid);
|
MatchTeam* team = MatchMgr::Instance()->GetTeam(team_uuid);
|
||||||
if (team) {
|
if (team) {
|
||||||
|
for (auto context : results) {
|
||||||
|
bool found = false;
|
||||||
|
for (auto& member : team->GetCurrMembers()) {
|
||||||
|
if (member->msg->account_id() == context.join_msg->account_id()){
|
||||||
|
member->battle_uuid = context.battle_uuid;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
RoomMgr::Instance()->JoinTeam(team);
|
RoomMgr::Instance()->JoinTeam(team);
|
||||||
team->RemoveTeam();
|
team->RemoveTeam();
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ namespace MetaData
|
|||||||
struct RawTeamMember
|
struct RawTeamMember
|
||||||
{
|
{
|
||||||
class MatchTeam* team = nullptr;
|
class MatchTeam* team = nullptr;
|
||||||
|
long long battle_uuid = 0;
|
||||||
long long add_tick = 0;
|
long long add_tick = 0;
|
||||||
int socket_handle = 0;
|
int socket_handle = 0;
|
||||||
std::shared_ptr<cs::CMJoin> msg;
|
std::shared_ptr<cs::CMJoin> msg;
|
||||||
|
@ -186,6 +186,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
|||||||
Player* hum = room->NewPlayer();
|
Player* hum = room->NewPlayer();
|
||||||
hum->proto_version = msg.proto_version();
|
hum->proto_version = msg.proto_version();
|
||||||
hum->hero_uniid = msg.hero_uniid();
|
hum->hero_uniid = msg.hero_uniid();
|
||||||
|
hum->battle_uuid = results.at(0).battle_uuid;
|
||||||
hum->ProcPreSettlementInfo(msg.pre_settlement_info());
|
hum->ProcPreSettlementInfo(msg.pre_settlement_info());
|
||||||
PlayerMgr::Instance()->
|
PlayerMgr::Instance()->
|
||||||
CreatePlayerByCMJoin(hum,
|
CreatePlayerByCMJoin(hum,
|
||||||
@ -734,6 +735,7 @@ void RoomMgr::SendGetBattleData(int mode,
|
|||||||
}
|
}
|
||||||
BattleDataContext context;
|
BattleDataContext context;
|
||||||
context.join_msg = msg;
|
context.join_msg = msg;
|
||||||
|
context.battle_uuid = App::Instance()->NewUuid();
|
||||||
context.errcode = 100;
|
context.errcode = 100;
|
||||||
context.errmsg = "";
|
context.errmsg = "";
|
||||||
result->push_back(context);
|
result->push_back(context);
|
||||||
@ -747,13 +749,6 @@ void RoomMgr::SendGetBattleData(int mode,
|
|||||||
{
|
{
|
||||||
std::string url;
|
std::string url;
|
||||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||||
if (!f8::IsOnlineEnv()) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
if (is_old_version) {
|
|
||||||
url = "https://game2006api-test.kingsome.cn/new/webapp/index.php";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (url.find('?') != std::string::npos) {
|
if (url.find('?') != std::string::npos) {
|
||||||
url += "&c=Battle&a=getBattleData";
|
url += "&c=Battle&a=getBattleData";
|
||||||
} else {
|
} else {
|
||||||
@ -763,12 +758,15 @@ void RoomMgr::SendGetBattleData(int mode,
|
|||||||
{
|
{
|
||||||
auto data = a8::MutableXObject::CreateObject();
|
auto data = a8::MutableXObject::CreateObject();
|
||||||
auto members = a8::MutableXObject::CreateArray();
|
auto members = a8::MutableXObject::CreateArray();
|
||||||
|
int i = 0;
|
||||||
for (auto msg : join_msgs) {
|
for (auto msg : join_msgs) {
|
||||||
auto member = a8::MutableXObject::CreateObject();
|
auto member = a8::MutableXObject::CreateObject();
|
||||||
member->SetVal("account_id", msg->account_id());
|
member->SetVal("account_id", msg->account_id());
|
||||||
member->SetVal("session_id", msg->session_id());
|
member->SetVal("session_id", msg->session_id());
|
||||||
member->SetVal("hero_uniid", msg->hero_uniid());
|
member->SetVal("hero_uniid", msg->hero_uniid());
|
||||||
|
member->SetVal("battle_uuid", result->at(i).battle_uuid);
|
||||||
member->SetVal("cmjoin", f8::PbToJson(msg.get()));
|
member->SetVal("cmjoin", f8::PbToJson(msg.get()));
|
||||||
|
++i;
|
||||||
members->Push(*member.get());
|
members->Push(*member.get());
|
||||||
}
|
}
|
||||||
data->SetVal("members", *members);
|
data->SetVal("members", *members);
|
||||||
@ -780,7 +778,7 @@ void RoomMgr::SendGetBattleData(int mode,
|
|||||||
HttpProxy::Instance()->HttpGet
|
HttpProxy::Instance()->HttpGet
|
||||||
(
|
(
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(new std::shared_ptr<std::vector<BattleDataContext>>(result))
|
.SetSender(new std::shared_ptr<std::vector<BattleDataContext>>(result))
|
||||||
.SetParam1(new std::function<
|
.SetParam1(new std::function<
|
||||||
void(std::vector<BattleDataContext>&)>(cb)),
|
void(std::vector<BattleDataContext>&)>(cb)),
|
||||||
[] (a8::XParams& param, a8::XObject& data)
|
[] (a8::XParams& param, a8::XObject& data)
|
||||||
|
@ -49,6 +49,7 @@ struct RoomInitInfo
|
|||||||
struct BattleDataContext
|
struct BattleDataContext
|
||||||
{
|
{
|
||||||
std::shared_ptr<cs::CMJoin> join_msg;
|
std::shared_ptr<cs::CMJoin> join_msg;
|
||||||
|
long long battle_uuid = 0;
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
std::string errmsg;
|
std::string errmsg;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user