Fix import BG rate exp
This commit is contained in:
@@ -160,27 +160,33 @@ namespace Trinity
|
|||||||
|
|
||||||
inline uint32 Gain(Player* player, Unit* u)
|
inline uint32 Gain(Player* player, Unit* u)
|
||||||
{
|
{
|
||||||
uint32 gain;
|
Creature* creature = u->ToCreature();
|
||||||
|
uint32 gain = 0;
|
||||||
|
|
||||||
if (u->GetTypeId() == TYPEID_UNIT &&
|
if (!creature || (!creature->IsTotem() && !creature->IsPet() && !creature->IsCritter() &&
|
||||||
(((Creature*)u)->IsTotem() || ((Creature*)u)->IsPet() ||
|
!(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)))
|
||||||
(((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ||
|
|
||||||
u->IsCritter()))
|
|
||||||
gain = 0;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
float xpMod = 1.0f;
|
||||||
|
|
||||||
gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
||||||
|
|
||||||
if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
|
if (gain && creature)
|
||||||
|
{
|
||||||
|
if (creature->isElite())
|
||||||
{
|
{
|
||||||
// Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus.
|
// Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus.
|
||||||
if (u->GetMap()->IsDungeon())
|
if (u->GetMap() && u->GetMap()->IsDungeon())
|
||||||
gain = uint32(gain * 2.75);
|
xpMod *= 2.75f;
|
||||||
else
|
else
|
||||||
gain *= 2;
|
xpMod *= 2.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
gain = uint32(gain * sWorld->getRate(RATE_XP_KILL));
|
// This requires TrinityCore creature_template.ExperienceModifier feature
|
||||||
|
// xpMod *= creature->GetCreatureTemplate()->ModExperience;
|
||||||
|
}
|
||||||
|
|
||||||
|
xpMod *= isBattleGround ? sWorld->getRate(RATE_XP_BG_KILL) : sWorld->getRate(RATE_XP_KILL);
|
||||||
|
gain = uint32(gain * xpMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
//sScriptMgr->OnGainCalculation(gain, player, u); // pussywizard: optimization
|
//sScriptMgr->OnGainCalculation(gain, player, u); // pussywizard: optimization
|
||||||
|
|||||||
Reference in New Issue
Block a user