[6966] Fix bug adding XP in DK trigger aura

Use MaNGOS::XP::GetGrayLevel for honor target gray level

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2008-12-28 23:31:23 +03:00
parent 27175a9ad8
commit 53127cd6d9
4 changed files with 24 additions and 8 deletions

View file

@ -6035,12 +6035,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
victim_guid = 0; // Don't show HK: <rank> message, only log. victim_guid = 0; // Don't show HK: <rank> message, only log.
} }
if(k_level <= 5) k_grey = MaNGOS::XP::GetGrayLevel(k_level);
k_grey = 0;
else if( k_level <= 39 )
k_grey = k_level - 5 - k_level/10;
else
k_grey = k_level - 1 - k_level/5;
if(v_level<=k_grey) if(v_level<=k_grey)
return false; return false;
@ -18463,6 +18458,26 @@ uint32 Player::GetResurrectionSpellId()
return spell_id; return spell_id;
} }
// Used in triggers for check "Only to targets that grant experience or honor" req
bool Player::isHonorOrXPTarget(Unit* pVictim)
{
uint32 v_level = pVictim->getLevel();
uint32 k_grey = MaNGOS::XP::GetGrayLevel(getLevel());
// Victim level less gray level
if(v_level<=k_grey)
return false;
if(pVictim->GetTypeId() == TYPEID_UNIT)
{
if (((Creature*)pVictim)->isTotem() ||
((Creature*)pVictim)->isPet() ||
((Creature*)pVictim)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
return false;
}
return true;
}
bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim) bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
{ {
bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer(); bool PvP = pVictim->isCharmedOwnedByPlayerOrPlayer();

View file

@ -1760,6 +1760,7 @@ class MANGOS_DLL_SPEC Player : public Unit
bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const; bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
bool RewardPlayerAndGroupAtKill(Unit* pVictim); bool RewardPlayerAndGroupAtKill(Unit* pVictim);
bool isHonorOrXPTarget(Unit* pVictim);
FactionStateList m_factions; FactionStateList m_factions;
ForcedReactions m_forcedReactions; ForcedReactions m_forcedReactions;

View file

@ -5874,7 +5874,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
{ {
if (GetTypeId() != TYPEID_PLAYER) if (GetTypeId() != TYPEID_PLAYER)
return false; return false;
if (!((Player*)this)->RewardPlayerAndGroupAtKill(pVictim)) if (!((Player*)this)->isHonorOrXPTarget(pVictim))
return false; return false;
trigger_spell_id = 50475; trigger_spell_id = 50475;
basepoints0 = damage * triggerAmount / 100; basepoints0 = damage * triggerAmount / 100;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "6965" #define REVISION_NR "6966"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__