Core/Reputation:

- Fix copy and paste fail (thx zorix)
- Add new field for monthly rate quests
This commit is contained in:
Vincent-Michael committed 2012-12-04 15:58:57 +01:00
1 parent 2b3b124e09
commit c90ec469db
5 files changed
+25 -7

No files matched your search

@@ -0,0 +1 @@
ALTER TABLE `reputation_reward_rate` ADD `quest_monthly_rate` FLOAT NOT NULL DEFAULT '1' AFTER `quest_weekly_rate`;
+9 -1
View File
@@ -6945,6 +6945,7 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
case REPUTATION_SOURCE_QUEST:
case REPUTATION_SOURCE_DAYLIY_QUEST:
case REPUTATION_SOURCE_WEEKLY_QUEST:
case REPUTATION_SOURCE_MONTHLY_QUEST:
rate = sWorld->getRate(RATE_REPUTATION_LOWLEVEL_QUEST);
break;
case REPUTATION_SOURCE_SPELL:
@@ -6977,6 +6978,9 @@ int32 Player::CalculateReputationGain(ReputationSource source, uint32 creatureOr
case REPUTATION_SOURCE_WEEKLY_QUEST:
repRate = repData->questWeeklyRate;
break;
case REPUTATION_SOURCE_MONTHLY_QUEST:
repRate = repData->questMonthlyRate;
break;
case REPUTATION_SOURCE_SPELL:
repRate = repData->spellRate;
break;
@@ -7089,6 +7093,8 @@ void Player::RewardReputation(Quest const* quest)
rep = CalculateReputationGain(REPUTATION_SOURCE_DAYLIY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
else if (quest->IsWeekly())
rep = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
else if (quest->IsMonthly())
rep = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
else
rep = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), quest->RewardFactionValueIdOverride[i]/100, quest->RewardFactionId[i], true);
@@ -7111,8 +7117,10 @@ void Player::RewardReputation(Quest const* quest)
if (quest->IsDaily())
repPoints = CalculateReputationGain(REPUTATION_SOURCE_DAYLIY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
else if (quest->IsDaily())
else if (quest->IsWeekly())
repPoints = CalculateReputationGain(REPUTATION_SOURCE_WEEKLY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
else if (quest->IsMonthly())
repPoints = CalculateReputationGain(REPUTATION_SOURCE_MONTHLY_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
else
repPoints = CalculateReputationGain(REPUTATION_SOURCE_QUEST, GetQuestLevel(quest), repPoints, quest->RewardFactionId[i], true);
+1
View File
@@ -168,6 +168,7 @@ enum ReputationSource
REPUTATION_SOURCE_QUEST,
REPUTATION_SOURCE_DAYLIY_QUEST,
REPUTATION_SOURCE_WEEKLY_QUEST,
REPUTATION_SOURCE_MONTHLY_QUEST,
REPUTATION_SOURCE_SPELL
};
+13 -6
View File
@@ -6644,8 +6644,8 @@ void ObjectMgr::LoadReputationRewardRate()
_repRewardRateStore.clear(); // for reload case
uint32 count = 0; // 0 1 2 3 4 5
QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, creature_rate, spell_rate FROM reputation_reward_rate");
uint32 count = 0; // 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, creature_rate, spell_rate FROM reputation_reward_rate");
if (!result)
{
sLog->outError(LOG_FILTER_SQL, ">> Loaded `reputation_reward_rate`, table is empty!");
@@ -6663,8 +6663,9 @@ void ObjectMgr::LoadReputationRewardRate()
repRate.questRate = fields[1].GetFloat();
repRate.questDailyRate = fields[2].GetFloat();
repRate.questWeeklyRate = fields[3].GetFloat();
repRate.creatureRate = fields[4].GetFloat();
repRate.spellRate = fields[5].GetFloat();
repRate.questMonthlyRate = fields[4].GetFloat();
repRate.creatureRate = fields[5].GetFloat();
repRate.spellRate = fields[6].GetFloat();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
if (!factionEntry)
@@ -6681,13 +6682,19 @@ void ObjectMgr::LoadReputationRewardRate()
if (repRate.questDailyRate < 0.0f)
{
sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId);
sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId);
continue;
}
if (repRate.questWeeklyRate < 0.0f)
{
sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId);
sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId);
continue;
}
if (repRate.questMonthlyRate < 0.0f)
{
sLog->outError(LOG_FILTER_SQL, "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId);
continue;
}
+1
View File
@@ -466,6 +466,7 @@ struct RepRewardRate
float questRate; // We allow rate = 0.0 in database. For this case, it means that
float questDailyRate;
float questWeeklyRate;
float questMonthlyRate;
float creatureRate; // no reputation are given at all for this faction/rate type.
float spellRate;
};