Core/BG:
- Force removal of stealth and invisible auras when using gameobjects with type GAMEOBJECT_TYPE_FLAGSTAND and GAMEOBJECT_TYPE_FLAGDROP - Do not allow players to use unfriendly battleground objects (prevents flag cap with Nitro Boosts active for example)
This commit is contained in:
@@ -1522,14 +1522,18 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
|
||||
if (player->CanUseBattlegroundObject())
|
||||
if (player->CanUseBattlegroundObject(this))
|
||||
{
|
||||
// in battleground check
|
||||
Battleground* bg = player->GetBattleground();
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
if (player->GetVehicle())
|
||||
return;
|
||||
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||
// BG flag click
|
||||
// AB:
|
||||
// 15001
|
||||
@@ -1562,14 +1566,18 @@ void GameObject::Use(Unit* user)
|
||||
|
||||
Player* player = user->ToPlayer();
|
||||
|
||||
if (player->CanUseBattlegroundObject())
|
||||
if (player->CanUseBattlegroundObject(this))
|
||||
{
|
||||
// in battleground check
|
||||
Battleground* bg = player->GetBattleground();
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
if (player->GetVehicle())
|
||||
return;
|
||||
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_INVISIBILITY);
|
||||
// BG flag dropped
|
||||
// WS:
|
||||
// 179785 - Silverwing Flag
|
||||
|
||||
@@ -23488,10 +23488,14 @@ WorldObject* Player::GetViewpoint() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Player::CanUseBattlegroundObject()
|
||||
bool Player::CanUseBattlegroundObject(GameObject* gameobject)
|
||||
{
|
||||
// TODO : some spells gives player ForceReaction to one faction (ReputationMgr::ApplyForceReaction)
|
||||
// maybe gameobject code should handle that ForceReaction usage
|
||||
FactionTemplateEntry const* playerFaction = getFactionTemplateEntry();
|
||||
FactionTemplateEntry const* faction = sFactionTemplateStore.LookupEntry(gameobject->GetUInt32Value(GAMEOBJECT_FACTION));
|
||||
|
||||
if (playerFaction && faction && !playerFaction->IsFriendlyTo(*faction))
|
||||
return false;
|
||||
|
||||
// BUG: sometimes when player clicks on flag in AB - client won't send gameobject_use, only gameobject_report_use packet
|
||||
// Note: Mount, stealth and invisibility will be removed when used
|
||||
return (!isTotalImmune() && // Damage immune
|
||||
|
||||
@@ -2237,7 +2237,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
bool GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const;
|
||||
bool isTotalImmunity();
|
||||
bool CanUseBattlegroundObject();
|
||||
bool CanUseBattlegroundObject(GameObject* gameobject);
|
||||
bool isTotalImmune();
|
||||
bool CanCaptureTowerPoint();
|
||||
|
||||
|
||||
@@ -5210,7 +5210,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
if (m_spellInfo->Id != 1842 || (m_targets.GetGOTarget() &&
|
||||
m_targets.GetGOTarget()->GetGOInfo()->type != GAMEOBJECT_TYPE_TRAP))
|
||||
if (m_caster->ToPlayer()->InBattleground() && // In Battleground players can use only flags and banners
|
||||
!m_caster->ToPlayer()->CanUseBattlegroundObject())
|
||||
!m_caster->ToPlayer()->CanUseBattlegroundObject(m_targets.GetGOTarget()))
|
||||
return SPELL_FAILED_TRY_AGAIN;
|
||||
|
||||
// get the lock entry
|
||||
|
||||
Reference in New Issue
Block a user