decord/source/modules/premium/powerups/GuildPowerupsNotificationStore.tsx

97 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11710
// Function ID: 11711
2026-07-29 08:29:29 +00:00
// Name: getState
2026-08-24 06:08:38 +00:00
// Dependencies: [4286, 1910, 4265, 11711, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 11710 (getState)
import initializeDefault from "initialize" /* 589 */;
import dispatcherDefault from "dispatcher" /* 709 */;
import getExpiringGuildEntitlements from "getExpiringGuildEntitlements" /* 11711 */;
import closure_2 from "handleGameServerInstanceCreated" /* 4286 */;
import closure_3 from "createGuildRecordFromRust" /* 1910 */;
import closure_4 from "calculateAppliedBoosts" /* 4265 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let closure_5 = {};
2026-08-24 06:08:38 +00:00
const PersistedStore = initializeDefault.PersistedStore;
2026-07-29 08:29:29 +00:00
class GuildPowerupsNotificationStore extends PersistedStore {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = GuildPowerupsNotificationStore.prototype;
prototype["getState"] = function getState() {
return closure_5;
};
prototype["initialize"] = function initialize(arg0) {
2026-08-24 06:08:38 +00:00
this.waitFor(closure_2, closure_4, closure_3);
2026-07-29 08:29:29 +00:00
if (null != arg0) {
2026-08-24 06:08:38 +00:00
closure_5 = arg0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
prototype["getNotificationStateForGuild"] = function getNotificationStateForGuild(closure_0) {
return table[closure_0];
};
GuildPowerupsNotificationStore.displayName = "GuildPowerupsNotificationStore";
GuildPowerupsNotificationStore.persistKey = "GuildPowerupsNotificationStore";
2026-07-23 10:11:24 +00:00
let items = [
2026-07-20 16:05:17 +00:00
(arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const entries = Object.entries(arg0);
const item = entries.forEach((arg0) => {
[tmp, tmp2] = arg0;
2026-07-23 10:11:24 +00:00
closure_0[tmp] = tmp2;
2026-07-20 16:05:17 +00:00
});
return arg0;
}
];
2026-07-29 08:29:29 +00:00
GuildPowerupsNotificationStore.migrations = items;
2026-08-24 06:08:38 +00:00
const guildPowerupsNotificationStore = new GuildPowerupsNotificationStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
GUILD_POWERUPS_ACK_NOTIFICATION: function handleAckNotification(guildId) {
guildId = guildId.guildId;
2026-07-23 10:11:24 +00:00
guild = guild.getGuild(guildId);
2026-07-29 08:29:29 +00:00
let num;
if (guild != null) {
num = guild.premiumSubscriberCount;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
const stateForGuild = stateForGuild2.getStateForGuild(guildId);
const stateForGuild1 = stateForGuild.getStateForGuild(guildId);
2026-08-24 06:08:38 +00:00
let obj = getExpiringGuildEntitlements;
2026-07-20 16:05:17 +00:00
let unlockedPowerups;
2026-07-29 08:29:29 +00:00
if (stateForGuild != null) {
2026-07-20 16:05:17 +00:00
unlockedPowerups = stateForGuild.unlockedPowerups;
}
2026-07-29 08:29:29 +00:00
if (unlockedPowerups == null) {
2026-07-20 16:05:17 +00:00
unlockedPowerups = {};
}
const items = [...Object.values(unlockedPowerups)];
let entitlements;
2026-07-29 08:29:29 +00:00
if (stateForGuild1 != null) {
2026-07-20 16:05:17 +00:00
entitlements = stateForGuild1.entitlements;
}
2026-07-29 08:29:29 +00:00
if (entitlements == null) {
2026-07-20 16:05:17 +00:00
entitlements = {};
}
2026-07-29 08:29:29 +00:00
HermesBuiltin.arraySpread(Object.values(entitlements), tmp4);
2026-07-20 16:05:17 +00:00
const expiringGuildEntitlements = obj.getExpiringGuildEntitlements(items);
obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(obj);
2026-07-20 16:05:17 +00:00
let ends_at;
2026-07-29 08:29:29 +00:00
if (expiringGuildEntitlements[expiringGuildEntitlements.length - 1] != null) {
ends_at = tmp7.ends_at;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (ends_at == null) {
2026-07-20 16:05:17 +00:00
const _Date = Date;
ends_at = Date.now();
}
2026-08-24 06:08:38 +00:00
obj = { lastSeenWarningNotification: new Date(ends_at).getTime(), lastBoostCount: num };
2026-07-20 16:05:17 +00:00
obj[guildId] = obj;
},
GUILD_POWERUPS_RESET_NOTIFICATIONS: function handleResetNotifications() {
2026-08-24 06:08:38 +00:00
closure_5 = {};
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/premium/powerups/GuildPowerupsNotificationStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default guildPowerupsNotificationStore;