1
This commit is contained in:
parent
e195dfb8ff
commit
50b834332a
@ -2537,6 +2537,79 @@ void Human::DeadDrop()
|
||||
MarkSyncActivePlayer(__FILE__, __LINE__, __func__);
|
||||
}
|
||||
|
||||
void Human::SendBattleSettlement()
|
||||
{
|
||||
if (!IsPlayer()) {
|
||||
return;
|
||||
}
|
||||
Player* p = (Player*)this;
|
||||
auto on_ok =
|
||||
[] (a8::XParams& param, a8::XObject& data)
|
||||
{
|
||||
Room* room = RoomMgr::Instance()->GetRoomByUuid(param.sender);
|
||||
if (!room) {
|
||||
return;
|
||||
}
|
||||
Player* hum = room->GetPlayerByAccountId(param.param1.GetString());
|
||||
if (!hum) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
auto on_error =
|
||||
[] (a8::XParams& param, const std::string& response)
|
||||
{
|
||||
a8::UdpLog::Instance()->Error("reportSettlement error params: %s response: %s",
|
||||
{
|
||||
param.param2,
|
||||
response
|
||||
});
|
||||
Room* room = RoomMgr::Instance()->GetRoomByUuid(param.sender);
|
||||
if (!room) {
|
||||
return;
|
||||
}
|
||||
Player* hum = room->GetPlayerByAccountId(param.param1.GetString());
|
||||
if (!hum) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
|
||||
{
|
||||
params->SetVal("account_id", account_id);
|
||||
params->SetVal("session_id", session_id);
|
||||
params->SetVal("battle_uuid", battle_uuid);
|
||||
params->SetVal("__POST", f8::PbToJson(p->settlement.get()));
|
||||
}
|
||||
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
if (url.find('?') != std::string::npos) {
|
||||
url += "c=Battle&a=reportSettlement";
|
||||
} else {
|
||||
url += "?c=Battle&a=reportSettlement";
|
||||
}
|
||||
std::string data;
|
||||
params->ToUrlEncodeStr(data);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
if (!f8::IsTestEnv()) {
|
||||
a8::XPrintf("reportSettlement %s\n", {data});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
a8::XParams()
|
||||
.SetSender(room->GetRoomUuid())
|
||||
.SetParam1(account_id)
|
||||
.SetParam2(data),
|
||||
on_ok,
|
||||
on_error,
|
||||
url.c_str(),
|
||||
*params.get()
|
||||
);
|
||||
}
|
||||
|
||||
void Human::SendBattleReport()
|
||||
{
|
||||
std::shared_ptr<a8::MutableXObject> params = a8::MutableXObject::CreateObject();
|
||||
|
@ -384,6 +384,7 @@ protected:
|
||||
private:
|
||||
void GenBattleReportData(a8::MutableXObject* params);
|
||||
void FillSMGameOver(cs::SMGameOver& msg);
|
||||
void SendBattleSettlement();
|
||||
void SendBattleReport();
|
||||
void Revive();
|
||||
void AdjustDecHp(float old_health, float& new_health);
|
||||
|
Loading…
x
Reference in New Issue
Block a user