dcss-webtiles-extension-module (DWEM) is a framework designed to extend the functionality of Dungeon Crawl Stone Soup Webtiles.
This framework hooks into RequireJS, allowing the injection of user code snippets before the Webtiles JavaScript code is loaded.
- Install a script manager such as Tampermonkey or Greasemonkey.
- Install Greasy Fork (loader/dwem-base-loader.js).
Warning: DWEM is already applied to the CNC server (so you can use the already applied modules directly), and these steps are for using DWEM on servers where it is not yet applied.
The default loading modules include ModuleManager. To check if DWEM has loaded correctly, you can press Ctrl + F12 (toggle) to view the Module Manager UI.
After installation, you can uncomment the following section of the script and enter the URLs of the desired module scripts to load the modules you want.
// localStorage.DWEM_MODULES = JSON.stringify(['https://example.org/module.js', ...]);
If no additional modifications are made, the utility modules posted in this repository, excluding the CNC server-specific modules, will be loaded by default.
<script type="text/javascript">
var socket_server = "{{ socket_server }}";
localStorage.DWEM_MODULES = ['https://example.org/module1.js', 'https://example.org/module2.js'];
</script>
<script src="https://cdn.jsdelivr.net/gh/refracta/dcss-webtiles-extension-module/loader/dwem-base-loader.js"></script>
Modify webserver/templates/client.html
like the code above. You can define the URLs of the modules you want to load by
default in localStorage.DWEM_MODULES
.
export default class BasicModule {
static name = 'BasicModule'
static version = '1.0'
static dependencies = []
static description = ''
onLoad() {
}
}
- The
name
andversion
properties are essential attributes required by the DWEM loader to function correctly. - The
dependencies
property specifies the dependencies on other modules. If defined, the DWEM loader will load the dependent modules first, then load the current module. (Example:dependencies = ['Module1', 'Module2:1.0'];
) - The
description
property allows you to provide a brief description of the module, which can be displayed in the module manager. - The DWEM loader pauses the loading of
RequireJS
, loads itself and the classes of other modules, and then executes theonLoad()
function of each module. In this step, you can define the initialization logic required for each module.
- You can refer to the examples in
modules/io-hook/index.js
andmodules/test-module1/index.js
.
-
- Description: This module helps to check and control the loading status of multiple modules.
-
- Description: (Beta) This module implements sound features in the webtiles environment. You can use it by adding a sound pack to the RC configuration.
-
- Description: (Beta) This module provides convenience features.
-
- Description: (Library) This module allows users to add hooks before and after sending and receiving WebSocket data.
-
- Description: (Library) This module returns site information to other modules.
-
- Description: (Library) This module simulates a WebSocket that replicates the user's session.
-
- Description: (Beta) This module provides advanced CNC user information.
-
- Description: (Library) This module provides features for creating custom RC trigger logic.
-
- Description: This module sets the banner for the CNC server.
-
- Description: (Beta) This module provides CNC server public chat.
DWEM is currently in the development and testing phase.