Conditions and Lore Formats
Condition System
Condition definition files are located in the conditions/ directory and control PDC attribute reading rules for items. When an item does not meet the conditions, its attributes can be marked as invalid or failed.
Condition File Format
enabled: true
source_id: "forge"
condition_type: pdc_meta
invalid_as_failure: true
conditions:
- key: "emaki:bind_player"
operator: "=="
value: "%player_name%"Field Descriptions
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
enabled | boolean | No | true | Whether this condition is enabled |
source_id | String | Yes | — | Associated PDC attribute source ID |
condition_type | String | Yes | — | Condition type (pdc_meta or lore_regex) |
invalid_as_failure | boolean | No | true | Whether to treat invalid conditions as failure |
conditions | List | Yes | — | Condition list |
pdc_meta Type
Reads values from the item's PDC metadata for comparison.
condition_type: pdc_meta
conditions:
- key: "emaki:bind_player"
operator: "=="
value: "%player_name%"
- key: "emaki:required_level"
operator: "<="
value: "%player_level%"Supported operators: ==, !=, >, >=, <, <=
lore_regex Type
Uses regular expressions to match item Lore lines.
condition_type: lore_regex
conditions:
- pattern: "绑定玩家: (.+)"
group: 1
operator: "=="
value: "%player_name%"
- pattern: "需要等级: (\\d+)"
group: 1
operator: "<="
value: "%player_level%"lore_regex Capture Groups
group specifies the capture group number of the regular expression. group: 0 means the entire match, group: 1 means the content captured by the first parentheses.
Built-in Condition Files
| File Name | source_id | Condition Type | Description |
|---|---|---|---|
default_bind.yml | — | pdc_meta | Bind player check, verifies whether the item is bound to the current player |
default_equipment_level.yml | — | pdc_meta | Equipment level check, verifies whether the player's level meets equipment requirements |
forge.yml | forge | pdc_meta | Forge source condition, checks forge-related PDC metadata |
strengthen.yml | strengthen | pdc_meta | Strengthen source condition, checks strengthen-related PDC metadata |
Expression Placeholders
The value field of conditions supports the following placeholders:
| Placeholder | Description |
|---|---|
%value% | The actual value read from the item |
%player_level% | Player level |
%player_name% | Player name |
$1, $2, ... | Regex capture groups (lore_regex type only) |
Condition Execution Order
Conditions are executed in file loading order. When invalid_as_failure: true, if the condition's source_id has no corresponding PDC data on the item, the condition is immediately judged as failed and the item's attributes will not be included in the snapshot.
Lore Format System
Lore format definition files are located in the lore_formats/ directory and control how attribute values are displayed and parsed in item Lore.
Lore Format File Format
id: default_flat
format: "{sign}{value} {name}"
precision: 2
read_priority: 50
read_patterns:
- "([+-]?\\d+\\.?\\d*) (.+)"Field Descriptions
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
id | String | Yes | — | Unique format identifier |
format | String | No | "{sign}{value} {name}" | Display format template |
precision | int | No | 2 | Numeric precision (decimal places) |
read_priority | int | No | Auto-assigned by ID | Read priority, higher values are tried first |
read_patterns | List | No | [] | Read regex pattern list |
read_patterns Aliases
The read_patterns field supports the following aliases: read_pattern, lore_patterns, lore_pattern, all of which are merged during processing.
Built-in Lore Formats
| ID | Format | read_priority | Description |
|---|---|---|---|
default_flat | {sign}{value} {name} | 50 | Flat value format, e.g., +100 Physical Attack |
default_percent | {sign}{value}% {name} | 100 | Percentage format, e.g., +15% Physical Damage Bonus |
default_regen | {sign}{value}/s {name} | 80 | Regen format, e.g., +5/s Health Regen |
default_resource | {sign}{value} {name} | 60 | Resource format, e.g., +200 Health |
Priority Explanation
read_priority determines the matching order during Lore parsing. default_percent (100) is tried first to prevent percentage formats from being incorrectly captured by flat value formats.
Lore Parsing Pipeline
Item Lore line
▼
Iterate all Lore formats in descending read_priority order
▼
For each format, attempt to match the Lore line using read_patterns
▼
Match success → extract attribute name and value
▼
Reverse-verify attribute ID via attribute definition's lore_patterns
▼
Write to attribute snapshotFull Parsing Example
Suppose an item Lore contains the line: +150 物理攻击
default_percent(priority=100) attempts match → no%, match failsdefault_regen(priority=80) attempts match → no/s, match failsdefault_resource(priority=60) attempts match → match succeeds, extracts value150, name物理攻击- Iterates attribute definitions, finds that
physical_attack'slore_patternscontains物理攻击 - Writes
physical_attack = 150to the item attribute snapshot