mirror of
https://github.com/mangosfour/server.git
synced 2025-12-24 19:37:07 +00:00
[12164] Fix inspect honor kill stats, arena stats.
Fix SMSG_NOTIFICATION structure Move back Updatehonorfields, too fastly removed Define some pvp opcodes Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
parent
f911964642
commit
4dcb91df9f
16 changed files with 128 additions and 24 deletions
|
|
@ -554,6 +554,8 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
m_armorPenetrationPct = 0.0f;
|
||||
m_spellPenetrationItemMod = 0;
|
||||
|
||||
m_lastHonorKillsUpdateTime = time(NULL);
|
||||
|
||||
// Player summoning
|
||||
m_summon_expire = 0;
|
||||
m_summon_mapid = 0;
|
||||
|
|
@ -6531,6 +6533,35 @@ void Player::RewardReputation(Quest const* pQuest)
|
|||
// TODO: implement reputation spillover
|
||||
}
|
||||
|
||||
void Player::UpdateHonorKills()
|
||||
{
|
||||
/// called when rewarding honor and at each save
|
||||
time_t now = time(NULL);
|
||||
time_t today = (time(NULL) / DAY) * DAY;
|
||||
|
||||
if (m_lastHonorKillsUpdateTime < today)
|
||||
{
|
||||
time_t yesterday = today - DAY;
|
||||
|
||||
uint16 kills_today = GetUInt16Value(PLAYER_FIELD_KILLS, 0);
|
||||
|
||||
// update yesterday's contribution
|
||||
if (m_lastHonorKillsUpdateTime >= yesterday)
|
||||
{
|
||||
// this is the first update today, reset today's contribution
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 0, 0);
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 1, kills_today);
|
||||
}
|
||||
else
|
||||
{
|
||||
// no honor/kills yesterday or today, reset
|
||||
SetUInt32Value(PLAYER_FIELD_KILLS, 0);
|
||||
}
|
||||
}
|
||||
|
||||
m_lastHonorKillsUpdateTime = now;
|
||||
}
|
||||
|
||||
/// Calculate the amount of honor gained based on the victim
|
||||
/// and the size of the group for which the honor is divided
|
||||
/// An exact honor value can also be given (overriding the calcs)
|
||||
|
|
@ -6555,6 +6586,9 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, float honor)
|
|||
ObjectGuid victim_guid;
|
||||
uint32 victim_rank = 0;
|
||||
|
||||
// need call before fields update to have chance move yesterday data to appropriate fields before today data change.
|
||||
UpdateHonorKills();
|
||||
|
||||
if (honor <= 0)
|
||||
{
|
||||
if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
|
||||
|
|
@ -15333,8 +15367,8 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
}
|
||||
|
||||
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[40].GetUInt32());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[41].GetUInt16());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[42].GetUInt16());
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 0, fields[41].GetUInt16()); // today
|
||||
SetUInt16Value(PLAYER_FIELD_KILLS, 1, fields[42].GetUInt16()); // yesterday
|
||||
|
||||
_LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
|
||||
|
||||
|
|
@ -15531,6 +15565,10 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
|
|||
|
||||
m_atLoginFlags = fields[34].GetUInt32();
|
||||
|
||||
// Update Honor kills data
|
||||
m_lastHonorKillsUpdateTime = logoutTime;
|
||||
UpdateHonorKills();
|
||||
|
||||
m_deathExpireTime = (time_t)fields[37].GetUInt64();
|
||||
if (m_deathExpireTime > now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP)
|
||||
m_deathExpireTime = now + MAX_DEATH_COUNT * DEATH_EXPIRE_STEP - 1;
|
||||
|
|
@ -17028,6 +17066,9 @@ void Player::SaveToDB()
|
|||
return;
|
||||
}
|
||||
|
||||
// first save/honor gain after midnight will also update the player's honor fields
|
||||
UpdateHonorKills();
|
||||
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_PLAYER_STATS, "The value of player %s at save: ", m_name.c_str());
|
||||
outDebugStatsValues();
|
||||
|
||||
|
|
@ -23506,6 +23547,6 @@ void Player::ResetCurrencyWeekCounts()
|
|||
itr->second.state = PLAYERCURRENCY_CHANGED;
|
||||
}
|
||||
|
||||
WorldPacket data(SMSG_WEEKLY_RESET_CURRENCY, 0);
|
||||
WorldPacket data(SMSG_WEEKLY_RESET_CURRENCIES, 0);
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue