mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-05 00:33:51 +00:00
fix: validate displayId range and skip missing equipment textures
Reject displayId values >100k (corrupted update-field data) to avoid pointless DBC lookups and log spam. Add fileExists() guard before using base texture path in 4 equipment compositing code paths that were falling through without checking, causing excessive "Texture not found" warnings when users have incomplete MPQ extractions.
This commit is contained in:
parent
2f3a973444
commit
83eef878fb
4 changed files with 18 additions and 5 deletions
|
|
@ -649,6 +649,14 @@ void EntitySpawner::buildCreatureDisplayLookups() {
|
|||
}
|
||||
|
||||
std::string EntitySpawner::getModelPathForDisplayId(uint32_t displayId) const {
|
||||
// WotLK 3.3.5a CreatureDisplayInfo tops out around ~32000; values far
|
||||
// beyond that are corrupted update-field data or packet parse errors.
|
||||
// Silently reject to avoid pointless DBC lookups and log spam.
|
||||
constexpr uint32_t kMaxReasonableDisplayId = 100000;
|
||||
if (displayId == 0 || displayId > kMaxReasonableDisplayId) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (displayId == 30412) return "Creature\\Gryphon\\Gryphon.m2";
|
||||
if (displayId == 30413) return "Creature\\Wyvern\\Wyvern.m2";
|
||||
|
||||
|
|
|
|||
|
|
@ -769,10 +769,12 @@ void EntitySpawner::setOnlinePlayerEquipment(uint64_t guid,
|
|||
std::string base = "Item\\TextureComponents\\" + std::string(componentDirs[region]) + "\\" + texName;
|
||||
std::string genderPath = base + (isFemale ? "_F.blp" : "_M.blp");
|
||||
std::string unisexPath = base + "_U.blp";
|
||||
std::string basePath = base + ".blp";
|
||||
std::string fullPath;
|
||||
if (assetManager_->fileExists(genderPath)) fullPath = genderPath;
|
||||
else if (assetManager_->fileExists(unisexPath)) fullPath = unisexPath;
|
||||
else fullPath = base + ".blp";
|
||||
else if (assetManager_->fileExists(basePath)) fullPath = basePath;
|
||||
else continue;
|
||||
|
||||
regionLayers.emplace_back(region, fullPath);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -463,9 +463,10 @@ void EntitySpawner::processCreatureSpawnQueue(bool unlimited) {
|
|||
std::string(compDirs[region]) + "\\" + texName;
|
||||
std::string gp = base + (isFem ? "_F.blp" : "_M.blp");
|
||||
std::string up = base + "_U.blp";
|
||||
std::string bp = base + ".blp";
|
||||
if (am->fileExists(gp)) displaySkinPaths.push_back(gp);
|
||||
else if (am->fileExists(up)) displaySkinPaths.push_back(up);
|
||||
else displaySkinPaths.push_back(base + ".blp");
|
||||
else if (am->fileExists(bp)) displaySkinPaths.push_back(bp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -673,9 +674,10 @@ std::vector<std::string> EntitySpawner::resolveEquipmentTexturePaths(uint64_t gu
|
|||
std::string(componentDirs[region]) + "\\" + texName;
|
||||
std::string genderPath = base + (isFemale ? "_F.blp" : "_M.blp");
|
||||
std::string unisexPath = base + "_U.blp";
|
||||
std::string basePath = base + ".blp";
|
||||
if (assetManager_->fileExists(genderPath)) paths.push_back(genderPath);
|
||||
else if (assetManager_->fileExists(unisexPath)) paths.push_back(unisexPath);
|
||||
else paths.push_back(base + ".blp");
|
||||
else if (assetManager_->fileExists(basePath)) paths.push_back(basePath);
|
||||
}
|
||||
}
|
||||
return paths;
|
||||
|
|
|
|||
|
|
@ -315,9 +315,10 @@ void GameScreen::updateCharacterTextures(game::Inventory& inventory) {
|
|||
fullPath = genderPath;
|
||||
} else if (assetManager->fileExists(unisexPath)) {
|
||||
fullPath = unisexPath;
|
||||
} else {
|
||||
// Last resort: try without suffix
|
||||
} else if (assetManager->fileExists(base + ".blp")) {
|
||||
fullPath = base + ".blp";
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
regionLayers.emplace_back(region, fullPath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue