fix: env damage alias overwrote handler that preserved damage type

SMSG_ENVIRONMENTALDAMAGELOG (alias) registration at line 173 silently
overwrote the canonical SMSG_ENVIRONMENTAL_DAMAGE_LOG handler at line
108. The alias handler discarded envType (fall/lava/drowning), so the
UI couldn't differentiate environmental damage sources. Removed the
dead alias handler and its method; the canonical inline handler with
envType forwarding is now the sole registration.
This commit is contained in:
Kelsi 2026-03-29 18:20:51 -07:00
parent 0795430390
commit fc2526fc18
2 changed files with 2 additions and 21 deletions

View file

@ -137,7 +137,6 @@ private:
void handleUpdateComboPoints(network::Packet& packet);
void handlePvpCredit(network::Packet& packet);
void handleProcResist(network::Packet& packet);
void handleEnvironmentalDamageLog(network::Packet& packet);
void handleSpellDamageShield(network::Packet& packet);
void handleSpellOrDamageImmune(network::Packet& packet);
void handleResistLog(network::Packet& packet);

View file

@ -169,8 +169,8 @@ void CombatHandler::registerOpcodes(DispatchTable& table) {
table[Opcode::SMSG_PVP_CREDIT] = [this](network::Packet& p) { handlePvpCredit(p); };
table[Opcode::SMSG_PROCRESIST] = [this](network::Packet& p) { handleProcResist(p); };
// ---- Environmental / reflect / immune / resist ----
table[Opcode::SMSG_ENVIRONMENTALDAMAGELOG] = [this](network::Packet& p) { handleEnvironmentalDamageLog(p); };
// SMSG_ENVIRONMENTALDAMAGELOG is an alias for SMSG_ENVIRONMENTAL_DAMAGE_LOG
// (registered above at line 108 with envType forwarding). No separate handler needed.
table[Opcode::SMSG_SPELLDAMAGESHIELD] = [this](network::Packet& p) { handleSpellDamageShield(p); };
table[Opcode::SMSG_SPELLORDAMAGE_IMMUNE] = [this](network::Packet& p) { handleSpellOrDamageImmune(p); };
table[Opcode::SMSG_RESISTLOG] = [this](network::Packet& p) { handleResistLog(p); };
@ -800,24 +800,6 @@ void CombatHandler::handleProcResist(network::Packet& packet) {
// Environmental / reflect / immune / resist
// ============================================================
void CombatHandler::handleEnvironmentalDamageLog(network::Packet& packet) {
// uint64 victimGuid + uint8 envDamageType + uint32 damage + uint32 absorb + uint32 resist
if (!packet.hasRemaining(21)) return;
uint64_t victimGuid = packet.readUInt64();
/*uint8_t envType =*/ packet.readUInt8();
uint32_t damage = packet.readUInt32();
uint32_t absorb = packet.readUInt32();
uint32_t resist = packet.readUInt32();
if (victimGuid == owner_.playerGuid) {
// Environmental damage: no caster GUID, victim = player
if (damage > 0)
addCombatText(CombatTextEntry::ENVIRONMENTAL, static_cast<int32_t>(damage), 0, false, 0, 0, victimGuid);
if (absorb > 0)
addCombatText(CombatTextEntry::ABSORB, static_cast<int32_t>(absorb), 0, false, 0, 0, victimGuid);
if (resist > 0)
addCombatText(CombatTextEntry::RESIST, static_cast<int32_t>(resist), 0, false, 0, 0, victimGuid);
}
}
void CombatHandler::handleSpellDamageShield(network::Packet& packet) {
// Classic: packed_guid victim + packed_guid caster + spellId(4) + damage(4) + schoolMask(4)