📊 SpellItemEnchantmentCondition.dbc
SpellItemEnchantmentCondition.dbc 定义了附魔效果的激活条件。控制附魔在何种状态下生效,如物品等级范围、角色等级要求等。
📋 字段结构
| 索引 | 字段名 | 类型 | 说明 |
|---|---|---|---|
| 0 | ID | uint32 | 条件唯一标识符 |
| 1-5 | Lt_OperandType[1-5] | uint32 | 左操作数类型 |
| 6-10 | Lt_Operand[1-5] | uint32 | 左操作数值 |
| 11-15 | Operator[1-5] | uint32 | 比较运算符 |
| 16-20 | Rt_OperandType[1-5] | uint32 | 右操作数类型 |
| 21-25 | Rt_Operand[1-5] | uint32 | 右操作数值 |
| 26-30 | Logic[1-5] | uint32 | 逻辑连接符(AND/OR) |
📌 关键字段详解
ID - 条件索引
被 SpellItemEnchantment.dbc 的 ConditionID 字段引用。当 ID=0 表示无条件,附魔始终有效。
Lt_OperandType / Rt_OperandType - 操作数类型
定义比较值的来源类型:1=物品等级(Item Level)、2=装备槽位、3=装备类型、4=常量值、5=角色等级。
Operator - 比较运算符
1=等于、2=不等于、3=小于、4=小于等于、5=大于、6=大于等于。
Logic - 逻辑连接
定义多个条件组合方式。0=NONE(单条件)、1=AND(所有条件必须满足)、2=OR(满足任一条件即可)。
💡 实际应用场景
| 场景 | 条件配置 | 说明 |
|---|---|---|
| 物品等级限制 | Lt_Type=1, Op=5, Rt_Type=4, Rt_Val=200 | 物品等级>200时附魔生效 |
| 套装效果 | Lt_Type=2, Op=1, Rt_Type=4, Rt_Val=1 | 仅头盔位置生效 |
| 角色等级 | Lt_Type=5, Op=5, Rt_Type=4, Rt_Val=60 | 仅60级以上角色 |
🔧 使用示例
查询附魔条件
-- 查询某附魔(ID=1234)的条件配置
SELECT e.ID AS EnchantID, e.Name_enUS, c.*
FROM spell_item_enchantment e
LEFT JOIN spell_item_enchantment_condition c ON e.ConditionID = c.ID
WHERE e.ID = 1234;
创建条件限制
-- 创建条件:物品等级>=200 且 角色等级>=60
INSERT INTO spell_item_enchantment_condition (ID, Lt_OperandType_1, Lt_Operand_1, Operator_1, Rt_OperandType_1, Rt_Operand_1, Logic_1,
Lt_OperandType_2, Lt_Operand_2, Operator_2, Rt_OperandType_2, Rt_Operand_2, Logic_2)
VALUES (100, 1, 0, 5, 4, 200, 1, 5, 0, 5, 4, 60, 0);
💡 使用技巧
- 条件组合:可通过多个条件槽位 + Logic=NONE/AND/OR 构建复杂条件逻辑。
- 条件层级:最多支持 5 个条件组合,足以表达绝大多数业务需求。
- 默认行为:ConditionID=0 或未设置条件时,附魔无条件生效。
- 扩展性:当需要更复杂的条件时,可结合 spell_proc_event 表实现。
- 参考链接:AzerothCore Wiki - spell_item_enchantment_condition