mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
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:
parent
18a3a0fd01
commit
70dcb6ef43
2 changed files with 19 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -4637,8 +4637,12 @@ void GameScreen::renderNameplates(game::GameHandler& gameHandler) {
|
|||
ImVec2 textSize = ImGui::CalcTextSize(labelBuf);
|
||||
float nameX = sx - textSize.x * 0.5f;
|
||||
float nameY = sy - barH - 12.0f;
|
||||
// Name color: hostile=red, non-hostile=yellow (WoW convention)
|
||||
ImU32 nameColor = unit->isHostile()
|
||||
? IM_COL32(220, 80, 80, A(230))
|
||||
: IM_COL32(240, 200, 100, A(230));
|
||||
drawList->AddText(ImVec2(nameX + 1.0f, nameY + 1.0f), IM_COL32(0, 0, 0, A(160)), labelBuf);
|
||||
drawList->AddText(ImVec2(nameX, nameY), IM_COL32(255, 255, 255, A(220)), labelBuf);
|
||||
drawList->AddText(ImVec2(nameX, nameY), nameColor, labelBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue