Skip to content

Commit

Permalink
Add nasty TODO in group and clean up a bit in player
Browse files Browse the repository at this point in the history
Small player fixup and group TODO
  • Loading branch information
Phatcat committed Jun 18, 2016
1 parent 9f64ca5 commit 86dfe99
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/game/Group.cpp
Expand Up @@ -1284,6 +1284,9 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co

pGroupGuy->GiveXP(itr_xp, pVictim);
if (Pet* pet = pGroupGuy->GetPet())
// TODO: Pets need to get exp based on their level diff to the target, not the owners.
// the whole RewardGroupAtKill needs a rewrite to match up with this anyways:
// http://wowwiki.wikia.com/wiki/Formulas:Mob_XP?oldid=228414
pet->GivePetXP(itr_xp / 2);
}

Expand Down
21 changes: 11 additions & 10 deletions src/game/Player.cpp
Expand Up @@ -2509,11 +2509,13 @@ void Player::GiveLevel(uint32 level)
if (level == getLevel())
return;

uint32 plClass = getClass();

PlayerLevelInfo info;
sObjectMgr.GetPlayerLevelInfo(getRace(), getClass(), level, &info);
sObjectMgr.GetPlayerLevelInfo(getRace(), plClass, level, &info);

PlayerClassLevelInfo classInfo;
sObjectMgr.GetPlayerClassLevelInfo(getClass(), level, &classInfo);
sObjectMgr.GetPlayerClassLevelInfo(plClass, level, &classInfo);

// send levelup info to client
WorldPacket data(SMSG_LEVELUP_INFO, (4 + 4 + MAX_POWERS * 4 + MAX_STATS * 4));
Expand Down Expand Up @@ -2564,8 +2566,6 @@ void Player::GiveLevel(uint32 level)
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);

_ApplyAllLevelScaleItemMods(true);

Expand Down Expand Up @@ -2625,13 +2625,16 @@ void Player::InitStatsForLevel(bool reapplyMods)
_RemoveAllStatBonuses();

PlayerClassLevelInfo classInfo;
sObjectMgr.GetPlayerClassLevelInfo(getClass(), getLevel(), &classInfo);

uint32 level = getLevel();
uint32 plClass = getClass();
sObjectMgr.GetPlayerClassLevelInfo(plClass, level, &classInfo);

PlayerLevelInfo info;
sObjectMgr.GetPlayerLevelInfo(getRace(), getClass(), getLevel(), &info);
sObjectMgr.GetPlayerLevelInfo(getRace(), plClass, level, &info);

SetUInt32Value(PLAYER_FIELD_MAX_LEVEL, sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL));
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(getLevel()));
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, sObjectMgr.GetXPForLevel(level));

// reset before any aura state sources (health set/aura apply)
SetUInt32Value(UNIT_FIELD_AURASTATE, 0);
Expand Down Expand Up @@ -2768,8 +2771,6 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetPower(POWER_ENERGY, GetMaxPower(POWER_ENERGY));
if (GetPower(POWER_RAGE) > GetMaxPower(POWER_RAGE))
SetPower(POWER_RAGE, GetMaxPower(POWER_RAGE));
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
SetPower(POWER_RUNIC_POWER, 0);

// update level to hunter/summon pet
Expand Down Expand Up @@ -18092,7 +18093,7 @@ void Player::PetSpellInitialize()
uint8 addlist = 0;
data << uint8(addlist); // placeholder

if (pet->IsPermanentPetFor(this))
if (pet->isControlled())
{
// spells loop
for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
Expand Down

0 comments on commit 86dfe99

Please sign in to comment.