Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 37d5c8a

Browse files
committed
feat: optimize string concatenation and add LibCustomIcons support
1 parent fa60739 commit 37d5c8a

36 files changed

Lines changed: 20894 additions & 3486 deletions

docs/champion_mermaid_usage.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Champion Points Mermaid Diagram Generator - Usage Guide
2+
3+
## Overview
4+
5+
The `ChampionPointsGraph.lua` module now includes a `generateMermaidDiagram()` function that creates beautiful, themed Mermaid flowchart diagrams for ESO Champion Points constellations.
6+
7+
## Function Signature
8+
9+
```lua
10+
ChampionPointsGraph.generateMermaidDiagram(constellationName, characterPoints)
11+
```
12+
13+
### Parameters
14+
15+
- **constellationName** (string): The constellation to generate - `"craft"`, `"warfare"`, or `"fitness"`
16+
- **characterPoints** (table, optional): A table mapping star names to allocated points
17+
- Format: `{["Star Name"] = pointsAllocated, ...}`
18+
- If `nil` or empty, all stars shown as unallocated
19+
20+
### Returns
21+
22+
- **string**: Complete Mermaid flowchart diagram ready to render
23+
24+
## Features
25+
26+
### Visual Theming
27+
- **Craft (Green)**: Forest green theme with `#2d5016` primary color
28+
- **Warfare (Red)**: Battle red theme with `#6b1e1e` primary color
29+
- **Fitness (Blue)**: Ocean blue theme with `#1e4d6b` primary color
30+
31+
### Star Visualization
32+
- **Allocated stars**: Shown with ✅ icon and emphasized styling
33+
- **Unallocated slottable stars**: Shown with 🔲 icon and muted styling
34+
- **Unallocated passive stars**: Shown with ✅ icon and muted styling
35+
36+
### Functional Grouping
37+
Stars are organized into logical subgraphs by function:
38+
39+
**Craft Constellation**:
40+
- 🗡️ Stealth & Thievery
41+
- 🌿 Gathering & Crafting
42+
- 🎣 Fishing
43+
- 🧪 Consumables
44+
- 🐎 Mount & Movement
45+
- ⚡ Utility
46+
47+
**Warfare Constellation**:
48+
- ⚔️ Direct Damage
49+
- 🗡️ Weapon Mastery
50+
- ✨ Magic Damage
51+
- 💚 Healing
52+
- 🛡️ Damage Mitigation
53+
- ⚡ Resource Sustain
54+
- 🔰 Block & Riposte
55+
56+
**Fitness Constellation**:
57+
- 💧 Recovery
58+
- ⚡ Speed & Mobility
59+
- 🛡️ Shield & Block
60+
- ✨ Magic Sustain
61+
- ❤️ Health & Survival
62+
- 🔰 Defensive
63+
- 💨 Evasion & CC
64+
65+
## Usage Examples
66+
67+
### Example 1: Generate diagram with character allocations
68+
69+
```lua
70+
local ChampionPointsGraph = require("src/generators/helpers/ChampionPointsGraph")
71+
72+
-- Character's allocated points
73+
local myPoints = {
74+
["Gilded Fingers"] = 50,
75+
["Fortune's Favor"] = 50,
76+
["Wanderer"] = 50,
77+
["Breakfall"] = 50,
78+
["Soul Reservoir"] = 30
79+
}
80+
81+
-- Generate diagram
82+
local diagram = ChampionPointsGraph.generateMermaidDiagram("craft", myPoints)
83+
84+
-- Save to file or display
85+
print(diagram)
86+
```
87+
88+
### Example 2: Generate empty constellation (planning view)
89+
90+
```lua
91+
-- Show all stars without allocations
92+
local planningDiagram = ChampionPointsGraph.generateMermaidDiagram("warfare", nil)
93+
```
94+
95+
### Example 3: Integration with Champion collector
96+
97+
```lua
98+
-- From the Champion collector data
99+
local championData = CM.collectors.CollectChampionPointData()
100+
101+
-- Extract points for a specific discipline
102+
local craftPoints = {}
103+
for _, discipline in ipairs(championData.disciplines) do
104+
if discipline.name == "Craft" then
105+
for _, skill in ipairs(discipline.allStars) do
106+
if skill.points > 0 then
107+
craftPoints[skill.name] = skill.points
108+
end
109+
end
110+
break
111+
end
112+
end
113+
114+
-- Generate diagram
115+
local diagram = ChampionPointsGraph.generateMermaidDiagram("craft", craftPoints)
116+
```
117+
118+
## Output Format
119+
120+
The generated diagram includes:
121+
1. **Theme configuration** - Mermaid init block with color scheme
122+
2. **Flowchart declaration** - `flowchart TB` (top-to-bottom)
123+
3. **Subgraphs** - Grouped stars by functional category
124+
4. **Node definitions** - Each star with icon, name, and point info
125+
5. **Connections** - Prerequisite arrows with min_points labels
126+
6. **Styling** - CSS classes for allocated vs unallocated stars
127+
128+
## Rendering
129+
130+
The output can be rendered in:
131+
- **Mermaid Live Editor**: https://mermaid.live
132+
- **Markdown files**: GitHub, GitLab, etc. with Mermaid support
133+
- **Documentation sites**: MkDocs, Docusaurus, etc.
134+
- **ESO addon UI**: If integrated with a Mermaid renderer
135+
136+
## Notes
137+
138+
- Node IDs use the star's numeric ID from the game
139+
- Prerequisite connections show the minimum points required
140+
- The diagram matches the visual style of the example templates
141+
- All data is synchronized with `champion_points.yaml`

0 commit comments

Comments
 (0)