📖 表说明
法术掉落模板表定义了特定法术施放时可能掉落的物品及其概率。这个表用于创建法术相关的掉落系统,例如某些特殊法术施放后会产生物品奖励。
数据来源: 本文档基于AzerothCore官方Wiki和官方数据表借鉴.sql编写,确保字段定义的准确性和权威性。
📊 表结构
| 字段名 | 数据类型 | 属性 | 键 | 默认值 | 描述 |
|---|---|---|---|---|---|
| Entry | int UNSIGNED | 不为空 | 主键 | 0 | 法术ID,对应Spell.dbc |
| Item | int UNSIGNED | 不为空 | 主键 | 0 | 物品ID,对应item_template.entry |
| Reference | int | 不为空 | 0 | 引用ID,如果不为0则引用reference_loot_template | |
| Chance | float | 不为空 | 100 | 掉落几率(百分比) | |
| QuestRequired | tinyint | 不为空 | 0 | 是否需要任务(0=否,1=是) | |
| LootMode | smallint UNSIGNED | 不为空 | 1 | 掉落模式(位掩码) | |
| GroupId | tinyint UNSIGNED | 不为空 | 0 | 组ID,同一组中只会掉落一个物品 | |
| MinCount | tinyint UNSIGNED | 不为空 | 1 | 最小掉落数量 | |
| MaxCount | tinyint UNSIGNED | 不为空 | 1 | 最大掉落数量 | |
| Comment | varchar(255) | 可为空 | NULL | 注释说明 |
主键: (Entry, Item)
注意: spell_loot_template的GroupId不是主键
🔑 核心字段详解
🆔 Entry - 法术ID
详细说明:法术掉落模板的唯一标识ID,对应Spell.dbc文件中的法术记录。
取值范围:对应Spell.dbc中的法术ID
- 主键字段,标识法术掉落模板
- 对应Spell.dbc中的法术ID
- 只有特定法术才会使用此表的掉落配置
- 用于关联法术和其掉落产物
示例:
- Entry=12345 - 特殊法术的掉落配置
- Entry=67890 - 另一个特殊法术的掉落配置
📦 Item - 物品ID
详细说明:法术施放后掉落的物品ID,对应item_template表中的entry字段。
取值范围:对应item_template.entry
- 主键字段,标识掉落的物品
- 必须对应item_template表中存在的entry
- 可以是各种类型的物品
- 用于定义法术掉落的具体物品
示例:
- Item=123 - 某种物品
- Item=456 - 另一种物品
其他字段说明
注意: 其他字段(Reference、Chance、QuestRequired、LootMode、GroupId、MinCount、MaxCount、Comment)的详细说明与creature_loot_template完全相同,请参考 creature_loot_template 的字段详解。
💡 实际案例
法术 特殊法术掉落配置
配置特殊法术施放后的物品掉落
-- 特殊法术掉落配置
DELETE FROM spell_loot_template WHERE Entry = 12345;
INSERT INTO spell_loot_template VALUES
(12345, 123, 0, 100, 0, 1, 0, 1, 1, '特殊物品');
效果: 施放法术12345后必定掉落1个物品123。
法术 多物品掉落配置
配置法术施放后可能掉落多种物品
-- 多物品掉落配置
DELETE FROM spell_loot_template WHERE Entry = 67890;
INSERT INTO spell_loot_template VALUES
(67890, 123, 0, 50, 0, 1, 0, 1, 1, '物品A'),
(67890, 456, 0, 50, 0, 1, 0, 1, 1, '物品B');
效果: 施放法术67890后有50%几率掉落物品123,50%几率掉落物品456。
⚡ 快速参考
表关系
- 法术表: spell_dbc - 法术数据表
- 关联字段: Entry → spell_dbc.ID
- 物品表: item_template - 物品模板表
- 关联字段: Item → item_template.entry
- 引用表: reference_loot_template - 引用掉落模板表
- 关联字段: Reference → reference_loot_template.entry
🔗 相关表格
- spell_dbc - 法术数据表
- item_template - 物品模板表
- creature_loot_template - 生物掉落模板表
- reference_loot_template - 引用掉落模板表
❓ 常见问题
Q1: 如何配置法术的物品掉落?
在spell_loot_template表中添加条目,指定法术ID(Entry)和物品ID(Item)。设置Chance字段控制掉落几率。
Q2: 法术掉落可以设置多个物品吗?
可以。在spell_loot_template表中添加多个条目,每个条目对应一个可能的掉落物品。使用Chance字段控制各物品的出现几率。
Q3: 如何配置必定掉落的物品?
设置Chance=100,表示该物品必定掉落。可以配合MinCount和MaxCount字段控制物品的数量范围。