decord/source/modules/game_server/OwnedGameServersStore.tsx

100 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 12612
// Function ID: 12613
// Name: OwnedGameServersStore
// Dependencies: [4527, 504, 573, 2]
2026-07-28 08:39:19 +00:00
// Module 12612 (OwnedGameServersStore)
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import GameServerConstants from "GameServerConstants" /* 4527 */;
import size from "module_2" /* 2 */;
2026-07-28 08:39:19 +00:00
function handleGameServerUpsert(gameServer) {
2026-07-31 08:44:05 +00:00
gameServer = undefined;
2026-07-28 08:39:19 +00:00
if (null == gameServer.guildId) {
if (-1 === closure_1.findIndex((id) => id.id === gameServer.id)) {
2026-07-28 08:39:19 +00:00
const items = [];
items[HermesBuiltin.arraySpread(closure_1, 0)] = gameServer;
let mapped = items;
2026-07-28 08:39:19 +00:00
} else {
mapped = closure_1.map((id) => {
2026-07-31 08:44:05 +00:00
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;
2026-07-28 08:39:19 +00:00
}
2026-07-31 08:44:05 +00:00
return tmp2;
2026-07-28 08:39:19 +00:00
});
}
closure_1 = mapped;
2026-07-28 08:39:19 +00:00
}
}
const GAME_SERVER_SHOP_MAX_INSTANCES = GameServerConstants.GAME_SERVER_SHOP_MAX_INSTANCES;
2026-07-31 08:44:05 +00:00
let closure_1 = [];
let maxServers = GAME_SERVER_SHOP_MAX_INSTANCES;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class OwnedGameServersStore extends Store {
}
2026-07-31 08:44:05 +00:00
const prototype = OwnedGameServersStore.prototype;
prototype["getGameServers"] = function getGameServers() {
return closure_1;
};
prototype["getMaxServers"] = function getMaxServers() {
return maxServers;
2026-07-29 08:29:29 +00:00
};
OwnedGameServersStore.displayName = "OwnedGameServersStore";
const ownedGameServersStore = new OwnedGameServersStore(DispatcherDefault, {
2026-07-28 08:39:19 +00:00
LOGOUT: function handleReset() {
2026-08-24 06:08:38 +00:00
closure_1 = [];
maxServers = GAME_SERVER_SHOP_MAX_INSTANCES;
2026-07-28 08:39:19 +00:00
},
2026-07-31 08:44:05 +00:00
GAME_SERVER_FETCH_MY_SERVERS_SUCCESS: function handleFetchMyServersSuccess(arg0) {
({ gameServers, maxServers } = arg0);
2026-08-24 06:08:38 +00:00
closure_1 = gameServers.map((subscription_id) => {
const found = closure_1_1.find((id) => id.id === subscription_id.id);
2026-07-31 08:44:05 +00:00
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;
}
2026-07-28 08:39:19 +00:00
},
GAME_SERVER_CREATE: handleGameServerUpsert,
GAME_SERVER_UPDATE: handleGameServerUpsert,
GAME_SERVER_DELETE: function handleGameServerDeleted(gameServerId) {
gameServerId = gameServerId.gameServerId;
if (null == gameServerId.guildId) {
2026-07-31 08:44:05 +00:00
closure_1 = closure_1.filter((id) => id.id !== gameServerId);
2026-07-28 08:39:19 +00:00
}
}
});
const result = size.fileFinishedImporting("modules/game_server/OwnedGameServersStore.tsx");
2026-07-28 08:39:19 +00:00
2026-07-29 08:29:29 +00:00
export default ownedGameServersStore;