diff --git a/server/gameserver/app.cc b/server/gameserver/app.cc index 7b9061f..6e2d6f1 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() + 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 bullet:%d\n", diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index 00c894d..f1092a3 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); @@ -515,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) { @@ -1483,8 +1485,10 @@ void Human::SendUpdateMsg() void Human::SendGameOver() { - if (!sending_gameover_) { - InternalSendGameOver(); + if (entity_subtype == EST_Player) { + if (!sending_gameover_) { + InternalSendGameOver(); + } } } @@ -1767,7 +1771,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); @@ -1779,7 +1785,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; @@ -1836,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); 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; 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),