本文整理汇总了C++中SkillExtraItemMap类的典型用法代码示例。如果您正苦于以下问题:C++ SkillExtraItemMap类的具体用法?C++ SkillExtraItemMap怎么用?C++ SkillExtraItemMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SkillExtraItemMap类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: canCreateExtraItems
bool canCreateExtraItems(Player* pPlayer, uint32 spellId, float &additionalChance, uint8 &additionalMax, uint32 &newItemId)
{
// get the info for the specified spell
SkillExtraItemMap::const_iterator ret = SkillExtraItemStore.find(spellId);
if(ret == SkillExtraItemStore.end())
return false;
SkillExtraItemEntry const* specEntry = &ret->second;
// if no entry, then no extra items can be created
if(!specEntry)
return false;
// the player doesn't have the required specialization, return false
if(!pPlayer->HasSpell(specEntry->requiredSpecialization))
return false;
// set the arguments to the appropriate values
additionalChance = specEntry->additionalCreateChance;
additionalMax = specEntry->additionalMaxNum;
newItemId = specEntry->newItemId;
// enable extra item creation
return true;
}
示例2: LoadSkillExtraItemTable
// loads the extra item creation info from DB
void LoadSkillExtraItemTable()
{
uint32 oldMSTime = getMSTime();
SkillExtraItemStore.clear(); // need for reload
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
if (!result)
{
TC_LOG_ERROR(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 spellId = fields[0].GetUInt32();
if (!sSpellMgr->GetSpellInfo(spellId))
{
TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if (!sSpellMgr->GetSpellInfo(requiredSpecialization))
{
TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
if (additionalCreateChance <= 0.0f)
{
TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
if (!additionalMaxNum)
{
TC_LOG_ERROR(LOG_FILTER_SQL, "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];
skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
++count;
}
while (result->NextRow());
TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
示例3: LoadSkillExtraItemTable
// loads the extra item creation info from DB
void LoadSkillExtraItemTable()
{
uint32 count = 0;
SkillExtraItemStore.clear(); // need for reload
// 0 1 2 3
QueryResult* result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template");
if (result)
{
BarGoLink bar(result->GetRowCount());
do
{
Field* fields = result->Fetch();
bar.step();
uint32 spellId = fields[0].GetUInt32();
if (!sSpellTemplate.LookupEntry<SpellEntry>(spellId))
{
sLog.outError("Skill specialization %u has nonexistent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if (!sSpellTemplate.LookupEntry<SpellEntry>(requiredSpecialization))
{
sLog.outError("Skill specialization %u have nonexistent required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
if (additionalCreateChance <= 0.0f)
{
sLog.outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
if (!additionalMaxNum)
{
sLog.outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];
skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
++count;
}
while (result->NextRow());
delete result;
sLog.outString(">> Loaded %u spell specialization definitions", count);
}
else
sLog.outString(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
sLog.outString();
}
示例4: LoadSkillExtraItemTable
// loads the extra item creation info from DB
void LoadSkillExtraItemTable()
{
uint32 oldMSTime = getMSTime();
SkillExtraItemStore.clear(); // need for reload
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum, newItemId FROM skill_extra_item_template");
if(!result)
{
sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty.");
sLog->outString();
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
uint32 spellId = fields[0].GetUInt32();
if(!sSpellStore.LookupEntry(spellId))
{
sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if(!sSpellStore.LookupEntry(requiredSpecialization))
{
sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
}
float additionalCreateChance = fields[2].GetFloat();
if(additionalCreateChance <= 0.0f)
{
sLog->outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId);
continue;
}
uint8 additionalMaxNum = fields[3].GetUInt8();
if(!additionalMaxNum)
{
sLog->outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId);
continue;
}
uint32 newItemId = fields[4].GetUInt32();
if(newItemId < 0)
{
sLog->outError("Skill specialization %u has newItemId lower than 0 in `skill_extra_item_template`!", spellId);
continue;
}
SkillExtraItemEntry& skillExtraItemEntry = SkillExtraItemStore[spellId];
skillExtraItemEntry.requiredSpecialization = requiredSpecialization;
skillExtraItemEntry.additionalCreateChance = additionalCreateChance;
skillExtraItemEntry.additionalMaxNum = additionalMaxNum;
skillExtraItemEntry.newItemId = newItemId;
++count;
}
while(result->NextRow());
sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}