跳到正文

完整服务器示例:从长剑到刷装循环

本例建立一条完整链:僵尸掉落未鉴定史诗/稀有长剑 → 用卷轴鉴定 → 用材料重铸/洗炼 → 给装备开孔并镶红宝石 → 达成烈焰共鸣。

仓库 examples/complete/ 不会被自动加载。以下每段必须保存到标明的正式路径。先在测试服使用;如果已有同名 ID,请重命名并同步所有引用。

1. 品质 qualities/example.yml

yaml
rare:
  rank: 20
  display-name: '<blue>稀有'
  display:
    item-name: '{quality} {name}'
    lore: ['<blue>稀有品质']
  slots:
    primary: { capacity: 2, initial: 1 }
    secondary: { capacity: 1, initial: 1 }

epic:
  rank: 30
  display-name: '<light_purple>史诗'
  display:
    item-name: '{quality} {name}'
    lore: ['<light_purple>史诗品质']
  slots:
    primary: { capacity: 3, initial: 2 }
    secondary: { capacity: 2, initial: 1 }

2. 词条 affixes/example.yml

yaml
physical_power:
  display-name: '<red>力量'
  slot: primary
  weight: 100
  pools: [weapon_primary]
  applies-to:
    all-tags: [weapon]
    none-tags: [cosmetic]
  lore: ['<red>{name} <white>{values} <dark_gray>[T{tier}]']
  tiers:
    1:
      unlock-at: 1
      weight: 100
      attributes:
        sealattributes:physical_attack:
          add:
            algorithm: triangular
            pity-direction: higher
            min: 8
            mode: 12
            max: 18
            step: 1

vital:
  display-name: '<green>活力'
  slot: secondary
  weight: 80
  pools: [weapon_secondary]
  applies-to:
    any-tags: [weapon, armor]
  tiers:
    1:
      unlock-at: 1
      weight: 100
      attributes:
        sealattributes:max_health:
          add:
            algorithm: uniform
            pity-direction: higher
            min: 15
            max: 25
            step: 1

3. 方案 affix-schemes/example.yml

yaml
standard_weapon:
  default-affix-level: 20
  pools:
    primary: weapon_primary
    secondary: weapon_secondary
  slots:
    primary: { capacity: 2, initial: 1 }
    secondary: { capacity: 2, initial: 1 }

4. 物品与材料 items/example.yml

yaml
example_blade:
  item:
    material: DIAMOND_SWORD
    name: '<aqua>示例长剑'
    lore: ['<gray>完整刷装示例']
    custom-model-data: 10001
    unbreakable: false
    damage: 0
    enchantment-glint: true
    item-flags: [hide-attributes]
  instance: individual
  tags: [equipment, weapon, sword]
  equipment:
    attributes:
      sealattributes:physical_attack:
        add: { min: 18, max: 24 }
      sealattributes:max_health:
        add: 20
        total-percent: 0.05
  affixes:
    scheme: standard_weapon
    affix-level: 25
    slots:
      primary: { capacity: 3, initial: 2 }
      secondary: { capacity: 2, initial: 1 }
  quality:
    pool: { rare: 80, epic: 20 }

identification_scroll:
  item: { material: PAPER, name: '<yellow>鉴定卷轴' }
  instance: stackable
  tags: [identification-material]

reforge_stone:
  item: { material: FIRE_CHARGE, name: '<gold>重铸石' }
  instance: stackable
  tags: [affix-material]

refine_stone:
  item: { material: AMETHYST_SHARD, name: '<aqua>洗炼石' }
  instance: stackable
  tags: [affix-material]

locking_wax:
  item: { material: HONEYCOMB, name: '<yellow>锁定蜡' }
  instance: stackable
  tags: [affix-material]

gem_dust:
  item: { material: GLOWSTONE_DUST, name: '<light_purple>宝石粉尘' }
  instance: stackable
  tags: [socket-material]

ruby_t1:
  item:
    material: RED_DYE
    name: '<red>Ⅰ阶红宝石'
    lore: ['<gray>可镶嵌到攻击孔或通用孔']
    custom-model-data: 11001
  instance: stackable
  tags: [gem, fire]

5. 鉴定 gameplay/identification/rules.yml

yaml
defaults:
  required: false
items:
  example_blade:
    required: true
    cost: { item: identification_scroll, amount: 2 }
display:
  unidentified-lore:
    - '<yellow>✦ 该装备尚未鉴定'
    - '<gray>前往鉴定界面查看隐藏词条'

6. 词条改造 gameplay/affix-modification/rules.yml

yaml
defaults:
  reforge: { enabled: false }
  refine: { enabled: false }
items:
  example_blade:
    reforge:
      enabled: true
      scope: all-unlocked
      cost:
        item: { id: reforge_stone, amount-per-affix: 2 }
        currency: { type: vault, amount-per-affix: '100.00' }
      locks:
        max: 1
        cost:
          item: { id: locking_wax, amount-per-affix: 1 }
      pity:
        revision: 1
        guarantee-on-attempt: 5
        tiers: [1]
    refine:
      enabled: true
      scope: single
      cost:
        item: { id: refine_stone, amount-per-affix: 1 }
        currency: { type: playerpoints, amount-per-affix: '10' }

没有安装对应经济插件时,先删除 currency 行,只测试 SealItems 材料费用。

7. 掉落规则与表

gameplay/loot/rules.yml

yaml
enabled: true
vanilla:
  enabled: true
  defaults: { delivery: killer, notification: actionbar }
  limits:
    max-selection-units-per-death: 2048
    max-generated-stacks-per-death: 64
  rules:
    zombie-example:
      enabled: true
      entity: ZOMBIE
      worlds: [world]
      spawn-reasons: [NATURAL, SPAWNER]
      delivery: killer
      notification: actionbar
      tables:
        - { table: zombie_equipment, trigger-chance: '10%' }
mythic:
  defaults: { delivery: ground, notification: actionbar }

gameplay/loot/tables/zombie.yml

yaml
id: zombie_equipment
mode: weighted
rolls: 1
entries:
  - item: example_blade
    weight: 30
    amount: 1
    quality: epic
    identification: unidentified
  - item: identification_scroll
    weight: 70
    amount: { min: 1, max: 2 }

8. 孔位与宝石

gameplay/sockets/settings.yml

yaml
enabled: true
unidentified: { reveal-sockets: false, allow-operations: false }
equipped-conflicts:
  fallback: disable-excess
  priority: [main-hand, off-hand, helmet, chestplate, leggings, boots]
legacy-items: { policy: preserve }

socket-types.yml

yaml
types:
  attack: { display-name: '<red>攻击孔', accepts: [fire], arcartx-icon: 'sealitems:socket/attack' }
  universal: { display-name: '<light_purple>通用孔', accepts: [fire, elemental], arcartx-icon: 'sealitems:socket/universal' }

limit-profiles.yml

yaml
profiles:
  core-unique:
    same-gem: { per-item: 1, equipped: 1 }
    exclusive-group: { per-item: 1, equipped: 1 }

gems/ruby.yml

yaml
gems:
  ruby_t1:
    categories: [fire, elemental]
    limit-profile: core-unique
    exclusive-group: elemental-core
    effects:
      default:
        sealattributes:max_health: { add: 20 }
      contexts:
        weapon:
          sealattributes:physical_attack: { add: 12, total-percent: 0.10 }

operations.yml 最小全成功版:

yaml
operations:
  unlock-standard:
    action: unlock
    result: random
    allowed-types: [attack, universal]
    costs: { sealitems: { gem_dust: 2 } }
    success: { chance: '100%' }
    failure: { consume-items: true }
  insert-standard:
    action: insert
    costs: { sealitems: { gem_dust: 1 } }
    success: { chance: '100%' }
    failure: { consume-items: true, consume-input-gem: true }
  convert-standard:
    action: convert
    result: selected
    allowed-types: [attack, universal]
    costs: { sealitems: { gem_dust: 3 } }
    success: { chance: '100%' }
    failure: { consume-items: true }
  remove-safe:
    action: remove
    result: return-gem
    costs: { sealitems: { gem_dust: 1 } }
    success: { chance: '100%' }
    failure: { consume-items: true, destroy-existing-gem: false }
  replace-standard:
    action: replace
    result: return-old-gem
    costs: { sealitems: { gem_dust: 2 } }
    success: { chance: '100%' }
    failure: { consume-items: true, consume-input-gem: true }

profiles.yml

yaml
profiles:
  standard-weapon:
    context: weapon
    potential: { weights: { 1: 80, 2: 20 } }
    initially-open: 1
    socket-type-weights: { attack: 80, universal: 20 }
    operations:
      unlock: [unlock-standard]
      insert: [insert-standard]
      convert: [convert-standard]
      remove: [remove-safe]
      replace: [replace-standard]
assignments:
  - { priority: 100, match-tags: [equipment, weapon], profile: standard-weapon }
overrides: {}

resonances/flame.yml

yaml
id: flame-path
display-name: '<red>烈焰之路'
points:
  categories: { fire: 1 }
  items: { ruby_t1: 2 }
thresholds:
  3: { sealattributes:physical_attack: { add: 5 } }
  6: { sealattributes:physical_attack: { add: 10 } }

migrations.yml 初次使用保持空:

yaml
gems: {}
socket-types: {}
profiles: {}

9. GUI provider

三个 GUI 文件顶层都先使用:

yaml
provider: vanilla

业务链验证通过后再改 auto

10. 重载顺序与验收

text
/si reload all
/si health
/si give 玩家名 identification_scroll 20
/si give 玩家名 reforge_stone 20
/si give 玩家名 refine_stone 20
/si give 玩家名 locking_wax 5
/si give 玩家名 gem_dust 20
/si give 玩家名 ruby_t1 2
/si give 玩家名 example_blade 1 epic unidentified

验收清单:

  • [ ] 未鉴定长剑隐藏真实信息。
  • [ ] /si identify 扣 2 卷轴并揭示。
  • [ ] /si modify 能预览重铸/洗炼与锁定费用。
  • [ ] /si socket 能插入、开孔、转换、移除、替换。
  • [ ] 穿戴后 SealAttributes 基础、词条、宝石和共鸣贡献正确。
  • [ ] 材料不足、背包满、移动装备和重复点击都安全拒绝。
  • [ ] 符合条件僵尸能按概率掉落表物品。
  • [ ] 重启后物品 UUID、revision、品质、词条、孔位和宝石不重抽。

Minecraft 服务端插件使用与开发文档