From e4d8ece610015c72fc1f2a9afc9f1306fbaa5797 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Nov 2022 14:44:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=86=8A=EF=BC=8C=E6=AD=BB=E4=BA=A1=E8=87=AA?= =?UTF-8?q?=E7=88=86=E6=97=B6=EF=BC=8C=E4=B8=8D=E7=AE=97=E7=9C=9F=E6=AD=BB?= =?UTF-8?q?=E3=80=82=E6=89=80=E4=BB=A5ko=E5=92=8C=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E8=A6=81=E7=AD=89=E5=88=B0=E6=AD=BB=E4=BA=A1=E7=88=86=E7=82=B8?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=90=8E=E5=91=88=E7=8E=B0=EF=BC=8C=E8=A1=80?= =?UTF-8?q?=E4=B8=BA0=E6=97=B6=E8=A6=81=E6=92=AD=E6=94=BE=E8=87=AA?= =?UTF-8?q?=E7=88=86=E5=89=8D=E7=9A=84=E7=8A=B6=E6=80=81=EF=BC=8C=E5=90=8E?= =?UTF-8?q?=E8=87=AA=E7=88=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/creature.h | 1 + server/gameserver/httpproxy.cc | 10 ++++++++-- server/gameserver/human.cc | 19 ++++++++++++++++++- server/gameserver/skill.cc | 3 +++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/server/gameserver/creature.h b/server/gameserver/creature.h index 951d6b38..4dd9faeb 100644 --- a/server/gameserver/creature.h +++ b/server/gameserver/creature.h @@ -88,6 +88,7 @@ class Creature : public MoveableEntity bool playing_skill = false; int power_idx = -1; std::function on_add_buff; + int over_delay_time = 0; Weapon second_weapon; a8::Vec2 context_pos; diff --git a/server/gameserver/httpproxy.cc b/server/gameserver/httpproxy.cc index 06af8968..42552ad2 100644 --- a/server/gameserver/httpproxy.cc +++ b/server/gameserver/httpproxy.cc @@ -18,6 +18,7 @@ struct HttpProxyRequest f8::AsyncHttpOnErrorFunc on_error; std::string url; a8::XObject url_params; + long long add_tick = 0; }; static void _ProxyCallback(f8::JsonHttpRequest* request) @@ -72,6 +73,7 @@ std::string HttpProxy::HttpGet(a8::XParams param, request->on_error = on_error; request->url = url; request->url_params = url_params; + request->add_tick = a8::XGetTickCount(); if (request_hash_.find(request->req_id) != request_hash_.end()) { abort(); } @@ -95,9 +97,11 @@ std::string HttpProxy::HttpGet(a8::XParams param, { HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString()); if (req) { + long long cost_time = a8::XGetTickCount() - req->add_tick; #ifdef DEBUG - a8::UdpLog::Instance()->Debug("ProxyHttpGet ok url:%s params:%s", + a8::UdpLog::Instance()->Debug("ProxyHttpGet ok cost_time:%d url:%s params:%s", { + cost_time, req->url, req->url_params.ToJsonStr(), }); @@ -108,8 +112,10 @@ std::string HttpProxy::HttpGet(a8::XParams param, { HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString()); if (req) { - a8::UdpLog::Instance()->Warning("ProxyHttpGet error url:%s params:%s response:%s", + long long cost_time = a8::XGetTickCount() - req->add_tick; + a8::UdpLog::Instance()->Warning("ProxyHttpGet error cost_time:%d url:%s params:%s response:%s", { + cost_time, req->url, req->url_params.ToJsonStr(), response diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index b5d9d2a8..3408c4d7 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1894,7 +1894,24 @@ void Human::SendGameOver() } else { if (!sending_battlereport_) { sending_battlereport_ = true; - SendBattleReport(); + if (over_delay_time > 0) { + room->xtimer.AddDeadLineTimerAndAttach + (over_delay_time / FRAME_RATE_MS, + a8::XParams() + .SetSender(this), + [] (const a8::XParams& param) + { + Human* hum = (Human*)param.sender.GetUserData(); + hum->SendBattleReport(); + hum->over_delay_time = 0; + }, + &xtimer_attacher.timer_list_, + [] (const a8::XParams& param) + { + }); + } else { + SendBattleReport(); + } } if (!is_game_end_) { GameLog::Instance()->GameEnd((Player*)this); diff --git a/server/gameserver/skill.cc b/server/gameserver/skill.cc index e52c2c9c..f9619204 100644 --- a/server/gameserver/skill.cc +++ b/server/gameserver/skill.cc @@ -516,6 +516,9 @@ void Skill::ProcSWZB() SkillHelper::GetSwzbEffect(meta), 0 ); + if (!meta->phases.empty()) { + owner->over_delay_time = meta->phases.at(0).param1; + } #ifdef DEBUG { std::string dbg_msg = a8::Format