@mudlet/mudlet-web 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +338 -0
- package/README.md +150 -0
- package/dist-lib/App.d.ts +1 -0
- package/dist-lib/MudletWebApp.d.ts +11 -0
- package/dist-lib/ProfileSession.d.ts +15 -0
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +9 -0
- package/dist-lib/branding.d.ts +213 -0
- package/dist-lib/core/EventBus.d.ts +29 -0
- package/dist-lib/db/sqliteClient.d.ts +25 -0
- package/dist-lib/hooks/useEngines.d.ts +12 -0
- package/dist-lib/hooks/useMudSession.d.ts +10 -0
- package/dist-lib/hooks/useOutput.d.ts +17 -0
- package/dist-lib/hooks/useViewportMode.d.ts +14 -0
- package/dist-lib/import/applyMudletProfile.d.ts +57 -0
- package/dist-lib/import/collectProfileExport.d.ts +16 -0
- package/dist-lib/import/defaultPackages.d.ts +81 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +13023 -0
- package/dist-lib/import/defaults/run-lua-code.mpackage +0 -0
- package/dist-lib/import/mudletHost.d.ts +67 -0
- package/dist-lib/import/mudletLink.d.ts +34 -0
- package/dist-lib/import/mudletProfileExport.d.ts +49 -0
- package/dist-lib/import/mudletProfileImport.d.ts +71 -0
- package/dist-lib/import/mudletVariables.d.ts +49 -0
- package/dist-lib/import/mudletWriteback.d.ts +12 -0
- package/dist-lib/import/mudletXmlExport.d.ts +16 -0
- package/dist-lib/import/mudletXmlImport.d.ts +21 -0
- package/dist-lib/import/packageInstaller.d.ts +72 -0
- package/dist-lib/import/packageRepository.d.ts +54 -0
- package/dist-lib/import/remotePackageInstall.d.ts +52 -0
- package/dist-lib/index.d.ts +30 -0
- package/dist-lib/index.js +42307 -0
- package/dist-lib/logging/SessionLogger.d.ts +41 -0
- package/dist-lib/main.d.ts +2 -0
- package/dist-lib/map/MapSelectionOverlay.d.ts +15 -0
- package/dist-lib/map/MapStore.d.ts +1067 -0
- package/dist-lib/map/MudixMapReader.d.ts +90 -0
- package/dist-lib/map/MudletHighlightOverlay.d.ts +18 -0
- package/dist-lib/map/mapImageExport.d.ts +26 -0
- package/dist-lib/map/mapParser.worker.d.ts +1 -0
- package/dist-lib/map/mapParserClient.d.ts +35 -0
- package/dist-lib/map/pathfinding.d.ts +52 -0
- package/dist-lib/map/xmlMapImport.d.ts +28 -0
- package/dist-lib/mud/MudSession.d.ts +236 -0
- package/dist-lib/mud/PatternEngine.d.ts +28 -0
- package/dist-lib/mud/aliases/AliasEngine.d.ts +15 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +84 -0
- package/dist-lib/mud/connection/MudClient.d.ts +268 -0
- package/dist-lib/mud/connection/PingTracker.d.ts +28 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +188 -0
- package/dist-lib/mud/connection/telnetDebug.d.ts +54 -0
- package/dist-lib/mud/events.d.ts +160 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +36 -0
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +45 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +33 -0
- package/dist-lib/mud/protocol/charset.d.ts +105 -0
- package/dist-lib/mud/protocol/constants.d.ts +116 -0
- package/dist-lib/mud/protocol/echo.d.ts +63 -0
- package/dist-lib/mud/protocol/gmcp.d.ts +28 -0
- package/dist-lib/mud/protocol/index.d.ts +11 -0
- package/dist-lib/mud/protocol/mccp.d.ts +18 -0
- package/dist-lib/mud/protocol/mnes.d.ts +83 -0
- package/dist-lib/mud/protocol/msdp.d.ts +19 -0
- package/dist-lib/mud/protocol/msp.d.ts +47 -0
- package/dist-lib/mud/protocol/mssp.d.ts +25 -0
- package/dist-lib/mud/protocol/mxp.d.ts +188 -0
- package/dist-lib/mud/protocol/naws.d.ts +7 -0
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +31 -0
- package/dist-lib/mud/replay/ReplayRecorder.d.ts +18 -0
- package/dist-lib/mud/replay/replayFormat.d.ts +49 -0
- package/dist-lib/mud/text/Console.d.ts +183 -0
- package/dist-lib/mud/text/FormatState.d.ts +256 -0
- package/dist-lib/mud/text/ansiEscapes.d.ts +88 -0
- package/dist-lib/mud/text/cellRender.d.ts +21 -0
- package/dist-lib/mud/text/colorParsers.d.ts +54 -0
- package/dist-lib/mud/text/colors.d.ts +31 -0
- package/dist-lib/mud/text/controlCharacterMode.d.ts +13 -0
- package/dist-lib/mud/text/controlChars.d.ts +31 -0
- package/dist-lib/mud/text/hyperlinkConfig.d.ts +164 -0
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +37 -0
- package/dist-lib/mud/text/oscLinkManager.d.ts +35 -0
- package/dist-lib/mud/text/wcwidth.d.ts +44 -0
- package/dist-lib/mud/text/xterm256.d.ts +2 -0
- package/dist-lib/mud/timers/TimerEngine.d.ts +61 -0
- package/dist-lib/mud/triggers/ChunkProcessor.d.ts +11 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +188 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +26 -0
- package/dist-lib/scripting/EngineHost.d.ts +152 -0
- package/dist-lib/scripting/GlobalEventChannel.d.ts +36 -0
- package/dist-lib/scripting/IScriptingRuntime.d.ts +95 -0
- package/dist-lib/scripting/MapOpenNotifier.d.ts +19 -0
- package/dist-lib/scripting/ScriptingAPI.d.ts +1691 -0
- package/dist-lib/scripting/ScriptingEngine.d.ts +806 -0
- package/dist-lib/scripting/StopwatchManager.d.ts +94 -0
- package/dist-lib/scripting/heldModifiers.d.ts +3 -0
- package/dist-lib/scripting/http/HttpService.d.ts +23 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +190 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/commandLine.d.ts +11 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +87 -0
- package/dist-lib/scripting/lua/bindings/cursor.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +9 -0
- package/dist-lib/scripting/lua/bindings/map.d.ts +14 -0
- package/dist-lib/scripting/lua/bindings/media.d.ts +24 -0
- package/dist-lib/scripting/lua/bindings/output.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/packages.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/session.d.ts +16 -0
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +9 -0
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +11 -0
- package/dist-lib/scripting/lua/bindings/window.d.ts +10 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +4 -0
- package/dist-lib/scripting/lua/luaCompletions.d.ts +9 -0
- package/dist-lib/scripting/lua/mudlet-lua/generic-mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/scripting/lua/rex.d.ts +3 -0
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +1 -0
- package/dist-lib/scripting/lua/yajl.d.ts +11 -0
- package/dist-lib/scripting/profilesPresence.d.ts +50 -0
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +62 -0
- package/dist-lib/scripting/vfs/cssRewrite.d.ts +21 -0
- package/dist-lib/scripting/vfs/folderHandleStore.d.ts +16 -0
- package/dist-lib/scripting/vfs/folderSync.d.ts +59 -0
- package/dist-lib/scripting/vfs/htmlRewrite.d.ts +26 -0
- package/dist-lib/scripting/vfs/vfsBridge.d.ts +16 -0
- package/dist-lib/services/cloudflare.d.ts +54 -0
- package/dist-lib/storage/appStore.d.ts +132 -0
- package/dist-lib/storage/crossTabSync.d.ts +3 -0
- package/dist-lib/storage/debouncedStorage.d.ts +18 -0
- package/dist-lib/storage/hooks.d.ts +17 -0
- package/dist-lib/storage/index.d.ts +4 -0
- package/dist-lib/storage/logExport.d.ts +32 -0
- package/dist-lib/storage/logStorage.d.ts +45 -0
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/profileVfsData.d.ts +47 -0
- package/dist-lib/storage/schema.d.ts +638 -0
- package/dist-lib/styles.css +2 -0
- package/dist-lib/ui/AboutModal.d.ts +8 -0
- package/dist-lib/ui/BrandLoginFields.d.ts +25 -0
- package/dist-lib/ui/BrandLoginScreen.d.ts +11 -0
- package/dist-lib/ui/CharLoginModal.d.ts +32 -0
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +27 -0
- package/dist-lib/ui/CodeEditorPreview.d.ts +19 -0
- package/dist-lib/ui/CommandBar.d.ts +17 -0
- package/dist-lib/ui/ConnectionFormModal.d.ts +13 -0
- package/dist-lib/ui/ConnectionGrid.d.ts +18 -0
- package/dist-lib/ui/ConnectionScreen.d.ts +14 -0
- package/dist-lib/ui/FileBrowserModal.d.ts +20 -0
- package/dist-lib/ui/FilePickerModal.d.ts +21 -0
- package/dist-lib/ui/FolderPermissionScreen.d.ts +16 -0
- package/dist-lib/ui/JsonPreview.d.ts +15 -0
- package/dist-lib/ui/LogBrowserModal.d.ts +7 -0
- package/dist-lib/ui/MapEditorModal.d.ts +9 -0
- package/dist-lib/ui/MarkdownPreview.d.ts +15 -0
- package/dist-lib/ui/MergeConflictModal.d.ts +17 -0
- package/dist-lib/ui/ModuleResolveModal.d.ts +22 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -0
- package/dist-lib/ui/ProfileBusyScreen.d.ts +12 -0
- package/dist-lib/ui/ProfileExportModal.d.ts +7 -0
- package/dist-lib/ui/ProxyInfoModal.d.ts +6 -0
- package/dist-lib/ui/ProxyWhyModal.d.ts +6 -0
- package/dist-lib/ui/ProxyWizardModal.d.ts +6 -0
- package/dist-lib/ui/QuickOpenPalette.d.ts +8 -0
- package/dist-lib/ui/ResizableModal.d.ts +17 -0
- package/dist-lib/ui/ScriptingDocsModal.d.ts +12 -0
- package/dist-lib/ui/SettingsModal.d.ts +9 -0
- package/dist-lib/ui/Toolbar.d.ts +29 -0
- package/dist-lib/ui/bufferWords.d.ts +38 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +21 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +97 -0
- package/dist-lib/ui/cmdline/CommandLineOverlay.d.ts +8 -0
- package/dist-lib/ui/codemirror/theme.d.ts +5 -0
- package/dist-lib/ui/commandHistory.d.ts +31 -0
- package/dist-lib/ui/components/Button.d.ts +9 -0
- package/dist-lib/ui/components/ConfirmDialog.d.ts +29 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +9 -0
- package/dist-lib/ui/components/FontPicker.d.ts +9 -0
- package/dist-lib/ui/components/FormField.d.ts +16 -0
- package/dist-lib/ui/components/HelpTip.d.ts +7 -0
- package/dist-lib/ui/components/Input.d.ts +6 -0
- package/dist-lib/ui/components/Toggle.d.ts +10 -0
- package/dist-lib/ui/components/index.d.ts +9 -0
- package/dist-lib/ui/components/useModalFocus.d.ts +18 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +220 -0
- package/dist-lib/ui/labels/LabelOverlay.d.ts +9 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +10 -0
- package/dist-lib/ui/labels/cursorShapes.d.ts +6 -0
- package/dist-lib/ui/labels/gifMovie.d.ts +100 -0
- package/dist-lib/ui/labels/qtCss.d.ts +57 -0
- package/dist-lib/ui/layout/ContentLayout.d.ts +19 -0
- package/dist-lib/ui/layout/DockArea.d.ts +14 -0
- package/dist-lib/ui/layout/DockedPanel.d.ts +13 -0
- package/dist-lib/ui/layout/FloatingWindowLayer.d.ts +10 -0
- package/dist-lib/ui/layout/MobileLayout.d.ts +22 -0
- package/dist-lib/ui/layout/PopoutWindow.d.ts +35 -0
- package/dist-lib/ui/layout/ScriptWindow.d.ts +29 -0
- package/dist-lib/ui/layout/SplitGroupPanel.d.ts +17 -0
- package/dist-lib/ui/layout/TabGroupPanel.d.ts +12 -0
- package/dist-lib/ui/layout/WindowContextMenu.d.ts +11 -0
- package/dist-lib/ui/layout/dockDetect.d.ts +26 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +71 -0
- package/dist-lib/ui/markdown.d.ts +1 -0
- package/dist-lib/ui/output/CaretReviewPanel.d.ts +22 -0
- package/dist-lib/ui/output/OutputArea.d.ts +9 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +23 -0
- package/dist-lib/ui/output/OutputRenderer.d.ts +64 -0
- package/dist-lib/ui/output/ScreenReaderLog.d.ts +23 -0
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +28 -0
- package/dist-lib/ui/output/backgroundImageStyle.d.ts +17 -0
- package/dist-lib/ui/output/caretMode.d.ts +40 -0
- package/dist-lib/ui/output/linkNavigation.d.ts +29 -0
- package/dist-lib/ui/output/osc8Menu.d.ts +16 -0
- package/dist-lib/ui/output/outputCopy.d.ts +15 -0
- package/dist-lib/ui/preventPinchZoom.d.ts +1 -0
- package/dist-lib/ui/scrollbox/ScrollBoxManager.d.ts +62 -0
- package/dist-lib/ui/scrollbox/ScrollBoxOverlay.d.ts +25 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +149 -0
- package/dist-lib/ui/sound/closedCaption.d.ts +37 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +56 -0
- package/dist-lib/ui/tts/TtsManager.d.ts +68 -0
- package/dist-lib/ui/useBrandLogin.d.ts +19 -0
- package/dist-lib/ui/useCommandHistory.d.ts +7 -0
- package/dist-lib/ui/video/VideoManager.d.ts +56 -0
- package/dist-lib/ui/windows/ScriptEditorModal.d.ts +13 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +694 -0
- package/dist-lib/ui/windows/panels/HtmlPanel.d.ts +27 -0
- package/dist-lib/ui/windows/panels/LuaEditor.d.ts +14 -0
- package/dist-lib/ui/windows/panels/MapPanel.d.ts +8 -0
- package/dist-lib/ui/windows/panels/PackageRepositoryModal.d.ts +18 -0
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +24 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +12 -0
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +35 -0
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +21 -0
- package/dist-lib/ui/windows/panels/VfsModulePickerModal.d.ts +8 -0
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +23 -0
- package/dist-lib/ui/windows/types.d.ts +145 -0
- package/dist-lib/utils/documentTitle.d.ts +33 -0
- package/dist-lib/utils/fontLoader.d.ts +52 -0
- package/dist-lib/utils/profileLock.d.ts +26 -0
- package/dist-lib/utils/sessionCredentials.d.ts +16 -0
- package/dist-lib/version.d.ts +39 -0
- package/dist-lib/vfs-sw.js +131 -0
- package/dist-lib/vite.d.ts +2 -0
- package/dist-lib/vite.js +154 -0
- package/package.json +93 -0
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
import type { MudletArea, MudletFont, MudletMap, MudletMapHeader, MudletRoom } from 'mudlet-map-binary-reader';
|
|
2
|
+
import { readerExport } from 'mudlet-map-binary-reader';
|
|
3
|
+
import { type ExitWeightFilter, type PathfindResult } from './pathfinding';
|
|
4
|
+
export type { ExitWeightFilter, PathfindResult } from './pathfinding';
|
|
5
|
+
export type MapRendererData = ReturnType<typeof readerExport>;
|
|
6
|
+
export declare function parseDirection(dir: unknown): number | undefined;
|
|
7
|
+
export declare const DEFAULT_FONT: MudletFont;
|
|
8
|
+
export declare function makeRoom(areaId: number): MudletRoom;
|
|
9
|
+
/**
|
|
10
|
+
* Convert Mudlet's own `saveJsonMap` export into the binary-reader model.
|
|
11
|
+
*
|
|
12
|
+
* This is a genuinely different shape from {@link toJsonString}'s output (which
|
|
13
|
+
* mirrors the binary model): areas are an *array* carrying their rooms nested
|
|
14
|
+
* inside, there is no top-level `rooms` map, exits are `{exitId, name}` records
|
|
15
|
+
* rather than direction fields, and a room's symbol is an OBJECT
|
|
16
|
+
* (`{color24RGB, text}`) rather than a string. Not handling it meant
|
|
17
|
+
* `loadJsonMap` rejected every map Mudlet actually writes, so packages fell
|
|
18
|
+
* back to rebuilding the map through the Lua API — and passing that symbol
|
|
19
|
+
* object straight to setRoomChar is what rendered rooms as "[LuaTable …]".
|
|
20
|
+
*
|
|
21
|
+
* Returns null when the payload isn't this format, so the caller can fall
|
|
22
|
+
* through to the binary-model path.
|
|
23
|
+
*
|
|
24
|
+
* Room `border` is the one documented field still unmapped — no map available
|
|
25
|
+
* to verify it against, and it needs the same post-load side-table treatment as
|
|
26
|
+
* symbol colours. Everything else in TRoom.cpp's writeJsonRoom is covered.
|
|
27
|
+
* Symbol colours are applied separately by applyJsonSymbolColors.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mudletJsonMapToMudletMap(src: unknown): MudletMap | null;
|
|
30
|
+
export declare function makeArea(): MudletArea;
|
|
31
|
+
export interface MapLabelInfo {
|
|
32
|
+
X: number;
|
|
33
|
+
Y: number;
|
|
34
|
+
Z: number;
|
|
35
|
+
Width: number;
|
|
36
|
+
Height: number;
|
|
37
|
+
Text: string;
|
|
38
|
+
Pixmap: string;
|
|
39
|
+
OnTop: boolean;
|
|
40
|
+
Scaling: boolean;
|
|
41
|
+
Temporary: boolean;
|
|
42
|
+
FgColor: {
|
|
43
|
+
r: number;
|
|
44
|
+
g: number;
|
|
45
|
+
b: number;
|
|
46
|
+
};
|
|
47
|
+
BgColor: {
|
|
48
|
+
r: number;
|
|
49
|
+
g: number;
|
|
50
|
+
b: number;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export type MapLabelLookup = {
|
|
54
|
+
ok: false;
|
|
55
|
+
err: 'noarea' | 'noid';
|
|
56
|
+
} | {
|
|
57
|
+
ok: true;
|
|
58
|
+
single: MapLabelInfo;
|
|
59
|
+
} | {
|
|
60
|
+
ok: true;
|
|
61
|
+
multi: Record<number, MapLabelInfo>;
|
|
62
|
+
};
|
|
63
|
+
/** Mudlet room highlight: two-color radial gradient with per-color alpha and
|
|
64
|
+
* a radius factor. Rendered by MudletHighlightOverlay. Despite the suffix
|
|
65
|
+
* naming, Mudlet's gradient puts color2 at the *centre* and color1 at the
|
|
66
|
+
* *outer* ring (T2DMap::drawRoom: setColorAt(0, color2), setColorAt(0.85,
|
|
67
|
+
* color1)). */
|
|
68
|
+
export interface RoomHighlight {
|
|
69
|
+
r1: number;
|
|
70
|
+
g1: number;
|
|
71
|
+
b1: number;
|
|
72
|
+
r2: number;
|
|
73
|
+
g2: number;
|
|
74
|
+
b2: number;
|
|
75
|
+
a1: number;
|
|
76
|
+
a2: number;
|
|
77
|
+
radius: number;
|
|
78
|
+
}
|
|
79
|
+
/** Mudlet registerMapInfo callback result. Returned by the LuaRuntime
|
|
80
|
+
* evaluator after invoking a registered contributor; `null` when the
|
|
81
|
+
* callback returned an empty string / nothing, or when the evaluator
|
|
82
|
+
* itself failed (the Lua error is reported via showHandlerError, not here). */
|
|
83
|
+
export interface MapInfoResult {
|
|
84
|
+
label: string;
|
|
85
|
+
text: string;
|
|
86
|
+
isBold: boolean;
|
|
87
|
+
isItalic: boolean;
|
|
88
|
+
color?: {
|
|
89
|
+
r: number;
|
|
90
|
+
g: number;
|
|
91
|
+
b: number;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/** A registered Mudlet `registerMapInfo` contributor.
|
|
95
|
+
*
|
|
96
|
+
* Two kinds exist. Script-registered ones carry a `callbackId` that indexes
|
|
97
|
+
* into the Lua-side `__mudix_cb` registry; the LuaRuntime evaluator dispatches
|
|
98
|
+
* to it, and they start disabled (Mudlet semantics — caller must
|
|
99
|
+
* `enableMapInfo(label)` to show it). Built-in ones (`builtin: true`,
|
|
100
|
+
* `callbackId: null`) mirror Mudlet's native "Short"/"Full" contributors —
|
|
101
|
+
* they're evaluated directly from MapStore data (see `builtinMapInfo`), don't
|
|
102
|
+
* depend on a live Lua runtime, and can't be removed via `killMapInfo`. */
|
|
103
|
+
export interface MapInfoContributor {
|
|
104
|
+
label: string;
|
|
105
|
+
callbackId: number | null;
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
builtin?: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface MapEventEntry {
|
|
110
|
+
/** Stable id used by removeMapEvent and as a parent reference. */
|
|
111
|
+
uniqueName: string;
|
|
112
|
+
/** Event name passed to raiseEvent on click. */
|
|
113
|
+
eventName: string;
|
|
114
|
+
/** uniqueName of a parent entry that this is nested under, or null for top-level. */
|
|
115
|
+
parent: string | null;
|
|
116
|
+
/** Label rendered in the context menu. Defaults to uniqueName when unspecified. */
|
|
117
|
+
displayName: string;
|
|
118
|
+
/** Extra arguments captured by addMapEvent. Mudlet's "selection" branch
|
|
119
|
+
* (the one mudix mirrors, since the right-clicked room is treated as the
|
|
120
|
+
* selection) discards these — kept for parity with the registration API. */
|
|
121
|
+
args: unknown[];
|
|
122
|
+
}
|
|
123
|
+
export interface MapMenuEntry {
|
|
124
|
+
/** Stable id used by removeMapMenu and as a parent reference from
|
|
125
|
+
* addMapEvent/addMapMenu entries. */
|
|
126
|
+
name: string;
|
|
127
|
+
/** name of a parent menu this is nested under, or null for top-level. */
|
|
128
|
+
parent: string | null;
|
|
129
|
+
/** Label rendered for the submenu. Defaults to name when unspecified. */
|
|
130
|
+
displayName: string;
|
|
131
|
+
}
|
|
132
|
+
export declare class MapStore {
|
|
133
|
+
private rooms;
|
|
134
|
+
private areas;
|
|
135
|
+
private areaNames;
|
|
136
|
+
private hashToRoom;
|
|
137
|
+
private labels;
|
|
138
|
+
private envColors;
|
|
139
|
+
private nextRoomId;
|
|
140
|
+
private nextAreaId;
|
|
141
|
+
/** Installed by `setExitWeightFilter`; consulted per exit in findPath. */
|
|
142
|
+
private exitWeightFilter;
|
|
143
|
+
private pendingBinaryHashIndex;
|
|
144
|
+
private pendingBinaryHadSelection;
|
|
145
|
+
private version;
|
|
146
|
+
private subscribers;
|
|
147
|
+
private notifyPending;
|
|
148
|
+
private highlightSubscribers;
|
|
149
|
+
private highlightNotifyPending;
|
|
150
|
+
private selectedRooms;
|
|
151
|
+
private selectionCenter;
|
|
152
|
+
private selectionVersion;
|
|
153
|
+
private selectionSubscribers;
|
|
154
|
+
private selectionNotifyPending;
|
|
155
|
+
private mapEvents;
|
|
156
|
+
private mapMenus;
|
|
157
|
+
private customEnvColors;
|
|
158
|
+
/** roomID → the special-exit COMMANDS locked on it. See
|
|
159
|
+
* {@link lockedSpecialCommands}. */
|
|
160
|
+
private specialExitLocks;
|
|
161
|
+
private roomHighlights;
|
|
162
|
+
private mapUserData;
|
|
163
|
+
private playerRoomId;
|
|
164
|
+
private mRoomIdHash;
|
|
165
|
+
/** Mudlet's mProfileName — the key into mRoomIdHash for this profile's saved
|
|
166
|
+
* player room. Set by ScriptingEngine to the connection name before the map
|
|
167
|
+
* loads. Empty string when unknown (then no position is restored/saved). */
|
|
168
|
+
profileName: string;
|
|
169
|
+
private mapEventDispatcher;
|
|
170
|
+
private mapInfoContributors;
|
|
171
|
+
private builtinMapInfo;
|
|
172
|
+
private mapInfoEvaluator;
|
|
173
|
+
constructor();
|
|
174
|
+
subscribe(cb: () => void): () => void;
|
|
175
|
+
/** Subscribe to highlight-set changes only (highlightRoom / unHighlightRoom
|
|
176
|
+
* and bulk clears via newEmptyMap / loadFromBinary). MudletHighlightOverlay
|
|
177
|
+
* uses this so it re-renders without forcing a full MudixMapReader rebuild. */
|
|
178
|
+
subscribeHighlights(cb: () => void): () => void;
|
|
179
|
+
/** Subscribe to selection changes (selectMapRoom / toggleMapRoomSelection /
|
|
180
|
+
* clearMapSelection and the bulk clears in newEmptyMap / loadFromBinary).
|
|
181
|
+
* MapSelectionOverlay rides this so per-click repaints stay off the main
|
|
182
|
+
* store-notify channel. */
|
|
183
|
+
subscribeSelection(cb: () => void): () => void;
|
|
184
|
+
private notify;
|
|
185
|
+
private notifyHighlights;
|
|
186
|
+
private notifySelection;
|
|
187
|
+
/** Monotonic counter incremented on every mutation. Live readers compare
|
|
188
|
+
* the snapshot they cached against this to decide whether to rebuild. */
|
|
189
|
+
getVersion(): number;
|
|
190
|
+
isEmpty(): boolean;
|
|
191
|
+
private initialized;
|
|
192
|
+
/** True once newEmptyMap() has been called — the store is ready for scripting even with 0 rooms. */
|
|
193
|
+
isInitialized(): boolean;
|
|
194
|
+
/** Initialize with a single default area so scripts can start adding rooms immediately. */
|
|
195
|
+
newEmptyMap(): void;
|
|
196
|
+
/**
|
|
197
|
+
* Replace the store's contents with a parsed Mudlet binary map. Loads
|
|
198
|
+
* rooms, areas, area names, hashes, labels, custom env colors, env color
|
|
199
|
+
* palette, and map-level user data. Bumps the id cursors past any binary
|
|
200
|
+
* ids so subsequent {@link createRoomID} / {@link addAreaName} calls don't
|
|
201
|
+
* collide. One notification fires at the end of the batch.
|
|
202
|
+
*/
|
|
203
|
+
loadFromBinary(mudletMap: MudletMap): void;
|
|
204
|
+
/**
|
|
205
|
+
* Header phase of a streamed binary load — everything in a Mudlet map
|
|
206
|
+
* except the rooms (see `MudletMapReader.streamRooms`). Wipes the store and
|
|
207
|
+
* applies areas / names / labels / colours / user data, then leaves it open
|
|
208
|
+
* for {@link ingestBinaryRooms} batches. Nothing is notified until
|
|
209
|
+
* {@link endBinaryLoad}, so subscribers never observe a half-loaded map.
|
|
210
|
+
*
|
|
211
|
+
* {@link loadFromBinary} is this same three-phase sequence run eagerly over
|
|
212
|
+
* an already-materialised map.
|
|
213
|
+
*/
|
|
214
|
+
beginBinaryLoad(header: MudletMapHeader): void;
|
|
215
|
+
/**
|
|
216
|
+
* Room phase of a streamed binary load. Call any number of times between
|
|
217
|
+
* {@link beginBinaryLoad} and {@link endBinaryLoad}; each batch is folded
|
|
218
|
+
* into the store as it arrives, so the worker never has to hold (nor the
|
|
219
|
+
* structured clone carry) the whole room graph at once.
|
|
220
|
+
*/
|
|
221
|
+
ingestBinaryRooms(rooms: Iterable<readonly [number, MudletRoom]>): void;
|
|
222
|
+
private ingestBinaryRoom;
|
|
223
|
+
/**
|
|
224
|
+
* Finalize a streamed binary load: fold in the authoritative hash index,
|
|
225
|
+
* resolve the player room, and fire the single notification the whole load
|
|
226
|
+
* is worth.
|
|
227
|
+
*/
|
|
228
|
+
endBinaryLoad(): void;
|
|
229
|
+
/**
|
|
230
|
+
* Mudlet `deleteMap()` — wipe every room, area, label and associated datum,
|
|
231
|
+
* leaving a fresh empty map with a single default area (so scripts can keep
|
|
232
|
+
* adding rooms). Returns true.
|
|
233
|
+
*/
|
|
234
|
+
deleteMap(): boolean;
|
|
235
|
+
toRendererData(): MapRendererData | null;
|
|
236
|
+
/**
|
|
237
|
+
* Mudlet `saveJsonMap(path)` backbone — serialise the entire MapStore as a
|
|
238
|
+
* JSON string with the same shape as the in-memory `MudletMap` (so a later
|
|
239
|
+
* `loadJsonMap` can hand it straight to `loadFromBinary`). Pixmaps are
|
|
240
|
+
* already normalised to base64 by `loadFromBinary`, so the result
|
|
241
|
+
* round-trips cleanly through `JSON.stringify`.
|
|
242
|
+
*/
|
|
243
|
+
toJsonString(): string;
|
|
244
|
+
/**
|
|
245
|
+
* Save-side variant of {@link toMudletMap}: re-injects the v20-compatible
|
|
246
|
+
* `system.fallback_hidden` userData key for rooms in the hidden side-table
|
|
247
|
+
* so the serialised file round-trips back through `loadFromBinary` (and
|
|
248
|
+
* stays loadable by Mudlet v20 readers). Render paths still call the plain
|
|
249
|
+
* {@link toMudletMap} — the fallback key is dead weight for the renderer
|
|
250
|
+
* and we don't want to pay the per-room object spread on every redraw.
|
|
251
|
+
*/
|
|
252
|
+
toMudletMapForSave(): MudletMap;
|
|
253
|
+
/**
|
|
254
|
+
* Mudlet `loadJsonMap(path)` backbone — parse a JSON payload previously
|
|
255
|
+
* produced by `toJsonString` and replace the store's contents. Returns
|
|
256
|
+
* true on success, false when the JSON is malformed or doesn't carry the
|
|
257
|
+
* expected MudletMap shape (no `rooms` / `areas` records).
|
|
258
|
+
*/
|
|
259
|
+
loadFromJsonString(json: string): boolean;
|
|
260
|
+
toMudletMap(): MudletMap;
|
|
261
|
+
/**
|
|
262
|
+
* Mudlet `createRoomID([minimum])` — returns the smallest unused room id
|
|
263
|
+
* at or above `minimum` (or above the running cursor if not given). The
|
|
264
|
+
* id isn't reserved; a follow-up `addRoom(id)` is what actually claims it.
|
|
265
|
+
*/
|
|
266
|
+
createRoomID(minimum?: number): number;
|
|
267
|
+
/**
|
|
268
|
+
* Mudlet `addRoom(roomID [, areaID])`. The room is always created; the
|
|
269
|
+
* areaID is a placement *request*. An areaID naming an area that doesn't
|
|
270
|
+
* exist is not created on demand (Mudlet's TLuaInterpreter::addRoom parks
|
|
271
|
+
* the room in the default area -1 and reports the failed placement as
|
|
272
|
+
* `(nil, errMsg)` instead), so this returns the message for the binding to
|
|
273
|
+
* shape and leaves the room in -1.
|
|
274
|
+
*
|
|
275
|
+
* Returns false only when the roomID is already taken.
|
|
276
|
+
*/
|
|
277
|
+
addRoom(id: number, areaId?: number): boolean | {
|
|
278
|
+
err: string;
|
|
279
|
+
};
|
|
280
|
+
deleteRoom(id: number): boolean;
|
|
281
|
+
roomExists(id: number): boolean;
|
|
282
|
+
/** Mudlet `getPlayerRoom()` — id of the player's current room, or null
|
|
283
|
+
* when unset or the room no longer exists. Strict: no fallback room (Mudlet
|
|
284
|
+
* keeps the data-layer value empty until centerview/movement sets it). The
|
|
285
|
+
* view's "no known location" fallback lives in {@link getFallbackRoomId}. */
|
|
286
|
+
getPlayerRoom(): number | null;
|
|
287
|
+
/** Display-only fallback room for the map view when there is no real player
|
|
288
|
+
* position (getPlayerRoom() is null). Mudlet's T2DMap paints the marker on
|
|
289
|
+
* getRoomIDList().constFirst() — hash-arbitrary, hence its `randomRoom`
|
|
290
|
+
* name. We prefer room 1 (stable and what users expect), then the lowest
|
|
291
|
+
* existing id so the marker still lands somewhere on odd maps. null only
|
|
292
|
+
* when the map is empty. Never feeds getPlayerRoom — it's purely for
|
|
293
|
+
* centering + the marker. */
|
|
294
|
+
getFallbackRoomId(): number | null;
|
|
295
|
+
/** Mirror of Mudlet's `mRoomIdHash[host.getName()] = roomId` from centerview.
|
|
296
|
+
* centerView validates the id exists before calling this (Mudlet rejects
|
|
297
|
+
* unknown ids), so the stored id is normally live; getPlayerRoom still does
|
|
298
|
+
* an existence check on read in case the room is deleted afterwards. */
|
|
299
|
+
setPlayerRoom(id: number): void;
|
|
300
|
+
getRoomName(id: number): string | undefined;
|
|
301
|
+
setRoomName(id: number, name: string): boolean;
|
|
302
|
+
/** Mudlet `getRoomArea(id)` — area id of the room, or -1 if the room is missing. */
|
|
303
|
+
/** Mudlet `getRoomArea(roomID)` — the area the room belongs to (-1 is the
|
|
304
|
+
* default area), or undefined when the room itself doesn't exist. */
|
|
305
|
+
getRoomArea(id: number): number | undefined;
|
|
306
|
+
/**
|
|
307
|
+
* Mudlet `setRoomArea(roomID|{ids}, areaID|areaName)`. Accepts either a
|
|
308
|
+
* single room ID or an array of room IDs, and either a numeric area ID or
|
|
309
|
+
* an area-name string.
|
|
310
|
+
*
|
|
311
|
+
* The area must already exist — Mudlet does not create one on demand, and
|
|
312
|
+
* an areaID below 1 is refused outright (resetRoomArea is the documented
|
|
313
|
+
* way to park a room in the default area -1). Every refusal is a
|
|
314
|
+
* `(nil, errMsg)` return there, so the message is handed back here and null
|
|
315
|
+
* means success (see {@link setDoor}).
|
|
316
|
+
*/
|
|
317
|
+
setRoomArea(id: number | number[], areaIdOrName: number | string): string | null;
|
|
318
|
+
/** Resolve area-id-or-name → numeric id, or undefined if unknown. */
|
|
319
|
+
private resolveAreaId;
|
|
320
|
+
getRoomCoordinates(id: number): [number, number, number] | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* Mudlet `searchRoom(roomID | roomName[, caseSensitive[, exactMatch]])` —
|
|
323
|
+
* by id returns the room's name (or `undefined` for a miss); by name returns
|
|
324
|
+
* `{ [roomID] = roomName }` for every room whose name matches. Matching is a
|
|
325
|
+
* case-insensitive substring search by default; `caseSensitive`/`exactMatch`
|
|
326
|
+
* tighten it. The binding re-keys the wasmoon-stringified ids back to ints.
|
|
327
|
+
*/
|
|
328
|
+
searchRoom(arg: number | string, caseSensitive?: boolean, exactMatch?: boolean): string | undefined | Record<number, string>;
|
|
329
|
+
/**
|
|
330
|
+
* Mudlet `searchRoomUserData([key[, value]])`:
|
|
331
|
+
* • no args → sorted list of every user-data key used by any room;
|
|
332
|
+
* • key only → sorted list of every distinct value stored under that key;
|
|
333
|
+
* • key + value → sorted list of room ids where that key equals value.
|
|
334
|
+
*/
|
|
335
|
+
searchRoomUserData(key?: string, value?: string): string[] | number[];
|
|
336
|
+
setRoomCoordinates(id: number, x: number, y: number, z: number): boolean;
|
|
337
|
+
/**
|
|
338
|
+
* Mudlet `getRoomEnv(id)` — environment color id, or -1 if the room is
|
|
339
|
+
* missing. (Rooms without an env override still report their stored value.)
|
|
340
|
+
*/
|
|
341
|
+
getRoomEnv(id: number): number;
|
|
342
|
+
setRoomEnv(id: number, env: number): boolean;
|
|
343
|
+
getRoomChar(id: number): string;
|
|
344
|
+
setRoomChar(id: number, char: string): boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Mudlet `lockRoom(roomID, lockIfTrue)` — mark a room as locked so
|
|
347
|
+
* pathfinding routes around it (see {@link findPath}). Returns true on
|
|
348
|
+
* success, false when the room doesn't exist.
|
|
349
|
+
*/
|
|
350
|
+
lockRoom(id: number, lock: boolean): boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Mudlet `roomLocked(roomID)` — true when the room is locked, false when
|
|
353
|
+
* unlocked or the room doesn't exist (Mudlet returns nil for a missing
|
|
354
|
+
* room; the Lua binding re-shapes that case).
|
|
355
|
+
*/
|
|
356
|
+
roomLocked(id: number): boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Mudlet `getRoomWeight(roomID)` — the room's pathfinding weight (cost to
|
|
359
|
+
* enter). Returns `undefined` when the room doesn't exist; the Lua binding
|
|
360
|
+
* turns that into Mudlet's "no return value" miss.
|
|
361
|
+
*/
|
|
362
|
+
getRoomWeight(id: number): number | undefined;
|
|
363
|
+
/**
|
|
364
|
+
* Mudlet `setRoomWeight(roomID, weight)` — set the room's pathfinding
|
|
365
|
+
* weight. Mudlet rejects negative weights (0 is allowed). Returns true on
|
|
366
|
+
* success, false when the room doesn't exist or the weight is invalid.
|
|
367
|
+
*/
|
|
368
|
+
setRoomWeight(id: number, weight: number): boolean;
|
|
369
|
+
/** Mudlet `getRoomsByPosition(areaID, x, y, z)` — undefined for an unknown
|
|
370
|
+
* area, matching {@link getAreaRooms}. */
|
|
371
|
+
getRoomsByPosition(areaId: number, x: number, y: number, z: number): number[] | undefined;
|
|
372
|
+
getRoomIDbyHash(hash: string): number | undefined;
|
|
373
|
+
setRoomIDbyHash(id: number, hash: string): void;
|
|
374
|
+
getRoomHashByID(id: number): string | undefined;
|
|
375
|
+
/** Mudlet `getRoomExits(roomID)` — `{ direction = toRoomID }`. Undefined
|
|
376
|
+
* for an unknown room (Mudlet pushes nothing at all in that case). */
|
|
377
|
+
getRoomExits(id: number): Record<string, number> | undefined;
|
|
378
|
+
/**
|
|
379
|
+
* Mudlet `setExit(from, to, dir)` — `dir` is either a 1-12 integer or a
|
|
380
|
+
* direction name ("north"/"n"/etc.). Returns true on success.
|
|
381
|
+
*/
|
|
382
|
+
setExit(from: number, to: number, dir: number | string): boolean;
|
|
383
|
+
/** Mudlet `getExitStubs(roomID)` — the room's stub direction codes, or
|
|
384
|
+
* undefined for an unknown room (reported as `(nil, errMsg)` in Lua). */
|
|
385
|
+
getExitStubs(id: number): number[] | undefined;
|
|
386
|
+
/**
|
|
387
|
+
* Mudlet `getExitStubsNames(roomID)` — the room's exit stubs as direction
|
|
388
|
+
* names ("north"/"northeast"/…, or "other" for the special-exit code 13)
|
|
389
|
+
* rather than the numeric codes `getExitStubs` returns. Returns `undefined`
|
|
390
|
+
* when the room doesn't exist so the binding can hand back Mudlet's
|
|
391
|
+
* `(false, errMsg)`.
|
|
392
|
+
*/
|
|
393
|
+
getExitStubsNames(id: number): string[] | undefined;
|
|
394
|
+
/** Mudlet `findPath(from, to)` — see {@link findPath} in `./pathfinding`
|
|
395
|
+
* for the algorithm (A* with Mudlet's Euclidean-or-1 heuristic). */
|
|
396
|
+
findPath(from: number, to: number): PathfindResult | null;
|
|
397
|
+
/** Mudlet `setExitWeightFilter(fn|nil)` — the callback consulted for every
|
|
398
|
+
* candidate exit during pathfinding, or null when none is installed. Set
|
|
399
|
+
* by the Lua binding; read only by {@link findPath}. */
|
|
400
|
+
setExitWeightFilter(filter: ExitWeightFilter | null): void;
|
|
401
|
+
setExitStub(id: number, dir: number | string, set: boolean): boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Mudlet `lockExit(roomID, direction, lockIfTrue)` — toggle a stock-direction
|
|
404
|
+
* exit lock so pathfinding (see `pathfinding.ts`) routes around it. `dir`
|
|
405
|
+
* accepts the 1-12 integer code or a direction name ("north"/"n"/etc.).
|
|
406
|
+
* Returns true on success, false when the room is missing or `dir` doesn't
|
|
407
|
+
* resolve.
|
|
408
|
+
*/
|
|
409
|
+
lockExit(id: number, dir: number | string, lock: boolean): boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Mudlet `hasExitLock(roomID, direction)` — whether the stock-direction exit
|
|
412
|
+
* is currently locked. Returns false for an unlocked exit or when the room
|
|
413
|
+
* doesn't exist (Lua binding maps the latter to `(false, errMsg)`).
|
|
414
|
+
*/
|
|
415
|
+
hasExitLock(id: number, dir: number | string): boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Mudlet `addSpecialExit(exitRoomID, entranceRoomID, command)`. Both rooms
|
|
418
|
+
* must exist and the command must be non-empty; each failure is a
|
|
419
|
+
* `(nil, errMsg)` return in Mudlet, so the message is handed back here and
|
|
420
|
+
* null means success (same shape as {@link setDoor}).
|
|
421
|
+
*/
|
|
422
|
+
addSpecialExit(from: number, to: number, cmd: string): string | null;
|
|
423
|
+
/** Mudlet `removeSpecialExit(exitRoomID, command)` — see {@link addSpecialExit}
|
|
424
|
+
* for the message/null return shape. */
|
|
425
|
+
removeSpecialExit(from: number, cmd: string): string | null;
|
|
426
|
+
getSpecialExitsSwap(id: number): Record<string, number>;
|
|
427
|
+
/**
|
|
428
|
+
* Mudlet `getSpecialExits(roomID [, listAllExits])` — special exits keyed by
|
|
429
|
+
* destination room id: `{ [exitRoomID] = { [command] = "0"|"1" } }`, where
|
|
430
|
+
* "1" marks a locked exit. When several commands lead to the same room and
|
|
431
|
+
* `listAllExits` is false (the default), only the lowest-weight command is
|
|
432
|
+
* reported; pass `true` to list every command. Returns `{}` for a missing
|
|
433
|
+
* room. The lock flag follows this client's data model (special-exit locks
|
|
434
|
+
* are tracked by destination room id, see pathfinding.ts).
|
|
435
|
+
*/
|
|
436
|
+
getSpecialExits(id: number, listAllExits?: boolean): Record<number, Record<string, string>> | undefined;
|
|
437
|
+
/**
|
|
438
|
+
* Mudlet `getExitWeights(roomID)` — per-exit weight overrides as
|
|
439
|
+
* `{ [exit] = weight }`. Stock exits are keyed by their short direction name
|
|
440
|
+
* ("n"/"ne"/"up"/…), special exits by the verbatim command. Returns `{}`
|
|
441
|
+
* when the room has no overrides or doesn't exist.
|
|
442
|
+
*/
|
|
443
|
+
getExitWeights(id: number): Record<string, number>;
|
|
444
|
+
/**
|
|
445
|
+
* Mudlet `setExitWeight(roomID, exitCommand, weight)` — override the weight
|
|
446
|
+
* of a single exit. `exitCommand` is a stock direction (1-12 or a name) or a
|
|
447
|
+
* special-exit command. A weight of 0 resets the override (pathfinding falls
|
|
448
|
+
* back to the destination room's weight); negative weights are rejected.
|
|
449
|
+
* Each refusal is a `(nil, errMsg)` return in Mudlet, so the message is
|
|
450
|
+
* handed back here and null means success (see {@link setDoor}).
|
|
451
|
+
*/
|
|
452
|
+
setExitWeight(id: number, exitCommand: number | string, weight: number): string | null;
|
|
453
|
+
/**
|
|
454
|
+
* Mudlet `clearSpecialExits(roomID)` — remove every special exit from the
|
|
455
|
+
* room, along with the locks, doors and custom lines keyed by those
|
|
456
|
+
* commands (Mudlet's TRoom::clearSpecialExits does the same cleanup).
|
|
457
|
+
* Returns true on success, false when the room doesn't exist.
|
|
458
|
+
*/
|
|
459
|
+
clearSpecialExits(id: number): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Mudlet `lockSpecialExit(fromRoomID, toRoomID, command, lockIfTrue)` — lock
|
|
462
|
+
* or unlock a special exit so pathfinding skips it. Mudlet ignores the
|
|
463
|
+
* `toRoomID` argument (kept for signature compatibility); the lock is keyed
|
|
464
|
+
* by the COMMAND (TRoom::mSpecialExitLocks is a `QSet<QString>`), so two
|
|
465
|
+
* commands leading to the same room lock independently. Returns true on
|
|
466
|
+
* success or an error string (room missing / no such command) the binding
|
|
467
|
+
* turns into `(nil, errMsg)`.
|
|
468
|
+
*/
|
|
469
|
+
lockSpecialExit(fromId: number, command: string, lock: boolean): true | string;
|
|
470
|
+
/**
|
|
471
|
+
* Per-command special-exit locks for a room, created on first use. Seeded
|
|
472
|
+
* from the destination-keyed list a loaded map arrives with, since the
|
|
473
|
+
* binary reader collapses Mudlet's per-command locks down to the rooms they
|
|
474
|
+
* lead to (`MudletRoom.mSpecialExitLocks` is `number[]`) — so an imported
|
|
475
|
+
* map starts out with every command to a locked destination locked, exactly
|
|
476
|
+
* as it renders today, and diverges only as scripts lock individual
|
|
477
|
+
* commands.
|
|
478
|
+
*/
|
|
479
|
+
private lockedSpecialCommands;
|
|
480
|
+
/** Rebuild a room's destination-keyed `mSpecialExitLocks` from the
|
|
481
|
+
* authoritative per-command set. */
|
|
482
|
+
private syncSpecialExitLockMirror;
|
|
483
|
+
/**
|
|
484
|
+
* Mudlet `hasSpecialExitLock(fromRoomID, toRoomID, command)` — whether the
|
|
485
|
+
* special exit is locked. As with `lockSpecialExit`, the `toRoomID` argument
|
|
486
|
+
* is ignored and the lock is resolved via the command's destination room.
|
|
487
|
+
* Returns the boolean lock state, or an error string (room missing / no such
|
|
488
|
+
* command) the binding turns into `(false, errMsg)`.
|
|
489
|
+
*/
|
|
490
|
+
hasSpecialExitLock(fromId: number, command: string): boolean | string;
|
|
491
|
+
/** Whether one special-exit COMMAND is locked. */
|
|
492
|
+
isSpecialExitLocked(roomId: number, command: string): boolean;
|
|
493
|
+
/**
|
|
494
|
+
* Mudlet `getAllRoomEntrances(roomID)` — every room that has an exit (stock
|
|
495
|
+
* or special) leading into this room, as a sorted, de-duplicated id list.
|
|
496
|
+
* Returns `undefined` when the room doesn't exist.
|
|
497
|
+
*/
|
|
498
|
+
getAllRoomEntrances(id: number): number[] | undefined;
|
|
499
|
+
/**
|
|
500
|
+
* Mudlet `connectExitStub(fromID, direction)` / `(fromID, toID[, direction])`
|
|
501
|
+
* — hook up an existing exit stub to another room, wiring the reverse stub
|
|
502
|
+
* back too. Dispatches the three Mudlet call forms:
|
|
503
|
+
* • explicit `(fromID, toID, direction)` — connect the stub in `direction`.
|
|
504
|
+
* • direction only — find the nearest in-area room sitting in that
|
|
505
|
+
* direction that has a matching reverse stub.
|
|
506
|
+
* • toID only — connect when exactly one pair of reverse stubs exists.
|
|
507
|
+
* A bare numeric second argument is resolved to a direction or a toID by
|
|
508
|
+
* checking what actually exists (a stub in that direction vs. a room with
|
|
509
|
+
* that id); genuinely ambiguous cases return an error asking for a string
|
|
510
|
+
* direction. Returns true on success or an error string.
|
|
511
|
+
*/
|
|
512
|
+
connectExitStub(fromId: number, arg2: number | string, arg3?: number | string): true | string;
|
|
513
|
+
/** connectExitStub direction-only form (Mudlet connectExitStubByDirection). */
|
|
514
|
+
private connectStubByDir;
|
|
515
|
+
/** connectExitStub toID-only form (Mudlet connectExitStubByToId). */
|
|
516
|
+
private connectStubByTo;
|
|
517
|
+
/** connectExitStub explicit form (Mudlet connectExitStubByDirectionAndToId). */
|
|
518
|
+
private connectStubByDirAndTo;
|
|
519
|
+
/**
|
|
520
|
+
* Mudlet `getCustomLines(roomID)` — per-direction custom exit lines drawn
|
|
521
|
+
* on the map. Returns `undefined` when the room doesn't exist so the Lua
|
|
522
|
+
* wrapper can hand back `nil`; otherwise a `{ dir = { attributes, points } }`
|
|
523
|
+
* table (empty when the room has no custom lines). Points carry the room's
|
|
524
|
+
* Z because Mudlet stores only X/Y per point and uses the owning room's Z
|
|
525
|
+
* for rendering.
|
|
526
|
+
*/
|
|
527
|
+
getCustomLines(id: number): Record<string, {
|
|
528
|
+
attributes: {
|
|
529
|
+
color: {
|
|
530
|
+
r: number;
|
|
531
|
+
g: number;
|
|
532
|
+
b: number;
|
|
533
|
+
};
|
|
534
|
+
style: string;
|
|
535
|
+
arrow: boolean;
|
|
536
|
+
};
|
|
537
|
+
points: Array<{
|
|
538
|
+
x: number;
|
|
539
|
+
y: number;
|
|
540
|
+
z: number;
|
|
541
|
+
}>;
|
|
542
|
+
}> | undefined;
|
|
543
|
+
/**
|
|
544
|
+
* Mudlet `removeCustomLine(roomID, direction)` — drop the custom exit line
|
|
545
|
+
* for a direction (stock direction number/name or a special-exit command).
|
|
546
|
+
* The key form stored varies by map source, so we try the raw command, the
|
|
547
|
+
* canonical long name and the short name. Returns true when a line was
|
|
548
|
+
* removed, false when the room or the line doesn't exist.
|
|
549
|
+
*/
|
|
550
|
+
removeCustomLine(id: number, dir: number | string): boolean;
|
|
551
|
+
/**
|
|
552
|
+
* Mudlet `addCustomLine(roomID, id_to, direction, style, color, arrow)`.
|
|
553
|
+
* `target` is either a destination room id (line drawn to that room's
|
|
554
|
+
* position, which must be in the same area) or an explicit list of
|
|
555
|
+
* `[x, y, z]` points. `style` is one of Mudlet's pen-style names
|
|
556
|
+
* ("solid line", "dot line", "dash line", "dash dot line",
|
|
557
|
+
* "dash dot dot line"). Returns false when the room/target is invalid, the
|
|
558
|
+
* areas differ, no points are supplied, or the style name is unknown.
|
|
559
|
+
*/
|
|
560
|
+
addCustomLine(id: number, target: number | Array<[number, number, number]>, direction: number | string, style: string, color: {
|
|
561
|
+
r: number;
|
|
562
|
+
g: number;
|
|
563
|
+
b: number;
|
|
564
|
+
}, arrow: boolean): string | null;
|
|
565
|
+
/**
|
|
566
|
+
* Whether a room has a stock exit in `dirInt`, or a special exit whose
|
|
567
|
+
* command is `key`. Mirrors Mudlet's TRoom::hasExitOrSpecialExit, which
|
|
568
|
+
* addCustomLine consults before drawing — a custom line is a decoration for
|
|
569
|
+
* an existing exit, not a way to invent one.
|
|
570
|
+
*/
|
|
571
|
+
private hasExitOrSpecialExit;
|
|
572
|
+
/** Mudlet `getDoors(roomID)` — `{ exitCmd = doorType }`. Undefined for an
|
|
573
|
+
* unknown room, which the Lua binding reports as `(nil, errMsg)`. */
|
|
574
|
+
getDoors(id: number): Record<string, number> | undefined;
|
|
575
|
+
/**
|
|
576
|
+
* Mudlet `setDoor(roomID, exitCmd, status)`. exitCmd is either a stock
|
|
577
|
+
* direction — spelled exactly as Mudlet keys its door map ("n"/"ne"/…/
|
|
578
|
+
* "up"/"down"/"in"/"out"), which is also what a saved map carries — or an
|
|
579
|
+
* arbitrary special-exit command string, used as-is.
|
|
580
|
+
*
|
|
581
|
+
* Mudlet refuses a direction the room has no exit *or stub* for, and a
|
|
582
|
+
* status outside 0-3; both are `(nil, errMsg)` returns rather than a bare
|
|
583
|
+
* false, so the failure is reported here as the message string and success
|
|
584
|
+
* as null (same shape as {@link addCustomLine}).
|
|
585
|
+
*/
|
|
586
|
+
setDoor(id: number, dir: number | string, val: number): string | null;
|
|
587
|
+
/**
|
|
588
|
+
* Mudlet `getRoomUserData(id, key)` — returns the stored value, or
|
|
589
|
+
* `undefined` when either the room or the key is missing. The Lua binding
|
|
590
|
+
* differentiates the two cases when the script asks for the full-error
|
|
591
|
+
* shape (`fullErr=true`).
|
|
592
|
+
*/
|
|
593
|
+
getRoomUserData(id: number, key: string): string | undefined;
|
|
594
|
+
setRoomUserData(id: number, key: string, value: string): boolean;
|
|
595
|
+
/**
|
|
596
|
+
* Mudlet `getRoomUserDataKeys(id)` — returns the user-data keys for the
|
|
597
|
+
* room (possibly empty) or `undefined` when the room itself does not
|
|
598
|
+
* exist. The Bridge.lua wrapper converts the JS array to a 1-indexed Lua
|
|
599
|
+
* table and the `undefined` miss to `nil`.
|
|
600
|
+
*/
|
|
601
|
+
getRoomUserDataKeys(id: number): string[] | undefined;
|
|
602
|
+
/**
|
|
603
|
+
* Mudlet `getAllRoomUserData(roomID)` — every key/value pair stored on the
|
|
604
|
+
* room as `{ key = value }`. Returns `undefined` when the room itself does
|
|
605
|
+
* not exist (the Lua binding turns that into Mudlet's `(false, errMsg)`).
|
|
606
|
+
*/
|
|
607
|
+
getAllRoomUserData(id: number): Record<string, string> | undefined;
|
|
608
|
+
/**
|
|
609
|
+
* Mudlet `clearRoomUserData(roomID)` — wipe every user-data entry on the
|
|
610
|
+
* room. Returns `true` when something was cleared, `false` when it was
|
|
611
|
+
* already empty, and `undefined` when the room doesn't exist.
|
|
612
|
+
*/
|
|
613
|
+
clearRoomUserData(id: number): boolean | undefined;
|
|
614
|
+
/**
|
|
615
|
+
* Mudlet `clearRoomUserDataItem(roomID, key)` — drop a single user-data
|
|
616
|
+
* key. Returns `true` when the key existed, `false` when it didn't, and
|
|
617
|
+
* `undefined` when the room doesn't exist.
|
|
618
|
+
*/
|
|
619
|
+
clearRoomUserDataItem(id: number, key: string): boolean | undefined;
|
|
620
|
+
/**
|
|
621
|
+
* Mudlet `resetRoomArea(roomID)` — move the room back to the default "void"
|
|
622
|
+
* area (-1). Returns `true` on success, `undefined` when the room doesn't
|
|
623
|
+
* exist (Lua → `(nil, errMsg)`). Doesn't go through {@link setRoomArea},
|
|
624
|
+
* which refuses an areaID below 1 — resetRoomArea is Mudlet's documented
|
|
625
|
+
* way to reach the default area.
|
|
626
|
+
*/
|
|
627
|
+
resetRoomArea(id: number): boolean | undefined;
|
|
628
|
+
/**
|
|
629
|
+
* Mudlet `getMapUserData(key)` — returns the stored value, or `undefined`
|
|
630
|
+
* when the key has never been set. The Lua binding turns the missing case
|
|
631
|
+
* into Mudlet's `(false, errMsg)` 2-tuple.
|
|
632
|
+
*/
|
|
633
|
+
getMapUserData(key: string): string | undefined;
|
|
634
|
+
setMapUserData(key: string, value: string): void;
|
|
635
|
+
/**
|
|
636
|
+
* Mudlet `clearMapUserData()` (no args) wipes the entire map-level user
|
|
637
|
+
* data dict — used by scripts that want a clean slate when re-importing
|
|
638
|
+
* data. The single-key form is exposed under `clearMapUserDataItem` to
|
|
639
|
+
* match Mudlet's split.
|
|
640
|
+
*/
|
|
641
|
+
clearMapUserData(): boolean;
|
|
642
|
+
clearMapUserDataItem(key: string): boolean;
|
|
643
|
+
getAllMapUserData(): Record<string, string>;
|
|
644
|
+
/** Replace the entire map-level user-data dict (e.g. after loading a .dat). */
|
|
645
|
+
loadMapUserData(data: Record<string, string> | undefined | null): void;
|
|
646
|
+
/**
|
|
647
|
+
* Mudlet `addAreaName(name)` returns a numeric area ID on success or
|
|
648
|
+
* `(false, errMsg)` when the name is empty or already in use.
|
|
649
|
+
*/
|
|
650
|
+
addAreaName(rawName: string): number | {
|
|
651
|
+
ok: false;
|
|
652
|
+
err: string;
|
|
653
|
+
};
|
|
654
|
+
/**
|
|
655
|
+
* Mudlet `deleteArea(areaID|areaName)` — deletes the area record and the
|
|
656
|
+
* rooms it contained. The default area cannot be deleted and an areaID
|
|
657
|
+
* below 1 names it, so every refusal (unknown id/name, empty name, the
|
|
658
|
+
* default area) is a `(nil, errMsg)` return there: the message is handed
|
|
659
|
+
* back here and null means success (see {@link setDoor}).
|
|
660
|
+
*/
|
|
661
|
+
deleteArea(idOrName: number | string): string | null;
|
|
662
|
+
getAreaTable(): Record<string, number>;
|
|
663
|
+
/**
|
|
664
|
+
* Mudlet `getAreaTableSwap()` — the inverse of {@link getAreaTable}: every
|
|
665
|
+
* area keyed by id → name (`{ [areaID] = name }`). The Lua wrapper re-keys
|
|
666
|
+
* the wasmoon-stringified ids back to integers.
|
|
667
|
+
*/
|
|
668
|
+
getAreaTableSwap(): Record<number, string>;
|
|
669
|
+
/** True when an area with this id exists. */
|
|
670
|
+
hasArea(id: number): boolean;
|
|
671
|
+
/** Mudlet's T2DMap::csmDefaultXYZoom / csmMinXYZoom. */
|
|
672
|
+
static readonly DEFAULT_MAP_ZOOM = 20;
|
|
673
|
+
static readonly MIN_MAP_ZOOM = 3;
|
|
674
|
+
/**
|
|
675
|
+
* Mudlet `getAreaUserData(areaID, key)` — the stored value, or `undefined`
|
|
676
|
+
* when the key is absent. Area existence is checked by the binding via
|
|
677
|
+
* {@link hasArea} so it can distinguish the two miss cases.
|
|
678
|
+
*/
|
|
679
|
+
getAreaUserData(id: number, key: string): string | undefined;
|
|
680
|
+
/**
|
|
681
|
+
* Mudlet `setAreaUserData(areaID, key, value)` — store a string value on
|
|
682
|
+
* the area. Returns `false` when the area doesn't exist.
|
|
683
|
+
*/
|
|
684
|
+
setAreaUserData(id: number, key: string, value: string): boolean;
|
|
685
|
+
/**
|
|
686
|
+
* Mudlet `getAllAreaUserData(areaID)` — every key/value pair on the area.
|
|
687
|
+
* Returns `undefined` when the area doesn't exist.
|
|
688
|
+
*/
|
|
689
|
+
getAllAreaUserData(id: number): Record<string, string> | undefined;
|
|
690
|
+
/**
|
|
691
|
+
* Mudlet `clearAreaUserData(areaID)` — wipe every entry. Returns `true`
|
|
692
|
+
* when something was cleared, `false` when already empty, `undefined` when
|
|
693
|
+
* the area doesn't exist.
|
|
694
|
+
*/
|
|
695
|
+
clearAreaUserData(id: number): boolean | undefined;
|
|
696
|
+
/**
|
|
697
|
+
* Mudlet `clearAreaUserDataItem(areaID, key)` — drop a single key. Returns
|
|
698
|
+
* `true` when it existed, `false` when it didn't, `undefined` when the area
|
|
699
|
+
* doesn't exist.
|
|
700
|
+
*/
|
|
701
|
+
clearAreaUserDataItem(id: number, key: string): boolean | undefined;
|
|
702
|
+
/**
|
|
703
|
+
* Mudlet `searchAreaUserData([key[, value]])` — the area-level analogue of
|
|
704
|
+
* {@link searchRoomUserData}: no args → all keys; key only → all distinct
|
|
705
|
+
* values for that key; key + value → sorted area ids where key equals value.
|
|
706
|
+
*/
|
|
707
|
+
searchAreaUserData(key?: string, value?: string): string[] | number[];
|
|
708
|
+
/**
|
|
709
|
+
* Per-area 2D-map zoom stored in the map file (area userData under
|
|
710
|
+
* {@link AREA_ZOOM_KEY}). Returns `undefined` when the area is missing or has
|
|
711
|
+
* no saved zoom (caller falls back to fitArea). Mirrors Mudlet's treatment of
|
|
712
|
+
* zoom as map data rather than client config.
|
|
713
|
+
*/
|
|
714
|
+
getAreaZoom(id: number): number | undefined;
|
|
715
|
+
/**
|
|
716
|
+
* Save the per-area zoom into the area's userData so it round-trips with the
|
|
717
|
+
* map file. Deliberately does NOT call {@link notify} — zoom is a view-only
|
|
718
|
+
* datum that no renderer reads from the store snapshot, and the camera-move
|
|
719
|
+
* handler calls this on every wheel tick; notifying would rebuild the whole
|
|
720
|
+
* scene on each one. The value persists to IndexedDB the next time the map is
|
|
721
|
+
* serialised (saveMap → toMudletMapForSave). Returns false when the area is
|
|
722
|
+
* missing or the zoom isn't a positive finite number.
|
|
723
|
+
*/
|
|
724
|
+
setAreaZoom(id: number, zoom: number): boolean;
|
|
725
|
+
/**
|
|
726
|
+
* Mudlet `getGridMode(areaID)` — whether the area is drawn on a fixed grid
|
|
727
|
+
* (rooms snapped to integer coordinates, no custom exit lines). Returns
|
|
728
|
+
* `undefined` when the area doesn't exist.
|
|
729
|
+
*/
|
|
730
|
+
getGridMode(id: number): boolean | undefined;
|
|
731
|
+
/**
|
|
732
|
+
* Mudlet `setGridMode(areaID, true/false)` — toggle the area's grid layout.
|
|
733
|
+
* Returns `false` when the area doesn't exist.
|
|
734
|
+
*/
|
|
735
|
+
setGridMode(id: number, gridMode: boolean): boolean;
|
|
736
|
+
/**
|
|
737
|
+
* Mudlet `getRoomAreaName(areaID|areaName)` — bidirectional. Given an ID
|
|
738
|
+
* returns the name; given a name returns the ID. Returns undefined when
|
|
739
|
+
* the input cannot be resolved.
|
|
740
|
+
*/
|
|
741
|
+
getRoomAreaName(idOrName: number | string): string | number | undefined;
|
|
742
|
+
/**
|
|
743
|
+
* Mudlet `setAreaName(areaID|areaName, newName) → true | false, errMsg`.
|
|
744
|
+
* Rejects empty new names and names that conflict with another area.
|
|
745
|
+
*/
|
|
746
|
+
setAreaName(idOrName: number | string, newName: string): boolean | {
|
|
747
|
+
ok: false;
|
|
748
|
+
err: string;
|
|
749
|
+
};
|
|
750
|
+
/** Mudlet `getAreaRooms(areaID)` — the area's room ids, or undefined for an
|
|
751
|
+
* unknown area (Mudlet pushes nil, with no message). */
|
|
752
|
+
getAreaRooms(areaId: number): number[] | undefined;
|
|
753
|
+
/**
|
|
754
|
+
* Mudlet `getCollisionLocationsInArea(areaID)` — the (x, y, z) coordinates
|
|
755
|
+
* in an area occupied by more than one room, which render on top of each
|
|
756
|
+
* other on the 2D map. Mirrors TArea::getCollisionNodes (TArea.cpp).
|
|
757
|
+
* Returns null for an unknown area so the Lua wrapper can produce Mudlet's
|
|
758
|
+
* (nil, errMsg) pair; an area with no overlaps yields an empty list.
|
|
759
|
+
*/
|
|
760
|
+
getCollisionLocationsInArea(areaId: number): Array<[number, number, number]> | null;
|
|
761
|
+
/**
|
|
762
|
+
* Room to center the 2D view on when an area is opened with no player room
|
|
763
|
+
* in it, mirroring Mudlet's T2DMap::switchArea (T2DMap.cpp). Mudlet does NOT
|
|
764
|
+
* center on the bounding-box midpoint (which can land on empty space for
|
|
765
|
+
* sparse / L-shaped areas) — it:
|
|
766
|
+
* 1. picks a z-level: `preferredZ` if the area has rooms there, otherwise
|
|
767
|
+
* the level carrying the most rooms (lowest z wins ties),
|
|
768
|
+
* 2. takes the geometric centroid (mean x/y) of that level's rooms,
|
|
769
|
+
* 3. returns the room nearest that centroid.
|
|
770
|
+
* So the view always lands on an actual room. null when the area has no
|
|
771
|
+
* rooms (Mudlet falls back to 0,0,0 in that case).
|
|
772
|
+
*/
|
|
773
|
+
getAreaCenterRoomId(areaId: number, preferredZ?: number): number | null;
|
|
774
|
+
/**
|
|
775
|
+
* Mudlet `getAreaExits(areaID[, fullData])` — exits crossing out of the area.
|
|
776
|
+
* Without full data, a sorted list of the area's rooms that have any exit to
|
|
777
|
+
* another area. With full data, `{ [fromRoomID] = { [exitName] = toRoomID } }`,
|
|
778
|
+
* where `exitName` is the long direction name for stock exits or the verbatim
|
|
779
|
+
* command for special exits. Returns `undefined` when the area is unknown.
|
|
780
|
+
*/
|
|
781
|
+
getAreaExits(areaId: number, fullData?: boolean): number[] | Record<number, Record<string, number>> | undefined;
|
|
782
|
+
getRooms(): Record<number, string>;
|
|
783
|
+
/**
|
|
784
|
+
* Mudlet `getMapLabels(areaID)` — returns `{ [labelID] = labelText }` for
|
|
785
|
+
* every label in the area, or an empty object if the area has none / is
|
|
786
|
+
* unknown. Each `MudletLabel.id` is the QMap key Mudlet uses internally,
|
|
787
|
+
* which is also what `deleteMapLabel` expects.
|
|
788
|
+
*/
|
|
789
|
+
getMapLabels(areaId: number): Record<number, string>;
|
|
790
|
+
/**
|
|
791
|
+
* Mudlet `getMapLabel(areaID, labelID|labelText)`:
|
|
792
|
+
* - by ID (number): single flat properties record, or "noid" sentinel if the
|
|
793
|
+
* area has labels but not that ID
|
|
794
|
+
* - by text (string): `{[labelID]: properties}` for every label whose text
|
|
795
|
+
* matches exactly (possibly empty)
|
|
796
|
+
* - if the area has no labels at all: empty `multi: {}` regardless of key form
|
|
797
|
+
* (matches Mudlet's early-return)
|
|
798
|
+
* - if the area is missing: "noarea" sentinel
|
|
799
|
+
*
|
|
800
|
+
* Bridge.lua dispatches the sentinels into Mudlet's `(false, errMsg)` shape.
|
|
801
|
+
*/
|
|
802
|
+
getMapLabel(areaId: number, key: number | string): MapLabelLookup;
|
|
803
|
+
/** Next free label id within an area — Mudlet keys labels by an integer that
|
|
804
|
+
* is unique per area and starts at 0. */
|
|
805
|
+
private nextLabelId;
|
|
806
|
+
/**
|
|
807
|
+
* Mudlet `createMapLabel(areaID, text, posx, posy, posz, fgRed, fgGreen,
|
|
808
|
+
* fgBlue, bgRed, bgGreen, bgBlue [, zoom [, fontSize [, showOnTop [,
|
|
809
|
+
* noScaling]]]])`. Adds a text label to the area and returns its new id, or
|
|
810
|
+
* -1 if the area does not exist. (`zoom`/`fontSize` are accepted for
|
|
811
|
+
* signature parity — mudix stores labels but the renderer does not yet draw
|
|
812
|
+
* them, mirroring how labels loaded from binary maps are kept and queried
|
|
813
|
+
* but not painted.)
|
|
814
|
+
*/
|
|
815
|
+
createMapLabel(areaId: number, text: string, x: number, y: number, z: number, fgR: number, fgG: number, fgB: number, bgR: number, bgG: number, bgB: number, fontSize?: number, showOnTop?: boolean, noScaling?: boolean): number;
|
|
816
|
+
/**
|
|
817
|
+
* Mudlet `createMapImageLabel(areaID, imagePathFileName, posx, posy, posz,
|
|
818
|
+
* width, height, zoom [, showOnTop [, noScaling]])`. Adds an image label and
|
|
819
|
+
* returns its new id, or -1 if the area is missing. The image reference is
|
|
820
|
+
* stored verbatim in the label's `pixMap` (surfaced as `Pixmap` by
|
|
821
|
+
* getMapLabel); like text labels it is not yet painted by the renderer.
|
|
822
|
+
*/
|
|
823
|
+
createMapImageLabel(areaId: number, imagePath: string, x: number, y: number, z: number, width: number, height: number, showOnTop?: boolean, noScaling?: boolean): number;
|
|
824
|
+
/** Mudlet `deleteMapLabel(areaID, labelID)`. Removes the label; returns
|
|
825
|
+
* false when the area or label id does not exist. */
|
|
826
|
+
deleteMapLabel(areaId: number, labelId: number): boolean;
|
|
827
|
+
/**
|
|
828
|
+
* Mudlet `auditAreas()` — sweep the map for area/room consistency problems
|
|
829
|
+
* and repair what is safe to repair. mudix rebuilds every area's membership
|
|
830
|
+
* list (`rooms[]`) from the authoritative `room.area` back-pointers, which
|
|
831
|
+
* drops dangling room ids and re-files rooms that were missing from their
|
|
832
|
+
* area's list. Rooms whose `area` points at a non-existent area are reported
|
|
833
|
+
* but left untouched (they may be intentionally parked in the void area -1).
|
|
834
|
+
* Returns a summary report (Mudlet returns nothing; mudix surfaces the audit
|
|
835
|
+
* so scripts can act on it).
|
|
836
|
+
*/
|
|
837
|
+
auditAreas(): {
|
|
838
|
+
checkedAreas: number;
|
|
839
|
+
checkedRooms: number;
|
|
840
|
+
fixedAreas: number;
|
|
841
|
+
orphanRooms: number[];
|
|
842
|
+
danglingRefs: number[];
|
|
843
|
+
};
|
|
844
|
+
setMapEventDispatcher(fn: ((eventName: string, args: unknown[]) => void) | null): void;
|
|
845
|
+
addMapEvent(uniqueName: string, eventName: string, parent?: string | null, displayName?: string | null, ...args: unknown[]): boolean;
|
|
846
|
+
removeMapEvent(uniqueName: string): boolean;
|
|
847
|
+
getMapEvents(): MapEventEntry[];
|
|
848
|
+
/** Mudlet `addMapMenu(menuName [, parent [, displayName]])`. Registers a
|
|
849
|
+
* submenu in the map's right-click context menu that addMapEvent entries
|
|
850
|
+
* can nest under via their `parent`. Re-registering the same name replaces
|
|
851
|
+
* the prior entry. */
|
|
852
|
+
addMapMenu(name: string, parent?: string | null, displayName?: string | null): boolean;
|
|
853
|
+
removeMapMenu(name: string): boolean;
|
|
854
|
+
getMapMenus(): MapMenuEntry[];
|
|
855
|
+
private roomBorderColors;
|
|
856
|
+
private roomBorderThicknesses;
|
|
857
|
+
setRoomBorderColor(id: number, r: number, g: number, b: number, a: number): boolean;
|
|
858
|
+
getRoomBorderColor(id: number): {
|
|
859
|
+
r: number;
|
|
860
|
+
g: number;
|
|
861
|
+
b: number;
|
|
862
|
+
a: number;
|
|
863
|
+
} | null;
|
|
864
|
+
clearRoomBorderColor(id: number): boolean;
|
|
865
|
+
setRoomBorderThickness(id: number, thickness: number): boolean;
|
|
866
|
+
getRoomBorderThickness(id: number): number | null;
|
|
867
|
+
clearRoomBorderThickness(id: number): boolean;
|
|
868
|
+
/** Fire the registered event for a context-menu entry. Matches Mudlet's
|
|
869
|
+
* T2DMap::slot_userAction selection branch: raiseEvent(eventName,
|
|
870
|
+
* uniqueName, roomId). The right-clicked room stands in for Mudlet's
|
|
871
|
+
* multi-room selection; the entry's stored extra args are discarded
|
|
872
|
+
* (Mudlet does the same in this branch). */
|
|
873
|
+
dispatchMapEvent(uniqueName: string, roomId: number): void;
|
|
874
|
+
setMapInfoEvaluator(fn: MapStore['mapInfoEvaluator']): void;
|
|
875
|
+
/** Add or replace a contributor. Re-registering the same label keeps the
|
|
876
|
+
* current enabled state and returns the prior callbackId so the runtime
|
|
877
|
+
* can free the leaked Lua-registry slot. Registering over a built-in label
|
|
878
|
+
* ("Short"/"Full") overrides it with the script callback — Mudlet's
|
|
879
|
+
* registerMapInfo replaces same-named contributors the same way; the native
|
|
880
|
+
* evaluator is dropped so the script's version wins. */
|
|
881
|
+
registerMapInfo(label: string, callbackId: number): {
|
|
882
|
+
prevCallbackId: number | null;
|
|
883
|
+
};
|
|
884
|
+
/** Remove a contributor entirely. Returns the freed callbackId (so the
|
|
885
|
+
* runtime can release the Lua-registry slot) or null when the label
|
|
886
|
+
* wasn't registered. Built-in contributors can't be removed (Mudlet's
|
|
887
|
+
* native "Short"/"Full" are likewise permanent — only enable/disable
|
|
888
|
+
* applies); the call is a no-op reporting removed:false. */
|
|
889
|
+
killMapInfo(label: string): {
|
|
890
|
+
callbackId: number | null;
|
|
891
|
+
removed: boolean;
|
|
892
|
+
};
|
|
893
|
+
enableMapInfo(label: string): boolean;
|
|
894
|
+
disableMapInfo(label: string): boolean;
|
|
895
|
+
/** Snapshot for tests / debug. The panel goes through evaluateMapInfos. */
|
|
896
|
+
getMapInfoContributors(): MapInfoContributor[];
|
|
897
|
+
/** Run every enabled contributor and collect their (text, style, color)
|
|
898
|
+
* results. Built-in contributors are evaluated natively from MapStore data;
|
|
899
|
+
* script ones go through the LuaRuntime evaluator (skipped when it's
|
|
900
|
+
* unhooked). Empty when no enabled contributor returned a non-empty text. */
|
|
901
|
+
evaluateMapInfos(roomId: number | null, selectionSize: number, areaId: number, displayedAreaId: number): MapInfoResult[];
|
|
902
|
+
/** Drop every script-registered contributor. Called on LuaRuntime teardown
|
|
903
|
+
* — the callback IDs index into the dying runtime's __mudix_cb registry.
|
|
904
|
+
* Built-in contributors are native (no Lua dependency) so they survive,
|
|
905
|
+
* keeping the default "Short"/"Full" overlays available across reconnects
|
|
906
|
+
* and script reloads. */
|
|
907
|
+
clearMapInfoContributors(): void;
|
|
908
|
+
/** Seed the two built-in contributors. Mudlet registers "Short" then "Full"
|
|
909
|
+
* and enables "Full" by default (XMLimport seeds {"Full"} for a profile
|
|
910
|
+
* with no saved set); we mirror both the order and the default. */
|
|
911
|
+
private seedBuiltinMapInfo;
|
|
912
|
+
/** Mudlet's "Short" contributor: `<room name> / <id> (<area name>)`,
|
|
913
|
+
* collapsing to just `<id> (<area name>)` when the room is unnamed or its
|
|
914
|
+
* name is exactly its id. Plain (no bold/italic), default colour. */
|
|
915
|
+
private shortMapInfo;
|
|
916
|
+
/** Mudlet's "Full" contributor: area name/id + extent, optional room name,
|
|
917
|
+
* and the room id + position line whose suffix and styling depend on the
|
|
918
|
+
* selection (none → "Current player location"; 1 → "Selected room";
|
|
919
|
+
* many → "Center of N selected rooms"). Non-breaking spaces (U+00A0) and
|
|
920
|
+
* hyphens (U+2011) match Mudlet so the lines wrap the same way. Selections
|
|
921
|
+
* tint the block orange and bold it; with nothing selected the text is
|
|
922
|
+
* italic when the room's area isn't the one currently displayed, else bold.
|
|
923
|
+
* Mudlet keys the orange shade off the configured info-text lightness — we
|
|
924
|
+
* don't surface that, so we use its dark-background variant. */
|
|
925
|
+
private fullMapInfo;
|
|
926
|
+
/** Mudlet setCustomEnvColor(envID, r, g, b, a). envID identifies the user
|
|
927
|
+
* environment used by setRoomEnv; the renderer reads mCustomEnvColors and
|
|
928
|
+
* paints rooms with that env using these RGB values. spec=1 (RGB) is the
|
|
929
|
+
* Qt QColor::Rgb spec, matching what the binary reader emits. */
|
|
930
|
+
setCustomEnvColor(envId: number, r: number, g: number, b: number, a?: number): void;
|
|
931
|
+
/**
|
|
932
|
+
* Seed env IDs 257-272 with the profile's 16 mapper colours, mirroring
|
|
933
|
+
* TMap::restore16ColorSet. Mudlet keeps that block permanently present in
|
|
934
|
+
* mCustomEnvColors — `setCustomEnvColor(257, …)` is documented as *also*
|
|
935
|
+
* changing the profile's dark-red, and `getCustomEnvColorTable()[257]`
|
|
936
|
+
* reads back even on a brand-new map — so it is re-applied whenever the
|
|
937
|
+
* map is wiped rather than treated as user data.
|
|
938
|
+
*/
|
|
939
|
+
private restore16ColorSet;
|
|
940
|
+
getCustomEnvColor(envId: number): {
|
|
941
|
+
r: number;
|
|
942
|
+
g: number;
|
|
943
|
+
b: number;
|
|
944
|
+
a: number;
|
|
945
|
+
} | undefined;
|
|
946
|
+
getCustomEnvColorTable(): Record<number, {
|
|
947
|
+
r: number;
|
|
948
|
+
g: number;
|
|
949
|
+
b: number;
|
|
950
|
+
a: number;
|
|
951
|
+
}>;
|
|
952
|
+
/** Mudlet removeCustomEnvColor(envID). Drops the override so the renderer
|
|
953
|
+
* falls back to the built-in env palette. Returns true if an entry was
|
|
954
|
+
* removed. */
|
|
955
|
+
removeCustomEnvColor(envId: number): boolean;
|
|
956
|
+
private mapMode;
|
|
957
|
+
private mapModeListener;
|
|
958
|
+
setMapModeListener(fn: ((mode: 'viewing' | 'editing') => void) | null): void;
|
|
959
|
+
getMapMode(): 'viewing' | 'editing';
|
|
960
|
+
setMapMode(mode: 'viewing' | 'editing'): boolean;
|
|
961
|
+
private roomCharColors;
|
|
962
|
+
private hiddenRooms;
|
|
963
|
+
private hiddenVersion;
|
|
964
|
+
setRoomCharColor(id: number, r: number, g: number, b: number, a?: number): boolean;
|
|
965
|
+
getRoomCharColor(id: number): {
|
|
966
|
+
r: number;
|
|
967
|
+
g: number;
|
|
968
|
+
b: number;
|
|
969
|
+
a: number;
|
|
970
|
+
} | undefined;
|
|
971
|
+
/**
|
|
972
|
+
* Mudlet `unsetRoomCharColor(roomID)` — drop the per-room char colour
|
|
973
|
+
* override so the renderer falls back to the default text colour. Returns
|
|
974
|
+
* false when the room is missing or had no override to drop (Mudlet's
|
|
975
|
+
* own semantics).
|
|
976
|
+
*/
|
|
977
|
+
unsetRoomCharColor(id: number): boolean;
|
|
978
|
+
/**
|
|
979
|
+
* Mudlet `setRoomHidden(roomID, hidden)`. Toggles the hidden flag; the
|
|
980
|
+
* RoomLens installed on the renderer consults {@link isRoomHidden} when
|
|
981
|
+
* deciding whether to paint a room, so hidden rooms (and exits whose
|
|
982
|
+
* other endpoint is hidden) disappear from the view. Returns false when
|
|
983
|
+
* the room doesn't exist; no-ops without a notify when the state is
|
|
984
|
+
* already the requested one.
|
|
985
|
+
*/
|
|
986
|
+
setRoomHidden(id: number, hidden: boolean): boolean;
|
|
987
|
+
/**
|
|
988
|
+
* Mudlet `getRoomHidden(roomID)`. Returns the hidden flag (false by
|
|
989
|
+
* default). The Lua binding re-shapes the missing-room case into
|
|
990
|
+
* Mudlet's (false, errMsg) tuple.
|
|
991
|
+
*/
|
|
992
|
+
getRoomHidden(id: number): boolean;
|
|
993
|
+
/** True iff the room exists in the side-table. Used by the RoomLens. */
|
|
994
|
+
isRoomHidden(id: number): boolean;
|
|
995
|
+
/** Monotonic counter bumped only when the hidden-rooms set actually
|
|
996
|
+
* changes. Surfaced via the RoomLens's getVersion() so the renderer can
|
|
997
|
+
* cache lens output, and read by MapPanel to decide when a force-refresh
|
|
998
|
+
* is needed after store mutations that left area/level unchanged. */
|
|
999
|
+
getHiddenVersion(): number;
|
|
1000
|
+
/**
|
|
1001
|
+
* Mudlet `getHiddenRooms()` — the hidden rooms of the whole map. Mudlet
|
|
1002
|
+
* takes no argument at all (TLuaInterpreter::getHiddenRooms walks the
|
|
1003
|
+
* entire room map); mudix additionally accepts an areaID to scope the
|
|
1004
|
+
* answer, in which case `undefined` distinguishes "no such area" from "no
|
|
1005
|
+
* hidden rooms here".
|
|
1006
|
+
*/
|
|
1007
|
+
getHiddenRooms(areaId?: number): number[] | undefined;
|
|
1008
|
+
/**
|
|
1009
|
+
* Mudlet highlightRoom(roomID, r1, g1, b1, r2, g2, b2, radius, a1, a2).
|
|
1010
|
+
* Painted by MudletHighlightOverlay as a radial gradient: color1 (with
|
|
1011
|
+
* a1 alpha) at the center, color2 (with a2 alpha) at the outer edge,
|
|
1012
|
+
* with the circle radius = settings.roomSize × `radius`. Returns false
|
|
1013
|
+
* if the room does not exist.
|
|
1014
|
+
*/
|
|
1015
|
+
highlightRoom(id: number, r1: number, g1: number, b1: number, r2: number, g2: number, b2: number, radius: number, a1?: number, a2?: number): boolean;
|
|
1016
|
+
/** Mudlet unHighlightRoom(roomID). Returns false when the room had no highlight. */
|
|
1017
|
+
unHighlightRoom(id: number): boolean;
|
|
1018
|
+
/** Snapshot of all active room highlights. MapPanel reads this each store
|
|
1019
|
+
* notify to reconcile the renderer's overlay shapes against the store. */
|
|
1020
|
+
getRoomHighlights(): Map<number, RoomHighlight>;
|
|
1021
|
+
/** Monotonic counter bumped on every selection mutation. The
|
|
1022
|
+
* MapSelectionOverlay reads this through its lens-style version channel so
|
|
1023
|
+
* the renderer's overlay-output cache invalidates only when the set
|
|
1024
|
+
* actually changes. */
|
|
1025
|
+
getSelectionVersion(): number;
|
|
1026
|
+
/** True when the room is in the current selection — read by
|
|
1027
|
+
* MapSelectionOverlay when emitting per-room shapes. */
|
|
1028
|
+
isRoomSelected(id: number): boolean;
|
|
1029
|
+
/** The most recently single-clicked room (Mudlet's selection "center"), or
|
|
1030
|
+
* null when nothing is selected. Used by MapSelectionOverlay to draw a
|
|
1031
|
+
* distinct marker on the center. */
|
|
1032
|
+
getSelectionCenter(): number | null;
|
|
1033
|
+
/** Size of the current selection — fed to registerMapInfo callbacks as
|
|
1034
|
+
* Mudlet's `selectionSize` argument. */
|
|
1035
|
+
getMapSelectionSize(): number;
|
|
1036
|
+
/**
|
|
1037
|
+
* Mudlet `getMapSelection()` → `{ rooms = {roomIDs}, center = roomID }`.
|
|
1038
|
+
* `rooms` is a list of selected room ids (sorted for deterministic
|
|
1039
|
+
* Lua-side iteration); `center` is the room marked as the selection's
|
|
1040
|
+
* focal point (Mudlet uses the last-clicked / right-clicked room). Both
|
|
1041
|
+
* are empty / null when nothing is selected.
|
|
1042
|
+
*/
|
|
1043
|
+
getMapSelection(): {
|
|
1044
|
+
rooms: number[];
|
|
1045
|
+
center: number | null;
|
|
1046
|
+
};
|
|
1047
|
+
/**
|
|
1048
|
+
* Replace the selection with a single room and mark it as the center.
|
|
1049
|
+
* Mudlet's plain left-click on a room does the same. Returns false when
|
|
1050
|
+
* the room doesn't exist (silently — the caller is usually a UI handler).
|
|
1051
|
+
*/
|
|
1052
|
+
selectMapRoom(id: number): boolean;
|
|
1053
|
+
/**
|
|
1054
|
+
* Toggle a room in/out of the selection (Mudlet ctrl-click). Adding a
|
|
1055
|
+
* room makes it the new center; removing the current center promotes the
|
|
1056
|
+
* lowest remaining id as the new center (and nulls the center when the
|
|
1057
|
+
* selection ends up empty).
|
|
1058
|
+
*/
|
|
1059
|
+
toggleMapRoomSelection(id: number): boolean;
|
|
1060
|
+
/**
|
|
1061
|
+
* Mudlet `clearMapSelection()` — wipe the selection set and the center.
|
|
1062
|
+
* Returns true when something was cleared, false when the selection was
|
|
1063
|
+
* already empty (so callers don't spin on a no-op notify).
|
|
1064
|
+
*/
|
|
1065
|
+
clearMapSelection(): boolean;
|
|
1066
|
+
private updateAreaBounds;
|
|
1067
|
+
}
|