MCPcopy Index your code
hub / github.com/MaplebirchLeaf/SCML-DOL-maplebirchFramework

github.com/MaplebirchLeaf/SCML-DOL-maplebirchFramework @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
2,178 symbols 4,783 edges 110 files 45 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

中文 | English

SCML-DOL-maplebirchFramework

Author Game ModLoader CHS Release Downloads Stars Issues

maplebirchFramework is a SugarCube2 ModLoader framework for Degrees of Lewdity mods. It provides helper APIs for script loading, language and audio import, UI zone injection, NPC registration, combat actions, character layers, transformations, dynamic events, and general utility functions.

The framework is designed around additive mod development: instead of directly replacing large parts of vanilla passages or widgets, a mod can register content through stable framework APIs and let the framework merge it at the appropriate loading stage.


Contents

Overview

Use this framework when your mod needs to:

  • Load framework-dependent JavaScript files through boot.json.
  • Import translation files and audio folders.
  • Add widgets to existing UI zones such as options, status bar, menus, and link areas.
  • Register SugarCube macros or reusable text builders.
  • Register time, state, and weather events.
  • Add named NPCs, NPC stats, schedules, clothes, sidebar displays, NPC transformations, and NPC pregnancy extensions.
  • Add character layers, face styles, and transformations.
  • Add custom combat actions.
  • Use shared helpers such as source.clone(), Object.merge(), list.contains(), list.either(), and Math.clamp().

English documentation is organized under docs/EN and mirrors the Chinese documentation structure.

Installation

Download the framework from Releases and load it as a ModLoader mod.

Mods depending on this framework should declare the dependency:

"dependenceInfo": [
  {
    "modName": "maplebirch",
    "version": ">=required framework version"
  }
]

Script Loading

Use maplebirchAddon to load JavaScript files that depend on the framework:

"addonPlugin": [
  {
    "modName": "maplebirch",
    "addonName": "maplebirchAddon",
    "modVersion": "^required framework version",
    "params": {
      "script": ["framework.js"]
    }
  }
]

Most mod logic should use script. Use module only when you intentionally need an earlier module-extension stage.

Mod Encryption

The framework itself is not encrypted. Other mods that depend on the framework can use the companion author tools to build an encrypted shell .modpack. The shell asks the framework to verify a credential during earlyload, decrypts the real mod, then injects it through ModLoader lazy loading.

Author tools: DOL Mod Protection Tools

The generated .modpack only exposes a shell boot.json, an earlyload decryptor, and .crypt chunks. The original boot.json, auth.json, scripts, and assets are stored inside the encrypted payload. On first load, the player enters a credential; after successful verification, the password is cached. Closing the dialog or failing verification disables that encrypted mod.

auth.json is generated by the author tools or placed in the original zip root before conversion. It is not left in the shell package as plaintext. Minimal example:

{
  "key": "main",
  "publicKey": "BASE64_SPKI_PUBLIC_KEY"
}

Optional fields include subject, name, prompt, and date. See the companion author tools README for the full configuration.

Recommended Structure

For a small mod:

framework.js

For a larger mod:

framework.js
modules/options.js
modules/events.js
modules/npc.js
modules/combat.js
modules/sidebar.js

Example:

maplebirch.tool.addTo('Options', 'MyModOptions');

maplebirch.dynamic.regTimeEvent('onDay', 'myMod.dailyCheck', {
  cond: () => V.myMod?.enabled,
  event: () => '<<run setup.myMod.dailyCheck()>>'
});

maplebirch.npc.addStats({
  trust: {
    min: 0,
    max: 100,
    default: 0,
    position: 1
  }
});

Type Package

If your mod uses TypeScript, or if you want editor completion for the global maplebirch APIs, install the framework type package:

npm install -D @scml-maplebirch/types

Then add it to tsconfig.json:

{
  "compilerOptions": {
    "types": ["@types/twine-sugarcube", "@scml-maplebirch/types"],
    "skipLibCheck": true
  }
}

This package only provides TypeScript declarations. It does not include runtime framework code, so players still need to load the actual maplebirchFramework mod through ModLoader. Keep the type package version close to the framework version your mod depends on.

Documentation

Start here:

Feature areas:

Complete Chinese docs:

boot.json Quick Reference

"addonPlugin": [
  {
    "modName": "maplebirch",
    "addonName": "maplebirchAddon",
    "modVersion": "^required framework version",
    "params": {
      "language": ["CN", "EN"],
      "audio": ["audio"],
      "framework": {
        "addto": "Options",
        "widget": "MyModOptions"
      },
      "npc": {
        "NamedNPC": [],
        "Stats": {},
        "Sidebar": {
          "image": [],
          "clothes": [],
          "config": []
        }
      },
      "script": ["framework.js"]
    }
  }
]

Links

Extension points exported contracts — how you extend this code

SimpleStoreAPI (Interface)
(no doc) [4 implementers]
packages/types/maplebirch.d.ts
CanvasModelConstructor (Interface)
(no doc) [4 implementers]
types/twine-sugarcube.d.ts
LanguageManager (Interface)
(no doc) [3 implementers]
src/modules/Internals.ts
CryptOptions (Interface)
(no doc) [1 implementers]
src/services/CredentialVault.ts
Window (Interface)
(no doc)
types/global.d.ts
ObjectConstructor (Interface)
(no doc)
src/utils.ts
TransformationPart (Interface)
(no doc)
src/DoLPcompat.ts
CompatTimeData (Interface)
(no doc)
src/SFcompat.ts

Core symbols most depended-on inside this repo

log
called by 247
src/services/Logger.ts
get
called by 150
packages/types/maplebirch.d.ts
set
called by 115
types/twine-sugarcube.d.ts
push
called by 115
src/modules/Internals.ts
has
called by 108
packages/types/maplebirch.d.ts
forEach
called by 82
packages/types/maplebirch.d.ts
replace
called by 76
src/modules/AddonPlugin.ts
filter
called by 68
src/modules/Frameworks/migration.ts

Shape

Method 1,256
Interface 355
Function 341
Class 218
Struct 8

Languages

TypeScript98%
Go2%

Modules by API surface

packages/types/maplebirch.d.ts642 symbols
src/utils.ts90 symbols
src/services/CloudSaveService.ts68 symbols
src/modules/Audio.ts65 symbols
types/twine-sugarcube.d.ts57 symbols
src/modules/NamedNPCAddon/NPCPregnancy.ts42 symbols
src/modules/Character.ts42 symbols
src/modules/NamedNPC.ts40 symbols
src/modules/NamedNPCAddon/NPCClothes.ts38 symbols
src/modules/NamedNPCAddon/NPCSchedules.ts36 symbols
src/modules/AddonPlugin.ts36 symbols
cloud-services/go-sql-server/main.go33 symbols

For agents

$ claude mcp add SCML-DOL-maplebirchFramework \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact