Core/XP: Players only get 10% xp for killing NPCs of the same expansion or lower.

This commit is contained in:
Subv committed 2012-10-12 10:46:06 -05:00
1 parent 5e1b744261
commit c199e30874
3 files changed
+27 -2

No files matched your search

+18
View File
@@ -862,6 +862,24 @@ uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
return mapid;
}
uint32 GetMaxLevelForExpansion(uint32 expansion)
{
switch (expansion)
{
case CONTENT_1_60:
return 60;
case CONTENT_61_70:
return 70;
case CONTENT_71_80:
return 80;
case CONTENT_81_85:
return 85;
default:
break;
}
return 0;
}
/*
Used only for calculate xp gain by content lvl.
Calculation on Gilneas and group maps of LostIslands calculated as CONTENT_1_60.
+2
View File
@@ -52,6 +52,8 @@ enum ContentLevels
MAX_CONTENT
};
uint32 GetMaxLevelForExpansion(uint32 expansion);
ContentLevels GetContentLevelsForMapAndZone(uint32 mapid, uint32 zoneId);
bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId);
+7 -2
View File
@@ -75,6 +75,7 @@
#include <cmath>
#include "AccountMgr.h"
#include "DB2Stores.h"
#include "DBCStores.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "BattlefieldWG.h"
@@ -513,10 +514,14 @@ inline void KillRewarder::_RewardXP(Player* player, float rate)
for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
AddPct(xp, (*i)->GetAmount());
// 4.2.3. Give XP to player.
// 4.2.3. Calculate expansion penalty
if (_victim->GetTypeId() == TYPEID_UNIT && player->GetLevel() >= GetMaxLevelForExpansion(_victim->ToCreature()->GetCreatureTemplate()->expansion))
xp = CalculatePct(xp, 10); // Players get only 10% xp for killing creatures of lower expansion levels than himself
// 4.2.4. Give XP to player.
player->GiveXP(xp, _victim, _groupRate);
if (Pet* pet = player->GetPet())
// 4.2.4. If player has pet, reward pet with XP (100% for single player, 50% for group case).
// 4.2.5. If player has pet, reward pet with XP (100% for single player, 50% for group case).
pet->GivePetXP(_group ? xp / 2 : xp);
}
}