aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 55815e4acf4..3f0add0373b 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -2460,9 +2460,12 @@ void Player::GiveLevel(uint32 level)
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(level));
//update level, max level of skills
- if(getLevel()!= level)
- m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset
+ m_Played_time[PLAYED_TIME_LEVEL] = 0; // Level Played Time reset
+
+ _ApplyAllLevelScaleItemMods(false);
+
SetLevel(level);
+
UpdateSkillsForLevel ();
// save base values (bonuses already included in stored stats
@@ -2490,6 +2493,8 @@ void Player::GiveLevel(uint32 level)
SetPower(POWER_FOCUS, 0);
SetPower(POWER_HAPPINESS, 0);
+ _ApplyAllLevelScaleItemMods(true);
+
// update level to hunter/summon pet
if (Pet* pet = GetPet())
pet->SynchronizeLevelWithOwner();
@@ -6666,13 +6671,16 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
sLog.outDebug("_ApplyItemMods complete.");
}
-void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply)
+void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/)
{
if(slot >= INVENTORY_SLOT_BAG_END || !proto)
return;
- ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : 0;
- ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : 0;
+ ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL;
+ ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : NULL;
+
+ if(only_level_scale && !(ssd && ssv))
+ return;
for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
{
@@ -7439,6 +7447,24 @@ void Player::_ApplyAllItemMods()
sLog.outDebug("_ApplyAllItemMods complete.");
}
+void Player::_ApplyAllLevelScaleItemMods(bool apply)
+{
+ for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
+ {
+ if(m_items[i])
+ {
+ if(m_items[i]->IsBroken())
+ continue;
+
+ ItemPrototype const *proto = m_items[i]->GetProto();
+ if(!proto)
+ continue;
+
+ _ApplyItemBonuses(proto,i, apply, true);
+ }
+ }
+}
+
void Player::_ApplyAmmoBonuses()
{
// check ammo