63 Field* fields = result->Fetch();
69 if (chance > 0.000001f && chance <= 100.0f)
73 }
while (result->NextRow());
78 TC_LOG_INFO(
"server.loading",
">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
92 TC_LOG_ERROR(
"sql.sql",
"Item RandomProperty / RandomSuffix id #{} used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
99 for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
101 fCount += ench_iter->chance;
104 return ench_iter->ench;
108 dRoll = (
irand(0, (
int)floor(fCount * 100) + 1)) / 100;
111 for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
113 fCount += ench_iter->chance;
116 return ench_iter->ench;
147 TC_LOG_ERROR(
"sql.sql",
"Enchantment id #{} used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
151 return random_id->
ID;
160 TC_LOG_ERROR(
"sql.sql",
"Enchantment id #{} used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
233 return randomProperty->
Good[suffixFactor];
235 return randomProperty->
Superior[suffixFactor];
237 return randomProperty->
Epic[suffixFactor];
DBCStorage< RandPropPointsEntry > sRandPropPointsStore(RandPropPointsfmt)
DBCStorage< ItemRandomSuffixEntry > sItemRandomSuffixStore(ItemRandomSuffixfmt)
DBCStorage< ItemRandomPropertiesEntry > sItemRandomPropertiesStore(ItemRandomPropertiesfmt)
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< WorldDatabaseConnection > WorldDatabase
Accessor to the world database.
uint32 GenerateEnchSuffixFactor(uint32 item_id)
void LoadRandomEnchantmentsTable()
static EnchantmentStore RandomItemEnch
uint32 GetItemEnchantMod(int32 entry)
int32 GenerateItemRandomPropertyId(uint32 item_id)
std::unordered_map< uint32, EnchStoreList > EnchantmentStore
std::vector< EnchStoreItem > EnchStoreList
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
int32 irand(int32 min, int32 max)
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Class used to access individual fields of database query result.
EnchStoreItem(uint32 _ench, float _chance)