예제 #1
0
        private int Dequeue(int amount, Battleground bg, LinkedListNode <BattlegroundRelation> node)
        {
            BattlegroundTeam team = bg.GetTeam(this.Side);
            int num = 0;

            do
            {
                BattlegroundRelation battlegroundRelation = node.Value;
                if (battlegroundRelation.Count <= amount)
                {
                    this.m_chrCount -= battlegroundRelation.Characters.CharacterCount;
                    num             += team.Invite(battlegroundRelation.Characters);
                    battlegroundRelation.IsEnqueued = false;
                    LinkedListNode <BattlegroundRelation> next = node.Next;
                    this.PendingRequests.Remove(node);
                    node = next;
                    if (node == null)
                    {
                        break;
                    }
                }
            } while ((node = node.Next) != null && num <= amount);

            return(num);
        }
예제 #2
0
        public override void TeleportInside(Character chr)
        {
            BattlegroundInvitation invitation       = chr.Battlegrounds.Invitation;
            BattlegroundTeam       battlegroundTeam =
                invitation == null?this.GetTeam(chr.FactionGroup.GetBattlegroundSide()) : invitation.Team;

            chr.TeleportTo((Map)this, battlegroundTeam.StartPosition, new float?(battlegroundTeam.StartOrientation));
        }
예제 #3
0
        internal void InviteTo(BattlegroundTeam team, int queueIndex, BattlegroundRelation relation)
        {
            this._chr.EnsureContext();
            relation.IsEnqueued = false;
            Battleground           bg = team.Battleground;
            BattlegroundInvitation battlegroundInvitation = new BattlegroundInvitation(team, queueIndex);

            this._chr.Battlegrounds.Invitation = battlegroundInvitation;
            battlegroundInvitation.CancelTimer = this._chr.CallDelayed(BattlegroundMgr.InvitationTimeoutMillis,
                                                                       (Action <WorldObject>)(obj => this.RemoveRelation(bg.Template.Id)));
            BattlegroundHandler.SendStatusInvited(this._chr);
        }
예제 #4
0
        /// <summary>
        /// Removes up to the max possible amount of players from the Queues
        /// and adds them to the Battleground.
        /// </summary>
        public int ProcessPendingPlayers(BattlegroundTeam team)
        {
            if (!this.IsAddingPlayers)
            {
                return(0);
            }
            int openPlayerSlotCount = team.OpenPlayerSlotCount;

            if (openPlayerSlotCount > 0)
            {
                return(this.ProcessPendingPlayers(team.Side, openPlayerSlotCount));
            }
            return(0);
        }
예제 #5
0
 protected void JoinTeam(Character chr, BattlegroundTeam team)
 {
     if (chr.Battlegrounds.Team != null)
     {
         chr.Battlegrounds.Team.RemoveMember(chr);
     }
     chr.Battlegrounds.Stats = this.CreateStats();
     team.AddMember(chr);
     if (this._status != BattlegroundStatus.None || (long)this.PlayerCount <
         (long)this.MaxPlayerCount * (long)Battleground.StartPlayerPct / 100L)
     {
         return;
     }
     this.StartPreparation();
 }
예제 #6
0
        /// <summary>
        /// Invites this Character to the given Battleground or enqueues him/her.
        /// </summary>
        internal void InviteTo(BattlegroundTeam team)
        {
            var index = GetIndex(team.Battleground.Template.Id);
            BattlegroundRelation relation;

            if (index == -1)
            {
                index = AddRelation(relation = new BattlegroundRelation(team.Queue, _chr, false));
            }
            else
            {
                relation = _relations[index];
            }
            InviteTo(team, index, relation);
        }
예제 #7
0
        protected void JoinTeam(Character chr, BattlegroundTeam team)
        {
            if (chr.Battlegrounds.Team != null)
            {
                chr.Battlegrounds.Team.RemoveMember(chr);
            }
            chr.Battlegrounds.Stats = CreateStats();
            team.AddMember(chr);

            if (_status == BattlegroundStatus.None &&
                PlayerCount >= (MaxPlayerCount * StartPlayerPct) / 100)
            {
                StartPreparation();
            }
        }
예제 #8
0
        protected void DoTryJoin(Character chr, bool asGroup, BattlegroundSide side)
        {
            this.EnsureContext();
            if (!chr.IsInWorld || !this.IsOpen)
            {
                return;
            }
            BattlegroundTeam team         = this.GetTeam(side);
            ICharacterSet    characterSet = this._instanceQueue.GetTeamQueue(side).GetCharacterSet(chr, asGroup);

            if (characterSet == null)
            {
                return;
            }
            team.Enqueue(characterSet);
        }
예제 #9
0
        /// <summary>
        /// Invites this Character to the given Battleground or enqueues him/her.
        /// </summary>
        internal void InviteTo(BattlegroundTeam team)
        {
            int queueIndex = this.GetIndex(team.Battleground.Template.Id);
            BattlegroundRelation relation;

            if (queueIndex == -1)
            {
                queueIndex =
                    this.AddRelation(relation = new BattlegroundRelation(team.Queue, (ICharacterSet)this._chr, false));
            }
            else
            {
                relation = this._relations[queueIndex];
            }
            this.InviteTo(team, queueIndex, relation);
        }
예제 #10
0
        /// <summary>
        /// Removes up to the max possible amount of players from the Queues
        /// and adds them to the Battleground.
        /// </summary>
        public int ProcessPendingPlayers(BattlegroundTeam team)
        {
            if (!IsAddingPlayers)
            {
                return(0);
            }

            int amount = team.OpenPlayerSlotCount;

            if (amount > 0)
            {
                return(ProcessPendingPlayers(team.Side, amount));
            }

            return(0);
        }
예제 #11
0
        internal void InviteTo(BattlegroundTeam team, int queueIndex, BattlegroundRelation relation)
        {
            _chr.EnsureContext();

            relation.IsEnqueued = false;
            var bg     = team.Battleground;
            var invite = new BattlegroundInvitation(team, queueIndex);

            _chr.Battlegrounds.Invitation = invite;

            invite.CancelTimer = _chr.CallDelayed(BattlegroundMgr.InvitationTimeoutMillis, obj =>
            {
                RemoveRelation(bg.Template.Id);
            });

            BattlegroundHandler.SendStatusInvited(_chr);
        }
예제 #12
0
        /// <summary>Is called when a Character logs back in</summary>
        protected internal virtual bool LogBackIn(Character chr)
        {
            BattlegroundSide battlegroundTeam = chr.Record.BattlegroundTeam;
            BattlegroundTeam team             = this.GetTeam(battlegroundTeam);

            if (battlegroundTeam != BattlegroundSide.End && !team.IsFull)
            {
                BattlegroundTeamQueue queue = team.Queue;
                int queueIndex =
                    chr.Battlegrounds.AddRelation(new BattlegroundRelation(queue, (ICharacterSet)chr, false));
                chr.Battlegrounds.Invitation = new BattlegroundInvitation(team, queueIndex);
            }
            else if (!chr.Role.IsStaff)
            {
                this.TeleportOutside(chr);
                return(false);
            }

            return(true);
        }
예제 #13
0
        protected override void OnLeave(Character chr)
        {
            base.OnLeave(chr);
            BattlegroundTeam team = chr.Battlegrounds.Team;

            if (team == null)
            {
                return;
            }
            if (chr.Battlegrounds.Invitation != null)
            {
                chr.Battlegrounds.RemoveRelation(this.Template.Id);
            }
            team.RemoveMember(chr);
            this.ProcessPendingPlayers(team);
            if (this.IsActive && !chr.Role.IsStaff)
            {
                chr.Auras.CreateSelf(BattlegroundMgr.DeserterSpell, false);
            }
            chr.Auras.Remove(this._healingReductionSpell);
            this.CheckShutdown();
        }
예제 #14
0
        protected override void OnEnter(Character chr)
        {
            base.OnEnter(chr);
            BattlegroundInvitation invitation = chr.Battlegrounds.Invitation;

            if (invitation == null)
            {
                return;
            }
            BattlegroundTeam team = invitation.Team;

            if (team.Battleground != this)
            {
                team.Battleground.TeleportInside(chr);
            }
            else
            {
                chr.RemoveUpdateAction((ObjectUpdateTimer)invitation.CancelTimer);
                chr.SpellCast.TriggerSelf(this._healingReductionSpell);
                this.JoinTeam(chr, team);
                BattlegroundHandler.SendStatusActive(chr, this, invitation.QueueIndex);
            }
        }
예제 #15
0
		internal void InviteTo(BattlegroundTeam team, int queueIndex, BattlegroundRelation relation)
		{
			_chr.EnsureContext();

			relation.IsEnqueued = false;
			var bg = team.Battleground;
			var invite = new BattlegroundInvitation(team, queueIndex);
			_chr.Battlegrounds.Invitation = invite;

			invite.CancelTimer = _chr.CallDelayed(BattlegroundMgr.InvitationTimeoutMillis, obj =>
			{
				RemoveRelation(bg.Template.Id);
			});

			BattlegroundHandler.SendStatusInvited(_chr);
		}
예제 #16
0
		/// <summary>
		/// Invites this Character to the given Battleground or enqueues him/her.
		/// </summary>
		internal void InviteTo(BattlegroundTeam team)
		{
			var index = GetIndex(team.Battleground.Template.Id);
			BattlegroundRelation relation;
			if (index == -1)
			{
				index = AddRelation(relation = new BattlegroundRelation(team.Queue, _chr, false));
			}
			else
			{
				relation = _relations[index];
			}
			InviteTo(team, index, relation);
		}
예제 #17
0
		protected void JoinTeam(Character chr, BattlegroundTeam team)
		{
			if (chr.Battlegrounds.Team != null)
			{
				chr.Battlegrounds.Team.RemoveMember(chr);
			}
			chr.Battlegrounds.Stats = CreateStats();
			team.AddMember(chr);

			if (_status == BattlegroundStatus.None &&
			   PlayerCount >= (MaxPlayerCount * StartPlayerPct) / 100)
			{
				StartPreparation();
			}
		}
예제 #18
0
		/// <summary>
		/// Removes up to the max possible amount of players from the Queues
		/// and adds them to the Battleground.
		/// </summary>
		public int ProcessPendingPlayers(BattlegroundTeam team)
		{
			if (!IsAddingPlayers)
				return 0;

			int amount = team.OpenPlayerSlotCount;

			if (amount > 0)
			{
				return ProcessPendingPlayers(team.Side, amount);
			}

			return 0;
		}
예제 #19
0
 public void Win(BattlegroundTeam team)
 {
     Winner = team;
     FinishFight();
 }
예제 #20
0
		public BattlegroundInvitation(BattlegroundTeam team, int queueIndex)
		{
			Team = team;
			QueueIndex = queueIndex;
		}
예제 #21
0
 public BattlegroundInvitation(BattlegroundTeam team, int queueIndex)
 {
     this.Team       = team;
     this.QueueIndex = queueIndex;
 }
예제 #22
0
 private void InformNearVictory(BattlegroundTeam team, int score)
 {
     Characters.SendSystemMessage(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.ABNearVictory), 
                                                                                                     team.Side.ToString(), score);
     MiscHandler.SendPlaySoundToMap(this, (uint)ABSounds.NearVictory);
     isInformatedNearVictory = true;
 }
예제 #23
0
 private void Graveyards(Character chr, BattlegroundTeam team)
 {
 }
예제 #24
0
 private void InformNearVictory(BattlegroundTeam team, int score)
 {
     Characters.SendSystemMessage(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.EOTSNearVictory), team.Side.ToString(), score);
     isInformatedNearVictory = true;
 }