[8014] Fixes and cleanup in error messages at skill_discovery_template loading. Author: NoFantasy

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-15 17:05:27 -05:00
parent ef28e35c89
commit 9c33d4ed3c
+25 -17
View File
@@ -58,9 +58,15 @@ void LoadSkillDiscoveryTable()
if (result)
{
sLog.outString();
sLog.outString( ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty." );
return;
}
barGoLink bar(result->GetRowCount());
std::ostringstream ssNonDiscoverableEntries;
std::set<uint32> reportedReqSpells;
do
{
@@ -81,19 +87,27 @@ void LoadSkillDiscoveryTable()
if (reqSkillOrSpell > 0) // spell case
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(reqSkillOrSpell);
if( !spellEntry )
SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(reqSkillOrSpell);
if (!reqSpellEntry)
{
if(reportedReqSpells.count(reqSkillOrSpell)==0)
{
sLog.outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table",spellId,reqSkillOrSpell);
reportedReqSpells.insert(reqSkillOrSpell);
}
continue;
}
// mechanic discovery
if (spellEntry->Mechanic != MECHANIC_DISCOVERY &&
if (reqSpellEntry->Mechanic != MECHANIC_DISCOVERY &&
// explicit discovery ability
!IsExplicitDiscoverySpell(spellEntry))
!IsExplicitDiscoverySpell(reqSpellEntry))
{
sLog.outErrorDb("Spell (ID: %u) not have have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc and not 100%% chance random discovery ability but listed in `skill_discovery_template` table",spellId);
if (reportedReqSpells.count(reqSkillOrSpell)==0)
{
sLog.outErrorDb("Spell (ID: %u) not have have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",reqSkillOrSpell,spellId);
reportedReqSpells.insert(reqSkillOrSpell);
}
continue;
}
@@ -131,12 +145,6 @@ void LoadSkillDiscoveryTable()
if(!ssNonDiscoverableEntries.str().empty())
sLog.outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s",ssNonDiscoverableEntries.str().c_str());
}
else
{
sLog.outString();
sLog.outString( ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty." );
}
}
uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player)
{
@@ -187,9 +195,9 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player)
{
for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter)
{
if( roll_chance_f(item_iter->chance * sWorld.getRate(RATE_SKILL_DISCOVERY))
&& item_iter->reqSkillValue <= skillvalue
&& !player->HasSpell(item_iter->spellId) )
if (roll_chance_f(item_iter->chance * sWorld.getRate(RATE_SKILL_DISCOVERY)) &&
item_iter->reqSkillValue <= skillvalue &&
!player->HasSpell(item_iter->spellId))
return item_iter->spellId;
}
@@ -205,9 +213,9 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player)
{
for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter)
{
if( roll_chance_f(item_iter->chance * sWorld.getRate(RATE_SKILL_DISCOVERY))
&& item_iter->reqSkillValue <= skillvalue
&& !player->HasSpell(item_iter->spellId) )
if (roll_chance_f(item_iter->chance * sWorld.getRate(RATE_SKILL_DISCOVERY)) &&
item_iter->reqSkillValue <= skillvalue &&
!player->HasSpell(item_iter->spellId))
return item_iter->spellId;
}