[12187] Fix item random properties and suffixes

Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
Yaki Khadafi 2012-09-05 20:36:38 +03:00 committed by Antz
parent c58ffa3c41
commit 4049442c80
5 changed files with 30 additions and 9 deletions

View file

@ -998,6 +998,12 @@ bool Item::IsBoundByEnchant() const
if (!enchant_id)
continue;
if (enchant_slot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
return true;
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
continue;
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!enchantEntry)
continue;

View file

@ -164,14 +164,17 @@ enum EnchantmentSlot
SOCK_ENCHANTMENT_SLOT_3 = 4,
BONUS_ENCHANTMENT_SLOT = 5,
PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment
MAX_INSPECTED_ENCHANTMENT_SLOT = 7,
// = 7,
REFORGE_ENCHANTMENT_SLOT = 8,
TRANSMOGRIFY_ENCHANTMENT_SLOT = 9,
MAX_INSPECTED_ENCHANTMENT_SLOT = 10,
PROP_ENCHANTMENT_SLOT_0 = 7, // used with RandomSuffix
PROP_ENCHANTMENT_SLOT_1 = 8, // used with RandomSuffix
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
MAX_ENCHANTMENT_SLOT = 12
PROP_ENCHANTMENT_SLOT_0 = 10, // used with RandomSuffix
PROP_ENCHANTMENT_SLOT_1 = 11, // used with RandomSuffix
PROP_ENCHANTMENT_SLOT_2 = 12, // used with RandomSuffix and RandomProperty
PROP_ENCHANTMENT_SLOT_3 = 13, // used with RandomProperty
PROP_ENCHANTMENT_SLOT_4 = 14, // used with RandomProperty
MAX_ENCHANTMENT_SLOT = 15,
};
#define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment)

View file

@ -7686,6 +7686,9 @@ void Player::CastItemCombatSpell(Unit* Target, WeaponAttackType attType)
// item combat enchantments
for (int e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot)
{
if (e_slot > PRISMATIC_ENCHANTMENT_SLOT && e_slot < PROP_ENCHANTMENT_SLOT_0)
continue;
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant) continue;
@ -7790,6 +7793,9 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
// Item enchantments spells casted at use
for (int e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot)
{
if (e_slot > PRISMATIC_ENCHANTMENT_SLOT && e_slot < PROP_ENCHANTMENT_SLOT_0)
continue;
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant)
@ -12309,6 +12315,9 @@ void Player::AddEnchantmentDurations(Item* item)
{
for (int x = 0; x < MAX_ENCHANTMENT_SLOT; ++x)
{
if (x > PRISMATIC_ENCHANTMENT_SLOT && x < PROP_ENCHANTMENT_SLOT_0)
continue;
if (!item->GetEnchantmentId(EnchantmentSlot(x)))
continue;
@ -12405,6 +12414,9 @@ void Player::ApplyEnchantment(Item* item, bool apply)
void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition)
{
if (slot > PRISMATIC_ENCHANTMENT_SLOT && slot < PROP_ENCHANTMENT_SLOT_0)
return;
if (!item)
return;

View file

@ -796,7 +796,7 @@ void Player::UpdateMasteryAuras()
if (!masterySpells)
return;
for (int i = 0; i < masterySpells->size(); ++i)
for (uint32 i = 0; i < masterySpells->size(); ++i)
{
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
if (!holder)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12186"
#define REVISION_NR "12187"
#endif // __REVISION_NR_H__