Parse SMSG_ENVIRONMENTAL_DAMAGE_LOG and color nameplate names by hostility

- Implement SMSG_ENVIRONMENTAL_DAMAGE_LOG: show fall/lava/fire/drowning
  damage as ENVIRONMENTAL combat text (orange -N) for the local player
- Color nameplate unit names: hostile units red, non-hostile yellow
  (matches WoW's standard red=enemy / yellow=neutral convention)
This commit is contained in:
Kelsi 2026-03-09 17:18:18 -07:00
parent 18a3a0fd01
commit 70dcb6ef43
2 changed files with 19 additions and 2 deletions

View file

@ -3085,7 +3085,20 @@ void GameHandler::handlePacket(network::Packet& packet) {
packet.setReadPos(packet.getSize());
break;
}
case Opcode::SMSG_ENVIRONMENTAL_DAMAGE_LOG:
case Opcode::SMSG_ENVIRONMENTAL_DAMAGE_LOG: {
// packed_guid victim + uint32 envDmgType + uint32 damage + uint32 absorbed + uint32 resisted
// envDmgType: 1=Exhausted(fatigue), 2=Drowning, 3=Fall, 4=Lava, 5=Slime, 6=Fire
if (packet.getSize() - packet.getReadPos() < 2) { packet.setReadPos(packet.getSize()); break; }
uint64_t victimGuid = UpdateObjectParser::readPackedGuid(packet);
if (packet.getSize() - packet.getReadPos() < 12) { packet.setReadPos(packet.getSize()); break; }
/*uint32_t envType =*/ packet.readUInt32();
uint32_t dmg = packet.readUInt32();
/*uint32_t abs =*/ packet.readUInt32();
if (victimGuid == playerGuid && dmg > 0)
addCombatText(CombatTextEntry::ENVIRONMENTAL, static_cast<int32_t>(dmg), 0, false);
packet.setReadPos(packet.getSize());
break;
}
case Opcode::SMSG_SET_PROFICIENCY:
packet.setReadPos(packet.getSize());
break;