Skip to content

Commit

Permalink
Include DLC which don't require base game
Browse files Browse the repository at this point in the history
For real this time
  • Loading branch information
Citrinate committed Dec 19, 2024
1 parent 7e0cd46 commit 0c028ce
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
1 change: 0 additions & 1 deletion FreePackages.Tests/Apps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void CanDetectRedeemableAppWithAppRequirement() {

Assert.IsTrue(app.MustOwnAppToPurchase > 0);
Assert.IsTrue(PackageFilter.IsRedeemableApp(app));
Assert.IsTrue(app.MustOwnAppToPurchase == app.DLCForAppID);
}

[TestMethod]
Expand Down
4 changes: 0 additions & 4 deletions FreePackages/PackageFilter/Filterables/FilterableApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ internal sealed class FilterableApp {
internal string? ReleaseState;
internal string? State;
internal uint MustOwnAppToPurchase;
internal uint DLCForAppID;
internal List<string>? RestrictedCountries;
internal List<string>? PurchaseRestrictedCountries;
internal bool AllowPurchaseFromRestrictedCountries;
Expand All @@ -28,7 +27,6 @@ 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) {}
Expand All @@ -44,7 +42,6 @@ internal FilterableApp(uint id, KeyValue kv) {
ReleaseState = kv["common"]["releasestate"].AsString();
State = kv["extended"]["state"].AsString();
MustOwnAppToPurchase = kv["extended"]["mustownapptopurchase"].AsUnsignedInteger();
DLCForAppID = kv["extended"]["dlcforappid"].AsUnsignedInteger();
RestrictedCountries = kv["common"]["restricted_countries"].AsString()?.ToUpper().Split(",").ToList();
PurchaseRestrictedCountries = kv["extended"]["purchaserestrictedcountries"].AsString()?.ToUpper().Split(" ").ToList();
AllowPurchaseFromRestrictedCountries = kv["extended"]["allowpurchasefromrestrictedcountries"].AsBoolean();
Expand All @@ -58,7 +55,6 @@ 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/
Expand Down
11 changes: 0 additions & 11 deletions FreePackages/PackageFilter/PackageFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,6 @@ internal bool IsRedeemableApp(FilterableApp app, HashSet<uint>? includedAppIDs =
return false;
}

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

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)) {
// App is restricted in this bot's country
return false;
Expand Down

0 comments on commit 0c028ce

Please sign in to comment.