2026-08-24 06:08:38 +00:00
|
|
|
// Module ID: 16647
|
|
|
|
|
// Function ID: 16648
|
2026-07-29 08:29:29 +00:00
|
|
|
// Name: finishRoll
|
2026-08-24 06:08:38 +00:00
|
|
|
// Dependencies: [1391, 1980, 11185, 8498, 4670, 5043, 1236, 7465, 7474, 2]
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-08-24 06:08:38 +00:00
|
|
|
// Module 16647 (finishRoll)
|
|
|
|
|
import getSystemLocale from "getSystemLocale" /* 1236 */;
|
|
|
|
|
import initializeDefault from "initialize" /* 5043 */;
|
|
|
|
|
import trackInviteDefault from "trackInvite" /* 7465 */;
|
|
|
|
|
import rebuildDefault from "rebuild" /* 7474 */;
|
|
|
|
|
import closure_3 from "ensureGuildLoaded" /* 1391 */;
|
|
|
|
|
import closure_4 from "handleConnectionOpen" /* 1980 */;
|
|
|
|
|
import closure_5 from "INITIAL_STATE" /* 11185 */;
|
|
|
|
|
import { INITIAL_STATE } from "INITIAL_STATE" /* 11185 */;
|
|
|
|
|
import ROLL_DURATION_MS from "ROLL_DURATION_MS" /* 8498 */;
|
|
|
|
|
import { MessageSendLocation } from "MESSAGE_GROUP_SPACING" /* 4670 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-08-24 06:08:38 +00:00
|
|
|
require = arg1;
|
|
|
|
|
({ AFTER_ROLL_DELAY_MS: error, ALLOWED_DICE_SIDES_SET: closure_8, DEFAULT_DICE_SIDES: c9, DISMISS_DELAY_MS: c10, MAX_DICE_COUNT: unpackModuleId, ROLL_DURATION_MS: closure_12 } = ROLL_DURATION_MS);
|
|
|
|
|
initializeDefault;
|
2026-07-29 08:29:29 +00:00
|
|
|
class DiceRollLifecycleManager extends tmp3 {
|
|
|
|
|
constructor() {
|
|
|
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
|
|
|
closure_0 = applyArgumentsResult;
|
|
|
|
|
applyArgumentsResult.actions = {
|
|
|
|
|
CHANNEL_SELECT(arg0) {
|
|
|
|
|
return applyArgumentsResult.handleChannelSelect(arg0);
|
|
|
|
|
},
|
|
|
|
|
DICE_ROLL_START(channelId) {
|
|
|
|
|
return applyArgumentsResult.handleStartRoll(channelId);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
applyArgumentsResult.rollTimer = null;
|
|
|
|
|
applyArgumentsResult.postRollDismissTimer = null;
|
|
|
|
|
applyArgumentsResult.collapseTimer = null;
|
|
|
|
|
applyArgumentsResult.handleChannelSelect = function handleChannelSelect(channelId) {
|
2026-08-24 06:08:38 +00:00
|
|
|
const state = closure_1_5.getState();
|
2026-07-29 08:29:29 +00:00
|
|
|
if (tmp2) {
|
|
|
|
|
applyArgumentsResult.clearTimers();
|
|
|
|
|
applyArgumentsResult.dismiss();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
applyArgumentsResult.handleStartRoll = function handleStartRoll(channelId) {
|
|
|
|
|
channelId = channelId.channelId;
|
|
|
|
|
let num = channelId.diceCount;
|
|
|
|
|
if (num === undefined) {
|
|
|
|
|
num = 1;
|
|
|
|
|
}
|
|
|
|
|
let diceSides = channelId.diceSides;
|
|
|
|
|
if (diceSides === undefined) {
|
2026-08-24 06:08:38 +00:00
|
|
|
diceSides = closure_1_9;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
let num3;
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_2 = undefined;
|
2026-07-29 08:29:29 +00:00
|
|
|
let items;
|
2026-08-24 06:08:38 +00:00
|
|
|
if (closure_1_4.getChannelId() === channelId) {
|
|
|
|
|
if (null == closure_1_5.getState().channelId) {
|
2026-07-29 08:29:29 +00:00
|
|
|
num3 = 42;
|
|
|
|
|
if (42 !== num) {
|
|
|
|
|
const _Math = Math;
|
|
|
|
|
const _Math2 = Math;
|
2026-08-24 06:08:38 +00:00
|
|
|
num3 = Math.min(Math.max(num, 1), closure_1_11);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
let tmp4 = diceSides;
|
2026-08-24 06:08:38 +00:00
|
|
|
if (!closure_1_8.has(diceSides)) {
|
|
|
|
|
tmp4 = closure_1_9;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_2 = tmp4;
|
2026-07-29 08:29:29 +00:00
|
|
|
const obj = { channelId: null, rolling: true, diceCount: null, diceSides: null, results: null };
|
|
|
|
|
obj[0] = channelId;
|
|
|
|
|
obj[2] = num3;
|
|
|
|
|
obj[3] = tmp4;
|
|
|
|
|
obj2.setState(obj);
|
|
|
|
|
items = [];
|
|
|
|
|
for (let num4 = 0; num4 < num3; num4 = num4 + 1) {
|
|
|
|
|
let _Math3 = Math;
|
|
|
|
|
let _Math4 = Math;
|
|
|
|
|
let arr = items.push(Math.floor(Math.random() * tmp4) + 1);
|
|
|
|
|
}
|
|
|
|
|
const _setTimeout = setTimeout;
|
|
|
|
|
channelId.rollTimer = setTimeout(() => {
|
|
|
|
|
channelId.rollTimer = null;
|
2026-08-24 06:08:38 +00:00
|
|
|
channelId.finishRoll(channelId, num3, closure_2, items);
|
|
|
|
|
}, closure_1_12);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
obj2 = closure_1_5;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
return applyArgumentsResult;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
const prototype = DiceRollLifecycleManager.prototype;
|
2026-08-24 06:08:38 +00:00
|
|
|
prototype["finishRoll"] = function finishRoll(channelId, arg1, closure_2, items) {
|
2026-07-29 08:29:29 +00:00
|
|
|
const self = this;
|
|
|
|
|
store.setState({ rolling: false, results: items });
|
|
|
|
|
this.postRollDismissTimer = setTimeout(() => {
|
|
|
|
|
self.postRollDismissTimer = null;
|
|
|
|
|
self.dismiss();
|
|
|
|
|
}, closure_7);
|
2026-08-24 06:08:38 +00:00
|
|
|
this.sendMessage(channelId, arg1, closure_2, items);
|
2026-07-29 08:29:29 +00:00
|
|
|
};
|
|
|
|
|
prototype["sendMessage"] = function sendMessage(arg0, arg1, arg2, arr) {
|
|
|
|
|
channel = channel.getChannel(arg0);
|
|
|
|
|
if (null != channel) {
|
|
|
|
|
let str = channel.getGuildId();
|
|
|
|
|
if (str == null) {
|
|
|
|
|
str = "@me";
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
obj1 = globalThis;
|
2026-07-29 08:29:29 +00:00
|
|
|
const _location = location;
|
|
|
|
|
const _window = window;
|
|
|
|
|
const _HermesInternal = HermesInternal;
|
|
|
|
|
const combined = "" + location.protocol + window.GLOBAL_ENV.WEBAPP_ENDPOINT + "/channels/" + str + "/" + arg0 + "/roll-dice/" + arg1 + "d" + arg2;
|
2026-08-24 06:08:38 +00:00
|
|
|
const intl = getSystemLocale.intl;
|
2026-07-29 08:29:29 +00:00
|
|
|
let obj = { count: null, sides: null };
|
|
|
|
|
obj[0] = arg1;
|
|
|
|
|
obj[1] = arg2;
|
|
|
|
|
const _HermesInternal2 = HermesInternal;
|
2026-08-24 06:08:38 +00:00
|
|
|
const combined1 = "[`" + intl.formatToPlainString(getSystemLocale.t.uV5JaG, obj) + "`](" + combined + ")";
|
2026-07-29 08:29:29 +00:00
|
|
|
const reduced = arr.reduce((arg0, arg1) => arg0 + arg1, 0);
|
2026-08-24 06:08:38 +00:00
|
|
|
const intl2 = getSystemLocale.intl;
|
2026-07-29 08:29:29 +00:00
|
|
|
obj = { total: null, count: null, sides: null };
|
|
|
|
|
obj[0] = reduced;
|
|
|
|
|
obj[1] = arg1;
|
|
|
|
|
obj[2] = arg2;
|
2026-08-24 06:08:38 +00:00
|
|
|
const result = intl2.formatToMarkdownString(getSystemLocale.t.tmSbYW, obj);
|
2026-07-29 08:29:29 +00:00
|
|
|
const mapped = arr.map((arg0) => ":game_die: " + arg0.toString());
|
|
|
|
|
let str10 = " ";
|
|
|
|
|
const _HermesInternal3 = HermesInternal;
|
|
|
|
|
const combined2 = "-# " + mapped.join(" ");
|
|
|
|
|
if (1 === arg1) {
|
|
|
|
|
let combined3 = "### " + result + ` ` + combined1;
|
|
|
|
|
} else {
|
|
|
|
|
const _HermesInternal4 = HermesInternal;
|
|
|
|
|
combined3 = "### " + result + ` ` + combined1 + "\n" + combined2;
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
str10 = trackInviteDefault;
|
|
|
|
|
obj1 = rebuildDefault;
|
2026-07-29 08:29:29 +00:00
|
|
|
obj1 = { location: null };
|
|
|
|
|
obj1[0] = MessageSendLocation.CHAT_INPUT;
|
|
|
|
|
str10.sendMessage(arg0, obj1.parse(channel, combined3), true, obj1);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
prototype["dismiss"] = function dismiss() {
|
|
|
|
|
const self = this;
|
|
|
|
|
store.setState({ dismissing: true });
|
|
|
|
|
this.collapseTimer = setTimeout(() => {
|
|
|
|
|
self.collapseTimer = null;
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_1_5.setState(closure_1_6);
|
2026-07-29 08:29:29 +00:00
|
|
|
}, closure_10);
|
|
|
|
|
};
|
|
|
|
|
prototype["clearTimers"] = function clearTimers() {
|
|
|
|
|
const self = this;
|
|
|
|
|
if (null != this.rollTimer) {
|
|
|
|
|
const _clearTimeout = clearTimeout;
|
|
|
|
|
clearTimeout(self.rollTimer);
|
|
|
|
|
self.rollTimer = null;
|
|
|
|
|
}
|
|
|
|
|
if (null != self.postRollDismissTimer) {
|
|
|
|
|
const _clearTimeout2 = clearTimeout;
|
|
|
|
|
clearTimeout(self.postRollDismissTimer);
|
|
|
|
|
self.postRollDismissTimer = null;
|
|
|
|
|
}
|
|
|
|
|
if (null != self.collapseTimer) {
|
|
|
|
|
const _clearTimeout3 = clearTimeout;
|
|
|
|
|
clearTimeout(self.collapseTimer);
|
|
|
|
|
self.collapseTimer = null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const diceRollLifecycleManager = new DiceRollLifecycleManager();
|
2026-08-24 06:08:38 +00:00
|
|
|
let result = require("set").fileFinishedImporting("modules/dice_roll/DiceRollLifecycleManager.tsx");
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
export default diceRollLifecycleManager;
|