diff options
Diffstat (limited to 'libs/game_bethesda/src/games/starfield/gamestarfield.cpp')
| -rw-r--r-- | libs/game_bethesda/src/games/starfield/gamestarfield.cpp | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/libs/game_bethesda/src/games/starfield/gamestarfield.cpp b/libs/game_bethesda/src/games/starfield/gamestarfield.cpp index ebec948..06a6d79 100644 --- a/libs/game_bethesda/src/games/starfield/gamestarfield.cpp +++ b/libs/game_bethesda/src/games/starfield/gamestarfield.cpp @@ -22,6 +22,7 @@ #include <QDir> #include <QFileInfo> #include <QList> +#include <QRegularExpression> #include <QObject> #include <QString> #include <QStringList> @@ -337,15 +338,23 @@ QStringList GameStarfield::CCPlugins() const // as Creations. The StarfieldUnmanagedMods class handles parsing mod names and files. if (unmanagedMods.get()) { auto contentCatalog = unmanagedMods->parseContentCatalog(); - for (const auto& mod : contentCatalog) { - if (!plugins.contains(mod.first, Qt::CaseInsensitive)) { - plugins.append(mod.first); + for (auto& mod : contentCatalog) { + QStringList pluginFiles = mod.second.files.filter(QRegularExpression( + "\\.es(m|p|l)$", QRegularExpression::CaseInsensitiveOption)); + if (!pluginFiles.isEmpty()) { + plugins += pluginFiles; } } } + plugins.removeDuplicates(); return plugins; } +QString GameStarfield::blueprintPrefix() const +{ + return "blueprintships-"; +} + IPluginGame::SortMechanism GameStarfield::sortMechanism() const { return IPluginGame::SortMechanism::LOOT; @@ -380,6 +389,10 @@ std::vector<unsigned int> GameStarfield::activeProblems() const if (testFilePresent()) result.push_back(PROBLEM_TEST_FILE); } + if (hasInvalidBlueprint()) + result.push_back(PROBLEM_INVALID_BLUEPRINT); + if (hasUnpairedBlueprint()) + result.push_back(PROBLEM_UNPAIRED_BLUEPRINT); } return result; } @@ -412,6 +425,38 @@ bool GameStarfield::testFilePresent() const return false; } +bool GameStarfield::hasInvalidBlueprint() const +{ + auto plugins = m_Organizer->pluginList()->pluginNames(); + for (auto plugin : plugins) { + if (m_Organizer->pluginList()->isBlueprintFlagged(plugin)) { + if (!plugin.startsWith(blueprintPrefix(), Qt::CaseInsensitive) || + !m_Organizer->pluginList()->hasMasterExtension(plugin)) + return true; + } else if (plugin.startsWith(blueprintPrefix(), Qt::CaseInsensitive)) { + return true; + } + } + return false; +} + +bool GameStarfield::hasUnpairedBlueprint() const +{ + auto plugins = m_Organizer->pluginList()->pluginNames(); + for (auto plugin : plugins) { + if (plugin.startsWith(blueprintPrefix(), Qt::CaseInsensitive) && + m_Organizer->pluginList()->hasMasterExtension(plugin)) { + QString parent = plugin.mid(blueprintPrefix().size(), + plugin.size() - blueprintPrefix().size() - 4); + auto mainPlugin = plugins.filter(QRegularExpression( + "^" + parent + "\\.es(m|p|l)$", QRegularExpression::CaseInsensitiveOption)); + if (mainPlugin.isEmpty()) + return true; + } + } + return false; +} + QString GameStarfield::shortDescription(unsigned int key) const { switch (key) { @@ -419,6 +464,10 @@ QString GameStarfield::shortDescription(unsigned int key) const return tr("You have active ESP plugins in Starfield"); case PROBLEM_TEST_FILE: return tr("sTestFile entries are present"); + case PROBLEM_INVALID_BLUEPRINT: + return tr("Invalid blueprint plugins found"); + case PROBLEM_UNPAIRED_BLUEPRINT: + return tr("Unpaired blueprint plugins found"); } return ""; } @@ -446,6 +495,17 @@ QString GameStarfield::fullDescription(unsigned int key) const "settings in your StarfieldCustom.ini. These must be removed or the game " "will not read the plugins.txt file. Management is still disabled.</p>"); } + case PROBLEM_INVALID_BLUEPRINT: + return tr( + "<p>You have a blueprint file that is invalid. Blueprints require the " + "blueprint flag and prefix and must have the ESM extension to be valid.</p>"); + case PROBLEM_UNPAIRED_BLUEPRINT: + return tr( + "<p>You have a valid blueprint file that has no paired main plugin. The only " + "way to load blueprint files is by enabling a main plugin with the same base " + "name. This is the part after the prefix and before the extension.</p><p>eg. " + "<strong>BlueprintShips-example.esm</strong> should have a paired main plugin " + "<strong>example.esm</strong></p>"); } return ""; } |
