[Bug Fix] Fix NPC After Death Emotes (#4021)

* [Bug Fix] Fix NPC After Death Emotes

- `DoNPCEmote` was being called on the corpse, not the NPC, so it wasn't working for some reason despite it working for years.
- Cleaned up some other logic and variable names in `NPC::Death` while I was in there.

* Update attack.cpp

* Update npc.cpp

* Update attack.cpp

* Update attack.cpp
This commit is contained in:
Alex King
2024-01-29 00:03:34 -05:00
committed by GitHub
parent 1cb72642ac
commit a1f2a21c99
3 changed files with 298 additions and 190 deletions
+6 -9
View File
@@ -438,7 +438,7 @@ NPC::NPC(const NPCType *npc_type_data, Spawn2 *in_respawn, const glm::vec4 &posi
qGlobals = nullptr;
SetEmoteID(static_cast<uint32>(npc_type_data->emoteid));
SetEmoteID(npc_type_data->emoteid);
InitializeBuffSlots();
CalcBonuses();
@@ -1113,9 +1113,8 @@ void NPC::UpdateEquipmentLight()
}
void NPC::Depop(bool start_spawn_timer) {
const uint32 emote_id = GetEmoteID();
if (emote_id) {
DoNPCEmote(EQ::constants::EmoteEventTypes::OnDespawn, emote_id);
if (emoteid) {
DoNPCEmote(EQ::constants::EmoteEventTypes::OnDespawn, emoteid);
}
if (IsNPC()) {
@@ -3073,10 +3072,8 @@ void NPC::SendPayload(int payload_id, std::string payload_value)
NPC_Emote_Struct* NPC::GetNPCEmote(uint32 emote_id, uint8 event_) {
std::vector<NPC_Emote_Struct*> emotes;
for (const auto &e : zone->npc_emote_list) {
auto nes = e;
if (nes->emoteid == emote_id && nes->event_ == event_) {
for (auto& e : zone->npc_emote_list) {
if (e->emoteid == emote_id && e->event_ == event_) {
emotes.emplace_back(e);
}
}
@@ -3098,7 +3095,7 @@ void NPC::DoNPCEmote(uint8 event_, uint32 emote_id, Mob* t)
return;
}
auto e = GetNPCEmote(emote_id, event_);
const auto& e = GetNPCEmote(emote_id, event_);
if (!e) {
return;
}