* Implement reputation reward rate for quest / creatures
* Need DB data for this to work * Original patch by NoFantasy --HG-- branch : trunk
This commit is contained in:
@@ -6741,6 +6741,75 @@ void ObjectMgr::LoadCorpses()
|
||||
sLog.outString(">> Loaded %u corpses", count);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadReputationRewardRate()
|
||||
{
|
||||
m_RepRewardRateMap.clear(); // for reload case
|
||||
|
||||
uint32 count = 0;
|
||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT faction, quest_rate, creature_rate, spell_rate FROM reputation_reward_rate");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outErrorDb(">> Loaded `reputation_reward_rate`, table is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar((int)result->GetRowCount());
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint32 factionId = fields[0].GetUInt32();
|
||||
|
||||
RepRewardRate repRate;
|
||||
|
||||
repRate.quest_rate = fields[1].GetFloat();
|
||||
repRate.creature_rate = fields[2].GetFloat();
|
||||
repRate.spell_rate = fields[3].GetFloat();
|
||||
|
||||
FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionId);
|
||||
if (!factionEntry)
|
||||
{
|
||||
sLog.outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (repRate.quest_rate < 0.0f)
|
||||
{
|
||||
sLog.outErrorDb("Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.quest_rate, factionId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (repRate.creature_rate < 0.0f)
|
||||
{
|
||||
sLog.outErrorDb("Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creature_rate, factionId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (repRate.spell_rate < 0.0f)
|
||||
{
|
||||
sLog.outErrorDb("Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spell_rate, factionId);
|
||||
continue;
|
||||
}
|
||||
|
||||
m_RepRewardRateMap[factionId] = repRate;
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u reputation_reward_rate", count);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadReputationOnKill()
|
||||
{
|
||||
// For reload case
|
||||
|
||||
Reference in New Issue
Block a user