aboutsummaryrefslogtreecommitdiff
path: root/src/game/Group.cpp
diff options
context:
space:
mode:
authorw12x <none@none>2008-10-26 11:50:07 -0500
committerw12x <none@none>2008-10-26 11:50:07 -0500
commit6f2e0ee48a24dff1ac7acf441b1559e9d7c26657 (patch)
treebd28bea52660e6eb2425435ff0e1b0206a21cffe /src/game/Group.cpp
parent55c25d894ed0eb53b7aac6b15bdddf0927565165 (diff)
[svn] * Fixed xp calculation for low level characters when grouped with a higher level player. Patch provided by Reiner030.
* Fixed positive spells being not resistable when cast on hostile units. Patch provided by QAston. * Fixed compile warnings in gcc. Patch provided by WarHead. --HG-- branch : trunk
Diffstat (limited to 'src/game/Group.cpp')
-rw-r--r--src/game/Group.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 98ee161cee3..bf448df36f5 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -26,6 +26,7 @@
#include "World.h"
#include "ObjectMgr.h"
#include "Group.h"
+#include "Formulas.h"
#include "ObjectAccessor.h"
#include "BattleGround.h"
#include "MapManager.h"
@@ -785,7 +786,7 @@ void Group::SetTargetIcon(uint8 id, uint64 guid)
BroadcastPacket(&data);
}
-void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level)
+void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_level, Player* & member_with_max_level, Player* & not_gray_member_with_max_level)
{
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
@@ -798,8 +799,16 @@ void Group::GetDataForXPAtKill(Unit const* victim, uint32& count,uint32& sum_lev
++count;
sum_level += member->getLevel();
+ // store maximum member level
if(!member_with_max_level || member_with_max_level->getLevel() < member->getLevel())
member_with_max_level = member;
+
+ uint32 gray_level = Trinity::XP::GetGrayLevel(member->getLevel());
+ // if the victim is higher level than the gray level of the currently examined group member,
+ // then set not_gray_member_with_max_level if needed.
+ if( victim->getLevel() > gray_level && (!not_gray_member_with_max_level
+ || not_gray_member_with_max_level->getLevel() < member->getLevel()))
+ not_gray_member_with_max_level = member;
}
}