> For the complete documentation index, see [llms.txt](https://worldboxopenmods.gitbook.io/mod-tutorial-en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://worldboxopenmods.gitbook.io/mod-tutorial-en/game-contents/itemcreator.md).

# Create Equipment Asset

## Introduction

Vanllia's `ItemAsset` can be Weapon, Armor, Accessory, Weapon Material, Armor Material, Accessory Material, Equipment Modifier at same time.

But in fact, they should not be unitied into a class entirely. But Maxim did it. It causes `ItemAsset`'s fields have different usage in different places.

The related content is complicated. It wastes time to understand all of them.

So NML provides some creator methods in `NeoModLoader.General.Game.ItemAssetCreator`. Parameters in methods are all valid fields in them.

[Related Example Code](https://github.com/WorldBoxOpenMods/ModExample/blob/master/content/ExampleItems.cs)

## Weapon Material

使用`CreateWeaponMaterial`创建`ItemAsset`后需要自行加入到`AssetManager.items_material_weapon`.

`CreateWeaponMaterial`参数如下

|                     Parameter                    |              Type             |                 解释                 |            备注           | Neccessary |
| :----------------------------------------------: | :---------------------------: | :--------------------------------: | :---------------------: | :--------: |
|                        id                        |             string            |               武器材质的id              |           应当唯一          |      √     |
|                    base\_stats                   |           BaseStats           |                属性加成                |            -            |      ×     |
|                    cost\_gold                    |              int              |            构建该材质消耗黄金的数量            |            -            |      ×     |
|                  cost\_resources                 | KeyValuePair\<string, int>\[] |   <p>构建该材质消耗的<br>资源-数量的键值对数组</p>   | <p>只有前面<br>最多2个元素有效</p> |      ×     |
|                 equipment\_value                 |              int              |              装备评估价值加成              |            -            |      ×     |
|                     metallic                     |              bool             |               是否为金属材质              |        决定攻击/受击声音        |      ×     |
| <p>minimum\_city<br>*storage*<br>resource\_1</p> |              int              |      <p>城市拥有第一种资源<br>的最低数量</p>     |            -            |      ×     |
|                     mod\_rank                    |              int              | <p>在这里用于加成<br>装备评估价值<br>五倍数值加成</p> |            -            |      ×     |
|                      quality                     |          ItemQuality          |              武器品质的最小值              |            -            |      ×     |
|                   tech\_needed                   |             string            |       <p>打造该武器需要的<br>科技id</p>      |            -            |      ×     |

## Accessory/Armor Material

使用`CreateAccessoryOrArmorMaterial`创建`ItemAsset`后需要自行加入到`AssetManager.items_material_accessory`或`AssetManager.items_material_armor`.

`CreateAccessoryOrArmorMaterial`参数如下

|                     Parameter                    |              Type             |                 解释                 |            备注           | Neccessary |
| :----------------------------------------------: | :---------------------------: | :--------------------------------: | :---------------------: | :--------: |
|                        id                        |             string            |               武器材质的id              |           应当唯一          |      √     |
|                    base\_stats                   |           BaseStats           |                属性加成                |            -            |      ×     |
|                    cost\_gold                    |              int              |            构建该材质消耗黄金的数量            |            -            |      ×     |
|                  cost\_resources                 | KeyValuePair\<string, int>\[] |   <p>构建该材质消耗的<br>资源-数量的键值对数组</p>   | <p>只有前面<br>最多2个元素有效</p> |      ×     |
|                 equipment\_value                 |              int              |              装备评估价值加成              |            -            |      ×     |
| <p>minimum\_city<br>*storage*<br>resource\_1</p> |              int              |      <p>城市拥有第一种资源<br>的最低数量</p>     |            -            |      ×     |
|                     mod\_rank                    |              int              | <p>在这里用于加成<br>装备评估价值<br>五倍数值加成</p> |            -            |      ×     |
|                      quality                     |          ItemQuality          |              武器品质的最小值              |            -            |      ×     |
|                   tech\_needed                   |             string            |       <p>打造该武器需要的<br>科技id</p>      |            -            |      ×     |

## Melee Weapon

使用`CreateMeleeWeapon`创建`ItemAsset`后会自动加入到`AssetManager.items`

`CreateMeleeWeapon`参数如下

|         Parameter         |     Type     |               解释               |                         备注                        | Neccessary |
| :-----------------------: | :----------: | :----------------------------: | :-----------------------------------------------: | :--------: |
|             id            |    string    |              武器的id             |              <p>应当唯一<br>与所有其他装备不同</p>             |      √     |
|        base\_stats        |   BaseStats  |              属性加成              |                         -                         |      ×     |
|         materials         |     List     |              可选的材质             |                      从武器材质中选                      |      ×     |
|      item\_modifiers      |     List     |              自带的词条             |            <p>是词条id的列表<br>不是词条type</p>            |      ×     |
|        name\_class        |    string    |             装备类型名称             | <p>注意要自己添加<br>"name\_class\_装备可能的品质"<br>的翻译文本</p> |      ×     |
|      name\_templates      |     List     |           传说品质可选命名模板           |              <p>注意要自己添加<br>对应的命名器</p>             |      ×     |
|        tech\_needed       |    string    |              所需科技              |                      单个科技的id                      |      ×     |
|   action\_attack\_target  | AttackAction |         攻击目标时触发的Action         |                         -                         |      ×     |
|  action\_special\_effect  |  WorldAction |         持有时不断触发的Action         |                         -                         |      ×     |
| special\_effect\_interval |     float    | <p>持有时不断触发的Action<br>的触发间隔</p> |                        单位为秒                       |      ×     |
|      equipment\_value     |      int     |            装备评估价值加成            |                         -                         |      ×     |
|   path\_slash\_animation  |    string    |              攻击动画              |                         -                         |      ×     |

## Range Weapon

使用`CreateRangeWeapon`创建`ItemAsset`后会自动加入到`AssetManager.items`

`CreateRangeWeapon`参数如下

|         Parameter         |     Type     |               解释               |                         备注                        | Neccessary |
| :-----------------------: | :----------: | :----------------------------: | :-----------------------------------------------: | :--------: |
|             id            |    string    |              武器的id             |              <p>应当唯一<br>与所有其他装备不同</p>             |      √     |
|         projectile        |    string    |             投掷物的id             |          <p>使用现成投掷物<br>或自己添加<br>对应投掷物</p>         |      √     |
|        base\_stats        |   BaseStats  |              属性加成              |                         -                         |      ×     |
|         materials         |     List     |              可选的材质             |                      从武器材质中选                      |      ×     |
|      item\_modifiers      |     List     |              自带的词条             |            <p>是词条id的列表<br>不是词条type</p>            |      ×     |
|        name\_class        |    string    |             装备类型名称             | <p>注意要自己添加<br>"name\_class\_装备可能的品质"<br>的翻译文本</p> |      ×     |
|      name\_templates      |     List     |           传说品质可选命名模板           |              <p>注意要自己添加<br>对应的命名器</p>             |      ×     |
|        tech\_needed       |    string    |              所需科技              |                      单个科技的id                      |      ×     |
|   action\_attack\_target  | AttackAction |         攻击目标时触发的Action         |                         -                         |      ×     |
|  action\_special\_effect  |  WorldAction |         持有时不断触发的Action         |                         -                         |      ×     |
| special\_effect\_interval |     float    | <p>持有时不断触发的Action<br>的触发间隔</p> |                        单位为秒                       |      ×     |
|      equipment\_value     |      int     |            装备评估价值加成            |                         -                         |      ×     |
|   path\_slash\_animation  |    string    |              攻击动画              |                         -                         |      ×     |

## Accessory/Armor

使用`CreateArmorOrAccessory`创建`ItemAsset`后会自动加入到`AssetManager.items`

`CreateArmorOrAccessory`参数如下

|         Parameter         |      Type     |               解释               |                         备注                        | Neccessary |
| :-----------------------: | :-----------: | :----------------------------: | :-----------------------------------------------: | :--------: |
|             id            |     string    |              装备的id             |              <p>应当唯一<br>与所有其他装备不同</p>             |      √     |
|       equipmentType       | EquipmentType |             饰品/防具类型            |                       不能是武器                       |      √     |
|        base\_stats        |   BaseStats   |              属性加成              |                         -                         |      ×     |
|         materials         |      List     |              可选的材质             |                      从武器材质中选                      |      ×     |
|      item\_modifiers      |      List     |              自带的词条             |            <p>是词条id的列表<br>不是词条type</p>            |      ×     |
|        name\_class        |     string    |             装备类型名称             | <p>注意要自己添加<br>"name\_class\_装备可能的品质"<br>的翻译文本</p> |      ×     |
|      name\_templates      |      List     |           传说品质可选命名模板           |              <p>注意要自己添加<br>对应的命名器</p>             |      ×     |
|        tech\_needed       |     string    |              所需科技              |                      单个科技的id                      |      ×     |
|   action\_attack\_target  |  AttackAction |         攻击目标时触发的Action         |                         -                         |      ×     |
|  action\_special\_effect  |  WorldAction  |         持有时不断触发的Action         |                         -                         |      ×     |
| special\_effect\_interval |     float     | <p>持有时不断触发的Action<br>的触发间隔</p> |                        单位为秒                       |      ×     |
|      equipment\_value     |      int      |            装备评估价值加成            |                         -                         |      ×     |

## Equipment Modifier

使用`CreateAndAddModifier`创建`ItemAsset`后会自动加入到`AssetManager.items_modifiers`并更新到对应的`pool`

`CreateAndAddModifier`参数如下

|         Parameter         |     Type     |               解释               |                 备注                 | Neccessary |
| :-----------------------: | :----------: | :----------------------------: | :--------------------------------: | :--------: |
|             id            |    string    |              词条的id             |      <p>应当唯一<br>与所有其他词条不同</p>      |      √     |
|         mod\_type         |    string    |              词条的类型             | <p>用于判断是否为同类型词条<br>同类型词条才能比较等级</p> |      √     |
|         mod\_rank         |      int     |              词条的等级             |    <p>同样有5倍于数值的<br>装备评估价值加成</p>    |      √     |
|      translation\_key     |    string    |            词条的翻译key            |            需要自己添加对应的翻译文本           |      √     |
|           rarity          |      int     |            稀有度(常见度)            |   <p>越大越常见<br>游戏本体的值大多集中于1或3</p>   |      ×     |
|      equipment\_value     |      int     |            装备评估价值加成            |                  -                 |      ×     |
|          quality          |  ItemQuality |            武器品质的最小值            |                  -                 |      ×     |
|        base\_stats        |   BaseStats  |              属性加成              |                  -                 |      ×     |
|   action\_attack\_target  | AttackAction |         攻击目标时触发的Action         |                  -                 |      ×     |
|  action\_special\_effect  |  WorldAction |         持有时不断触发的Action         |                  -                 |      ×     |
| special\_effect\_interval |     float    | <p>持有时不断触发的Action<br>的触发间隔</p> |                单位为秒                |      ×     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://worldboxopenmods.gitbook.io/mod-tutorial-en/game-contents/itemcreator.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.
