Understand the D2RMM mod runtime globals
masterWhen a D2RMM mod (mod.js or mod.ts) runs, it is provided with three global variables that allow you to interact with the manager, the user's configuration, and the console:
D2RMM: An object of typeModAPIused to perform file operations and check environment versions.config: An object of typeModConfigValuecontaining the values selected by the user in the mod's configuration UI.console: An object of typeConsoleAPIfor logging information.
Example usage:
if (D2RMM.getVersion() < 1.5) {
throw new Error('This mod requires D2RMM version 1.5 or newer!');
}
D2RMM.writeJson('local\lng\strings\foo.json', {foo: 'foo!'});
if (config.isBarEnabled) {
console.log('Feature bar is enabled!');
D2RMM.writeJson('local\lng\strings\bar.json', {bar: 'bar!'});
}if (D2RMM.getVersion() < 1.5) {
throw new Error('This mod requires D2RMM version 1.5 or newer!');
}
D2RMM.writeJson('local\lng\strings\foo.json', {foo: 'foo!'});
if (config.isBarEnabled) {
console.log('Feature bar is enabled!');
D2RMM.writeJson('local\lng\strings\bar.json', {bar: 'bar!'});
}