This commit is contained in:
aozhiwei 2024-05-27 17:28:47 +08:00
parent 22febc1eb7
commit bd78ed0f4c
4 changed files with 19 additions and 23 deletions

View File

@ -3435,6 +3435,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
Entity* killer = room->GetEntityByUniId(real_killer_id);
if (killer && killer->IsCreature(room)) {
((Creature*)killer)->GetTrigger()->Kill(this, weapon_id);
info.real_killer_team_id = ((Creature*)killer)->team_id;
}
}
if (room->IsPveRoom()) {

View File

@ -16,6 +16,7 @@ struct KillInfo
std::string killer_name;
int weapon_id = 0;
int real_killer_id = 0;
int real_killer_team_id = 0;
std::string real_killer_name;
};

View File

@ -79,6 +79,7 @@ namespace mt
int self_bekill_color = 0xFF0000;
int other_bekill_color = 0xFFFFFF;
int other_kill_color = 0xFFFFFF;
int map_cell_width = 64 * 8;
int bullet_planck_step_length = 15;

View File

@ -245,7 +245,7 @@ void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info)
std::shared_ptr<cs::SMRollMsg> pb_msg = std::make_shared<cs::SMRollMsg>();
FillHintInfo(dead_hum, info, hint_info);
PreprocessRollMsg(dead_hum, pb_msg, hint_info);
BoradcastRollMsg(dead_hum, info, 0, pb_msg);
BoradcastRollMsg(dead_hum, info, info->real_killer_team_id, pb_msg);
}
void KillMgr::PreprocessRollMsg(Human* dead_hum,
@ -342,7 +342,9 @@ void KillMgr::BoradcastRollMsgCb(Human* dead_hum,
for (int i = 0; i < pb_msg->elements_size(); ++i) {
auto element = pb_msg->mutable_elements(i);
if (element->element_type() == kTextElement) {
elements.push_back(element);
if (element->union_obj_1().text() != " ") {
elements.push_back(element);
}
}
}
auto proc_dead =
@ -362,7 +364,16 @@ void KillMgr::BoradcastRollMsgCb(Human* dead_hum,
auto proc_killer =
[dead_hum, info, killer_team_id] (cs::MFRichTextElement* element, Human* hum)
{
if (info->killer_id == hum->GetUniId()) {
auto color = mt::Param::s().self_kill_color;
element->mutable_union_obj_1()->set_color(color);
} else if (killer_team_id == hum->team_id) {
auto color = mt::Param::s().teammate_kill_color;
element->mutable_union_obj_1()->set_color(color);
} else {
auto color = mt::Param::s().other_kill_color;
element->mutable_union_obj_1()->set_color(color);
}
};
dead_hum->room->TraversePlayerList
(
@ -372,28 +383,10 @@ void KillMgr::BoradcastRollMsgCb(Human* dead_hum,
if (elements.size() == 1) {
proc_dead(elements.at(0), hum);
} else if (elements.size() == 2) {
proc_killer(elements.at(1), hum);
proc_dead(elements.at(0), hum);
proc_killer(elements.at(0), hum);
proc_dead(elements.at(1), hum);
} else {
}
for (int i = 0; i < pb_msg->elements_size(); ++i) {
auto element = pb_msg->mutable_elements(i);
if (element->element_type() == kTextElement) {
int color = element->mutable_union_obj_1()->color();
if (dead_hum == hum) {
color = mt::Param::s().self_bekill_color;
} else if (dead_hum->team_id == hum->team_id) {
color = mt::Param::s().teammate_bekill_color;
} else if (info->killer_id == hum->GetUniId()){
color = mt::Param::s().self_kill_color;
} else if (killer_team_id == hum->team_id) {
color = mt::Param::s().teammate_kill_color;
}
if (element->mutable_union_obj_1()->color() != color) {
element->mutable_union_obj_1()->set_color(color);
}
}
}
#ifdef MYDEBUG1
a8::XPrintf("SMRollMsg:%s\n", {f8::PbToJson(pb_msg.get())});
#endif