<p align="center">
  <a href="README.ja.md">日本語</a> | <a href="README.md">English</a> | <a href="README.es.md">Español</a> | <a href="README.fr.md">Français</a> | <a href="README.hi.md">हिन्दी</a> | <a href="README.it.md">Italiano</a> | <a href="README.pt-BR.md">Português (BR)</a>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/mcp-tool-shop-org/brand/main/logos/ai-rpg-engine/readme.png" width="400" alt="AI RPG Engine">
</p>

<p align="center">
  <a href="https://github.com/mcp-tool-shop-org/ai-rpg-engine/actions/workflows/ci.yml"><img src="https://github.com/mcp-tool-shop-org/ai-rpg-engine/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
  <a href="https://github.com/mcp-tool-shop-org/ai-rpg-engine/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
  <a href="https://mcp-tool-shop-org.github.io/ai-rpg-engine/"><img src="https://img.shields.io/badge/Landing_Page-live-blue" alt="Landing Page"></a>
</p>

# @ai-rpg-engine/content-schema

AI RPG 引擎的内容模式和验证器——将房间、实体、对话、物品和任务定义为数据。

## 安装

```bash
npm install @ai-rpg-engine/content-schema
```

## 包含内容

- **房间模式**：包含出口、属性和环境状态的区域。
- **实体模式**：定义 NPC、生物和玩家角色。
- **对话模式**：基于图的对话树，包含条件和效果。
- **物品模式**：装备、消耗品、任务物品，以及属性修改器。
- **内容包加载器**：验证和加载 JSON/TypeScript 内容包。
- **能力模式**：定义能力、状态，以及包含平衡建议的包验证。
- **模式验证器**：运行时验证，提供结构化的错误信息。

## 用法

```typescript
import { loadContent, validateGameContent, toJsonSchema } from '@ai-rpg-engine/content-schema';

const result = loadContent(myContentData);
if (!result.ok) {
  console.error(result.errors);
}

const refs = validateGameContent(myContentData);
if (!refs.ok) {
  console.error(refs.errors);
}

const schema = toJsonSchema();
```

## 文档

- [内容文件（第 13 章）](https://mcp-tool-shop-org.github.io/ai-rpg-engine/handbook/13-content-files/)：创建内容包。
- [手册](https://mcp-tool-shop-org.github.io/ai-rpg-engine/handbook/)
- [GitHub](https://github.com/mcp-tool-shop-org/ai-rpg-engine)

---

由 <a href="https://mcp-tool-shop.github.io/">MCP Tool Shop</a> 构建。
