diff options
author | silinoron <none@none> | 2010-07-26 15:40:40 -0700 |
---|---|---|
committer | silinoron <none@none> | 2010-07-26 15:40:40 -0700 |
commit | 3ea0f411d3be47f073232e7fc54e10f5c09de8d8 (patch) | |
tree | 0295c88663b21c40bba61b8d1655365f0a50c4ef /src/server/game/Globals/ObjectMgr.cpp | |
parent | 5977a76d96b03b533f44ad0baed523394e936d29 (diff) | |
parent | 4565242e946001f54103d1c2c7ebea0b7ef6437b (diff) |
merge
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 31e6c0c0c72..2a51d2f3273 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -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 |