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

100 lines
3.4 KiB
TypeScript
Raw Normal View History

// Module ID: 12522
// Function ID: 12523
// Name: GuildPowerupsNotificationStore
// Dependencies: [4484, 1979, 4463, 12523, 504, 573, 2]
2026-07-20 16:05:17 +00:00
// Module 12522 (GuildPowerupsNotificationStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import getExpiringGuildEntitlements from "getExpiringGuildEntitlements" /* 12523 */;
import GameServerStore from "GameServerStore" /* 4484 */;
import GuildStore from "GuildStore" /* 1979 */;
import GuildPowerupsStore from "GuildPowerupsStore" /* 4463 */;
2026-07-23 10:11:24 +00:00
require = fn;
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) {
this.waitFor(GameServerStore, GuildPowerupsStore, GuildStore);
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(arg0) {
return closure_5[arg0];
2026-07-29 08:29:29 +00:00
};
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((item) => {
[tmp, tmp2] = item;
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;
const guildPowerupsNotificationStore = new GuildPowerupsNotificationStore(DispatcherDefault, {
2026-07-20 16:05:17 +00:00
GUILD_POWERUPS_ACK_NOTIFICATION: function handleAckNotification(guildId) {
guildId = guildId.guildId;
const guild = GuildStore.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 = GuildPowerupsStore.getStateForGuild(guildId);
const stateForGuild1 = GameServerStore.getStateForGuild(guildId);
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);
const expiringGuildEntitlements = getExpiringGuildEntitlements.getExpiringGuildEntitlements(items);
const obj2 = {};
const merged = Object.assign(closure_5);
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();
}
const obj3 = { lastSeenWarningNotification: null, lastBoostCount: null };
obj3.lastSeenWarningNotification = new Date(ends_at).getTime();
obj3.lastBoostCount = num;
obj2[guildId] = obj3;
closure_5 = obj2;
2026-07-20 16:05:17 +00:00
},
GUILD_POWERUPS_RESET_NOTIFICATIONS: function handleResetNotifications() {
2026-08-24 06:08:38 +00:00
closure_5 = {};
2026-07-20 16:05:17 +00:00
}
});
const size = fn(2);
const result = size.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;