# liangshi233/liangshi-calc architecture

> Architecture diagram of the GitHub repository liangshi233/liangshi-calc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/liangshi233/liangshi-calc
- Repository: https://github.com/liangshi233/liangshi-calc

## Overview

liangshi-calc is a Miao-Plugin extension for game character damage calculations, panel workflows, and game-data updates. Users issue bot commands; the plugin handles the requested panel, calculation, wiki, or update operation and returns a result or writes panel/resource data. Calculation modules combine shared game-specific parameters, talent definitions, team buffs, and reaction buffs; the README also documents preset/custom panels and artifact/weapon calculation extensions. Several documented subsystems are represented by their listed paths, but their internal calls were not sampled, so those links are documented at feature level only.

Main entry points: [`damage/liangshi-gs/index.js`](https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-gs/index.js) (Genshin model), [`apps/sharePanel.js`](https://github.com/liangshi233/liangshi-calc/blob/master/apps/sharePanel.js) (Panel sharing), [`apps/new/GenshinImpact/GSnanoka.js`](https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/GenshinImpact/GSnanoka.js) (Genshin updater), [`apps/new/StarRail/SRnanoka.js`](https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/StarRail/SRnanoka.js) (Star Rail updater)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Bot Features"]
  node_wiki["Wiki expansion<br/>[wiki.js]"]
end

subgraph group_calculations["Damage Calculations"]
  node_gs_calc["Genshin damage<br/>[calc_basic_gs.js]"]
  node_sr_calc["Star Rail damage<br/>[calc_basic_sr.js]"]
  node_gs_model["Genshin model<br/>[index.js]"]
  node_mc_model["Wuthering Waves model<br/>[index.js]"]
  node_sr_model["Star Rail model<br/>[index.js]"]
  node_team_buffs["Team buffs"]
  node_weapon_artifact["Weapon and artifact"]
end

subgraph group_panel["Panel Workflows"]
  node_preset["Preset panels<br/>[预设替换.js]"]
  node_panel_custom["Custom panels<br/>[panel.js]"]
  node_sharing["Panel sharing<br/>[sharePanel.js]"]
  node_panel_store[("Player panels")]
end

subgraph group_updates["Data Updates"]
  node_gs_update["Genshin updater<br/>[GSnanoka.js]"]
  node_sr_update["Star Rail updater<br/>[SRnanoka.js]"]
  node_mc_update["Wuthering updater<br/>[MCencore.js]"]
  node_game_resources[("Game resources")]
end

subgraph group_shared["Shared Calculation Support"]
  node_common["Shared components<br/>[index.js]"]
  node_calc_buffs["Reaction and buffs<br/>[index.js]"]
  node_config["Configuration<br/>[Cfg.js]"]
end

node_user(("Bot user"))
node_nanoka(("Nanoka service"))

node_user -->|"requests wiki"| node_wiki
node_user -->|"requests preset"| node_preset
node_user -->|"customizes panel"| node_panel_custom
node_user -->|"shares panel"| node_sharing
node_user -->|"requests damage"| node_gs_calc
node_user -->|"requests update"| node_gs_update
node_user -->|"requests update"| node_sr_update
node_user -->|"requests update"| node_mc_update
node_sharing -->|"calls import/export"| node_panel_custom
node_sharing -->|"reads panel data"| node_panel_store
node_panel_custom -->|"writes panel data"| node_panel_store
node_gs_calc -->|"imports buffs"| node_calc_buffs
node_gs_model -->|"registers team buffs"| node_team_buffs
node_gs_model -.->|"provides calculation model"| node_gs_calc
node_sr_model -.->|"provides calculation model"| node_sr_calc
node_user -->|"requests damage"| node_sr_calc
node_gs_update -->|"fetches game data"| node_nanoka
node_sr_update -->|"fetches game data"| node_nanoka
node_gs_update -.->|"updates resources"| node_game_resources
node_sr_update -.->|"updates resources"| node_game_resources
node_mc_update -.->|"updates resources"| node_game_resources
node_weapon_artifact -.->|"extends calculation"| node_gs_model
node_gs_model -->|"uses shared components"| node_common
node_gs_model -.->|"uses configuration"| node_config

click node_wiki "https://github.com/liangshi233/liangshi-calc/blob/master/apps/wiki.js"
click node_preset "https://github.com/liangshi233/liangshi-calc/blob/master/apps/%E9%A2%84%E8%AE%BE%E6%9B%BF%E6%8D%A2.js"
click node_panel_custom "https://github.com/liangshi233/liangshi-calc/blob/master/apps/panel/panel.js"
click node_sharing "https://github.com/liangshi233/liangshi-calc/blob/master/apps/sharePanel.js"
click node_gs_calc "https://github.com/liangshi233/liangshi-calc/blob/master/damage/calc_basic_gs.js"
click node_sr_calc "https://github.com/liangshi233/liangshi-calc/blob/master/damage/calc_basic_sr.js"
click node_gs_model "https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-gs/index.js"
click node_mc_model "https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-mc/index.js"
click node_sr_model "https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-sr/index.js"
click node_team_buffs "https://github.com/liangshi233/liangshi-calc/tree/master/damage/liangshi-gs"
click node_weapon_artifact "https://github.com/liangshi233/liangshi-calc/tree/master/damage/liangshi-gs/weapon"
click node_gs_update "https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/GenshinImpact/GSnanoka.js"
click node_sr_update "https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/StarRail/SRnanoka.js"
click node_mc_update "https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/WutheringWaves/MCencore.js"
click node_game_resources "https://github.com/liangshi233/liangshi-calc/tree/master/damage/liangshi-gs/data"
click node_common "https://github.com/liangshi233/liangshi-calc/blob/master/components/index.js"
click node_calc_buffs "https://github.com/liangshi233/liangshi-calc/blob/master/resources/CalcBuff/index.js"
click node_config "https://github.com/liangshi233/liangshi-calc/blob/master/components/Cfg.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wiki,node_user toneBlue
class node_gs_calc,node_sr_calc,node_gs_model,node_mc_model,node_sr_model,node_team_buffs,node_weapon_artifact toneAmber
class node_preset,node_panel_custom,node_sharing,node_panel_store toneMint
class node_gs_update,node_sr_update,node_mc_update,node_game_resources toneRose
class node_common,node_calc_buffs,node_config,node_nanoka toneIndigo
```

## Components

### Bot Features

- [Wiki expansion](https://github.com/liangshi233/liangshi-calc/blob/master/apps/wiki.js): `apps/wiki.js`

### Damage Calculations

- [Genshin damage](https://github.com/liangshi233/liangshi-calc/blob/master/damage/calc_basic_gs.js): `damage/calc_basic_gs.js`
- [Star Rail damage](https://github.com/liangshi233/liangshi-calc/blob/master/damage/calc_basic_sr.js): `damage/calc_basic_sr.js`
- [Genshin model](https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-gs/index.js): `damage/liangshi-gs/index.js`
- [Wuthering Waves model](https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-mc/index.js): `damage/liangshi-mc/index.js`
- [Star Rail model](https://github.com/liangshi233/liangshi-calc/blob/master/damage/liangshi-sr/index.js): `damage/liangshi-sr/index.js`
- [Team buffs](https://github.com/liangshi233/liangshi-calc/tree/master/damage/liangshi-gs): `damage/liangshi-gs`
- [Weapon and artifact](https://github.com/liangshi233/liangshi-calc/tree/master/damage/liangshi-gs/weapon): `damage/liangshi-gs/weapon`

### Panel Workflows

- [Preset panels](https://github.com/liangshi233/liangshi-calc/blob/master/apps/%E9%A2%84%E8%AE%BE%E6%9B%BF%E6%8D%A2.js): `apps/预设替换.js`
- [Custom panels](https://github.com/liangshi233/liangshi-calc/blob/master/apps/panel/panel.js): `apps/panel/panel.js`
- [Panel sharing](https://github.com/liangshi233/liangshi-calc/blob/master/apps/sharePanel.js): `apps/sharePanel.js`
- **Player panels**

### Data Updates

- [Genshin updater](https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/GenshinImpact/GSnanoka.js): `apps/new/GenshinImpact/GSnanoka.js`
- [Star Rail updater](https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/StarRail/SRnanoka.js): `apps/new/StarRail/SRnanoka.js`
- [Wuthering updater](https://github.com/liangshi233/liangshi-calc/blob/master/apps/new/WutheringWaves/MCencore.js): `apps/new/WutheringWaves/MCencore.js`
- [Game resources](https://github.com/liangshi233/liangshi-calc/tree/master/damage/liangshi-gs/data): `damage/liangshi-gs/data`

### Shared Calculation Support

- [Shared components](https://github.com/liangshi233/liangshi-calc/blob/master/components/index.js): `components/index.js`
- [Reaction and buffs](https://github.com/liangshi233/liangshi-calc/blob/master/resources/CalcBuff/index.js): `resources/CalcBuff/index.js`
- [Configuration](https://github.com/liangshi233/liangshi-calc/blob/master/components/Cfg.js): `components/Cfg.js`

### Other components

- **Bot user**
- **Nanoka service**

## Connections

- Bot user → Wiki expansion: requests wiki
- Bot user → Preset panels: requests preset
- Bot user → Custom panels: customizes panel
- Bot user → Panel sharing: shares panel
- Bot user → Genshin damage: requests damage
- Bot user → Genshin updater: requests update
- Bot user → Star Rail updater: requests update
- Bot user → Wuthering updater: requests update
- Panel sharing → Custom panels: calls import/export (evidence: `apps/sharePanel.js`)
- Panel sharing → Player panels: reads panel data (evidence: `apps/sharePanel.js`)
- Custom panels → Player panels: writes panel data (evidence: `apps/panel/panel.js`)
- Genshin damage → Reaction and buffs: imports buffs (evidence: `damage/calc_basic_gs.js`)
- Genshin model → Team buffs: registers team buffs (evidence: `damage/liangshi-gs/index.js`)
- Genshin model → Genshin damage: provides calculation model
- Star Rail model → Star Rail damage: provides calculation model
- Bot user → Star Rail damage: requests damage
- Genshin updater → Nanoka service: fetches game data
- Star Rail updater → Nanoka service: fetches game data (evidence: `apps/new/StarRail/SRnanoka.js`)
- Genshin updater → Game resources: updates resources
- Star Rail updater → Game resources: updates resources
- Wuthering updater → Game resources: updates resources
- Weapon and artifact → Genshin model: extends calculation
- Genshin model → Shared components: uses shared components (evidence: `damage/liangshi-gs/index.js`)
- Genshin model → Configuration: uses configuration
