diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index bdf38859c..3e20e0a65 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -141,7 +141,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint() ++j; continue; } - if (plr->CanCaptureTowerPoint() && + if (plr->CanUseCapturePoint() && plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS)) { //player joined point! @@ -180,7 +180,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint() ++j; continue; } - if (!plr->CanCaptureTowerPoint() || + if (!plr->CanUseCapturePoint() || !plr->IsWithinDist3d(BG_EY_NodePositions[i][0], BG_EY_NodePositions[i][1], BG_EY_NodePositions[i][2], BG_EY_POINT_RADIUS)) //move player out of point (add him to players that are out of points { diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 5ad1f24d7..46689dc09 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -1174,6 +1174,22 @@ namespace MaNGOS uint32 i_spellId; }; + class AnyPlayerInObjectRangeWithOutdoorPvPCheck + { + public: + AnyPlayerInObjectRangeWithOutdoorPvPCheck(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() && + i_obj->IsWithinDistInMap(u, i_range); + } + private: + WorldObject const* i_obj; + float i_range; + }; + // Prepare using Builder localized packets with caching and send to player template class LocalizedPacketDo diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 052f4f958..5c24fedbf 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6695,6 +6695,15 @@ void Player::UpdateArea(uint32 newArea) UpdateAreaDependentAuras(); } +bool Player::CanUseOutdoorCapturePoint() +{ + return CanUseCapturePoint() && + (IsPvP() || sWorld.IsPvPRealm()) && + !HasMovementFlag(MOVEFLAG_FLYING) && + !IsTaxiFlying() && + !isGameMaster(); +} + void Player::UpdateZone(uint32 newZone, uint32 newArea) { AreaTableEntry const* zone = GetAreaEntryByAreaID(newZone); @@ -21476,24 +21485,19 @@ bool Player::CanUseBattleGroundObject() // TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction) // maybe gameobject code should handle that ForceReaction usage // BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet - return ( //InBattleGround() && // in battleground - not need, check in other cases - //!IsMounted() && - not correct, player is dismounted when he clicks on flag - //player cannot use object when he is invulnerable (immune) - !isTotalImmune() && // not totally immune - //i'm not sure if these two are correct, because invisible players should get visible when they click on flag - !HasStealthAura() && // not stealthed - !HasInvisibilityAura() && // not invisible - !HasAura(SPELL_RECENTLY_DROPPED_FLAG, EFFECT_INDEX_0) &&// can't pickup - isAlive() // live player - ); + return (isAlive() && // living + // the following two are incorrect, because invisible/stealthed players should get visible when they click on flag + !HasStealthAura() && // not stealthed + !HasInvisibilityAura() && // visible + !isTotalImmune() && // vulnerable (not immune) + !HasAura(SPELL_RECENTLY_DROPPED_FLAG, EFFECT_INDEX_0)); } -bool Player::CanCaptureTowerPoint() +bool Player::CanUseCapturePoint() { - return ( !HasStealthAura() && // not stealthed - !HasInvisibilityAura() && // not invisible - isAlive() // live player - ); + return (isAlive() && // living + !HasStealthAura() && // not stealthed + !HasInvisibilityAura()); // visible } uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, uint32 newskintone) diff --git a/src/game/Player.h b/src/game/Player.h index 346ea6fc9..fc90e5205 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2145,7 +2145,14 @@ class MANGOS_DLL_SPEC Player : public Unit bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const; bool CanUseBattleGroundObject(); bool isTotalImmune(); - bool CanCaptureTowerPoint(); + bool CanUseCapturePoint(); + + /*********************************************************/ + /*** WORLD PVP SYSTEM ***/ + /*********************************************************/ + + // returns true if the player is in active state for outdoor pvp objective capturing + bool CanUseOutdoorCapturePoint(); /*********************************************************/ /*** REST SYSTEM ***/ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 615b7337b..238442e3c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12058" + #define REVISION_NR "12059" #endif // __REVISION_NR_H__