mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Merge commit 'origin/master' into 320
Conflicts: src/game/Player.cpp src/game/Totem.cpp
This commit is contained in:
commit
4c709772c1
61 changed files with 912 additions and 454 deletions
|
|
@ -612,8 +612,8 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
|
|||
|
||||
// Played time
|
||||
m_Last_tick = time(NULL);
|
||||
m_Played_time[0] = 0;
|
||||
m_Played_time[1] = 0;
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = 0;
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = 0;
|
||||
|
||||
// base stats and related field values
|
||||
InitStatsForLevel();
|
||||
|
|
@ -1286,8 +1286,8 @@ void Player::Update( uint32 p_time )
|
|||
if (now > m_Last_tick)
|
||||
{
|
||||
uint32 elapsed = uint32(now - m_Last_tick);
|
||||
m_Played_time[0] += elapsed; // Total played time
|
||||
m_Played_time[1] += elapsed; // Level played time
|
||||
m_Played_time[PLAYED_TIME_TOTAL] += elapsed; // Total played time
|
||||
m_Played_time[PLAYED_TIME_LEVEL] += elapsed; // Level played time
|
||||
m_Last_tick = now;
|
||||
}
|
||||
|
||||
|
|
@ -2378,9 +2378,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[1] = 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
|
||||
|
|
@ -2405,6 +2408,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();
|
||||
|
|
@ -6487,13 +6492,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 (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
{
|
||||
|
|
@ -7216,6 +7224,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
|
||||
|
|
@ -13850,8 +13876,8 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid )
|
|||
|
||||
// the instance id is not needed at character enum
|
||||
|
||||
m_Played_time[0] = fields[7].GetUInt32();
|
||||
m_Played_time[1] = fields[8].GetUInt32();
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = fields[7].GetUInt32();
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = fields[8].GetUInt32();
|
||||
|
||||
m_atLoginFlags = fields[9].GetUInt32();
|
||||
|
||||
|
|
@ -14349,8 +14375,8 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
}
|
||||
|
||||
m_cinematic = fields[19].GetUInt32();
|
||||
m_Played_time[0]= fields[20].GetUInt32();
|
||||
m_Played_time[1]= fields[21].GetUInt32();
|
||||
m_Played_time[PLAYED_TIME_TOTAL]= fields[20].GetUInt32();
|
||||
m_Played_time[PLAYED_TIME_LEVEL]= fields[21].GetUInt32();
|
||||
|
||||
m_resetTalentsCost = fields[25].GetUInt32();
|
||||
m_resetTalentsTime = time_t(fields[26].GetUInt64());
|
||||
|
|
@ -15611,9 +15637,9 @@ void Player::SaveToDB()
|
|||
ss << m_cinematic;
|
||||
|
||||
ss << ", ";
|
||||
ss << m_Played_time[0];
|
||||
ss << m_Played_time[PLAYED_TIME_TOTAL];
|
||||
ss << ", ";
|
||||
ss << m_Played_time[1];
|
||||
ss << m_Played_time[PLAYED_TIME_LEVEL];
|
||||
|
||||
ss << ", ";
|
||||
ss << finiteAlways(m_rest_bonus);
|
||||
|
|
@ -19515,7 +19541,7 @@ bool Player::isTotalImmune()
|
|||
|
||||
bool Player::HasTitle(uint32 bitIndex)
|
||||
{
|
||||
if (bitIndex > 192)
|
||||
if (bitIndex > MAX_TITLE_INDEX)
|
||||
return false;
|
||||
|
||||
uint32 fieldIndexOffset = bitIndex / 32;
|
||||
|
|
@ -19529,9 +19555,19 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
|
|||
uint32 flag = 1 << (title->bit_index % 32);
|
||||
|
||||
if(lost)
|
||||
{
|
||||
if(!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
|
||||
return;
|
||||
|
||||
RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
|
||||
return;
|
||||
|
||||
SetFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_TITLE_EARNED, 4 + 4);
|
||||
data << uint32(title->bit_index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue