1
This commit is contained in:
parent
e842a5b7ce
commit
d7eaa2b5d6
@ -11,6 +11,7 @@
|
||||
#include "obstacle.h"
|
||||
#include "httpproxy.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "mt/MapMode.h"
|
||||
|
||||
@ -71,12 +72,20 @@ void BoxDrop::OnBattleStart()
|
||||
|
||||
void BoxDrop::RequestAllocBoxNum()
|
||||
{
|
||||
std::string account_id;
|
||||
std::string session_id;
|
||||
if (!FillAccountIdSessionId(account_id, session_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("c", "Battle");
|
||||
url_params->SetVal("a", "requestAllocBoxNum");
|
||||
url_params->SetVal("room_uuid", room_->GetRoomUuid());
|
||||
url_params->SetVal("account_id", account_id);
|
||||
url_params->SetVal("session_id", session_id);
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
[]
|
||||
@ -117,12 +126,21 @@ void BoxDrop::RequestReturnBoxNum()
|
||||
return;
|
||||
}
|
||||
returned_ = true;
|
||||
|
||||
std::string account_id;
|
||||
std::string session_id;
|
||||
if (!FillAccountIdSessionId(account_id, session_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("c", "Battle");
|
||||
url_params->SetVal("a", "requestReturnBoxNum");
|
||||
url_params->SetVal("room_uuid", room_->GetRoomUuid());
|
||||
url_params->SetVal("account_id", account_id);
|
||||
url_params->SetVal("session_id", session_id);
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
[]
|
||||
@ -161,5 +179,13 @@ int BoxDrop::GetRemainNum()
|
||||
|
||||
bool BoxDrop::FillAccountIdSessionId(std::string account_id, std::string session_id)
|
||||
{
|
||||
return true;
|
||||
bool ok = false;
|
||||
room_->TraversePlayerList
|
||||
([&ok, &account_id, &session_id] (Player* hum)
|
||||
{
|
||||
ok = true;
|
||||
account_id = hum->account_id;
|
||||
session_id = hum->session_id;
|
||||
});
|
||||
return ok;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user