Fix respawned corpse movement, faction hostility, and add WoW-canonical mob level colors

Reset NPC animation to idle when health goes from 0 to >0 (respawn), prevent
dead NPCs from being moved by server movement packets. Fix faction hostility
to check factionGroup Monster bit and individual enemy arrays, not just
enemyGroup. Add level-based mob coloring: grey (no XP), green (easy), yellow
(even), orange (hard), red (very hard) for target frame and selection circle.
This commit is contained in:
Kelsi 2026-02-06 16:47:07 -08:00
parent 74f90be449
commit 510794a66e
7 changed files with 127 additions and 9 deletions

View file

@ -736,12 +736,34 @@ void NpcManager::initialize(pipeline::AssetManager* am,
break;
}
}
// Find player's parent faction ID for individual enemy checks
uint32_t playerFactionId = 0;
for (uint32_t i = 0; i < dbc->getRecordCount(); i++) {
if (dbc->getUInt32(i, 0) == 1) {
playerFactionId = dbc->getUInt32(i, 1); // Faction (parent)
break;
}
}
// Second pass: classify each faction template
for (uint32_t i = 0; i < dbc->getRecordCount(); i++) {
uint32_t id = dbc->getUInt32(i, 0);
uint32_t factionGroup = dbc->getUInt32(i, 3);
uint32_t enemyGroup = dbc->getUInt32(i, 5);
// Hostile only if creature's enemy groups overlap player's faction/friend groups
// Check group-level hostility
bool hostile = (enemyGroup & playerFriendGroup) != 0;
// Check if creature is a Monster type (factionGroup bit 4)
if (!hostile && (factionGroup & 4) != 0) {
hostile = true;
}
// Check individual enemy faction IDs (fields 6-9)
if (!hostile && playerFactionId > 0) {
for (int e = 6; e <= 9; e++) {
if (dbc->getUInt32(i, e) == playerFactionId) {
hostile = true;
break;
}
}
}
factionHostile[id] = hostile;
}
LOG_INFO("NpcManager: loaded ", dbc->getRecordCount(),