fix(Core) : Enable randomProperties or suffix up to 5 (#2340)

This commit is contained in:
Shard
2020-01-23 08:06:05 +01:00
committed by Stoabrogga
parent 59234f8f4b
commit 9f690a3741
9 changed files with 38 additions and 52 deletions

View File

@@ -608,8 +608,8 @@ void Item::SetItemRandomProperties(int32 randomPropId)
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, item_rand->ID);
SetState(ITEM_CHANGED, GetOwner());
}
for (uint32 i = PROP_ENCHANTMENT_SLOT_2; i < PROP_ENCHANTMENT_SLOT_2 + 3; ++i)
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_2], 0, 0);
for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < MAX_ENCHANTMENT_SLOT; ++i)
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0);
}
}
else
@@ -625,7 +625,7 @@ void Item::SetItemRandomProperties(int32 randomPropId)
SetState(ITEM_CHANGED, GetOwner());
}
for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_0 + 3; ++i)
for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < MAX_ENCHANTMENT_SLOT; ++i)
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0);
}
}
@@ -898,7 +898,7 @@ void Item::ClearEnchantment(EnchantmentSlot slot)
if (!GetEnchantmentId(slot))
return;
for (uint8 x = 0; x < MAX_ITEM_ENCHANTMENT_EFFECTS; ++x)
for (uint8 x = 0; x < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++x)
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + x, 0);
SetState(ITEM_CHANGED, GetOwner());
}

View File

@@ -152,11 +152,11 @@ enum EnchantmentSlot
PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment
MAX_INSPECTED_ENCHANTMENT_SLOT = 7,
PROP_ENCHANTMENT_SLOT_0 = 7, // used with RandomSuffix
PROP_ENCHANTMENT_SLOT_1 = 8, // used with RandomSuffix
PROP_ENCHANTMENT_SLOT_0 = 7, // used with RandomSuffix and RandomProperty
PROP_ENCHANTMENT_SLOT_1 = 8, // used with RandomSuffix and RandomProperty
PROP_ENCHANTMENT_SLOT_2 = 9, // used with RandomSuffix and RandomProperty
PROP_ENCHANTMENT_SLOT_3 = 10, // used with RandomProperty
PROP_ENCHANTMENT_SLOT_4 = 11, // used with RandomProperty
PROP_ENCHANTMENT_SLOT_3 = 10, // used with RandomSuffix and RandomProperty
PROP_ENCHANTMENT_SLOT_4 = 11, // used with RandomSuffix and RandomProperty
MAX_ENCHANTMENT_SLOT = 12
};

View File

@@ -8579,7 +8579,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (!pEnchant)
continue;
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
{
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
continue;
@@ -8730,7 +8730,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant)
continue;
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
{
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_USE_SPELL)
continue;
@@ -12938,20 +12938,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update, bool swap)
// remove held enchantments, update expertise
if (slot == EQUIPMENT_SLOT_MAINHAND)
{
if (pItem->GetItemSuffixFactor())
{
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_3);
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_4);
}
else
{
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_0);
pItem->ClearEnchantment(PROP_ENCHANTMENT_SLOT_1);
}
UpdateExpertise(BASE_ATTACK);
}
else if (slot == EQUIPMENT_SLOT_OFFHAND)
UpdateExpertise(OFF_ATTACK);
// update armor penetration - passive auras may need it
@@ -14353,7 +14340,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool
if (!item->IsBroken())
{
for (int s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
for (int s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
{
uint32 enchant_display_type = pEnchant->type[s];
uint32 enchant_amount = pEnchant->amount[s];