138 lines
3.7 KiB
C++
138 lines
3.7 KiB
C++
#include "precompile.h"
|
|
|
|
#include "killmgr.h"
|
|
#include "human.h"
|
|
#include "room.h"
|
|
#include "player.h"
|
|
|
|
#include "mt/Param.h"
|
|
#include "mt/Text.h"
|
|
#include "mt/Equip.h"
|
|
#include "mt/Hero.h"
|
|
|
|
bool RollMsgHintInfo::Replace(Room* room, int idx, std::string& text)
|
|
{
|
|
switch (idx) {
|
|
case kFieldIdxMasterName:
|
|
{
|
|
text = master_name;
|
|
}
|
|
break;
|
|
case kFieldIdxKillerName:
|
|
{
|
|
text = killer_name;
|
|
}
|
|
break;
|
|
case kFieldIdxKillerHeroId:
|
|
{
|
|
Human* hum = room->GetHumanByUniId(killer_id);
|
|
if (hum) {
|
|
text = a8::XValue(hum->meta->id()).GetString();
|
|
}
|
|
}
|
|
break;
|
|
case kFieldIdxDeadName:
|
|
{
|
|
text = dead_name;
|
|
}
|
|
break;
|
|
case kFieldIdxDeadHeroId:
|
|
{
|
|
Human* hum = room->GetHumanByUniId(dead_id);
|
|
if (hum) {
|
|
text = a8::XValue(hum->meta->id()).GetString();
|
|
}
|
|
}
|
|
break;
|
|
case kFieldIdxWeaponTextIcon:
|
|
{
|
|
text = weapon_text_icon;
|
|
}
|
|
break;
|
|
default:
|
|
{
|
|
return false;
|
|
}
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void KillMgr::Init()
|
|
{
|
|
|
|
}
|
|
|
|
void KillMgr::UnInit()
|
|
{
|
|
|
|
}
|
|
|
|
void KillMgr::FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hint_info)
|
|
{
|
|
hint_info.dead_name = dead_hum->GetName();
|
|
|
|
switch (info->killer_id) {
|
|
case VP_Gas:
|
|
{
|
|
hint_info.killer_name = "";
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
("battle_server_dead_text_gas");
|
|
}
|
|
break;
|
|
case VP_Buff:
|
|
{
|
|
hint_info.killer_name = "";
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
(a8::Format("battle_server_dead_text_buff_%d", {info->weapon_id}));
|
|
if (!hint_info.hint_template) {
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
("battle_server_dead_text_buff_default");
|
|
}
|
|
}
|
|
break;
|
|
case VP_Explosion:
|
|
{
|
|
hint_info.killer_name = "";
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
(a8::Format("battle_server_dead_text_explosion_%d", {info->weapon_id}));
|
|
if (!hint_info.hint_template) {
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
("battle_server_dead_text_explosion_default");
|
|
}
|
|
}
|
|
break;
|
|
case VP_Water:
|
|
{
|
|
hint_info.killer_name = "";
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
("battle_server_dead_text_drown");
|
|
}
|
|
break;
|
|
default:
|
|
{
|
|
Entity* killer = dead_hum->room->GetEntityByUniId(info->killer_id);
|
|
if (killer) {
|
|
const mt::Equip* equip_meta = mt::Equip::GetById(info->weapon_id);
|
|
if (equip_meta) {
|
|
hint_info.weapon_text_icon = equip_meta->text_icon();
|
|
}
|
|
hint_info.dead_id = dead_hum->GetUniId();
|
|
hint_info.killer_id = info->killer_id;
|
|
hint_info.killer_name = killer->GetName();
|
|
if (info->killer_id == dead_hum->GetUniId()) {
|
|
//${dead.name} 自杀
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
("battle_server_dead_text_specate");
|
|
} else {
|
|
//${killer.name} 使用 ${weapon.text_icon} 干掉了 ${dead.name}
|
|
hint_info.hint_template = mt::Text::GetTextElements
|
|
("battle_server_dead_text_weapon");
|
|
}
|
|
} else {
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|