mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 02:25:38 +01:00
Core/Items: Updated random property value calculation
This commit is contained in:
@@ -127,36 +127,42 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
|
||||
if (!itemProto->RandomSuffix)
|
||||
return 0;
|
||||
|
||||
RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
|
||||
if (!randomProperty)
|
||||
return 0;
|
||||
return GetRandomPropertyPoints(itemProto->ItemLevel, itemProto->Quality, itemProto->InventoryType, itemProto->SubClass);
|
||||
}
|
||||
|
||||
uint32 suffixFactor;
|
||||
switch (itemProto->InventoryType)
|
||||
uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subClass)
|
||||
{
|
||||
uint32 propIndex;
|
||||
|
||||
switch (inventoryType)
|
||||
{
|
||||
// Items of that type don`t have points
|
||||
case INVTYPE_NON_EQUIP:
|
||||
case INVTYPE_BAG:
|
||||
case INVTYPE_TABARD:
|
||||
case INVTYPE_AMMO:
|
||||
case INVTYPE_QUIVER:
|
||||
case INVTYPE_RELIC:
|
||||
return 0;
|
||||
// Select point coefficient
|
||||
case INVTYPE_HEAD:
|
||||
case INVTYPE_BODY:
|
||||
case INVTYPE_CHEST:
|
||||
case INVTYPE_LEGS:
|
||||
case INVTYPE_RANGED:
|
||||
case INVTYPE_2HWEAPON:
|
||||
case INVTYPE_ROBE:
|
||||
suffixFactor = 0;
|
||||
case INVTYPE_THROWN:
|
||||
propIndex = 0;
|
||||
break;
|
||||
case INVTYPE_RANGEDRIGHT:
|
||||
if (subClass == ITEM_SUBCLASS_WEAPON_WAND)
|
||||
propIndex = 3;
|
||||
else
|
||||
propIndex = 0;
|
||||
break;
|
||||
case INVTYPE_WEAPON:
|
||||
case INVTYPE_WEAPONMAINHAND:
|
||||
case INVTYPE_WEAPONOFFHAND:
|
||||
propIndex = 3;
|
||||
break;
|
||||
case INVTYPE_SHOULDERS:
|
||||
case INVTYPE_WAIST:
|
||||
case INVTYPE_FEET:
|
||||
case INVTYPE_HANDS:
|
||||
case INVTYPE_TRINKET:
|
||||
suffixFactor = 1;
|
||||
propIndex = 1;
|
||||
break;
|
||||
case INVTYPE_NECK:
|
||||
case INVTYPE_WRISTS:
|
||||
@@ -164,36 +170,29 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
|
||||
case INVTYPE_SHIELD:
|
||||
case INVTYPE_CLOAK:
|
||||
case INVTYPE_HOLDABLE:
|
||||
suffixFactor = 2;
|
||||
break;
|
||||
case INVTYPE_WEAPON:
|
||||
case INVTYPE_WEAPONMAINHAND:
|
||||
case INVTYPE_WEAPONOFFHAND:
|
||||
suffixFactor = 3;
|
||||
break;
|
||||
case INVTYPE_RANGED:
|
||||
case INVTYPE_THROWN:
|
||||
case INVTYPE_RANGEDRIGHT:
|
||||
suffixFactor = 4;
|
||||
propIndex = 2;
|
||||
break;
|
||||
case INVTYPE_RELIC:
|
||||
propIndex = 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
// Select rare/epic modifier
|
||||
switch (itemProto->Quality)
|
||||
|
||||
RandomPropertiesPointsEntry const* randPropPointsEntry = sRandomPropertiesPointsStore.LookupEntry(itemLevel);
|
||||
if (!randPropPointsEntry)
|
||||
return 0;
|
||||
|
||||
switch (quality)
|
||||
{
|
||||
case ITEM_QUALITY_UNCOMMON:
|
||||
return randomProperty->UncommonPropertiesPoints[suffixFactor];
|
||||
return randPropPointsEntry->UncommonPropertiesPoints[propIndex];
|
||||
case ITEM_QUALITY_RARE:
|
||||
return randomProperty->RarePropertiesPoints[suffixFactor];
|
||||
case ITEM_QUALITY_HEIRLOOM:
|
||||
return randPropPointsEntry->RarePropertiesPoints[propIndex];
|
||||
case ITEM_QUALITY_EPIC:
|
||||
return randomProperty->EpicPropertiesPoints[suffixFactor];
|
||||
case ITEM_QUALITY_LEGENDARY:
|
||||
case ITEM_QUALITY_ARTIFACT:
|
||||
return 0; // not have random properties
|
||||
default:
|
||||
break;
|
||||
return randPropPointsEntry->EpicPropertiesPoints[propIndex];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
void LoadRandomEnchantmentsTable();
|
||||
uint32 GetItemEnchantMod(int32 entry);
|
||||
uint32 GenerateEnchSuffixFactor(uint32 item_id);
|
||||
uint32 GetRandomPropertyPoints(uint32 itemLevel, uint32 quality, uint32 inventoryType, uint32 subclass);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user