From 693f7328643c7e893b4c2b4216d24441c77432f9 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jun 2019 11:28:41 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=9C=BA=E5=99=A8=E4=BA=BA=E4=B8=8D?= =?UTF-8?q?=E5=8F=91=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/human.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 00c894d..5237c84 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1483,8 +1483,10 @@ void Human::SendUpdateMsg() void Human::SendGameOver() { - if (!sending_gameover_) { - InternalSendGameOver(); + if (entity_subtype == EST_Player) { + if (!sending_gameover_) { + InternalSendGameOver(); + } } } From bc5b1ca1ebfa94c0b00979a6c89287dd0d02fef0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jun 2019 11:49:10 +0800 Subject: [PATCH 2/6] =?UTF-8?q?battleReport=E6=B7=BB=E5=8A=A0map=5Fid=20ma?= =?UTF-8?q?p=5Ftpl=5Fname=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/human.cc | 2 ++ server/gameserver/room.cc | 4 ++-- server/gameserver/room.h | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 5237c84..183e1ad 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -1769,7 +1769,9 @@ void Human::GenBattleReportData(a8::MutableXObject* params) } } params->SetVal("account_id", account_id); + params->SetVal("map_id", room->map_meta->i->map_id()); params->SetVal("map_name", room->map_meta->i->map_name()); + params->SetVal("map_tpl_name", room->map_tpl_name); params->SetVal("game_time", time(nullptr)); params->SetVal("hurt", stats.damage_amount_in); params->SetVal("rank", rank); diff --git a/server/gameserver/room.cc b/server/gameserver/room.cc index c7ff655..e9c31ae 100644 --- a/server/gameserver/room.cc +++ b/server/gameserver/room.cc @@ -319,8 +319,8 @@ void Room::ScatterDrop(Vector2D center, int drop_id) void Room::CreateThings() { - std::string tpl_name = map_meta->RandTemplate(); - std::vector* things = MetaMgr::Instance()->GetMapTplThing(tpl_name); + map_tpl_name = map_meta->RandTemplate(); + std::vector* things = MetaMgr::Instance()->GetMapTplThing(map_tpl_name); if (things) { for (auto& thing_tpl : *things) { if (thing_tpl.i->weight() >= rand() % 10000) { diff --git a/server/gameserver/room.h b/server/gameserver/room.h index e9955c8..d400b69 100644 --- a/server/gameserver/room.h +++ b/server/gameserver/room.h @@ -34,6 +34,7 @@ class Room public: long long room_uuid = 0; MetaData::Map* map_meta = nullptr; + std::string map_tpl_name; FrameEvent frame_event; FrameMaker frame_maker; long long frame_no = 0; From 4cdcc694ac3e077712622a6470fa2fe85183a308 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jun 2019 13:50:22 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8A=80=E8=83=BDtimer?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/human.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 183e1ad..3130da2 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -54,6 +54,7 @@ Human::~Human() void Human::Initialize() { Entity::Initialize(); + skill_xtimer_attacher_.xtimer = &room->xtimer; RecalcSelfCollider(); volume_ = meta->volume; observers_.insert(this); @@ -1783,7 +1784,7 @@ void Human::GenBattleReportData(a8::MutableXObject* params) } else { params->SetVal("alive_time", dead_frameno * 1000.0f / SERVER_FRAME_RATE); } - params->SetVal("team_status", team_id != 0); + params->SetVal("team_status", team_members && team_members->size() > 1 ? 1 : 0); params->SetVal("room_uuid", room->room_uuid); int snipe_kill = 0; From ca1093988a8696cc64250a3078d9f822ca55364a Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jun 2019 14:40:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E6=95=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/app.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index 5c70c67..aa8f439 100755 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -53,10 +53,12 @@ const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log"; static void SavePerfLog() { - a8::UdpLog::Instance()->Info("max_mainloop_rundelay:%d room_num:%d", + a8::UdpLog::Instance()->Info("max_mainloop_rundelay:%d room_num:%d player_num:%d online_num:%d", { App::Instance()->perf.max_run_delay_time, RoomMgr::Instance()->RoomNum() + 0, + PlayerMgr::Instance()->OnlineNum() }); if (App::Instance()->HasFlag(4)) { a8::XPrintf("mainloop_time:%d netmsg_time:%d room:%d over_room:%d online:%d\n", From 4fdcfae52047e50d463a5b918288f9f5d64a5782 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jun 2019 15:29:27 +0800 Subject: [PATCH 5/6] 1 --- server/gameserver/app.cc | 2 +- server/gameserver/roommgr.cc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index aa8f439..008c281 100755 --- a/server/gameserver/app.cc +++ b/server/gameserver/app.cc @@ -56,7 +56,7 @@ static void SavePerfLog() a8::UdpLog::Instance()->Info("max_mainloop_rundelay:%d room_num:%d player_num:%d online_num:%d", { App::Instance()->perf.max_run_delay_time, - RoomMgr::Instance()->RoomNum() + RoomMgr::Instance()->RoomNum(), 0, PlayerMgr::Instance()->OnlineNum() }); diff --git a/server/gameserver/roommgr.cc b/server/gameserver/roommgr.cc index e8c60ee..f5c7ec9 100644 --- a/server/gameserver/roommgr.cc +++ b/server/gameserver/roommgr.cc @@ -162,6 +162,7 @@ Room* RoomMgr::GetRoomByUuid(long long room_uuid) void RoomMgr::AddOverRoom(long long room_uuid) { + inactive_room_hash_.erase(room_uuid); a8::Timer::Instance()->AddDeadLineTimer(1000, a8::XParams() .SetSender(room_uuid), From 727352fb9cda6bd318e433f2d0b6c0788199d90e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 4 Jun 2019 15:31:00 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AD=A6=E5=99=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/gameserver/human.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 3130da2..f1092a3 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -516,6 +516,7 @@ void Human::FillSMGameOver(cs::SMGameOver& msg) void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id) { if (!dead && !room->game_over) { + lethal_weapon = weapon_id; Entity* hum = room->GetEntityByUniId(killer_id); if (hum && hum->entity_type == ET_Player) { if (killer_id == entity_uniid) { @@ -1841,6 +1842,9 @@ void Human::GenBattleReportData(a8::MutableXObject* params) void Human::InternalSendGameOver() { + if (entity_subtype != EST_Player) { + return; + } if (already_report_battle_) { cs::SMGameOver msg; FillSMGameOver(msg);