mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[8014] Fixes and cleanup in error messages at skill_discovery_template loading.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
25140ea3cc
commit
2377917176
2 changed files with 100 additions and 92 deletions
|
|
@ -56,9 +56,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
|
||||
{
|
||||
|
|
@ -79,19 +85,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;
|
||||
}
|
||||
|
||||
|
|
@ -129,12 +143,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)
|
||||
{
|
||||
|
|
@ -185,9 +193,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;
|
||||
}
|
||||
|
||||
|
|
@ -203,9 +211,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8013"
|
||||
#define REVISION_NR "8014"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue