[12157] Merge Player::CanUseOutdoorCapturePoint into Player::CanUseCapturePoint

This commit is contained in:
stfx 2012-08-30 12:47:09 +02:00 committed by Antz
parent 97f6703301
commit 328a349a23
6 changed files with 14 additions and 24 deletions

View file

@ -2000,8 +2000,8 @@ void GameObject::TickCapturePoint()
// search for players in radius
std::list<Player*> capturingPlayers;
MaNGOS::AnyPlayerInObjectRangeWithOutdoorPvPCheck u_check(this, radius);
MaNGOS::PlayerListSearcher<MaNGOS::AnyPlayerInObjectRangeWithOutdoorPvPCheck> checker(capturingPlayers, u_check);
MaNGOS::AnyPlayerInCapturePointRange u_check(this, radius);
MaNGOS::PlayerListSearcher<MaNGOS::AnyPlayerInCapturePointRange> checker(capturingPlayers, u_check);
Cell::VisitWorldObjects(this, checker, radius);
GuidSet tempUsers(m_UniqueUsers);

View file

@ -1174,15 +1174,15 @@ namespace MaNGOS
uint32 i_spellId;
};
class AnyPlayerInObjectRangeWithOutdoorPvPCheck
class AnyPlayerInCapturePointRange
{
public:
AnyPlayerInObjectRangeWithOutdoorPvPCheck(WorldObject const* obj, float range)
AnyPlayerInCapturePointRange(WorldObject const* obj, float range)
: i_obj(obj), i_range(range) {}
WorldObject const& GetFocusObject() const { return *i_obj; }
bool operator()(Player* u)
{
return u->CanUseOutdoorCapturePoint() &&
return u->CanUseCapturePoint() &&
i_obj->IsWithinDistInMap(u, i_range);
}
private:

View file

@ -95,14 +95,14 @@ void OutdoorPvP::HandlePlayerKill(Player* killer, Player* victim)
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
if (groupMember->CanUseOutdoorCapturePoint())
if (groupMember->CanUseCapturePoint())
HandlePlayerKillInsideArea(groupMember);
}
}
else
{
// creature kills must be notified, even if not inside objective / not outdoor pvp active
if (killer && killer->CanUseOutdoorCapturePoint())
if (killer && killer->CanUseCapturePoint())
HandlePlayerKillInsideArea(killer);
}
}

View file

@ -6756,9 +6756,11 @@ void Player::UpdateArea(uint32 newArea)
UpdateAreaDependentAuras();
}
bool Player::CanUseOutdoorCapturePoint()
bool Player::CanUseCapturePoint()
{
return CanUseCapturePoint() &&
return isAlive() && // living
!HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // visible
(IsPvP() || sWorld.IsPvPRealm()) &&
!HasMovementFlag(MOVEFLAG_FLYING) &&
!IsTaxiFlying() &&
@ -21340,13 +21342,6 @@ bool Player::CanUseBattleGroundObject()
!HasAura(SPELL_RECENTLY_DROPPED_FLAG, EFFECT_INDEX_0));
}
bool Player::CanUseCapturePoint()
{
return (isAlive() && // living
!HasStealthAura() && // not stealthed
!HasInvisibilityAura()); // visible
}
uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, uint32 newskintone)
{
uint32 level = getLevel();

View file

@ -2174,15 +2174,10 @@ class MANGOS_DLL_SPEC Player : public Unit
bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const;
bool CanUseBattleGroundObject();
bool isTotalImmune();
// returns true if the player is in active state for capture point capturing
bool CanUseCapturePoint();
/*********************************************************/
/*** OUTDOOR PVP SYSTEM ***/
/*********************************************************/
// returns true if the player is in active state for outdoor pvp objective capturing
bool CanUseOutdoorCapturePoint();
/*********************************************************/
/*** REST SYSTEM ***/
/*********************************************************/

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12156"
#define REVISION_NR "12157"
#endif // __REVISION_NR_H__