mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Add support to set RandomProperty / RandomSuffix to -1 in item_template
--HG-- branch : trunk
This commit is contained in:
@@ -554,7 +554,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
||||
// RandomProperty case
|
||||
if (itemProto->RandomProperty)
|
||||
{
|
||||
int32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
|
||||
uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
|
||||
ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
||||
if (!random_id)
|
||||
{
|
||||
|
||||
@@ -86,11 +86,22 @@ void LoadRandomEnchantmentsTable()
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetItemEnchantMod(uint32 entry)
|
||||
uint32 GetItemEnchantMod(int32 entry)
|
||||
{
|
||||
if (!entry) return 0;
|
||||
if (!entry)
|
||||
return 0;
|
||||
|
||||
EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry);
|
||||
EnchantmentStore::const_iterator tab;
|
||||
|
||||
if (entry == -1)
|
||||
{
|
||||
tab = RandomItemEnch.begin();
|
||||
entry = urand(1, RandomItemEnch.size()) - 1;
|
||||
for (uint32 i = 0; i < entry; ++i)
|
||||
++tab;
|
||||
}
|
||||
else
|
||||
tab = RandomItemEnch.find(entry);
|
||||
|
||||
if (tab == RandomItemEnch.end())
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "Common.h"
|
||||
|
||||
void LoadRandomEnchantmentsTable();
|
||||
uint32 GetItemEnchantMod(uint32 entry);
|
||||
uint32 GetItemEnchantMod(int32 entry);
|
||||
uint32 GenerateEnchSuffixFactor(uint32 item_id);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ struct ItemPrototype
|
||||
int32 Material; // id from Material.dbc
|
||||
uint32 Sheath;
|
||||
int32 RandomProperty; // id from ItemRandomProperties.dbc
|
||||
uint32 RandomSuffix; // id from ItemRandomSuffix.dbc
|
||||
int32 RandomSuffix; // id from ItemRandomSuffix.dbc
|
||||
uint32 Block;
|
||||
uint32 ItemSet; // id from ItemSet.dbc
|
||||
uint32 MaxDurability;
|
||||
|
||||
Reference in New Issue
Block a user