导入 / 导出
QI 支持从 MMOItems / NeigeItems 导入物品,以及把内容打包成 .qipack 导出 / 导入。
🧭 想要从头迁移的完整步骤 + 字段映射对照表 + dry-run 解读?看 导入 / 导出实操手册。
1. 导入外部物品
把 MMOItems / NeigeItems 的物品配置放进 plugins/QinhItems/imports/ 目录,用命令导入。
| 命令 | 用途 |
|---|---|
/qi imports | 显示导入文件数 |
/qi imports list | 列出导入文件 |
/qi imports run | 执行导入 |
/qi imports dry-run | 预览(不真正导入) |
/qi migrate | 迁移旧物品源(带校验) |
/qi migrate dry-run | 预览迁移 |
支持格式
| 格式 | 导入内容 |
|---|---|
mmoitems | base.*、stats、ability、permission、required-level、required-class、perm-effects |
neigeitems | sections、FancyDrop、actions、actions_file、data |
generic | 未知格式的兜底 |
MMOItems 属性映射
- 核心属性 → 基础值:
attack-damage→base_attack_damage、max-health→base_health、defense→base_defense。 - 普通属性:
attack-speed、magic-damage、armor-penetration、max-mana、mana-regeneration。 - 比率属性(÷100):
critical-strike-chance→critical_rate、dodge-rating、block-rating、lifesteal。
MMOItems 技能映射(ability → 触发器)
| MMOItems | QI 触发器 |
|---|---|
| attack / on_hit | on_damage |
| damaged / when_hit | on_hit |
| right_click / left_click / shift_* | 同名 |
| sneak | shift_toggle |
| kill_entity | on_kill |
| shoot_bow | bow_shoot |
| shoot_trident | trident_throw |
| death / login | death / join |
限制映射
| MMOItems | QI |
|---|---|
required-level: N | level:N |
required-class: A,B | class:A,B(委托 QinhItemUseCheckEvent) |
permission: X | permission:X |
API
kotlin
QinhItemImportService.importAll(dryRun = false): ImportReport
QinhItemImportService.migrateLegacySources(dryRun): ImportReport
QinhItemImportService.importFiles(files, dryRun): ImportReportImportReport 含:扫描文件数、导入数、导入 ID、各格式计数、映射字段、生成的段 / 词缀、警告 / 错误。
2. 内容包(.qipack)
把当前 QI 内容(物品引用的段 / 词缀 / 层快照)打包成单文件,便于跨服分发。
| 命令 | 用途 |
|---|---|
/qi packs | 显示包文件数与目录 |
/qi packs list | 列出包文件 |
/qi packs export | 导出所有内容到文件 |
/qi packs import | 导入(= apply / sync) |
/qi packs sync | 同步(刷新 + 导出) |
/qi packs apply | 应用(= sync) |
/qi packs gui | 打开内容包编辑 GUI |
导出
kotlin
QinhItemPackExportService.exportAll(targetFileName = "qinhitems-pack.yml"): PackExportReport导出结构:metadata(计数、ID、各格式分布、schema 版本)+ sections + affixes + layerSnapshots + 每物品的 section_ids / affix_ids / layer_summary。
导入
kotlin
QinhItemPackImportService.importFile(file): PackImportReport导入会校验声明数与实际加载数是否一致(structureMismatch / mismatchSummary),缺 metadata 时从节点键回退计算。
3. 导入产物转换
kotlin
QinhItemImportArtifacts.toSection(id, mappingResult): QinhSection
QinhItemImportArtifacts.toAffix(id, mappingResult): QinhAffix