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

98 lines
3.2 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 11584
// Function ID: 11585
// Name: getState
// Dependencies: [1862, 4097, 4076, 11585, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 11584 (getState)
import createGuildRecordFromRust from "createGuildRecordFromRust";
import handleGameServerInstanceCreated from "handleGameServerInstanceCreated";
import calculateAppliedBoosts from "calculateAppliedBoosts";
import { PersistedStore } from "initialize";
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let closure_5 = {};
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(handleGameServerInstanceCreated, calculateAppliedBoosts, createGuildRecordFromRust);
if (null != arg0) {
let 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-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const entries = Object.entries(arg0);
const item = entries.forEach((arg0) => {
let tmp;
let tmp2;
[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;
const guildPowerupsNotificationStore = new GuildPowerupsNotificationStore(require("dispatcher"), {
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-07-29 08:29:29 +00:00
let obj = require(11585) /* 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-07-29 08:29:29 +00:00
obj = { lastSeenWarningNotification: null, lastBoostCount: null };
obj[0] = new Date(ends_at).getTime();
obj[1] = num;
2026-07-20 16:05:17 +00:00
obj[guildId] = obj;
},
GUILD_POWERUPS_RESET_NOTIFICATIONS: function handleResetNotifications() {
2026-07-29 08:29:29 +00:00
let closure_5 = {};
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
const result = require("calculateAppliedBoosts").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;