Skip to content

Commit

Permalink
Include DLC which don't require base game
Browse files Browse the repository at this point in the history
Citrinate committed Dec 13, 2024

Verified

This commit was signed with the committer’s verified signature.
1 parent 0a1e9a6 commit 7607cb4
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions FreePackages/PackageFilter/Filterables/FilterableApp.cs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ internal sealed class FilterableApp {
internal List<string>? OSList;
internal uint DeckCompatibility;
internal DateTime SteamReleaseDate;
internal bool ActivationOnlyDLC;
internal bool Hidden;

internal FilterableApp(SteamApps.PICSProductInfoCallback.PICSProductInfo productInfo) : this(productInfo.ID, productInfo.KeyValues) {}
@@ -57,6 +58,7 @@ internal FilterableApp(uint id, KeyValue kv) {
OSList = kv["common"]["oslist"].AsString()?.ToUpper().Split(",").ToList();
DeckCompatibility = kv["common"]["steam_deck_compatibility"]["category"].AsUnsignedInteger();
SteamReleaseDate = DateTimeOffset.FromUnixTimeSeconds(kv["common"]["steam_release_date"].AsUnsignedInteger()).UtcDateTime;
ActivationOnlyDLC = kv["extended"]["activationonlydlc"].AsBoolean();
Hidden = kv["common"] == KeyValue.Invalid;

// Fix the category for games which do have trading cards, but which don't have the trading card category, Ex: https://steamdb.info/app/316260/
7 changes: 6 additions & 1 deletion FreePackages/PackageFilter/PackageFilter.cs
Original file line number Diff line number Diff line change
@@ -70,7 +70,12 @@ internal bool IsRedeemableApp(FilterableApp app, HashSet<uint>? includedAppIDs =
if (app.DLCForAppID > 0 && !OwnedAppIDs.Contains(app.DLCForAppID) && (includedAppIDs == null || !includedAppIDs.Contains(app.DLCForAppID))) {
// Missing a necessary app
// Note: Some apps have only DLCForAppid and are missing MustOwnAppToPurchase, so we need to check this also, ex: https://steamdb.info/app/41046
return false;

if (!app.ActivationOnlyDLC) {
// Some DLC can be redeemed without owning the base game, ex: https://steamdb.info/app/2765950/
// All I see that's special here is having ActivationOnlyDLC set to true, and missing MustOwnAppToPurchase
return false;
}
}

if (app.RestrictedCountries != null && app.RestrictedCountries.Contains(Country, StringComparer.OrdinalIgnoreCase)) {

0 comments on commit 7607cb4

Please sign in to comment.