[7435] Fixed Spell::EffectAddHonor to corrcetly add honor based on player's level

Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
Triply 2009-03-10 11:00:21 +01:00
parent bdd7b4f74b
commit 2c787373c5
2 changed files with 12 additions and 6 deletions

View file

@ -53,6 +53,7 @@
#include "TemporarySummon.h"
#include "ScriptCalls.h"
#include "SkillDiscovery.h"
#include "Formulas.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@ -3769,13 +3770,18 @@ void Spell::EffectAddHonor(uint32 /*i*/)
if(unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, damage, ((Player*)unitTarget)->GetGUIDLow());
uint32 honor_reward = MaNGOS::Honor::hk_honor_at_level(unitTarget->getLevel(), damage);
sLog.outDebug("SpellEffect::AddHonor called for spell_id %u, that rewards %u honor points to player: %u", m_spellInfo->Id, honor_reward, ((Player*)unitTarget)->GetGUIDLow());
// TODO: find formula for honor reward based on player's level!
// now fixed only for level 70 players:
if (((Player*)unitTarget)->getLevel() == 70)
// do not allow to add too many honor for player (50 * 21) = 1040 at level 70, or (50 * 31) = 1550 at level 80
if( damage <= 50 )
((Player*)unitTarget)->RewardHonor(NULL, 1, honor_reward);
else
{
//maybe we have correct honor_gain in damage already
((Player*)unitTarget)->RewardHonor(NULL, 1, damage);
sLog.outError("SpellEffect::AddHonor called for spell_id %u, that rewards %d * honor for one honorable kill and it is too much (%u of honor) for player: %u", m_spellInfo->Id, damage, honor_reward, ((Player*)unitTarget)->GetGUIDLow());
}
}
void Spell::EffectTradeSkill(uint32 /*i*/)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7434"
#define REVISION_NR "7435"
#endif // __REVISION_NR_H__