decord/alpha/source/stores/RegionStore.tsx

104 lines
2.5 KiB
TypeScript
Raw Normal View History

2026-10-05 08:00:40 +00:00
// Module ID: 16984
// Function ID: 16985
// Name: RegionStore
2026-10-03 08:58:59 +00:00
// Dependencies: [2074, 12, 504, 584, 2]
2026-07-23 10:11:24 +00:00
2026-10-05 08:00:40 +00:00
// Module 16984 (RegionStore)
import _modDef12 from "module_12" /* 12 */;
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
import GuildStore from "GuildStore" /* 2074 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
let c3 = null;
2026-10-03 08:58:59 +00:00
const React3 = {};
const Store = get_initializedDefault.Store;
2026-07-29 08:29:29 +00:00
class RegionStore extends Store {
2026-10-03 08:58:59 +00:00
initialize() {
this.waitFor(GuildStore);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
getOptimalRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const regions = this.getRegions(tmp);
let tmp2 = null;
if (null != regions) {
let found = regions.find((optimal) => optimal.optimal);
if (found == null) {
const obj = _modDef12;
found = obj.sample(regions);
}
tmp2 = found;
}
return tmp2;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getOptimalRegionId(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const optimalRegion = this.getOptimalRegion(tmp);
let id = null;
if (null != optimalRegion) {
id = optimalRegion.id;
}
return id;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getRandomRegion(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const regions = this.getRegions(tmp);
let sampleResult = null;
if (null != regions) {
const obj = _modDef12;
sampleResult = obj.sample(regions);
}
return sampleResult;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getRandomRegionId(guildId) {
let tmp = guildId;
if (guildId === undefined) {
tmp = null;
}
const randomRegion = this.getRandomRegion(tmp);
let id = null;
if (null != randomRegion) {
id = randomRegion.id;
}
return id;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
getRegions(guildId) {
let tmp;
if (null != guildId) {
tmp = closure_4[guildId];
} else {
tmp = c3;
}
return tmp;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
}
const prototype = RegionStore.prototype;
2026-07-29 08:29:29 +00:00
RegionStore.displayName = "RegionStore";
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
LOAD_REGIONS: function handleLoadRegions(regions) {
2026-10-03 08:58:59 +00:00
const obj = _modDef12;
const sortByResult = obj.sortBy(regions.regions, (name) => name.name);
2026-07-20 16:05:17 +00:00
if (null != regions.guildId) {
2026-07-29 08:29:29 +00:00
closure_4[regions.guildId] = sortByResult;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
c3 = sortByResult;
2026-07-20 16:05:17 +00:00
}
},
GUILD_DELETE: function handleDeleteGuild(arg0) {
2026-10-03 08:58:59 +00:00
delete closure_4[arg0.guild.id];
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
};
const regionStore = new RegionStore(DispatcherDefault, obj);
const result = size.fileFinishedImporting("stores/RegionStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default regionStore;