mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
fix(Core) : Enable randomProperties or suffix up to 5 (#2340)
This commit is contained in:
@@ -1131,14 +1131,13 @@ struct ItemLimitCategoryEntry
|
||||
uint32 mode; // 19, 0 = have, 1 = equip (enum ItemLimitCategoryMode)
|
||||
};
|
||||
|
||||
#define MAX_ITEM_ENCHANTMENT_EFFECTS 3
|
||||
#define MAX_ITEM_ENCHANTMENT_EFFECTS 5
|
||||
|
||||
struct ItemRandomPropertiesEntry
|
||||
{
|
||||
uint32 ID; // 0 m_ID
|
||||
//char* internalName // 1 m_Name
|
||||
uint32 enchant_id[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 2-4 m_Enchantment
|
||||
// 5-6 unused
|
||||
uint32 enchant_id[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 2-6 m_Enchantment
|
||||
char* nameSuffix[16]; // 7-22 m_name_lang
|
||||
// 23 name flags
|
||||
};
|
||||
@@ -1149,10 +1148,8 @@ struct ItemRandomSuffixEntry
|
||||
char* nameSuffix[16]; // 1-16 m_name_lang
|
||||
// 17, name flags
|
||||
// 18 m_internalName
|
||||
uint32 enchant_id[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 19-21 m_enchantment
|
||||
//uint32 unk1[2] // 22-23 unknown
|
||||
uint32 prefix[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 24-26 m_allocationPct
|
||||
//uint32 unk2[2] // 27-28 unknown
|
||||
uint32 enchant_id[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 19-23 m_enchantment
|
||||
uint32 prefix[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 24-28 m_allocationPct
|
||||
};
|
||||
|
||||
#define MAX_ITEM_SET_ITEMS 10
|
||||
@@ -1746,23 +1743,25 @@ struct SpellDurationEntry
|
||||
int32 Duration[3];
|
||||
};
|
||||
|
||||
#define MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS 3
|
||||
|
||||
struct SpellItemEnchantmentEntry
|
||||
{
|
||||
uint32 ID; // 0 m_ID
|
||||
uint32 charges; // 1 m_charges
|
||||
uint32 type[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 2-4 m_effect[MAX_ITEM_ENCHANTMENT_EFFECTS]
|
||||
uint32 amount[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 5-7 m_effectPointsMin[MAX_ITEM_ENCHANTMENT_EFFECTS]
|
||||
//uint32 amount2[MAX_ITEM_ENCHANTMENT_EFFECTS] // 8-10 m_effectPointsMax[MAX_ITEM_ENCHANTMENT_EFFECTS]
|
||||
uint32 spellid[MAX_ITEM_ENCHANTMENT_EFFECTS]; // 11-13 m_effectArg[MAX_ITEM_ENCHANTMENT_EFFECTS]
|
||||
char* description[16]; // 14-29 m_name_lang[16]
|
||||
//uint32 descriptionFlags; // 30 name flags
|
||||
uint32 aura_id; // 31 m_itemVisual
|
||||
uint32 slot; // 32 m_flags
|
||||
uint32 GemID; // 33 m_src_itemID
|
||||
uint32 EnchantmentCondition; // 34 m_condition_id
|
||||
uint32 requiredSkill; // 35 m_requiredSkillID
|
||||
uint32 requiredSkillValue; // 36 m_requiredSkillRank
|
||||
uint32 requiredLevel; // 37 m_requiredLevel
|
||||
uint32 ID; // 0 m_ID
|
||||
uint32 charges; // 1 m_charges
|
||||
uint32 type[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]; // 2-4 m_effect[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
|
||||
uint32 amount[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]; // 5-7 m_effectPointsMin[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
|
||||
//uint32 amount2[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS] // 8-10 m_effectPointsMax[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
|
||||
uint32 spellid[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]; // 11-13 m_effectArg[MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS]
|
||||
char* description[16]; // 14-29 m_name_lang[16]
|
||||
//uint32 descriptionFlags; // 30 name flags
|
||||
uint32 aura_id; // 31 m_itemVisual
|
||||
uint32 slot; // 32 m_flags
|
||||
uint32 GemID; // 33 m_src_itemID
|
||||
uint32 EnchantmentCondition; // 34 m_condition_id
|
||||
uint32 requiredSkill; // 35 m_requiredSkillID
|
||||
uint32 requiredSkillValue; // 36 m_requiredSkillRank
|
||||
uint32 requiredLevel; // 37 m_requiredLevel
|
||||
};
|
||||
|
||||
struct SpellItemEnchantmentConditionEntry
|
||||
|
||||
@@ -61,8 +61,8 @@ char const ItemDisplayTemplateEntryfmt[] = "nxxxxsxxxxxxxxxxxxxxxxxxx";
|
||||
//char const ItemCondExtCostsEntryfmt[] = "xiii";
|
||||
char const ItemExtendedCostEntryfmt[] = "niiiiiiiiiiiiiix";
|
||||
char const ItemLimitCategoryEntryfmt[] = "nxxxxxxxxxxxxxxxxxii";
|
||||
char const ItemRandomPropertiesfmt[] = "nxiiixxssssssssssssssssx";
|
||||
char const ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiixxiiixx";
|
||||
char const ItemRandomPropertiesfmt[] = "nxiiiiissssssssssssssssx";
|
||||
char const ItemRandomSuffixfmt[] = "nssssssssssssssssxxiiiiiiiiii";
|
||||
char const ItemSetEntryfmt[] = "dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii";
|
||||
char const LFGDungeonEntryfmt[] = "nssssssssssssssssxiiiiiiiiixxixixxxxxxxxxxxxxxxxx";
|
||||
char const LightEntryfmt[] = "nifffxxxxxxxxxx";
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -437,7 +437,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
|
||||
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]);
|
||||
if (pEnchant)
|
||||
{
|
||||
for (int t = 0; t < MAX_ITEM_ENCHANTMENT_EFFECTS; t++)
|
||||
for (int t = 0; t < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; t++)
|
||||
if (pEnchant->spellid[t] == m_spellInfo->Id)
|
||||
{
|
||||
amount = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000);
|
||||
|
||||
@@ -6969,7 +6969,7 @@ SpellCastResult Spell::CheckItems()
|
||||
// do not allow adding usable enchantments to items that have use effect already
|
||||
if (enchantEntry)
|
||||
{
|
||||
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
|
||||
for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
|
||||
{
|
||||
switch (enchantEntry->type[s])
|
||||
{
|
||||
|
||||
@@ -2914,7 +2914,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)
|
||||
// support only enchantings with add socket in this slot
|
||||
{
|
||||
bool add_socket = false;
|
||||
for (uint8 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
|
||||
for (uint8 i = 0; i < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++i)
|
||||
{
|
||||
if (pEnchant->type[i] == ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET)
|
||||
{
|
||||
|
||||
@@ -2801,7 +2801,7 @@ void SpellMgr::LoadSpellCustomAttr()
|
||||
{
|
||||
uint32 enchantId = spellInfo->Effects[j].MiscValue;
|
||||
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
|
||||
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
|
||||
for (uint8 s = 0; s < MAX_SPELL_ITEM_ENCHANTMENT_EFFECTS; ++s)
|
||||
{
|
||||
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user