176 lines
5.3 KiB
TypeScript
176 lines
5.3 KiB
TypeScript
// Metro module 11591 (f11592).
|
|
import GuildStore from "../../../../stores/GuildStore";
|
|
import GuildPowerupsStore from "../GuildPowerupsStore";
|
|
import "../../game_server/GameServerConstants";
|
|
import { PowerupActiveStatusType } from "../constants/GuildPowerupsConstants";
|
|
import { GuildFeatures } from "../../../../Constants";
|
|
import { useStateFromStores } from "../../../../_bundle/Module589";
|
|
function $mk87696($env) {
|
|
return () => $env.$parent[2].getGuild($env[0]);
|
|
}
|
|
function $mk87697($env) {
|
|
return () => $env.$parent[3].getStateForGuild($env[0]);
|
|
}
|
|
function $mk87698($env) {
|
|
return (a0) => {
|
|
let r27, r41;
|
|
const r6 = $env;
|
|
const skuId = a0.skuId;
|
|
const r4 = $env.$parent;
|
|
if (skuId === r4[4]) {
|
|
const r48 = r6[1];
|
|
const r50 = r48 == null;
|
|
let r51 = void 0;
|
|
if (!r50) {
|
|
const features = r48.features;
|
|
r51 = features == null ? void 0 : features.has(r4[9].GAME_SERVERS);
|
|
}
|
|
r41 = {
|
|
type: r51 != null && r51 ? r4[6].POWERUP_ACTIVATED : r4[6].INACTIVE,
|
|
powerup: a0,
|
|
sourceEntitlement: void 0,
|
|
sourcePowerup: void 0
|
|
};
|
|
} else {
|
|
L16: {
|
|
if (a0 != null) {
|
|
const r14 = r6[1];
|
|
if (r14 != null) {
|
|
const r9 = r6[2];
|
|
if (r9 != null) {
|
|
const r16 = r4[7][a0.skuId];
|
|
if (r16 == null) {
|
|
r27 = {
|
|
isActiveFromLevel: false,
|
|
levelEntitlement: void 0,
|
|
levelPowerup: void 0
|
|
};
|
|
break L16;
|
|
}
|
|
const isActiveFromLevel2 = r14.premiumTier >= r16;
|
|
const r10 = r4[8][r16];
|
|
const r1 = r10 != null;
|
|
let levelEntitlement2 = void 0;
|
|
if (r1) {
|
|
const unlockedPowerups = r9.unlockedPowerups;
|
|
levelEntitlement2 = unlockedPowerups == null ? void 0 : unlockedPowerups[r10];
|
|
}
|
|
const r22 = r10 != null;
|
|
let levelPowerup2 = void 0;
|
|
if (r22) {
|
|
const allPowerups = r9.allPowerups;
|
|
levelPowerup2 = allPowerups == null ? void 0 : allPowerups[r10];
|
|
}
|
|
r27 = {
|
|
isActiveFromLevel: isActiveFromLevel2,
|
|
levelEntitlement: levelEntitlement2,
|
|
levelPowerup: levelPowerup2
|
|
};
|
|
break L16;
|
|
}
|
|
}
|
|
}
|
|
r27 = {
|
|
isActiveFromLevel: false,
|
|
levelEntitlement: void 0,
|
|
levelPowerup: void 0
|
|
};
|
|
}
|
|
const { isActiveFromLevel, levelEntitlement, levelPowerup } = r27;
|
|
const r30 = r6[3] && r4[5].has(a0.skuId);
|
|
const r34 = r6[2];
|
|
const r35 = r34 == null;
|
|
let sourceEntitlement = void 0;
|
|
if (!r35) {
|
|
const unlockedPowerups2 = r34.unlockedPowerups;
|
|
sourceEntitlement = unlockedPowerups2 == null ? void 0 : unlockedPowerups2[a0.skuId];
|
|
}
|
|
if (sourceEntitlement == null) {
|
|
sourceEntitlement = null;
|
|
}
|
|
const r40 = r4[6];
|
|
r41 = {
|
|
type: r40.INACTIVE,
|
|
powerup: a0,
|
|
sourceEntitlement: void 0,
|
|
sourcePowerup: void 0
|
|
};
|
|
if (isActiveFromLevel) {
|
|
r41 = {
|
|
type: r40.LEVEL_ACTIVATED,
|
|
powerup: a0,
|
|
sourceEntitlement: levelEntitlement,
|
|
sourcePowerup: levelPowerup
|
|
};
|
|
} else if (r30) {
|
|
r41 = {
|
|
type: r40.TIER_OVERRIDE_ACTIVATED,
|
|
powerup: a0,
|
|
sourceEntitlement: void 0,
|
|
sourcePowerup: a0
|
|
};
|
|
} else if (sourceEntitlement != null) {
|
|
r41 = {
|
|
type: r40.POWERUP_ACTIVATED,
|
|
powerup: a0,
|
|
sourceEntitlement,
|
|
sourcePowerup: a0
|
|
};
|
|
}
|
|
}
|
|
return r41;
|
|
};
|
|
}
|
|
let env7908 = {};
|
|
export default function usePowerupActiveStatus(a0, a1) {
|
|
const r7 = a1 == null ? [] : [a1];
|
|
let env19017;
|
|
const r13 = env19017 = {
|
|
$parent: env7908
|
|
};
|
|
env19017[0] = a0;
|
|
const stateFromStores = useStateFromStores([GuildStore], $mk87696(r13));
|
|
env19017[1] = stateFromStores;
|
|
env19017[2] = useStateFromStores([GuildPowerupsStore], $mk87697(r13));
|
|
const r3 = stateFromStores == null;
|
|
let r25 = void 0;
|
|
if (!r3) {
|
|
const features = stateFromStores.features;
|
|
r25 = features == null ? void 0 : features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE);
|
|
}
|
|
if (r25 == null) {
|
|
r25 = false;
|
|
}
|
|
env19017[3] = r25;
|
|
const r33 = r7.map($mk87698(r13));
|
|
return r33.length <= 0 ? {
|
|
type: PowerupActiveStatusType.INACTIVE,
|
|
sourceEntitlement: void 0,
|
|
sourcePowerup: void 0
|
|
} : r33[0];
|
|
};
|
|
export function isPowerupActiveStatusActive(a0) {
|
|
return a0.type !== PowerupActiveStatusType.INACTIVE;
|
|
}
|
|
export function usePowerupsActiveStatuses(a0, a1) {
|
|
let env19016;
|
|
const r3 = env19016 = {
|
|
$parent: env7908
|
|
};
|
|
env19016[0] = a0;
|
|
const stateFromStores = useStateFromStores([GuildStore], $mk87696(r3));
|
|
env19016[1] = stateFromStores;
|
|
env19016[2] = useStateFromStores([GuildPowerupsStore], $mk87697(r3));
|
|
const r2 = stateFromStores == null;
|
|
let r22 = void 0;
|
|
if (!r2) {
|
|
const features = stateFromStores.features;
|
|
r22 = features == null ? void 0 : features.has(GuildFeatures.PREMIUM_TIER_3_OVERRIDE);
|
|
}
|
|
if (r22 == null) {
|
|
r22 = false;
|
|
}
|
|
env19016[3] = r22;
|
|
return a1.map($mk87698(r3));
|
|
}
|