# pedroh288/betsu-rpg architecture

> Architecture diagram of the GitHub repository pedroh288/betsu-rpg, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pedroh288/betsu-rpg
- Repository: https://github.com/pedroh288/betsu-rpg

## Overview

Betsu-RPG is a Python command-line toolkit for automating RPG session mechanics. A participant chooses a mestre or jogador menu, then enters a selected system: status calculations, bestiary lookup, shop information, or dice rolling; the mestre menu also offers probabilistic monster spawning by kingdom, region, and time. The systems use shared terminal helpers, while the bestiary, shop, and spawn modules load their respective JSON data files. The README documents these capabilities; the graph’s implementation links are limited to shown source and documented behavior.

Main entry points: [`main.py`](https://github.com/pedroh288/betsu-rpg/blob/main/main.py) (Role menus), [`sistemas/utils.py`](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/utils.py) (Terminal helpers), [`sistemas/betsuario.py`](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/betsuario.py) (Bestiary lookup), [`sistemas/lojas.py`](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/lojas.py) (Shop lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Role menus<br/>[main.py]"]
end

subgraph group_gameplay["Game systems"]
  node_bestiary["Bestiary lookup<br/>[betsuario.py]"]
  node_shops["Shop lookup<br/>[lojas.py]"]
  node_spawn["Monster spawn<br/>[spawn.py]"]
  node_status["Status calculator<br/>[status.py]"]
  node_dice["Dice roller<br/>[dado.py]"]
end

subgraph group_support["Shared support"]
  node_utils["Terminal helpers<br/>[utils.py]"]
end

subgraph group_worlddata["World data"]
  node_bestiarydata["Bestiary records<br/>[betsuario.json]"]
  node_shopdata["Shop records<br/>[lojas.json]"]
  node_spawndata["Spawn tables<br/>[spawn.json]"]
end

node_user(("Player or mestre"))

node_user -->|"selects role"| node_main
node_main -->|"displays menu"| node_utils
node_main -->|"dispatches"| node_status
node_main -->|"dispatches"| node_bestiary
node_main -->|"dispatches"| node_spawn
node_main -->|"dispatches"| node_shops
node_main -->|"dispatches"| node_dice
node_bestiary -->|"uses helpers"| node_utils
node_shops -->|"uses helpers"| node_utils
node_spawn -->|"uses helpers"| node_utils
node_status -->|"uses helpers"| node_utils
node_dice -->|"uses helpers"| node_utils
node_bestiary -->|"loads records"| node_bestiarydata
node_shops -->|"loads records"| node_shopdata
node_spawn -->|"loads tables"| node_spawndata

click node_main "https://github.com/pedroh288/betsu-rpg/blob/main/main.py"
click node_bestiary "https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/betsuario.py"
click node_shops "https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/lojas.py"
click node_spawn "https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/spawn.py"
click node_status "https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/status.py"
click node_dice "https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/dado.py"
click node_utils "https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/utils.py"
click node_bestiarydata "https://github.com/pedroh288/betsu-rpg/blob/main/dados/betsuario.json"
click node_shopdata "https://github.com/pedroh288/betsu-rpg/blob/main/dados/lojas.json"
click node_spawndata "https://github.com/pedroh288/betsu-rpg/blob/main/dados/spawn.json"

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_main toneBlue
class node_bestiary,node_shops,node_spawn,node_status,node_dice toneAmber
class node_utils toneMint
class node_bestiarydata,node_shopdata,node_spawndata toneRose
class node_user toneIndigo
```

## Components

### CLI entry

- [Role menus](https://github.com/pedroh288/betsu-rpg/blob/main/main.py): `main.py`

### Game systems

- [Bestiary lookup](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/betsuario.py): `sistemas/betsuario.py`
- [Shop lookup](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/lojas.py): `sistemas/lojas.py`
- [Monster spawn](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/spawn.py): `sistemas/spawn.py`
- [Status calculator](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/status.py): `sistemas/status.py`
- [Dice roller](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/dado.py): `sistemas/dado.py`

### Shared support

- [Terminal helpers](https://github.com/pedroh288/betsu-rpg/blob/main/sistemas/utils.py): `sistemas/utils.py`

### World data

- [Bestiary records](https://github.com/pedroh288/betsu-rpg/blob/main/dados/betsuario.json): `dados/betsuario.json`
- [Shop records](https://github.com/pedroh288/betsu-rpg/blob/main/dados/lojas.json): `dados/lojas.json`
- [Spawn tables](https://github.com/pedroh288/betsu-rpg/blob/main/dados/spawn.json): `dados/spawn.json`

### Other components

- **Player or mestre**

## Connections

- Player or mestre → Role menus: selects role (evidence: `main.py`)
- Role menus → Terminal helpers: displays menu (evidence: `main.py`)
- Role menus → Status calculator: dispatches (evidence: `main.py`)
- Role menus → Bestiary lookup: dispatches (evidence: `main.py`)
- Role menus → Monster spawn: dispatches (evidence: `main.py`)
- Role menus → Shop lookup: dispatches (evidence: `main.py`)
- Role menus → Dice roller: dispatches (evidence: `main.py`)
- Bestiary lookup → Terminal helpers: uses helpers (evidence: `sistemas/betsuario.py`)
- Shop lookup → Terminal helpers: uses helpers (evidence: `sistemas/lojas.py`)
- Monster spawn → Terminal helpers: uses helpers (evidence: `sistemas/spawn.py`)
- Status calculator → Terminal helpers: uses helpers (evidence: `sistemas/status.py`)
- Dice roller → Terminal helpers: uses helpers (evidence: `sistemas/dado.py`)
- Bestiary lookup → Bestiary records: loads records (evidence: `sistemas/betsuario.py`)
- Shop lookup → Shop records: loads records (evidence: `sistemas/lojas.py`)
- Monster spawn → Spawn tables: loads tables (evidence: `sistemas/spawn.py`)
