decord/alpha/source/modules/games/GameRecord.tsx

245 lines
7.8 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 2021
// Function ID: 2022
// Name: GameRecord
2026-10-09 10:00:15 +00:00
// Dependencies: [1405, 2022, 1998, 2030, 1415, 1388, 2]
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 2021 (GameRecord)
import GlobalUtils from "GlobalUtils" /* 1388 */;
import AvatarUtils from "AvatarUtils" /* 1415 */;
import Server from "Server" /* 1998 */;
import ApplicationRecord2 from "ApplicationRecord" /* 2022 */;
import getGameMediaRefURLDefault from "getGameMediaRefURL" /* 2030 */;
import Record from "Record" /* 1405 */;
2026-10-03 08:58:59 +00:00
import size_mod from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const ApplicationRecord = ApplicationRecord2;
let roles;
const createExecutable = ApplicationRecord2.createExecutable;
let size = size_mod;
const result = size.fileFinishedImporting("modules/games/GameRecord.tsx");
2026-10-03 08:58:59 +00:00
class GameRecord extends Record {
constructor(item10012) {
let aliases;
let game_flags;
let genres;
let reviews;
let tmp10;
let tmp8;
const tmp5 = new GameRecord(tmp4, tmp3, tmp2, tmp, new.target, this);
({ id: tmp5.id, name: tmp5.name, description: tmp5.description, aliases } = item10012);
2026-07-29 08:29:29 +00:00
if (aliases == null) {
aliases = [];
}
tmp5.aliases = aliases;
2026-10-03 08:58:59 +00:00
let executables = item10012.executables;
2026-07-29 08:29:29 +00:00
if (executables == null) {
executables = [];
}
tmp5.executables = executables.map(createExecutable);
2026-10-03 08:58:59 +00:00
let flag = item10012.overlay;
2026-07-29 08:29:29 +00:00
if (flag == null) {
flag = false;
}
tmp5.overlay = flag;
2026-10-03 08:58:59 +00:00
let flag2 = item10012.overlay_warn;
2026-07-29 08:29:29 +00:00
if (flag2 == null) {
flag2 = false;
}
tmp5.overlayWarn = flag2;
2026-10-03 08:58:59 +00:00
let flag3 = item10012.overlay_compatibility_hook;
2026-07-29 08:29:29 +00:00
if (flag3 == null) {
flag3 = false;
}
tmp5.overlayCompatibilityHook = flag3;
2026-10-03 08:58:59 +00:00
let flag4 = item10012.hook;
2026-07-29 08:29:29 +00:00
if (flag4 == null) {
flag4 = true;
}
tmp5.hook = flag4;
2026-10-03 08:58:59 +00:00
tmp5.supportsOutOfProcessOverlay = ApplicationRecord.supportsOutOfProcessOverlay(item10012.overlay_methods);
let third_party_skus = item10012.third_party_skus;
2026-07-29 08:29:29 +00:00
if (third_party_skus == null) {
third_party_skus = [];
}
tmp5.thirdPartySkus = third_party_skus;
2026-10-03 08:58:59 +00:00
let themes = item10012.themes;
2026-07-29 08:29:29 +00:00
if (themes == null) {
themes = [];
}
tmp5.themes = themes;
2026-10-03 08:58:59 +00:00
({ linked_applications: tmp5.linkedApplications, genres } = item10012);
2026-07-29 08:29:29 +00:00
if (genres == null) {
genres = [];
}
tmp5.genres = genres;
2026-10-03 08:58:59 +00:00
let platforms = item10012.platforms;
2026-07-29 08:29:29 +00:00
if (platforms == null) {
platforms = [];
}
tmp5.platforms = platforms;
2026-10-03 08:58:59 +00:00
let prop = item10012.platform_availability;
if (prop == null) {
prop = [];
}
tmp5.platformAvailability = prop;
2026-10-03 08:58:59 +00:00
let websites = item10012.websites;
2026-07-29 08:29:29 +00:00
if (websites == null) {
websites = [];
}
tmp5.websites = websites;
2026-10-06 11:16:32 +00:00
({ companies: tmp5.companies, screenshot_hashes: tmp5.screenshotHashes, screenshot_urls: tmp5.screenshotUrls, trailers: tmp5.trailers, l30_rank: tmp5.l30Rank, summary_localized: tmp5.summaryLocalized, media: tmp5.media, first_release_date: tmp5.firstReleaseDate, shop_collection_ids: tmp5.shopCollectionIds, community_guild_ids: tmp5.communityGuildIds, steam_release_status: tmp5.steamReleaseStatus, reviews } = item10012);
2026-10-03 08:58:59 +00:00
let steam;
2026-07-29 08:29:29 +00:00
if (reviews != null) {
steam = reviews.steam;
}
if (null != steam) {
2026-10-03 08:58:59 +00:00
let tmp9;
2026-07-29 08:29:29 +00:00
if (null != reviews.steam) {
2026-10-03 08:58:59 +00:00
tmp9 = { rating: reviews.steam.rating, ratingCount: reviews.steam.rating_count, recentRating: reviews.steam.recent_rating, recentRatingCount: reviews.steam.recent_rating_count, localizedRating: reviews.steam.localized_rating, localizedRatingCount: reviews.steam.localized_rating_count };
const obj = { rating: reviews.steam.rating, ratingCount: reviews.steam.rating_count, recentRating: reviews.steam.recent_rating, recentRatingCount: reviews.steam.recent_rating_count, localizedRating: reviews.steam.localized_rating, localizedRatingCount: reviews.steam.localized_rating_count };
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const obj2 = { steam: tmp9, opencritic: tmp10 };
2026-07-29 08:29:29 +00:00
tmp10 = undefined;
if (null != reviews.opencritic) {
2026-10-03 08:58:59 +00:00
tmp10 = { topCriticRating: reviews.opencritic.top_critic_rating, topCriticRatingCount: reviews.opencritic.top_critic_rating_count, tier: reviews.opencritic.tier };
const obj3 = { topCriticRating: reviews.opencritic.top_critic_rating, topCriticRatingCount: reviews.opencritic.top_critic_rating_count, tier: reviews.opencritic.tier };
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
tmp8 = obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-10-03 08:58:59 +00:00
let opencritic;
2026-07-29 08:29:29 +00:00
if (reviews != null) {
opencritic = reviews.opencritic;
}
}
tmp5.reviews = tmp8;
2026-10-03 08:58:59 +00:00
({ opencritic_url: tmp5.opencriticUrl, game_flags } = item10012);
2026-07-29 08:29:29 +00:00
if (game_flags == null) {
game_flags = 0;
}
tmp5.gameFlags = game_flags;
2026-10-03 08:58:59 +00:00
tmp5.contentClassification = item10012.content_classification;
2026-07-29 08:29:29 +00:00
return tmp5;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getOfficialApplicationId() {
const linkedApplications = this.linkedApplications;
let id;
if (linkedApplications != null) {
const found = linkedApplications.find((type) => type.type === Server.GameLinkTypes.OFFICIAL);
if (found != null) {
id = found.id;
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
return id;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getIconURL(size, format) {
const media = this.media;
let icon;
const id = this.id;
const tmp = getGameMediaRefURLDefault;
if (media != null) {
icon = media.icon;
}
const obj = { size, format };
return tmp(id, icon, obj);
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getBannerURL(size) {
const media = this.media;
let banner;
const id = this.id;
const tmp = getGameMediaRefURLDefault;
if (media != null) {
banner = media.banner;
}
const obj = { keepAspectRatio: true, size };
return tmp(id, banner, obj);
2026-07-29 08:29:29 +00:00
}
2026-10-09 10:00:15 +00:00
getCoverURL(c8) {
2026-10-03 08:58:59 +00:00
const media = this.media;
let cover;
const id = this.id;
const tmp2 = getGameMediaRefURLDefault;
if (media != null) {
cover = media.cover;
}
let str = "png";
if (AvatarUtils.SUPPORTS_WEBP) {
str = "webp";
}
2026-10-09 10:00:15 +00:00
const obj = { keepAspectRatio: true, format: str, size: c8 };
2026-10-03 08:58:59 +00:00
return tmp2(id, cover, obj);
}
2026-10-03 08:58:59 +00:00
getArtworkURLs(size) {
let str;
const self = this;
const tmp = str;
str = null;
const tmp2 = self;
if (str(self[4]).SUPPORTS_WEBP) {
str = "webp";
}
const media = this.media;
let artwork;
if (media != null) {
artwork = media.artwork;
}
if (artwork == null) {
artwork = [];
}
const mapped = artwork.map((item) => {
const obj = { size, format: str, keepAspectRatio: true };
return getGameMediaRefURLDefault(self.id, item, obj);
2026-07-29 08:29:29 +00:00
});
2026-10-03 08:58:59 +00:00
return mapped.filter(tmp(tmp2[5]).isNotNullish);
}
getScreenshotURL(index, size) {
let str;
const screenshotUrls = this.screenshotUrls;
let tmp;
if (screenshotUrls != null) {
tmp = screenshotUrls[index];
}
let tmp7Result = null;
if (null != tmp) {
const id = this.id;
const obj2 = { size, format: str, keepAspectRatio: true };
str = null;
const obj = { type: "url", value: tmp };
const tmp7 = getGameMediaRefURLDefault;
if (AvatarUtils.SUPPORTS_WEBP) {
str = "webp";
}
tmp7Result = tmp7(id, obj, obj2);
}
return tmp7Result;
}
getScreenshotURLs(arg0) {
const self = this;
let closure_0 = arg0;
let screenshotUrls = this.screenshotUrls;
if (screenshotUrls == null) {
screenshotUrls = [];
}
const mapped = screenshotUrls.map((item, index) => self.getScreenshotURL(index, closure_0));
return mapped.filter(GlobalUtils.isNotNullish);
2026-07-29 08:29:29 +00:00
}
2026-10-08 09:57:35 +00:00
getCompanyByRole(PUBLISHER) {
let closure_0 = PUBLISHER;
2026-10-03 08:58:59 +00:00
const companies = this.companies;
let found;
if (companies != null) {
found = companies.filter((roles) => {
roles = roles.roles;
2026-10-08 09:57:35 +00:00
return roles.includes(PUBLISHER);
2026-10-03 08:58:59 +00:00
});
}
if (found == null) {
found = [];
}
return found;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
}
const prototype = GameRecord.prototype;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default GameRecord;