diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 6024a93..adf4d7b 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1636,9 +1636,21 @@ void Human::SendUpdateMsg() void Human::SendGameOver() { if (entity_subtype == EST_Player) { +#if 1 + if (!sent_battlereport_) { + SendBattleReport(); + sent_battlereport_ = true; + } + { + cs::SMGameOver msg; + FillSMGameOver(msg); + SendNotifyMsg(msg); + } +#else if (!sending_gameover_) { InternalSendGameOver(); } +#endif } } @@ -2168,3 +2180,44 @@ void Human::DeadDrop() } } } + +void Human::SendBattleReport() +{ + a8::MutableXObject* params = a8::MutableXObject::NewObject(); + GenBattleReportData(params); + auto on_ok = [] (a8::XParams& param, a8::XObject& data) + { + }; + auto on_error = [] (a8::XParams& param, const std::string& response) + { + a8::UdpLog::Instance()->Error("battleReport http error params: %s response: %s", + { + param.param2, + response + }); + }; + std::string url; + if (!f8::IsOnlineEnv()) { + if (App::Instance()->HasFlag(3)) { + url = "http://192.168.100.41/webapp/index.php?c=Role&a=battleReport"; + } else { + url = "https://game2001api-test.kingsome.cn/webapp/index.php?c=Role&a=battleReport"; + } + } else { + url = "https://game2001api.kingsome.cn/webapp/index.php?c=Role&a=battleReport"; + } + std::string data; + params->ToUrlEncodeStr(data); + f8::HttpClientPool::Instance()->HttpGet( + a8::XParams() + .SetSender(room->room_uuid) + .SetParam1(entity_uniid) + .SetParam2(data), + on_ok, + on_error, + url.c_str(), + *params, + MAX_SYS_HTTP_NUM + (room->room_uuid % MAX_USER_HTTP_NUM) + ); + delete params; +} diff --git a/server/gameserver/human.h b/server/gameserver/human.h index f829e11..9c8c56a 100644 --- a/server/gameserver/human.h +++ b/server/gameserver/human.h @@ -208,6 +208,7 @@ private: void InternalSendGameOver(); void DeadDrop(); void FillSMGameOver(cs::SMGameOver& msg); + void SendBattleReport(); protected: long long last_shot_frameno_ = 0; @@ -244,6 +245,7 @@ private: bool already_report_battle_ = false; bool sending_gameover_ = false; + bool sent_battlereport_ = false; bool sent_game_end_ = false; int send_gameover_trycount_ = 0;