本文整理汇总了C++中EnchantmentStore::end方法的典型用法代码示例。如果您正苦于以下问题:C++ EnchantmentStore::end方法的具体用法?C++ EnchantmentStore::end怎么用?C++ EnchantmentStore::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnchantmentStore
的用法示例。
在下文中一共展示了EnchantmentStore::end方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetItemEnchantMod
uint32 GetItemEnchantMod(int32 entry)
{
if (!entry)
return 0;
EnchantmentStore::const_iterator tab;
if (entry > 0)
{
tab = RandomItemPropEnch.find(entry);
if (tab == RandomItemPropEnch.end())
{
sLog.outErrorDb("Item RandomProperty id #%u used in `item_template` but it doesn't have records in `item_enchantment_template` table.", entry);
return 0;
}
}
else
{
tab = RandomItemSuffixEnch.find(-entry);
if (tab == RandomItemSuffixEnch.end())
{
sLog.outErrorDb("Item RandomSuffix id #%u used in `item_template` but it doesn't have records in `item_enchantment_template` table.", -entry);
return 0;
}
}
double dRoll = rand_chance();
float fCount = 0;
for(EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
{
fCount += ench_iter->chance;
if (fCount > dRoll) return ench_iter->ench;
}
//we could get here only if sum of all enchantment chances is lower than 100%
dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100;
fCount = 0;
for(EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
{
fCount += ench_iter->chance;
if (fCount > dRoll) return ench_iter->ench;
}
return 0;
}
示例2: RandItemEnch
int* RandItemEnch(int32 item_id) {
uint32 count = 0; ItemTemplate const* item = sObjectMgr->GetItemTemplate(item_id);
if (item->RandomProperty) {
EnchantmentStore::const_iterator tab = RandomItemEnch.find(item->RandomProperty);
if (tab == RandomItemEnch.end()) return randitemench;
EnchStoreList::const_iterator ench_iter = tab->second.begin();
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) {
randitemench[count] = ench_iter->ench;
count++; } }
else {
EnchantmentStore::const_iterator tab = RandomItemEnch.find(item->RandomSuffix);
if (tab == RandomItemEnch.end()) return randitemench;
EnchStoreList::const_iterator ench_iter = tab->second.begin();
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) {
randitemench[count] = ench_iter->ench;
count++; } }
return randitemench; }
示例3: RandItemSuffix
std::string* RandItemSuffix(int32 item_id) {
uint32 count = 0; ItemTemplate const* item = sObjectMgr->GetItemTemplate(item_id);
if (item->RandomProperty) {
EnchantmentStore::const_iterator tab = RandomItemEnch.find(item->RandomProperty);
if (tab == RandomItemEnch.end()) return randitemsuffix;
EnchStoreList::const_iterator ench_iter = tab->second.begin();
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) {
const ItemRandomPropertiesEntry* random_id = sItemRandomPropertiesStore.LookupEntry(ench_iter->ench);
if ((count <= 31) && (ench_iter->ench != 0)) {
randitemsuffix[count] = random_id->nameSuffix[2]; }
count++; } }
else {
EnchantmentStore::const_iterator tab = RandomItemEnch.find(item->RandomSuffix);
if (tab == RandomItemEnch.end()) return randitemsuffix;
EnchStoreList::const_iterator ench_iter = tab->second.begin();
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) {
const ItemRandomSuffixEntry* random_id = sItemRandomSuffixStore.LookupEntry(ench_iter->ench);
if ((count <= 31) && (ench_iter->ench != 0)) {
randitemsuffix[count] = random_id->nameSuffix[2]; }
count++; } }
return randitemsuffix; }
示例4: GetItemEnchantMod
uint32 GetItemEnchantMod(int32 entry, uint32 type)
{
if (!entry)
return 0;
if (entry == -1)
return 0;
EnchantmentStore::const_iterator tab = type == ENCHANTMENT_RANDOM_PROPERTY ? RandomPropertyItemEnch.find(entry) : RandomSuffixItemEnch.find(entry) ;
if (tab == (type == ENCHANTMENT_RANDOM_PROPERTY ? RandomPropertyItemEnch.end() : RandomSuffixItemEnch.end()))
{
sLog->outError(LOG_FILTER_SQL, "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry);
return 0;
}
double dRoll = rand_chance();
float fCount = 0;
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
{
fCount += ench_iter->chance;
if (fCount > dRoll)
return ench_iter->ench;
}
//we could get here only if sum of all enchantment chances is lower than 100%
dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100;
fCount = 0;
for (EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter)
{
fCount += ench_iter->chance;
if (fCount > dRoll)
return ench_iter->ench;
}
return 0;
}