Prevent players from gaining rest state in hostile capital zones.

Fix a bug where PvP status never resets when not moving to another zone.
Reset PvP status at Taxi node end/worldport when moving into friendly territory.

--HG--
branch : trunk
This commit is contained in:
thenecromancer
2010-07-31 13:55:23 +02:00
parent bdf20fa420
commit 270367abfc
2 changed files with 14 additions and 7 deletions
+8 -7
View File
@@ -7020,9 +7020,12 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
if (zone->flags & AREA_FLAG_CAPITAL) // in capital city
{
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_IN_CITY);
InnEnter(time(0),GetMapId(),0,0,0);
if (!pvpInfo.inHostileArea || zone->IsSanctuary())
{
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_IN_CITY);
InnEnter(time(0),GetMapId(),0,0,0);
}
pvpInfo.inNoPvPArea = true;
}
else // anywhere else
@@ -19967,10 +19970,8 @@ void Player::UpdatePvP(bool state, bool override)
}
else
{
if (pvpInfo.endTimer != 0)
pvpInfo.endTimer = time(NULL);
else
SetPvP(state);
pvpInfo.endTimer = time(NULL);
SetPvP(state);
}
}
@@ -179,6 +179,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// honorless target
if (GetPlayer()->pvpInfo.inHostileArea)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// in friendly area
else if (GetPlayer()->IsPvP() && !GetPlayer()->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_IN_PVP))
GetPlayer()->UpdatePvP(false, false);
// resummon pet
GetPlayer()->ResummonPetTemporaryUnSummonedIfAny();
@@ -227,6 +230,9 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
// honorless target
if (plMover->pvpInfo.inHostileArea)
plMover->CastSpell(plMover, 2479, true);
// in friendly area
else if (plMover->IsPvP() && !plMover->HasFlag(PLAYER_FLAGS,PLAYER_FLAGS_IN_PVP))
plMover->UpdatePvP(false, false);
}
// resummon pet