Merge branch 'staging' into wi-processing-refactoring

This commit is contained in:
Cohee
2024-07-14 22:50:04 +03:00
83 changed files with 9931 additions and 407 deletions

View File

@@ -14,9 +14,8 @@ import { SlashCommand } from './slash-commands/SlashCommand.js';
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from './slash-commands/SlashCommandArgument.js';
import { SlashCommandEnumValue, enumTypes } from './slash-commands/SlashCommandEnumValue.js';
import { commonEnumProviders, enumIcons } from './slash-commands/SlashCommandCommonEnumsProvider.js';
import { SlashCommandExecutor } from './slash-commands/SlashCommandExecutor.js';
import { SlashCommandClosure } from './slash-commands/SlashCommandClosure.js';
import { Popup } from './popup.js';
import { callGenericPopup, Popup, POPUP_TYPE } from './popup.js';
export {
world_info,
@@ -1222,7 +1221,7 @@ function registerWorldInfoSlashCommands() {
enumTypes.enum, enumIcons.getDataTypeIcon(value.type))),
/** All existing UIDs based on the file argument as world name */
wiUids: (/** @type {SlashCommandExecutor} */ executor) => {
wiUids: (/** @type {import('./slash-commands/SlashCommandExecutor.js').SlashCommandExecutor} */ executor) => {
const file = executor.namedArgumentList.find(it => it.name == 'file')?.value;
if (file instanceof SlashCommandClosure) throw new Error('Argument \'file\' does not support closures');
// Try find world from cache
@@ -3168,7 +3167,8 @@ function duplicateWorldInfoEntry(data, uid) {
}
// Exclude uid and gather the rest of the properties
const { uid: _, ...originalData } = data.entries[uid];
const originalData = Object.assign({}, data.entries[uid]);
delete originalData.uid;
// Create new entry and copy over data
const entry = createWorldInfoEntry(data.name, data);
@@ -4327,7 +4327,7 @@ export function checkEmbeddedWorld(chid) {
importEmbeddedWorldInfo(true);
}
};
callPopup(html, 'confirm', '', { okButton: 'Yes' }).then(checkResult);
callGenericPopup(html, POPUP_TYPE.CONFIRM, '', { okButton: 'Yes' }).then(checkResult);
}
else {
toastr.info(
@@ -4429,8 +4429,9 @@ function onWorldInfoChange(args, text) {
$('#world_info').val(null).trigger('change');
}
} else { //if it's a pointer selection
let tempWorldInfo = [];
let selectedWorlds = $('#world_info').val().map((e) => Number(e)).filter((e) => !isNaN(e));
const tempWorldInfo = [];
const val = $('#world_info').val();
const selectedWorlds = (Array.isArray(val) ? val : [val]).map((e) => Number(e)).filter((e) => !isNaN(e));
if (selectedWorlds.length > 0) {
selectedWorlds.forEach((worldIndex) => {
const existingWorldName = world_names[worldIndex];