Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4825.js (118.4 MB)
328 lines
10 KiB
TypeScript
328 lines
10 KiB
TypeScript
// Module ID: 4549
|
|
// Function ID: 4550
|
|
// Name: GameServerStore
|
|
// Dependencies: [4550, 4551, 504, 573, 2]
|
|
|
|
// Module 4549 (GameServerStore)
|
|
import initializeDefault from "initialize" /* 504 */;
|
|
import DispatcherDefault from "Dispatcher" /* 573 */;
|
|
import gameServerResponseToInstanceDefault from "gameServerResponseToInstance" /* 4551 */;
|
|
|
|
function handleGameServerInstanceCreated(arg0) {
|
|
({ guildId, gameServer } = arg0);
|
|
if (null != guildId) {
|
|
if (null == obj2[guildId]) {
|
|
obj = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj;
|
|
}
|
|
obj2 = {};
|
|
const merged = Object.assign(obj2);
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(tmp3);
|
|
const obj4 = {};
|
|
const merged2 = Object.assign(tmp3.instances);
|
|
obj4[gameServer.id] = gameServerResponseToInstanceDefault(gameServer);
|
|
obj3.instances = obj4;
|
|
obj2[guildId] = obj3;
|
|
}
|
|
}
|
|
let c2 = 86400000;
|
|
let obj = { catalog: {}, hasFetchedCatalog: false, catalogLastFetchedAt: "r" };
|
|
const PersistedStore = initializeDefault.PersistedStore;
|
|
class GameServerStore extends PersistedStore {
|
|
}
|
|
const prototype = GameServerStore.prototype;
|
|
prototype["initialize"] = function initialize(arg0) {
|
|
|
|
};
|
|
prototype["getState"] = function getState() {
|
|
return obj2;
|
|
};
|
|
prototype["getStateForGuild"] = function getStateForGuild(arg0) {
|
|
let tmp;
|
|
if (null != arg0) {
|
|
tmp = obj2[arg0];
|
|
}
|
|
return tmp;
|
|
};
|
|
prototype["getGlobalCatalogState"] = function getGlobalCatalogState() {
|
|
return obj;
|
|
};
|
|
prototype["getGlobalCatalogGame"] = function getGlobalCatalogGame(arg0) {
|
|
closure_0 = arg0;
|
|
const values = Object.values(obj.catalog);
|
|
return values.find((gameId) => gameId.gameId === closure_0);
|
|
};
|
|
prototype["getLowestGameCostForGuild"] = function getLowestGameCostForGuild(arg0) {
|
|
if (null == arg0) {
|
|
return null;
|
|
} else {
|
|
let catalog;
|
|
if (obj2[arg0] != null) {
|
|
catalog = tmp7.catalog;
|
|
}
|
|
if (catalog == null) {
|
|
catalog = {};
|
|
}
|
|
const values = Object.values(catalog);
|
|
let applyResult = null;
|
|
if (0 !== values.length) {
|
|
const _Math = Math;
|
|
const items = [];
|
|
HermesBuiltin.arraySpread(values.map((baseCost) => baseCost.baseCost), 0);
|
|
const _Math2 = Math;
|
|
applyResult = HermesBuiltin.apply(items, Math);
|
|
}
|
|
return applyResult;
|
|
}
|
|
};
|
|
prototype["hasFetchedCatalog"] = function hasFetchedCatalog(arg0) {
|
|
let tmp = null != arg0;
|
|
if (tmp) {
|
|
let hasFetchedCatalog;
|
|
if (obj2[arg0] != null) {
|
|
hasFetchedCatalog = tmp3.hasFetchedCatalog;
|
|
}
|
|
tmp = true === hasFetchedCatalog;
|
|
}
|
|
return tmp;
|
|
};
|
|
prototype["hasFetchedInstances"] = function hasFetchedInstances(arg0) {
|
|
let tmp = null != arg0;
|
|
if (tmp) {
|
|
let hasFetchedInstances;
|
|
if (obj2[arg0] != null) {
|
|
hasFetchedInstances = tmp3.hasFetchedInstances;
|
|
}
|
|
tmp = true === hasFetchedInstances;
|
|
}
|
|
return tmp;
|
|
};
|
|
prototype["shouldFetchCatalogForGuild"] = function shouldFetchCatalogForGuild(arg0) {
|
|
let catalogLastFetchedAt;
|
|
if (obj2[arg0] != null) {
|
|
catalogLastFetchedAt = tmp.catalogLastFetchedAt;
|
|
}
|
|
let tmp3 = null == catalogLastFetchedAt;
|
|
if (!tmp3) {
|
|
const _Date = Date;
|
|
const sum = catalogLastFetchedAt + c2;
|
|
tmp3 = sum < Date.now();
|
|
}
|
|
return tmp3;
|
|
};
|
|
prototype["shouldFetchInstancesForGuild"] = function shouldFetchInstancesForGuild(arg0) {
|
|
let prop;
|
|
if (obj2[arg0] != null) {
|
|
prop = tmp.instancesLastFetchedAt;
|
|
}
|
|
let tmp3 = null == prop;
|
|
if (!tmp3) {
|
|
const _Date = Date;
|
|
const sum = prop + 300000;
|
|
tmp3 = sum < Date.now();
|
|
}
|
|
return tmp3;
|
|
};
|
|
prototype["shouldFetchGlobalCatalog"] = function shouldFetchGlobalCatalog() {
|
|
const catalogLastFetchedAt = obj.catalogLastFetchedAt;
|
|
let tmp = null == catalogLastFetchedAt;
|
|
if (!tmp) {
|
|
const _Date = Date;
|
|
const sum = catalogLastFetchedAt + c2;
|
|
tmp = sum < Date.now();
|
|
}
|
|
return tmp;
|
|
};
|
|
GameServerStore.displayName = "GameServerStore";
|
|
GameServerStore.persistKey = "GameServerStore";
|
|
obj = {
|
|
LOGOUT: function handleReset() {
|
|
|
|
},
|
|
GAME_SERVER_FETCH_CATALOG_SUCCESS: function handleFetchCatalogSuccess(guildId) {
|
|
guildId = guildId.guildId;
|
|
obj = {};
|
|
const merged = Object.assign(obj2);
|
|
if (null == obj2[guildId]) {
|
|
obj2 = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj2;
|
|
}
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(obj2[guildId]);
|
|
obj3.catalog = guildId.catalog;
|
|
obj3.hasFetchedCatalog = true;
|
|
obj3.catalogLastFetchedAt = Date.now();
|
|
obj[guildId] = obj3;
|
|
obj2 = obj;
|
|
},
|
|
GAME_SERVER_FETCH_GLOBAL_CATALOG_SUCCESS: function handleFetchGlobalCatalogSuccess(catalog) {
|
|
obj = { catalog: catalog.catalog, hasFetchedCatalog: true, catalogLastFetchedAt: Date.now() };
|
|
},
|
|
GAME_SERVER_FETCH_INSTANCES_SUCCESS: function handleFetchInstancesSuccess(guildId) {
|
|
guildId = guildId.guildId;
|
|
obj = {};
|
|
const merged = Object.assign(obj2);
|
|
if (null == obj2[guildId]) {
|
|
obj2 = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj2;
|
|
}
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(obj2[guildId]);
|
|
obj3.instances = guildId.instances;
|
|
obj3.hasFetchedInstances = true;
|
|
obj3.instancesLastFetchedAt = Date.now();
|
|
obj[guildId] = obj3;
|
|
obj2 = obj;
|
|
},
|
|
GAME_SERVER_FETCH_GAME_INSTRUCTIONS_SUCCESS: function handleFetchProductSuccess(guildId) {
|
|
guildId = guildId.guildId;
|
|
obj = {};
|
|
({ skuId, instructions } = guildId);
|
|
const merged = Object.assign(obj2);
|
|
if (null == obj2[guildId]) {
|
|
obj2 = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj2;
|
|
}
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(obj2[guildId]);
|
|
if (null == obj2[guildId]) {
|
|
const obj4 = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj4;
|
|
}
|
|
const obj5 = {};
|
|
const merged2 = Object.assign(obj2[guildId].instructions);
|
|
obj5[skuId] = instructions;
|
|
obj3.instructions = obj5;
|
|
obj[guildId] = obj3;
|
|
obj2 = obj;
|
|
},
|
|
GAME_SERVER_UPDATE_INSTANCE_SUCCESS: function handleUpdateInstanceSuccess(arg0) {
|
|
({ guildId, instance } = arg0);
|
|
if (null == obj2[guildId]) {
|
|
obj = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj;
|
|
}
|
|
obj2 = {};
|
|
const merged = Object.assign(obj2);
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(tmp2);
|
|
const obj4 = {};
|
|
const merged2 = Object.assign(tmp2.instances);
|
|
obj4[instance.id] = instance;
|
|
obj3.instances = obj4;
|
|
obj2[guildId] = obj3;
|
|
},
|
|
GUILD_BOOST_ENTITLEMENTS_FETCH_SUCCESS: function handleFetchBoostEntitlementsSuccess(arg0) {
|
|
({ guildId, unlockedGameServers } = arg0);
|
|
const values = Object.values(unlockedGameServers);
|
|
obj = {};
|
|
const reduced = values.reduce((acc, item) => {
|
|
let num = closure_0(dependencyMap[0])(item);
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
return acc + num;
|
|
}, 0);
|
|
const merged = Object.assign(obj2);
|
|
if (null == obj2[guildId]) {
|
|
obj2 = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj2;
|
|
}
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(obj2[guildId]);
|
|
obj3.entitlements = unlockedGameServers;
|
|
obj3.appliedBoosts = reduced;
|
|
obj[guildId] = obj3;
|
|
obj2 = obj;
|
|
},
|
|
GAME_SERVER_CREATE: handleGameServerInstanceCreated,
|
|
GAME_SERVER_UPDATE: handleGameServerInstanceCreated,
|
|
GAME_SERVER_DELETE: function handleGameServerInstanceDeleted(arg0) {
|
|
({ guildId, gameServerId } = arg0);
|
|
if (null != guildId) {
|
|
if (null == obj2[guildId]) {
|
|
obj = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj;
|
|
}
|
|
const instances = tmp6.instances;
|
|
delete tmp[tmp2];
|
|
obj2 = {};
|
|
const merged = Object.assign(obj2);
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(tmp6);
|
|
obj2[guildId] = obj3;
|
|
}
|
|
},
|
|
GUILD_POWERUP_ENTITLEMENTS_CREATE: function handleGameServerEntitlementCreated(arg0) {
|
|
({ guildId, entitlements } = arg0);
|
|
entitlements = undefined;
|
|
if (null == obj2[guildId]) {
|
|
obj = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj;
|
|
}
|
|
entitlements = tmp2;
|
|
const found = entitlements.filter((sku) => {
|
|
sku = sku.sku;
|
|
let game_server;
|
|
if (sku != null) {
|
|
const tenant_metadata = sku.tenant_metadata;
|
|
if (tenant_metadata != null) {
|
|
const guild_monetization = tenant_metadata.guild_monetization;
|
|
if (guild_monetization != null) {
|
|
game_server = guild_monetization.game_server;
|
|
}
|
|
}
|
|
}
|
|
return null != game_server;
|
|
});
|
|
const item = found.forEach((id) => {
|
|
entitlements.entitlements[id.id] = id;
|
|
});
|
|
const values = Object.values(tmp2.entitlements);
|
|
obj2 = {};
|
|
const reduced = values.reduce((acc, item) => {
|
|
let num = closure_0(dependencyMap[0])(item);
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
return acc + num;
|
|
}, 0);
|
|
const merged = Object.assign(obj2);
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(tmp2);
|
|
obj3.appliedBoosts = reduced;
|
|
obj2[guildId] = obj3;
|
|
},
|
|
GUILD_POWERUP_ENTITLEMENTS_DELETE: function handleGameServerEntitlementDeleted(arg0) {
|
|
({ guildId, entitlements } = arg0);
|
|
closure_0 = undefined;
|
|
if (null == obj2[guildId]) {
|
|
obj = { catalog: {}, instances: {}, instructions: {}, entitlements: {} };
|
|
obj2[guildId] = obj;
|
|
}
|
|
closure_0 = tmp2;
|
|
const item = entitlements.forEach((item) => {
|
|
delete tmp2[tmp];
|
|
});
|
|
const values = Object.values(tmp2.entitlements);
|
|
obj2 = {};
|
|
const reduced = values.reduce((acc, item) => {
|
|
let num = closure_0(dependencyMap[0])(item);
|
|
if (num == null) {
|
|
num = 0;
|
|
}
|
|
return acc + num;
|
|
}, 0);
|
|
const merged = Object.assign(obj2);
|
|
const obj3 = {};
|
|
const merged1 = Object.assign(tmp2);
|
|
obj3.appliedBoosts = reduced;
|
|
obj2[guildId] = obj3;
|
|
}
|
|
};
|
|
const gameServerStore = new GameServerStore(DispatcherDefault, obj);
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("modules/game_server/GameServerStore.tsx");
|
|
|
|
export default gameServerStore;
|