decord/source/modules/premium/powerups/hooks/usePowerupActiveStatus.tsx

226 lines
8.6 KiB
TypeScript
Raw Normal View History

// Module ID: 12642
// Function ID: 12643
2026-07-29 08:29:29 +00:00
// Name: usePowerupActiveStatus
// Dependencies: [1980, 4526, 4527, 1074, 4528, 504, 2]
2026-07-29 08:29:29 +00:00
// Exports: default, isPowerupActiveStatusActive, usePowerupsActiveStatuses
2026-07-20 16:05:17 +00:00
// Module 12642 (usePowerupActiveStatus)
import GuildStore from "GuildStore" /* 1980 */;
import GuildPowerupsStore from "GuildPowerupsStore" /* 4526 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
const require = fn;
const GuildPowerupsConstants = fn(4527);
({ GUILD_POWERUP_TIER_3_OVERRIDDEN_SKUS: closure_4, PowerupActiveStatusType: hasOwnProperty, POWERUPS_INCLUDED_IN_LEVEL: metroRequire, BOOSTING_TIER_TO_LEVEL_SKU_ID: closure_7 } = GuildPowerupsConstants);
const GuildFeatures = fn(1074).GuildFeatures;
let closure_9 = fn(4528).GAME_SERVER_POWERUP_SKU_ID;
const size = fn(2);
const result = size.fileFinishedImporting("modules/premium/powerups/hooks/usePowerupActiveStatus.tsx");
2026-07-29 08:29:29 +00:00
export default function usePowerupActiveStatus(arg0, arg1) {
if (null == arg1) {
let items = [];
} else {
items = [arg1];
}
_require = arg0;
const items1 = [unlockedPowerups];
stateFromStores = require("initialize").useStateFromStores(items1, () => GuildStore.getGuild(closure_0));
let obj = require("initialize");
2026-07-29 08:29:29 +00:00
const items2 = [flag];
unlockedPowerups = require("initialize").useStateFromStores(items2, () => GuildPowerupsStore.getStateForGuild(closure_0));
2026-07-29 08:29:29 +00:00
flag = undefined;
if (stateFromStores != null) {
let features = stateFromStores.features;
if (features != null) {
flag = features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE);
}
}
if (flag == null) {
flag = false;
}
const mapped = items.map((skuId) => {
if (skuId.skuId === closure_9) {
2026-07-20 16:05:17 +00:00
let hasItem;
2026-07-29 08:29:29 +00:00
if (stateFromStores != null) {
2026-07-20 16:05:17 +00:00
const features = stateFromStores.features;
2026-07-29 08:29:29 +00:00
if (features != null) {
hasItem = features.has(GuildFeatures.GAME_SERVERS);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (hasItem != null) {
2026-07-20 16:05:17 +00:00
if (hasItem) {
let INACTIVE = constants.POWERUP_ACTIVATED;
2026-07-20 16:05:17 +00:00
}
const obj2 = { type: INACTIVE, powerup: skuId, sourceEntitlement: "r", sourcePowerup: "HermesInternal" };
2026-07-20 16:05:17 +00:00
}
INACTIVE = constants.INACTIVE;
2026-07-20 16:05:17 +00:00
} else {
if (null != skuId) {
if (null != stateFromStores) {
if (null != unlockedPowerups) {
if (null == timestampProducer[skuId.skuId]) {
let obj = { isActiveFromLevel: false, levelEntitlement: "Boolean", levelPowerup: "accessible" };
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let tmp4;
if (null != React5[tmp22]) {
unlockedPowerups = tmp20.unlockedPowerups;
2026-07-29 08:29:29 +00:00
let tmp5;
if (unlockedPowerups != null) {
tmp5 = unlockedPowerups[tmp3];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = tmp5;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp6;
if (null != React5[tmp22]) {
2026-07-29 08:29:29 +00:00
const allPowerups = tmp20.allPowerups;
let tmp7;
if (allPowerups != null) {
tmp7 = allPowerups[tmp3];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp6 = tmp7;
2026-07-20 16:05:17 +00:00
}
obj = { isActiveFromLevel: tmp19.premiumTier >= tmp22, levelEntitlement: tmp4, levelPowerup: tmp6 };
2026-07-29 08:29:29 +00:00
const tmp = tmp19.premiumTier >= tmp22;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
let hasItem1 = flag;
2026-07-20 16:05:17 +00:00
({ isActiveFromLevel, levelEntitlement, levelPowerup } = obj);
2026-07-29 08:29:29 +00:00
if (flag) {
hasItem1 = set.has(skuId.skuId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp10;
if (unlockedPowerups != null) {
const unlockedPowerups2 = unlockedPowerups.unlockedPowerups;
2026-07-29 08:29:29 +00:00
if (unlockedPowerups2 != null) {
tmp10 = unlockedPowerups2[skuId.skuId];
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (tmp10 == null) {
tmp10 = null;
2026-07-20 16:05:17 +00:00
}
let obj3 = { type: constants.INACTIVE, powerup: skuId, sourceEntitlement: "r", sourcePowerup: "HermesInternal" };
2026-07-20 16:05:17 +00:00
if (isActiveFromLevel) {
const obj4 = { type: tmp11.LEVEL_ACTIVATED, powerup: skuId, sourceEntitlement: levelEntitlement, sourcePowerup: levelPowerup };
obj3 = obj4;
2026-07-20 16:05:17 +00:00
} else if (hasItem1) {
const obj5 = { type: tmp11.TIER_OVERRIDE_ACTIVATED, powerup: skuId, sourceEntitlement: "Array", sourcePowerup: skuId };
obj3 = obj5;
2026-07-29 08:29:29 +00:00
} else if (null != tmp10) {
const obj6 = { type: tmp11.POWERUP_ACTIVATED, powerup: skuId, sourceEntitlement: tmp10, sourcePowerup: skuId };
obj3 = obj6;
2026-07-20 16:05:17 +00:00
}
return obj3;
2026-07-20 16:05:17 +00:00
}
}
obj = { isActiveFromLevel: false, levelEntitlement: "Boolean", levelPowerup: "accessible" };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
});
if (mapped.length <= 0) {
let obj3 = { type: constants.INACTIVE, sourceEntitlement: "Array", sourcePowerup: "isArray" };
let first = obj3;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
first = mapped[0];
2026-07-20 16:05:17 +00:00
}
return first;
};
export const isPowerupActiveStatusActive = function isPowerupActiveStatusActive(type) {
return type.type !== constants.INACTIVE;
};
2026-07-29 08:29:29 +00:00
export const usePowerupsActiveStatuses = function usePowerupsActiveStatuses(guildId, powerups) {
_require = guildId;
2026-08-24 06:08:38 +00:00
const items = [closure_2];
stateFromStores = require("initialize").useStateFromStores(items, () => GuildStore.getGuild(closure_0));
const obj = require("initialize");
2026-07-29 08:29:29 +00:00
const items1 = [flag];
closure_2 = require("initialize").useStateFromStores(items1, () => GuildPowerupsStore.getStateForGuild(closure_0));
2026-07-29 08:29:29 +00:00
flag = undefined;
if (stateFromStores != null) {
const features = stateFromStores.features;
if (features != null) {
flag = features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE);
}
}
if (flag == null) {
flag = false;
}
return powerups.map((skuId) => {
if (skuId.skuId === closure_9) {
2026-07-29 08:29:29 +00:00
let hasItem;
if (stateFromStores != null) {
const features = stateFromStores.features;
if (features != null) {
hasItem = features.has(GuildFeatures.GAME_SERVERS);
2026-07-29 08:29:29 +00:00
}
}
if (hasItem != null) {
if (hasItem) {
let INACTIVE = constants.POWERUP_ACTIVATED;
2026-07-29 08:29:29 +00:00
}
const obj2 = { type: INACTIVE, powerup: skuId, sourceEntitlement: "r", sourcePowerup: "HermesInternal" };
2026-07-29 08:29:29 +00:00
}
INACTIVE = constants.INACTIVE;
2026-07-29 08:29:29 +00:00
} else {
if (null != skuId) {
if (null != stateFromStores) {
if (null != unlockedPowerups) {
if (null == timestampProducer[skuId.skuId]) {
let obj = { isActiveFromLevel: false, levelEntitlement: "Boolean", levelPowerup: "accessible" };
2026-07-29 08:29:29 +00:00
} else {
let tmp4;
if (null != React5[tmp22]) {
unlockedPowerups = tmp20.unlockedPowerups;
2026-07-29 08:29:29 +00:00
let tmp5;
if (unlockedPowerups != null) {
tmp5 = unlockedPowerups[tmp3];
}
tmp4 = tmp5;
}
let tmp6;
if (null != React5[tmp22]) {
2026-07-29 08:29:29 +00:00
const allPowerups = tmp20.allPowerups;
let tmp7;
if (allPowerups != null) {
tmp7 = allPowerups[tmp3];
}
tmp6 = tmp7;
}
obj = { isActiveFromLevel: tmp19.premiumTier >= tmp22, levelEntitlement: tmp4, levelPowerup: tmp6 };
2026-07-29 08:29:29 +00:00
const tmp = tmp19.premiumTier >= tmp22;
}
}
let hasItem1 = flag;
({ isActiveFromLevel, levelEntitlement, levelPowerup } = obj);
if (flag) {
hasItem1 = set.has(skuId.skuId);
2026-07-29 08:29:29 +00:00
}
let tmp10;
if (unlockedPowerups != null) {
const unlockedPowerups2 = unlockedPowerups.unlockedPowerups;
2026-07-29 08:29:29 +00:00
if (unlockedPowerups2 != null) {
tmp10 = unlockedPowerups2[skuId.skuId];
}
}
if (tmp10 == null) {
tmp10 = null;
}
let obj3 = { type: constants.INACTIVE, powerup: skuId, sourceEntitlement: "r", sourcePowerup: "HermesInternal" };
2026-07-29 08:29:29 +00:00
if (isActiveFromLevel) {
const obj4 = { type: tmp11.LEVEL_ACTIVATED, powerup: skuId, sourceEntitlement: levelEntitlement, sourcePowerup: levelPowerup };
obj3 = obj4;
2026-07-29 08:29:29 +00:00
} else if (hasItem1) {
const obj5 = { type: tmp11.TIER_OVERRIDE_ACTIVATED, powerup: skuId, sourceEntitlement: "Array", sourcePowerup: skuId };
obj3 = obj5;
2026-07-29 08:29:29 +00:00
} else if (null != tmp10) {
const obj6 = { type: tmp11.POWERUP_ACTIVATED, powerup: skuId, sourceEntitlement: tmp10, sourcePowerup: skuId };
obj3 = obj6;
2026-07-29 08:29:29 +00:00
}
return obj3;
2026-07-29 08:29:29 +00:00
}
}
obj = { isActiveFromLevel: false, levelEntitlement: "Boolean", levelPowerup: "accessible" };
2026-07-29 08:29:29 +00:00
}
});
};