mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[8203] Correcttly re-apply level scaled item stat mods at player level change.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
e793f0eeab
commit
22ed15a76e
4 changed files with 38 additions and 7 deletions
|
|
@ -4362,6 +4362,8 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
|
||||||
? sWorld.getConfig(CONFIG_START_PLAYER_LEVEL)
|
? sWorld.getConfig(CONFIG_START_PLAYER_LEVEL)
|
||||||
: sWorld.getConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
: sWorld.getConfig(CONFIG_START_HEROIC_PLAYER_LEVEL);
|
||||||
|
|
||||||
|
target->_ApplyAllLevelScaleItemMods(false);
|
||||||
|
|
||||||
target->SetLevel(start_level);
|
target->SetLevel(start_level);
|
||||||
target->InitRunes();
|
target->InitRunes();
|
||||||
target->InitStatsForLevel(true);
|
target->InitStatsForLevel(true);
|
||||||
|
|
@ -4370,6 +4372,8 @@ bool ChatHandler::HandleResetLevelCommand(const char * args)
|
||||||
target->InitTalentForLevel();
|
target->InitTalentForLevel();
|
||||||
target->SetUInt32Value(PLAYER_XP,0);
|
target->SetUInt32Value(PLAYER_XP,0);
|
||||||
|
|
||||||
|
target->_ApplyAllLevelScaleItemMods(true);
|
||||||
|
|
||||||
// reset level for pet
|
// reset level for pet
|
||||||
if(Pet* pet = target->GetPet())
|
if(Pet* pet = target->GetPet())
|
||||||
pet->SynchronizeLevelWithOwner();
|
pet->SynchronizeLevelWithOwner();
|
||||||
|
|
|
||||||
|
|
@ -2376,9 +2376,12 @@ void Player::GiveLevel(uint32 level)
|
||||||
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(level));
|
SetUInt32Value(PLAYER_NEXT_LEVEL_XP, objmgr.GetXPForLevel(level));
|
||||||
|
|
||||||
//update level, max level of skills
|
//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);
|
SetLevel(level);
|
||||||
|
|
||||||
UpdateSkillsForLevel ();
|
UpdateSkillsForLevel ();
|
||||||
|
|
||||||
// save base values (bonuses already included in stored stats
|
// save base values (bonuses already included in stored stats
|
||||||
|
|
@ -2403,6 +2406,8 @@ void Player::GiveLevel(uint32 level)
|
||||||
SetPower(POWER_FOCUS, 0);
|
SetPower(POWER_FOCUS, 0);
|
||||||
SetPower(POWER_HAPPINESS, 0);
|
SetPower(POWER_HAPPINESS, 0);
|
||||||
|
|
||||||
|
_ApplyAllLevelScaleItemMods(true);
|
||||||
|
|
||||||
// update level to hunter/summon pet
|
// update level to hunter/summon pet
|
||||||
if (Pet* pet = GetPet())
|
if (Pet* pet = GetPet())
|
||||||
pet->SynchronizeLevelWithOwner();
|
pet->SynchronizeLevelWithOwner();
|
||||||
|
|
@ -6485,13 +6490,16 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
|
||||||
sLog.outDebug("_ApplyItemMods complete.");
|
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)
|
if(slot >= INVENTORY_SLOT_BAG_END || !proto)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : 0;
|
ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL;
|
||||||
ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : 0;
|
ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(getLevel()) : NULL;
|
||||||
|
|
||||||
|
if(only_level_scale && !(ssd && ssv))
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -7214,6 +7222,24 @@ void Player::_ApplyAllItemMods()
|
||||||
sLog.outDebug("_ApplyAllItemMods complete.");
|
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()
|
void Player::_ApplyAmmoBonuses()
|
||||||
{
|
{
|
||||||
// check ammo
|
// check ammo
|
||||||
|
|
|
||||||
|
|
@ -1857,7 +1857,8 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void _ApplyItemMods(Item *item,uint8 slot,bool apply);
|
void _ApplyItemMods(Item *item,uint8 slot,bool apply);
|
||||||
void _RemoveAllItemMods();
|
void _RemoveAllItemMods();
|
||||||
void _ApplyAllItemMods();
|
void _ApplyAllItemMods();
|
||||||
void _ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply);
|
void _ApplyAllLevelScaleItemMods(bool apply);
|
||||||
|
void _ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply, bool only_level_scale = false);
|
||||||
void _ApplyAmmoBonuses();
|
void _ApplyAmmoBonuses();
|
||||||
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
|
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
|
||||||
void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
|
void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8202"
|
#define REVISION_NR "8203"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue