diff --git a/src/core/application.cpp b/src/core/application.cpp index 9c4e879d..7c1355ab 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -6487,84 +6487,6 @@ void Application::spawnOnlineCreature(uint64_t guid, uint32_t displayId, float x } } - // Optional NPC helmet attachments (kept disabled for stability: this path - // can increase spawn-time pressure and regress NPC visibility in crowded areas). - static constexpr bool kEnableNpcHelmetAttachments = false; - if (kEnableNpcHelmetAttachments && - itDisplayData != displayDataMap_.end() && - itDisplayData->second.extraDisplayId != 0) { - auto itExtra = humanoidExtraMap_.find(itDisplayData->second.extraDisplayId); - if (itExtra != humanoidExtraMap_.end()) { - const auto& extra = itExtra->second; - if (extra.equipDisplayId[0] != 0) { // Helm slot - auto itemDisplayDbc = assetManager->loadDBC("ItemDisplayInfo.dbc"); - const auto* idiL2 = pipeline::getActiveDBCLayout() ? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr; - if (itemDisplayDbc) { - int32_t helmIdx = itemDisplayDbc->findRecordById(extra.equipDisplayId[0]); - if (helmIdx >= 0) { - std::string helmModelName = itemDisplayDbc->getString(static_cast(helmIdx), idiL2 ? (*idiL2)["LeftModel"] : 1); - if (!helmModelName.empty()) { - size_t dotPos = helmModelName.rfind('.'); - if (dotPos != std::string::npos) { - helmModelName = helmModelName.substr(0, dotPos); - } - - static const std::unordered_map racePrefix = { - {1, "Hu"}, {2, "Or"}, {3, "Dw"}, {4, "Ni"}, {5, "Sc"}, - {6, "Ta"}, {7, "Gn"}, {8, "Tr"}, {10, "Be"}, {11, "Dr"} - }; - std::string genderSuffix = (extra.sexId == 0) ? "M" : "F"; - std::string raceSuffix; - auto itRace = racePrefix.find(extra.raceId); - if (itRace != racePrefix.end()) { - raceSuffix = "_" + itRace->second + genderSuffix; - } - - std::string helmPath; - std::vector helmData; - if (!raceSuffix.empty()) { - helmPath = "Item\\ObjectComponents\\Head\\" + helmModelName + raceSuffix + ".m2"; - helmData = assetManager->readFile(helmPath); - } - if (helmData.empty()) { - helmPath = "Item\\ObjectComponents\\Head\\" + helmModelName + ".m2"; - helmData = assetManager->readFile(helmPath); - } - - if (!helmData.empty()) { - auto helmModel = pipeline::M2Loader::load(helmData); - std::string skinPath = helmPath.substr(0, helmPath.size() - 3) + "00.skin"; - auto skinData = assetManager->readFile(skinPath); - if (!skinData.empty() && helmModel.version >= 264) { - pipeline::M2Loader::loadSkin(skinData, helmModel); - } - - if (helmModel.isValid()) { - uint32_t helmModelId = nextCreatureModelId_++; - std::string helmTexName = itemDisplayDbc->getString(static_cast(helmIdx), idiL2 ? (*idiL2)["LeftModelTexture"] : 3); - std::string helmTexPath; - if (!helmTexName.empty()) { - if (!raceSuffix.empty()) { - std::string suffixedTex = "Item\\ObjectComponents\\Head\\" + helmTexName + raceSuffix + ".blp"; - if (assetManager->fileExists(suffixedTex)) { - helmTexPath = suffixedTex; - } - } - if (helmTexPath.empty()) { - helmTexPath = "Item\\ObjectComponents\\Head\\" + helmTexName + ".blp"; - } - } - // Attachment point 11 = Head - charRenderer->attachWeapon(instanceId, 11, helmModel, helmModelId, helmTexPath); - } - } - } - } - } - } - } - } - // Try attaching NPC held weapons; if update fields are not ready yet, // IN_GAME retry loop will attempt again shortly. bool weaponsAttachedNow = tryAttachCreatureVirtualWeapons(guid, instanceId);