1
This commit is contained in:
parent
4a2a16d449
commit
def77eaddf
@ -215,6 +215,8 @@ enum VirtualWeapon_e
|
||||
enum VirtualPlayer_e
|
||||
{
|
||||
VP_Gas = 9000000,
|
||||
VP_Buff = 9000001,
|
||||
VP_Explosion = 9000002,
|
||||
};
|
||||
|
||||
enum EquipType_e
|
||||
|
@ -162,7 +162,6 @@ class Creature : public MoveableEntity
|
||||
void ActiveAllSkill();
|
||||
MetaData::SkillPhase* GetCurrSkillPhase();
|
||||
bool CanSee(const Creature* c) const;
|
||||
virtual std::string GetName() { return "";};
|
||||
virtual void SendDebugMsg(const std::string& debug_msg);
|
||||
virtual void DropItems(Obstacle* obstacle) {};
|
||||
bool IsPlayer() const;
|
||||
|
@ -52,6 +52,7 @@ class Entity
|
||||
virtual bool CanSeeMe(Human* hum) { return true; };
|
||||
virtual bool Attackable(Room* room) { return false; };
|
||||
virtual bool ReceiveExplosionDmg(Explosion* explosion) { return false; };
|
||||
virtual std::string GetName() { return "";};
|
||||
int GetUniId() const { return uniid_; }
|
||||
EntityType_e GetEntityType() const { return entity_type_; }
|
||||
EntitySubType_e GetEntitySubType() const { return entity_subtype_; }
|
||||
|
@ -27,45 +27,60 @@ void KillMgr::UnInit()
|
||||
*/
|
||||
void KillMgr::OnHumanDead(Human* dead_hum, KillInfo* info)
|
||||
{
|
||||
RollMsgHintInfo hint_info;
|
||||
std::shared_ptr<cs::SMRollMsg> pb_msg = std::make_shared<cs::SMRollMsg>();
|
||||
Entity* killer = dead_hum->room->GetEntityByUniId(info->killer_id);
|
||||
if (killer && killer->IsEntityType(ET_Player)) {
|
||||
if (info->killer_id == dead_hum->GetUniId()) {
|
||||
PreprocessRollMsg(pb_msg,
|
||||
TEXT("battle_server_dead_specate", "%s 自杀").c_str(),
|
||||
{
|
||||
info->killer_name
|
||||
});
|
||||
} else {
|
||||
PreprocessRollMsg(pb_msg,
|
||||
TEXT("battle_server_dead_weapon", "%s 使用 ${weapon_text_icon} 干掉了 %s").c_str(),
|
||||
{
|
||||
info->killer_name,
|
||||
dead_hum->name
|
||||
});
|
||||
FillHintInfo(dead_hum, info, hint_info);
|
||||
PreprocessRollMsg(pb_msg, hint_info);
|
||||
BoradcastRollMsg(dead_hum, info, 0, pb_msg);
|
||||
}
|
||||
|
||||
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.template_name = "battle_server_dead_text_gas";
|
||||
hint_info.template_defval = "%s 被${weapon_text_icon}干掉";
|
||||
}
|
||||
} else {
|
||||
Entity* root_master = dead_hum->room->GetEntityByUniId(info->root_master_id);
|
||||
if (root_master && root_master->IsEntityType(ET_Player)) {
|
||||
break;
|
||||
case VP_Buff:
|
||||
{
|
||||
hint_info.killer_name = "";
|
||||
hint_info.template_name = "battle_server_dead_text_gas";
|
||||
hint_info.template_defval = "%s 被${weapon_text_icon}干掉";
|
||||
}
|
||||
break;
|
||||
case VP_Explosion:
|
||||
{
|
||||
hint_info.killer_name = "";
|
||||
hint_info.template_name = "battle_server_dead_text_gas";
|
||||
hint_info.template_defval = "%s 被${weapon_text_icon}干掉";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
Entity* killer = dead_hum->room->GetEntityByUniId(info->killer_id);
|
||||
if (killer) {
|
||||
hint_info.killer_name = killer->GetName();
|
||||
if (info->killer_id == dead_hum->GetUniId()) {
|
||||
hint_info.template_name = "battle_server_dead_text_specate";
|
||||
hint_info.template_defval = "${dead.name} 自杀";
|
||||
} else {
|
||||
hint_info.template_name = "battle_server_dead_text_weapon";
|
||||
hint_info.template_defval = "${killer.name} 使用 ${weapon.text_icon} 干掉了 ${dead.name}";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
#if 0
|
||||
SendRollMsgEx
|
||||
(info,
|
||||
TEXT("battle_server_dead_gas", "%s 被${weapon_text_icon}干掉").c_str(),
|
||||
{
|
||||
name
|
||||
});
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void KillMgr::PreprocessRollMsg(std::shared_ptr<cs::SMRollMsg> pb_msg,
|
||||
const char* fmt,
|
||||
std::initializer_list<a8::XValue> args)
|
||||
RollMsgHintInfo& hint_info)
|
||||
{
|
||||
#if 0
|
||||
cs::SMRollMsg *pb_msg = new cs::SMRollMsg;
|
||||
|
@ -13,6 +13,17 @@ struct KillInfo
|
||||
int weapon_id = 0;
|
||||
};
|
||||
|
||||
struct RollMsgHintInfo
|
||||
{
|
||||
std::string master_name;
|
||||
std::string killer_name;
|
||||
std::string dead_name;
|
||||
std::string weapon_text_icon;
|
||||
|
||||
std::string template_name;
|
||||
std::string template_defval;
|
||||
};
|
||||
|
||||
class Human;
|
||||
class KillMgr : public a8::Singleton<KillMgr>
|
||||
{
|
||||
@ -28,9 +39,9 @@ class KillMgr : public a8::Singleton<KillMgr>
|
||||
void OnHumanDead(Human* dead_hum, KillInfo* info);
|
||||
|
||||
private:
|
||||
void FillHintInfo(Human* dead_hum, KillInfo* info, RollMsgHintInfo& hint_info);
|
||||
void PreprocessRollMsg(std::shared_ptr<cs::SMRollMsg> pb_msg,
|
||||
const char* fmt,
|
||||
std::initializer_list<a8::XValue> args);
|
||||
RollMsgHintInfo& hint_info);
|
||||
void BoradcastRollMsg(Human* dead_hum,
|
||||
KillInfo* info,
|
||||
int killer_team_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user