mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-09 22:20:24 +00:00
[Bug Fix] Fix EVENT_KILLED_MERIT firing before NPC removal (#4185)
* [Bug Fix] Fix EVENT_KILLED_MERIT firing before NPC removal # Notes - NPCs were parsing this event too early and anything that checked if they were still alive in `EVENT_KILLED_MERIT` would show them still alive because of this. # Image * Code cleanup * Update client.h * Add GetRaidOrGroupOrSelf() to Perl/Lua * Update to luabind::object, fix logic per comments. * Fix * Fix per comments.
This commit is contained in:
+12
-21
@@ -2618,12 +2618,6 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
||||
}
|
||||
|
||||
if (m.member) {
|
||||
m.member->RecordKilledNPCEvent(this);
|
||||
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
|
||||
parse->EventNPC(EVENT_KILLED_MERIT, this, m.member, "killed", 0);
|
||||
}
|
||||
|
||||
if (RuleB(NPC, EnableMeritBasedFaction)) {
|
||||
m.member->SetFactionLevel(
|
||||
m.member->CharacterID(),
|
||||
@@ -2683,18 +2677,11 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the EVENT_KILLED_MERIT event and update kill tasks
|
||||
* for all group members */
|
||||
/* Update kill tasks for all group members */
|
||||
for (const auto& m : killer_group->members) {
|
||||
if (m && m->IsClient()) {
|
||||
Client* c = m->CastToClient();
|
||||
|
||||
c->RecordKilledNPCEvent(this);
|
||||
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
|
||||
parse->EventNPC(EVENT_KILLED_MERIT, this, c, "killed", 0);
|
||||
}
|
||||
|
||||
if (RuleB(NPC, EnableMeritBasedFaction)) {
|
||||
c->SetFactionLevel(
|
||||
c->CharacterID(),
|
||||
@@ -2756,13 +2743,6 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the EVENT_KILLED_MERIT event */
|
||||
give_exp_client->RecordKilledNPCEvent(this);
|
||||
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
|
||||
parse->EventNPC(EVENT_KILLED_MERIT, this, give_exp_client, "killed", 0);
|
||||
}
|
||||
|
||||
if (RuleB(NPC, EnableMeritBasedFaction)) {
|
||||
give_exp_client->SetFactionLevel(
|
||||
give_exp_client->CharacterID(),
|
||||
@@ -2991,6 +2971,17 @@ bool NPC::Death(Mob* killer_mob, int64 damage, uint16 spell, EQ::skills::SkillTy
|
||||
|
||||
m_combat_record.Stop();
|
||||
|
||||
if (give_exp_client && !IsCorpse()) {
|
||||
const auto& v = give_exp_client->GetRaidOrGroupOrSelf(true);
|
||||
for (const auto& m : v) {
|
||||
m->CastToClient()->RecordKilledNPCEvent(this);
|
||||
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_KILLED_MERIT)) {
|
||||
parse->EventNPC(EVENT_KILLED_MERIT, this, m, "killed", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parse->HasQuestSub(GetNPCTypeID(), EVENT_DEATH_COMPLETE)) {
|
||||
const auto& export_string = fmt::format(
|
||||
"{} {} {} {} {} {} {} {} {}",
|
||||
|
||||
Reference in New Issue
Block a user