aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/flame
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-04-10 00:04:35 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-04-10 00:04:35 +0300
commit6d5c629b4316fb37b1ca0705c17867d6d9c771bd (patch)
tree26a3319288c025d38b8827d71a0e56258a2f5f34 /launcher/modplatform/flame
parent95842ee25f3f495915f3956296bbcb90686e1658 (diff)
downloadPrismLauncher-6d5c629b4316fb37b1ca0705c17867d6d9c771bd.tar.gz
PrismLauncher-6d5c629b4316fb37b1ca0705c17867d6d9c771bd.tar.bz2
PrismLauncher-6d5c629b4316fb37b1ca0705c17867d6d9c771bd.zip
Added dependencies to the APIs
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/modplatform/flame')
-rw-r--r--launcher/modplatform/flame/FlameModIndex.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/launcher/modplatform/flame/FlameModIndex.cpp b/launcher/modplatform/flame/FlameModIndex.cpp
index 7498e830..a820e3a1 100644
--- a/launcher/modplatform/flame/FlameModIndex.cpp
+++ b/launcher/modplatform/flame/FlameModIndex.cpp
@@ -136,7 +136,35 @@ auto FlameMod::loadIndexedPackVersion(QJsonObject& obj, bool load_changelog) ->
}
}
- if(load_changelog)
+ auto dependencies = Json::ensureArray(obj, "dependencies");
+ for (auto d : dependencies) {
+ auto dep = Json::ensureObject(d);
+ ModPlatform::Dependency dependency;
+ dependency.addonId = Json::requireInteger(dep, "modId");
+ switch (Json::requireInteger(dep, "relationType")) {
+ case 1: // EmbeddedLibrary
+ dependency.type = ModPlatform::DependencyType::EMBEDDED;
+ break;
+ case 2: // OptionalDependency
+ dependency.type = ModPlatform::DependencyType::OPTIONAL;
+ break;
+ case 3: // RequiredDependency
+ dependency.type = ModPlatform::DependencyType::REQUIRED;
+ break;
+ case 4: // Tool
+ dependency.type = ModPlatform::DependencyType::TOOL;
+ break;
+ case 5: // Incompatible
+ dependency.type = ModPlatform::DependencyType::INCOMPATIBLE;
+ break;
+ case 6: // Include
+ dependency.type = ModPlatform::DependencyType::INCLUDE;
+ break;
+ }
+ file.dependencies.append(dependency);
+ }
+
+ if (load_changelog)
file.changelog = api.getModFileChangelog(file.addonId.toInt(), file.fileId.toInt());
return file;