public bool CanUseBattlegroundObject(GameObject gameobject) { // It is possible to call this method with a null pointer, only skipping faction check. if (gameobject) { FactionTemplateRecord playerFaction = GetFactionTemplateEntry(); FactionTemplateRecord faction = CliDB.FactionTemplateStorage.LookupByKey(gameobject.GetUInt32Value(GameObjectFields.Faction)); if (playerFaction != null && faction != null && !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 !HasAura(BattlegroundConst.SpellRecentlyDroppedFlag) && // Still has recently held flag debuff IsAlive()); // Alive }