diff --git a/server/gameserver/human.cc b/server/gameserver/human.cc index be00f8e..3e92567 100644 --- a/server/gameserver/human.cc +++ b/server/gameserver/human.cc @@ -684,6 +684,12 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id) stats.killer_name = killer_name; stats.weapon_id = weapon_id; } + { + Entity* killer = room->GetEntityByUniId(killer_id); + if (killer && killer->IsCreature(room)) { + ((Creature*)killer)->GetTrigger()->Kill(this); + } + } { GetTrigger()->Die(); dead = true; diff --git a/server/gameserver/killmgr.cc b/server/gameserver/killmgr.cc index e4df722..b1599e5 100644 --- a/server/gameserver/killmgr.cc +++ b/server/gameserver/killmgr.cc @@ -20,39 +20,32 @@ void KillMgr::UnInit() void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info) { -#if 0 { - Entity* hum = room->GetEntityByUniId(killer_id); + Entity* hum = dead_hum->room->GetEntityByUniId(info->killer_id); if (hum && hum->IsEntityType(ET_Player)) { Creature* killer = (Creature*)hum; - if (killer_id == GetUniId()) { - info.killer_id = killer->GetUniId(); - info.killer_team_id = killer->team_id; + if (info->killer_id == dead_hum->GetUniId()) { + #if 0 SendRollMsgEx(info, TEXT("battle_server_dead_specate", "%s 自杀").c_str(), { killer_name }); + #endif } else { - ((Human*)hum)->stats.kills++; - ((Human*)hum)->stats.last_kill_frameno = room->GetFrameNo(); - ((Human*)hum)->kill_humans.insert(this); - ((Human*)hum)->SyncAroundPlayers(__FILE__, __LINE__, __func__); - ((Human*)hum)->GetTrigger()->Kill(this); - { - info.killer_id = killer->GetUniId(); - info.killer_team_id = killer->team_id; - SendRollMsgEx - (info, - TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(), - { - killer_name, - name - } - ); - } + #if 0 + SendRollMsgEx + (info, + TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(), + { + killer_name, + name + } + ); + #endif } } else { + #if 0 switch (weapon_id) { case VW_SafeArea: { @@ -69,9 +62,9 @@ void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info) } break; } + #endif } } -#endif } void KillMgr::PreprocessRollMsg(cs::SMRollMsg* pb_msg, diff --git a/server/gameserver/trigger.cc b/server/gameserver/trigger.cc index d0c2db4..bde88a2 100644 --- a/server/gameserver/trigger.cc +++ b/server/gameserver/trigger.cc @@ -7,6 +7,7 @@ #include "metamgr.h" #include "skill.h" #include "room.h" +#include "human.h" void Trigger::Init() { @@ -100,6 +101,12 @@ void Trigger::Shot(MetaData::Equip* weapon_meta) void Trigger::Kill(Creature* target) { + if (owner_->IsHuman() && target->IsHuman()) { + owner_->AsHuman()->stats.kills++; + owner_->AsHuman()->stats.last_kill_frameno = owner_->room->GetFrameNo(); + owner_->AsHuman()->kill_humans.insert(target->AsHuman()); + owner_->AsHuman()->SyncAroundPlayers(__FILE__, __LINE__, __func__); + } ++kill_num_; TraverseCondBuffs (kCondBuffKillTarget,