Exemple #1
0
        /// <summary>
        /// Caps the flag. Notifies the participants.
        /// </summary>
        public bool CaptureFlag(Character capturer)
        {
            IsFlagCap = true;

            Instance.Characters.SendSystemMessage(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.WSCaptureFlag),
                                                  capturer.Name, Name);

            Opponent.Score++;

            OnFlagAuraRemoved(capturer);

            var evt = FlagCaptured;

            if (evt != null)
            {
                FlagCaptured(FlagCarrier);
            }

            if (FlagCarrier.Auras.Remove(_flagSpell.SpellId))
            {
                Instance.CallDelayed(_flagRespawnTime, () => RespawnFlag());                 //Respawn the flag in X seconds

                // We no longer have a carrier.
                FlagCarrier = null;
                IsFlagCap   = false;
                FlagCaptures.Add(new FlagCapture(capturer, DateTime.Now));
                var stats = (WSGStats)capturer.Battlegrounds.Stats;
                stats.FlagCaptures++;
                return(true);
            }
            return(false);
        }