[12059] Add grid searcher for OPvP Capture Points

Might be based on work of original OPvP authors

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
stfx 2012-07-06 14:30:07 +02:00 committed by Schmoozerd
parent 6de10526cc
commit acffb0de4c
5 changed files with 46 additions and 19 deletions

View file

@ -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
{

View file

@ -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 Builder>
class LocalizedPacketDo

View file

@ -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)

View file

@ -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 ***/

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12058"
#define REVISION_NR "12059"
#endif // __REVISION_NR_H__