Add support to set RandomProperty / RandomSuffix to -1 in item_template
--HG-- branch : trunk
This commit is contained in:
+1
-1
@@ -554,7 +554,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
|||||||
// RandomProperty case
|
// RandomProperty case
|
||||||
if (itemProto->RandomProperty)
|
if (itemProto->RandomProperty)
|
||||||
{
|
{
|
||||||
int32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
|
uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
|
||||||
ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
||||||
if (!random_id)
|
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())
|
if (tab == RandomItemEnch.end())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
|
||||||
void LoadRandomEnchantmentsTable();
|
void LoadRandomEnchantmentsTable();
|
||||||
uint32 GetItemEnchantMod(uint32 entry);
|
uint32 GetItemEnchantMod(int32 entry);
|
||||||
uint32 GenerateEnchSuffixFactor(uint32 item_id);
|
uint32 GenerateEnchSuffixFactor(uint32 item_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -570,7 +570,7 @@ struct ItemPrototype
|
|||||||
int32 Material; // id from Material.dbc
|
int32 Material; // id from Material.dbc
|
||||||
uint32 Sheath;
|
uint32 Sheath;
|
||||||
int32 RandomProperty; // id from ItemRandomProperties.dbc
|
int32 RandomProperty; // id from ItemRandomProperties.dbc
|
||||||
uint32 RandomSuffix; // id from ItemRandomSuffix.dbc
|
int32 RandomSuffix; // id from ItemRandomSuffix.dbc
|
||||||
uint32 Block;
|
uint32 Block;
|
||||||
uint32 ItemSet; // id from ItemSet.dbc
|
uint32 ItemSet; // id from ItemSet.dbc
|
||||||
uint32 MaxDurability;
|
uint32 MaxDurability;
|
||||||
|
|||||||
Reference in New Issue
Block a user