aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/rules/dnd5e_rules.json5
blob: 96f7cd1c36f21f9e8a16df535c56513b9b66e7eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
  // D&D 5E TRPG 日志解析规则
  metadata: [
    {
      type: "metadata",
      patterns: [
        "^\\[(.+?)\\]\\s*<(.+?)>\\s*(.*)$",  // [时间] <角色名> 内容
        "^(.+?)\\s*\\|\\s*(.+?)\\s*:\\s*(.*)$"  // 时间 | 角色名: 内容
      ],
      groups: ["timestamp", "speaker", "content"],
      priority: 100
    }
  ],
  
  content: [
    {
      type: "dice_roll",
      match_type: "enclosed",
      patterns: [
        "\\[d(\\d+)\\s*=\\s*(\\d+)\\]",  // [d20 = 15]
        "\\.r(\\d*)d(\\d+)(?:[+\\-](\\d+))?",  // .r1d20+5
        "\\((\\d+)d(\\d+)(?:[+\\-](\\d+))?\\s*=\\s*(\\d+)\\)"  // (1d20+5 = 18)
      ],
      groups: ["dice_type", "result"],
      priority: 90
    },
    {
      type: "action",
      match_type: "enclosed",
      patterns: [
        "\\*\\*(.+?)\\*\\*",  // **动作**
        "\\*(.+?)\\*"  // *动作*
      ],
      groups: ["action_text"],
      priority: 80
    },
    {
      type: "ooc",
      match_type: "enclosed",
      patterns: [
        "\\(\\((.+?)\\)\\)",  // ((OOC对话))
        "//(.+?)$"  // //OOC注释
      ],
      groups: ["ooc_text"],
      priority: 70
    },
    {
      type: "dialogue",
      match_type: "enclosed",
      patterns: [
        "「(.+?)」",
        "\u201c(.+?)\u201d",
        "\"(.+?)\""
      ],
      groups: ["dialogue_text"],
      priority: 60
    },
    {
      type: "system",
      match_type: "prefix",
      patterns: [
        "^\\[系统\\](.+)",
        "^\\[System\\](.+)"
      ],
      groups: ["system_message"],
      priority: 50
    },
    {
      type: "text",
      match_type: "prefix",
      patterns: [
        "^(.+)$"
      ],
      groups: ["text_content"],
      priority: 1
    }
  ]
}