# 创建一个自定义宠物

## 示例配置

示例配置如下：

```yaml
# 宠物的ID就是 .yml 文件的名称
# 例如 vampire.yml 的宠物ID就是 vampire
# 你可以将宠物的配置文件放置到 pets 文件夹下的任意位置
# 包括放置到子文件夹里面
# _example.yml 文件不会加载

# 显示给玩家的宠物名称
name: "&6老虎"

# 宠物描述
description: "&8&o通过造成近战伤害升级!"

# 指定各个等级所需的经验值，每一行代表新的一级
level-xp-requirements:
  - 50
  - 125
  - 200
  - 300
  - 500
  - 750
  - 1000
  - 1500
  - 2000
  - 3500
  - 5000
  - 7500
  - 10000
  - 15000
  - 20000
  - 30000
  - 50000
  - 75000
  - 100000
  - 200000
  - 300000
  - 400000
  - 500000
  - 600000
  - 700000
  - 800000
  - 900000
  - 1000000
  - 1100000
  - 1200000
  - 1300000
  - 1400000
  - 1500000
  - 1600000
  - 1700000
  - 1800000
  - 1900000
  - 2000000
  - 2100000
  - 2200000
  - 2300000
  - 2400000
  - 2500000
  - 2600000
  - 2750000
  - 2900000
  - 3100000
  - 3400000
  - 3700000

# 经验值获取方法
# 一个获取方法配置由 trigger，multiplier，conditions，filters 组成
# multiplier 加倍触发器的触发器属性中的值，加倍后的值就是获得的经验值
xp-gain-methods:
  - id: melee_attack
    multiplier: 0.5
    conditions: [ ] # 你可以设置该获取方法需要满足一定条件后才会使用

# 宠物描述中使用的变量符
# 在描述中通过 %key% 格式使用它们，例如这里就是 %damage_multiplier%
level-placeholders:
  - id: "damage_multiplier"
    value: "%level%"

# %effects% 变量符显示的文本

# 开始的数字代表的是开始显示这个等级奖励信息的等级
# 当检测到有另外一个等级可用时（例如10级将会显示这里设置的10）将会替代之前可用的信息
effects-description:
  1:
    - "&8» &8Gives a &a+%damage_multiplier%%&8 额外近战伤害"

# %rewards% 变量符显示的文本
rewards-description:
  1:
    - "&8» &8Gives a &a+%damage_multiplier%%&8 额外近战伤害"

# %level_up_messages% 变量符显示的文本
level-up-messages:
  1:
    - "&8» &8Gives a &a+%damage_multiplier%%&8 额外近战伤害"

# 每次升级后执行的指令，有两种格式:
# 等级值:指令 (例如. 10:eco give %player% 1000)，代表升到10级后执行这个指令
# 指令 (e.g. eco give %player% 5000)，代表每次升级都执行这个指令
level-commands: [ ]

# 宠物的效果
# 使用 %level% 来表示宠物等级的变量符
effects:
  - id: damage_multiplier
    args:
      multiplier: "%level% * 0.01 + 1"
    triggers:
      - melee_attack
      
# 宠物效果能够激活的条件
# 你仍可以使用 %level% 变量符
conditions: [ ]

# 宠物实体的材质
# 如果你使用 ModelEngine，请使用 modelengine:id 格式
entity-texture: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0="
modelengine-animation: "fly" # 如果你使用 ModelEngine，你应该指定一个动画

# 宠物在GUI内的图标
icon: player_head texture:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTA5NWZjYzFlM2Q3Y2JkMzUwZjE5YjM4OTQ5OGFiOGJiOTZjNjVhZDE4NWQzNDU5MjA2N2E3ZDAzM2FjNDhkZSJ9fX0=

# 宠物生成蛋
spawn-egg:
  enabled: true # If the pet should have a spawn egg
  item: blaze_spawn_egg unbreaking:1 hide_enchants
  name: "&6Tiger&f Pet Spawn Egg"
  lore:
    - ""
    - "&8&oPlace on the ground to"
    - "&8&ounlock the &r&6Tiger&8&o pet!"
  craftable: false
  recipe: [ ]
  # recipe-permission: ecopets.craft.tiger
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.superiormc.cn/auxilor-plugins/ecopets/chuang-jian-yi-ge-zi-ding-yi-chong-wu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
