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