Skip to content

Commit

Permalink
XP Calculation For players assisting
Browse files Browse the repository at this point in the history
Players should not receive full XP if not in a group and being assisted by another player, this is to stop XP boosting

[Note] I do not know the correct calculation for this as unable to find any documentation, currently using the group Method.
  • Loading branch information
talamortis committed Dec 17, 2021
1 parent c0b8881 commit a03262d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,32 @@ inline void KillRewarder::_RewardXP(Player* player, float rate)
else
xp = 0;
}
else
{

// Get threat list of victim
ThreatContainer::StorageType threatlist = _victim->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();

// Players should only recieve full amount of xp if the assisted player is the same level/ slightly higher.
// This will reduce XP boosting while not grouped
// Not sure on the calculations as can not find any documentation so will implement like player was in a group.
if (threatlist.size() > 1)
{
for (i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*_victim), (*i)->getUnitGuid());
if (pUnit && pUnit->GetTypeId() == TYPEID_PLAYER)
{
if (pUnit->ToPlayer()->isHonorOrXPTarget(_victim))
xp = (xp * rate);
else
xp = (xp * rate / 2) + 1;
}
}
}
}

if (xp)
{
// 4.2.2. Apply auras modifying rewarded XP (SPELL_AURA_MOD_XP_PCT).
Expand Down

0 comments on commit a03262d

Please sign in to comment.