[12056] Fix a bug of [11825] that causes wrong offhand attack times for players.

Thx to fr1nge for reporting the bug.
Problem spotting and patch by vovk
Additional cleanup by fr1nge

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Velvet 2012-07-18 14:56:42 +02:00 committed by Schmoozerd
parent 1c7e46a4a8
commit 4e117d1ee8
2 changed files with 41 additions and 48 deletions

View file

@ -1165,10 +1165,10 @@ void Player::Update( uint32 update_diff, uint32 p_time )
if (!IsInWorld())
return;
// remove failed timed Achievements
// Remove failed timed Achievements
GetAchievementMgr().DoFailedTimedAchievementCriterias();
// undelivered mail
// Undelivered mail
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(NULL))
{
SendNewMail();
@ -1178,21 +1178,14 @@ void Player::Update( uint32 update_diff, uint32 p_time )
m_nextMailDelivereTime = 0;
}
//used to implement delayed far teleports
// Used to implement delayed far teleports
SetCanDelayTeleport(true);
Unit::Update(update_diff, p_time);
SetCanDelayTeleport(false);
// update player only attacks
// Update player only attacks
if (uint32 ranged_att = getAttackTimer(RANGED_ATTACK))
{
setAttackTimer(RANGED_ATTACK, (update_diff >= ranged_att ? 0 : ranged_att - update_diff));
}
if(uint32 off_att = getAttackTimer(OFF_ATTACK))
{
setAttackTimer(OFF_ATTACK, (update_diff >= off_att ? 0 : off_att - update_diff) );
}
time_t now = time(NULL);
@ -1219,7 +1212,7 @@ void Player::Update( uint32 update_diff, uint32 p_time )
if (q_status.m_timer <= update_diff)
{
uint32 quest_id = *iter;
++iter; // current iter will be removed in FailQuest
++iter; // Current iter will be removed in FailQuest
FailQuest(quest_id);
}
else
@ -1249,13 +1242,13 @@ void Player::Update( uint32 update_diff, uint32 p_time )
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING))
{
if (roll_chance_i(3) && GetTimeInnEnter() > 0) //freeze update
if (roll_chance_i(3) && GetTimeInnEnter() > 0) // Freeze update
{
time_t time_inn = time(NULL) - GetTimeInnEnter();
if (time_inn >= 10) //freeze update
if (time_inn >= 10) // Freeze update
{
float bubble = 0.125f * sWorld.getConfig(CONFIG_FLOAT_RATE_REST_INGAME);
//speed collect rest bonus (section/in hour)
// Speed collect rest bonus (section/in hour)
SetRestBonus(float(GetRestBonus() + time_inn * (GetUInt32Value(PLAYER_NEXT_LEVEL_XP) / 72000) * bubble));
UpdateInnerTime(time(NULL));
}
@ -1286,11 +1279,11 @@ void Player::Update( uint32 update_diff, uint32 p_time )
GetZoneAndAreaId(newzone, newarea);
if (m_zoneUpdateId != newzone)
UpdateZone(newzone,newarea); // also update area
UpdateZone(newzone, newarea); // Also update area
else
{
// use area updates as well
// needed for free far all arenas for example
// Use area updates as well
// Needed for free for all arenas for example
if (m_areaUpdateId != newarea)
UpdateArea(newarea);
@ -1366,7 +1359,7 @@ void Player::Update( uint32 update_diff, uint32 p_time )
HandleSobering();
}
// not auto-free ghost from body in instances
// Not auto-free ghost from body in instances
if (m_deathTimer > 0 && !GetMap()->Instanceable())
{
if (p_time >= m_deathTimer)
@ -1382,7 +1375,7 @@ void Player::Update( uint32 update_diff, uint32 p_time )
UpdateEnchantTime(update_diff);
UpdateHomebindTime(update_diff);
// group update
// Group update
SendUpdateToOutOfRangeGroupMembers();
Pet* pet = GetPet();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12055"
#define REVISION_NR "12056"
#endif // __REVISION_NR_H__