decord/alpha/source/modules/quests/utils/QuestMatchingUtils.tsx

215 lines
7.6 KiB
TypeScript
Raw Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 12919
// Function ID: 12920
// Name: QuestMatchingUtils
2026-10-09 10:00:15 +00:00
// Dependencies: [32, 5437, 10614, 5979, 1085, 2024, 7406, 7390, 7404, 12492, 2]
2026-09-03 10:05:34 +00:00
// Exports: allPlayOnDesktopQuestsByApplicationId, getEligibleQuestsForApplicationId, getQuestApplicationIdsForRunningGame, getQuestByApplicationId, getQuestsFromActivities
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 12919 (QuestMatchingUtils)
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
2026-10-09 10:00:15 +00:00
import Constants2 from "Constants" /* 2024 */;
import QuestExpirationUtils from "QuestExpirationUtils" /* 7390 */;
import utils_QuestUtils from "utils/QuestUtils" /* 7404 */;
import QuestTaskUtils from "QuestTaskUtils" /* 7406 */;
import getApplicationIdsForGameDefault from "getApplicationIdsForGame" /* 12492 */;
2026-10-03 08:58:59 +00:00
import _slicedToArray from "_slicedToArray" /* 32 */;
2026-10-09 10:00:15 +00:00
import ApplicationStore from "ApplicationStore" /* 5437 */;
import SocialSdkApplicationStore from "SocialSdkApplicationStore" /* 10614 */;
import QuestConstants from "QuestConstants" /* 5979 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let userStatus;
let metroImportAll;
let metroImportDefault;
let metroRequire;
function questMatchesActivity(application_id, id) {
let tmp = null != application_id;
if (tmp) {
const tmp3 = application_id.application_id === closure_10 || application_id.platform === ActivityGamePlatforms.XBOX;
if (!tmp3) {
let tmp8;
const tmp7 = application_id.platform === ActivityGamePlatforms.PS4 || application_id.platform === tmp6.PS5;
if (!tmp7) {
tmp8 = null != id && id.id === metroImportDefault && application_id.application_id === metroImportAll;
if (!tmp8) {
let tmp11 = null != application_id.application_id;
if (tmp11) {
application_id = application_id.application_id;
const obj = QuestTaskUtils;
const allApplicationIds = obj.getAllApplicationIds(id);
tmp11 = null != allApplicationIds && allApplicationIds.some((item) => item === closure_0);
null != allApplicationIds && allApplicationIds.some((item) => item === closure_0);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp8 = tmp11;
2026-07-20 16:05:17 +00:00
}
}
2026-10-03 08:58:59 +00:00
tmp = tmp8;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const str = application_id.name;
const formatted = str.toLowerCase();
const obj3 = QuestTaskUtils;
const consoleApplicationId = obj3.getConsoleApplicationId(id);
2026-07-29 08:29:29 +00:00
let flag = false;
2026-10-03 08:58:59 +00:00
if (null != consoleApplicationId) {
const application = ApplicationStore.getApplication(consoleApplicationId);
2026-10-03 08:58:59 +00:00
let tmp21 = null != application;
if (tmp21) {
const str2 = application.name;
tmp21 = formatted === str2.toLowerCase();
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
flag = tmp21;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp8 = flag;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
function getQuestByActivity(result, application_id) {
let tmp4;
2026-07-29 08:29:29 +00:00
const obj = result[Symbol.iterator]();
while (obj !== undefined) {
let tmp3 = _slicedToArray(tmp, 2);
2026-07-29 08:29:29 +00:00
[r10011, tmp4] = tmp3;
let tmp5 = tmp4;
2026-10-03 08:58:59 +00:00
if (questMatchesActivity(application_id, tmp4)) {
2026-10-08 09:57:35 +00:00
let obj2 = QuestExpirationUtils;
2026-07-29 08:29:29 +00:00
if (!obj2.isQuestExpired(tmp5)) {
obj.return();
return tmp5;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
function questMatchesApplicationId(arg0, quest) {
2026-10-03 08:58:59 +00:00
let closure_0 = arg0;
const obj = QuestTaskUtils;
const allApplicationIds = obj.getAllApplicationIds(quest);
const tmp = null != allApplicationIds && allApplicationIds.some((item) => item === closure_0);
return tmp;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
({ DISCORD_APPLICATION_ID: metroRequire, PLAY_ACTIVITY_CLOUD_GAMING_QUEST_ID: metroImportDefault, PLAY_ACTIVITY_SOCIAL_ENTRY_APPLICATION_ID: metroImportAll } = QuestConstants);
const ActivityGamePlatforms = Constants.ActivityGamePlatforms;
let closure_10 = Constants2.XBOX_ACTIVITY_APPLICATION_ID;
const result = size.fileFinishedImporting("modules/quests/utils/QuestMatchingUtils.tsx");
2026-07-20 16:05:17 +00:00
export { questMatchesActivity };
export { getQuestByActivity };
2026-07-29 08:29:29 +00:00
export const getQuestByApplicationId = function getQuestByApplicationId(arg0, arg1) {
2026-10-03 08:58:59 +00:00
let tmp5;
2026-07-29 08:29:29 +00:00
const obj = arg0[Symbol.iterator]();
while (obj !== undefined) {
let tmp4 = _slicedToArray(tmp2, 2);
2026-07-29 08:29:29 +00:00
[r10013, tmp5] = tmp4;
let tmp6 = tmp5;
if (questMatchesApplicationId(arg1, tmp5)) {
2026-10-03 08:58:59 +00:00
let tmp;
2026-10-08 09:57:35 +00:00
let obj2 = QuestExpirationUtils;
2026-07-29 08:29:29 +00:00
if (!obj2.isQuestExpired(tmp6)) {
2026-10-03 08:58:59 +00:00
tmp = tmp5;
2026-07-29 08:29:29 +00:00
obj.return();
break;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
};
export const allPlayOnDesktopQuestsByApplicationId = function allPlayOnDesktopQuestsByApplicationId(arr, arg1) {
2026-10-03 08:58:59 +00:00
let closure_0 = arg1;
arr = Array.from(arr.values());
return arr.filter((quest) => {
const obj = QuestTaskUtils;
const allApplicationIds = obj.getAllApplicationIds(quest);
let hasPlayOnDesktopTaskResult = null != allApplicationIds && allApplicationIds.some((item) => item === closure_0);
2026-07-20 16:05:17 +00:00
if (hasPlayOnDesktopTaskResult) {
2026-10-08 09:57:35 +00:00
const tmpResult = QuestExpirationUtils;
2026-10-03 08:58:59 +00:00
hasPlayOnDesktopTaskResult = !tmpResult.isQuestExpired(quest);
2026-07-20 16:05:17 +00:00
}
if (hasPlayOnDesktopTaskResult) {
const obj2 = { quest };
2026-10-03 08:58:59 +00:00
const tmpResult2 = QuestTaskUtils;
hasPlayOnDesktopTaskResult = tmpResult2.hasPlayOnDesktopTask(obj2);
2026-07-20 16:05:17 +00:00
}
return hasPlayOnDesktopTaskResult;
});
};
export const getQuestsFromActivities = function getQuestsFromActivities(result, arg1) {
if (null != arg1) {
2026-07-20 16:05:17 +00:00
if (null != result) {
const obj = arg1[Symbol.iterator]();
2026-07-29 08:29:29 +00:00
while (obj !== undefined) {
let tmp7 = getQuestByActivity(result, tmp4);
if (null != tmp7) {
obj.return();
return tmp7;
2026-07-20 16:05:17 +00:00
}
}
return null;
}
}
return null;
};
export const getEligibleQuestsForApplicationId = function getEligibleQuestsForApplicationId(quests, applicationId, arg2) {
2026-10-03 08:58:59 +00:00
let items;
let closure_0 = applicationId;
2026-07-29 08:29:29 +00:00
let flag = arg2;
2026-07-20 16:05:17 +00:00
if (arg2 === undefined) {
flag = false;
}
if (null == applicationId) {
2026-10-03 08:58:59 +00:00
items = [];
2026-07-20 16:05:17 +00:00
} else {
const _Array = Array;
2026-10-03 08:58:59 +00:00
const arr = Array.from(quests.values());
items = arr.filter((userStatus) => {
const obj = QuestTaskUtils;
const activityApplicationId = obj.getActivityApplicationId(userStatus);
2026-07-20 16:05:17 +00:00
let canLaunchActivityResult = null != userStatus;
if (canLaunchActivityResult) {
2026-10-03 08:58:59 +00:00
const tmpResult = utils_QuestUtils;
canLaunchActivityResult = tmpResult.canLaunchActivity(userStatus);
2026-07-20 16:05:17 +00:00
}
if (canLaunchActivityResult) {
2026-10-08 09:57:35 +00:00
const tmpResult2 = QuestExpirationUtils;
2026-10-03 08:58:59 +00:00
canLaunchActivityResult = !tmpResult2.isQuestExpired(userStatus);
2026-07-20 16:05:17 +00:00
}
if (canLaunchActivityResult) {
2026-10-03 08:58:59 +00:00
canLaunchActivityResult = activityApplicationId === applicationId;
2026-07-20 16:05:17 +00:00
}
if (canLaunchActivityResult) {
2026-10-03 08:58:59 +00:00
canLaunchActivityResult = activityApplicationId !== metroRequire;
2026-07-20 16:05:17 +00:00
}
if (canLaunchActivityResult) {
userStatus = userStatus.userStatus;
let completedAt;
2026-07-29 08:29:29 +00:00
if (userStatus != null) {
2026-07-20 16:05:17 +00:00
completedAt = userStatus.completedAt;
}
canLaunchActivityResult = null == completedAt || flag;
}
if (canLaunchActivityResult) {
const userStatus2 = userStatus.userStatus;
let enrolledAt;
2026-07-29 08:29:29 +00:00
if (userStatus2 != null) {
2026-07-20 16:05:17 +00:00
enrolledAt = userStatus2.enrolledAt;
}
canLaunchActivityResult = null == enrolledAt || flag;
}
return canLaunchActivityResult;
});
}
return items;
};
2026-09-03 10:05:34 +00:00
export const getQuestApplicationIdsForRunningGame = function getQuestApplicationIdsForRunningGame(pid, arg1) {
const obj = getApplicationIdsForGameDefault(arg1);
2026-10-03 08:58:59 +00:00
const applicationIdForPID = SocialSdkApplicationStore.getApplicationIdForPID(pid.pid);
2026-09-03 10:05:34 +00:00
if (null != applicationIdForPID) {
const tmp4 = getApplicationIdsForGameDefault(applicationIdForPID);
for (const item10019 of tmp4) {
let addResult = obj.add(item10019);
continue;
}
}
return obj;
};