decord/source/modules/game_server/OwnedGameServersStore.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

99 lines
3.3 KiB
TypeScript

// Module ID: 12553
// Function ID: 12554
// Name: OwnedGameServersStore
// Dependencies: [4496, 504, 573, 2]
// Module 12553 (OwnedGameServersStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import GameServerConstants from "GameServerConstants" /* 4496 */;
import size from "module_2" /* 2 */;
function handleGameServerUpsert(gameServer) {
gameServer = undefined;
if (null == gameServer.guildId) {
if (-1 === closure_1.findIndex((id) => id.id === gameServer.id)) {
const items = [];
items[HermesBuiltin.arraySpread(closure_1, 0)] = gameServer;
let mapped = items;
} else {
mapped = closure_1.map((id) => {
let tmp2 = id;
if (id.id === gameServer.id) {
let tmp4 = tmp;
if (null == tmp.subscription_id) {
let subscription_id;
if (id != null) {
subscription_id = id.subscription_id;
}
tmp4 = tmp;
if (null != subscription_id) {
const obj = {};
const merged = Object.assign(tmp);
obj.subscription_id = id.subscription_id;
tmp4 = obj;
}
}
tmp2 = tmp4;
}
return tmp2;
});
}
closure_1 = mapped;
}
}
const GAME_SERVER_SHOP_MAX_INSTANCES = GameServerConstants.GAME_SERVER_SHOP_MAX_INSTANCES;
let closure_1 = [];
let maxServers = GAME_SERVER_SHOP_MAX_INSTANCES;
const Store = initializeDefault.Store;
class OwnedGameServersStore extends Store {
}
const prototype = OwnedGameServersStore.prototype;
prototype["getGameServers"] = function getGameServers() {
return closure_1;
};
prototype["getMaxServers"] = function getMaxServers() {
return maxServers;
};
OwnedGameServersStore.displayName = "OwnedGameServersStore";
const ownedGameServersStore = new OwnedGameServersStore(DispatcherDefault, {
LOGOUT: function handleReset() {
closure_1 = [];
maxServers = GAME_SERVER_SHOP_MAX_INSTANCES;
},
GAME_SERVER_FETCH_MY_SERVERS_SUCCESS: function handleFetchMyServersSuccess(arg0) {
({ gameServers, maxServers } = arg0);
closure_1 = gameServers.map((subscription_id) => {
const found = closure_1_1.find((id) => id.id === subscription_id.id);
let tmp2 = subscription_id;
if (null == subscription_id.subscription_id) {
subscription_id = undefined;
if (found != null) {
subscription_id = found.subscription_id;
}
tmp2 = subscription_id;
if (null != subscription_id) {
const obj = {};
const merged = Object.assign(subscription_id);
obj.subscription_id = found.subscription_id;
tmp2 = obj;
}
}
return tmp2;
});
if (maxServers == null) {
maxServers = GAME_SERVER_SHOP_MAX_INSTANCES;
}
},
GAME_SERVER_CREATE: handleGameServerUpsert,
GAME_SERVER_UPDATE: handleGameServerUpsert,
GAME_SERVER_DELETE: function handleGameServerDeleted(gameServerId) {
gameServerId = gameServerId.gameServerId;
if (null == gameServerId.guildId) {
closure_1 = closure_1.filter((id) => id.id !== gameServerId);
}
}
});
const result = size.fileFinishedImporting("modules/game_server/OwnedGameServersStore.tsx");
export default ownedGameServersStore;