DB/SpellItemEnchantmentCondition

From wowdev
Jump to navigation Jump to search

≥ BC

Structure

Column	Field 		Type 		Notes 
1 	ID 		Integer 	Referenced from SpellItemEnchantment.dbc  
2 	gemColor[5] 	Byte 		
7 	LT_Operand[5] 	Integer 	
12 	comparator[5] 	Byte 	
17 	compareColor[5] 	Byte 	
22 	value[5] 	Integer 	
27 	Logic[5] 	Byte
struct SpellItemEnchantmentConditionEntry // sizeof(0x48)
{
   m_ID; // +0x0, size 0x4, type 0
   m_lt_operandType; // +0x4, size 0x5, type 0
   m_lt_operand; // +0xC, size 0x14, type 0
   m_operator; // +0x20, size 0x5, type 0
   m_rt_operandType; // +0x25, size 0x5, type 0
   m_rt_operand; // +0x2C, size 0x14, type 0
   m_logic; // +0x40, size 0x5, type 0 
};

How It Works

I think the last unknown, represents a boolean if the conditions should be and'ed or or'ed together (it's only set for entries with more than one condition).

The "comparator" field seems to determine how to compare the values, what I've noticed so far, from what's available in the DBC file at the moment:

  • 2: Seems to be <
    • Used in Compare as: Requires more [compareColor] gems than [gemColor] gems.
  • 3: Seems to be >
    • Used in Compare as: Requires more [gemColor] gems than [compareColor] gems.
    • Used in Value as: Requires at least [value + 1] [gemColor] gems.
  • 5: Seems to be >=
    • Used in Value as: Requires at least [value] [gemColor] gems.

Type: Value

Example: 
Swift Skyfire Diamond
+24 Attack Power and Minor Run Speed Increase
Requires at least 2 Yellow gems
Requires at least 1 Red gem

Matching DBC entry (id 31):

gemColor:     {3, 2, 0, 0, 0}
unknownValue: {0, 0, 0, 0, 0}
comparator:   {5, 5, 0, 0, 0}
compareColor: {0, 0, 0, 0, 0}
value:        {2, 1, 0, 0, 0}
unknown:      {1, 0, 0, 0, 0}
  • Requires at least (2) (Gem Type 3 = Yellow) gems
  • Requires at least (1) (Gem Type 2 = Red) gems

Type: Compare

Example: 
Bracing Earthstorm Diamond
+26 Healing Spells & 2% Reduced Threat
Requires more Yellow gems than Blue gems
Requires more Red gems than Blue gems

Matching DBC entry (id 34):

gemColor:     {3, 2, 0, 0, 0}
unknownValue: {0, 0, 0, 0, 0}
comparator:   {3, 3, 0, 0, 0}
compareColor: {4, 4, 0, 0, 0}
value:        {0, 0, 0, 0, 0}
unknown:      {1, 0, 0, 0, 0}
  • Requires more (Gem Type 3 = Yellow) gems than (Gem Type 4 = Blue) gems
  • Requires more (Gem Type 2 = Red) gems than (Gem Type 4 = Blue) gems

GlobalStrings.lua constants

ENCHANT_CONDITION_AND = " and\32";
ENCHANT_CONDITION_EQUAL_COMPARE = "an equal number of %s and %s gems";
ENCHANT_CONDITION_EQUAL_VALUE = "exactly %d %s gem";
ENCHANT_CONDITION_EQUAL_VALUE_P1 = "exactly %d %s gems";
ENCHANT_CONDITION_LESS_VALUE = "less than %d %s gem";
ENCHANT_CONDITION_LESS_VALUE_P1 = "less than %d %s gems";
ENCHANT_CONDITION_MORE_COMPARE = "more %s gems than %s gems";
ENCHANT_CONDITION_MORE_EQUAL_COMPARE = "at least as many %s gems as %s gems";
ENCHANT_CONDITION_MORE_VALUE = "at least %d %s gem";
ENCHANT_CONDITION_MORE_VALUE_P1 = "at least %d %s gems";
ENCHANT_CONDITION_NOT_EQUAL_COMPARE = "a different number of %s and %s gems";
ENCHANT_CONDITION_NOT_EQUAL_VALUE = "any number but %d %s gem";
ENCHANT_CONDITION_NOT_EQUAL_VALUE_P1 = "any number but %d %s gems";
ENCHANT_CONDITION_REQUIRES = "Requires\32";

4.3.4.15595

struct SpellItemEnchantmentConditionEntry {
   uint32_t m_ID;
   uint8 m_lt_operandType[3];
   uint8 m_lt_op_padding[5];
   uint32 m_lt_operand[5];
   uint8 m_operator[3];
   uint8 m_op_padding[2];
   uint8 m_rt_operandType[3];
   uint16 m_rt_op_padding[2];
   uint32 m_rt_operand[3];
   uint32 m_rt_padding[4];
};

6.0.1.18179

struct SpellItemEnchantmentConditionRec {
  uint32_t m_ID;
  uint8_t m_lt_operandType[5];
  uint8_t padding_0[3];
  uint32_t m_lt_operand[5];
  uint8_t m_operator[5];
  uint8_t m_rt_operandType[5];
  uint8_t padding_1[2];
  uint32_t m_rt_operand[5];
  uint8_t m_logic[5];
  uint8_t padding_2[3];
};