Пример #1
0
        /// <summary>
        /// Make sure that Battleground.HasQueue is true before calling this method.
        /// Adds the given set of Characters to this team's queue.
        /// Will invite immediately if there are enough open slots and
        /// <see cref="P:WCell.RealmServer.Battlegrounds.Battleground.IsAddingPlayers" /> is true.
        /// </summary>
        /// <param name="chrs"></param>
        public BattlegroundRelation Enqueue(ICharacterSet chrs)
        {
            this._battleground.EnsureContext();
            BattlegroundRelation relation = new BattlegroundRelation(this.Queue, chrs);
            bool shouldInvite             = this._battleground.IsAddingPlayers && chrs.CharacterCount <= this.OpenPlayerSlotCount;

            if (!shouldInvite)
            {
                this.Queue.Enqueue(relation);
            }
            else
            {
                this.ReservedSlots += chrs.CharacterCount;
                relation.IsEnqueued = false;
            }

            chrs.ForeachCharacter((Action <Character>)(chr => chr.ExecuteInContext((Action)(() =>
            {
                int queueIndex = chr.Battlegrounds.AddRelation(relation);
                if (!shouldInvite)
                {
                    return;
                }
                chr.Battlegrounds.InviteTo(this, queueIndex, relation);
            }))));
            return(relation);
        }
Пример #2
0
        /// <summary>
        /// Make sure that Battleground.HasQueue is true before calling this method.
        /// Adds the given set of Characters to this team's queue.
        /// Will invite immediately if there are enough open slots and
        /// <see cref="WCell.RealmServer.Battlegrounds.Battleground.IsAddingPlayers"/> is true.
        /// </summary>
        /// <param name="chrs"></param>
        public BattlegroundRelation Enqueue(ICharacterSet chrs)
        {
            _battleground.EnsureContext();

            var relation     = new BattlegroundRelation(Queue, chrs);
            var shouldInvite = _battleground.IsAddingPlayers && chrs.CharacterCount <= OpenPlayerSlotCount;

            if (!shouldInvite)
            {
                Queue.Enqueue(relation);
            }
            else
            {
                ReservedSlots      += chrs.CharacterCount;
                relation.IsEnqueued = false;
            }

            chrs.ForeachCharacter(chr => chr.ExecuteInContext(() =>
            {
                var index = chr.Battlegrounds.AddRelation(relation);
                if (shouldInvite)
                {
                    chr.Battlegrounds.InviteTo(this, index, relation);
                }
            }));

            return(relation);
        }
Пример #3
0
        public virtual BattlegroundRelation Enqueue(ICharacterSet chrs)
        {
            BattlegroundRelation request = new BattlegroundRelation(this, chrs);

            chrs.ForeachCharacter((Action <Character>)(chr =>
                                                       chr.ExecuteInContext((Action)(() => chr.Battlegrounds.AddRelation(request)))));
            this.Enqueue(request);
            return(request);
        }
Пример #4
0
        public virtual BattlegroundRelation Enqueue(ICharacterSet chrs)
        {
            var request = new BattlegroundRelation(this, chrs);

            chrs.ForeachCharacter(chr =>
                                  chr.ExecuteInContext(() => {
                chr.Battlegrounds.AddRelation(request);
            }));

            Enqueue(request);
            return(request);
        }
Пример #5
0
        public int Invite(ICharacterSet chrs)
        {
            int added = 0;

            this.ReservedSlots += chrs.CharacterCount;
            chrs.ForeachCharacter((Action <Character>)(chr =>
            {
                if (!chr.IsInWorld)
                {
                    return;
                }
                chr.ExecuteInContext((Action)(() => chr.Battlegrounds.InviteTo(this)));
                ++added;
            }));
            return(added);
        }
Пример #6
0
        public int Invite(ICharacterSet chrs)
        {
            var added = 0;

            ReservedSlots += chrs.CharacterCount;

            chrs.ForeachCharacter(chr =>
            {
                if (chr.IsInWorld)
                {
                    chr.ExecuteInContext(() => { chr.Battlegrounds.InviteTo(this); });
                    ++added;
                }
            });
            return(added);
        }
Пример #7
0
		public virtual BattlegroundRelation Enqueue(ICharacterSet chrs)
		{
			var request = new BattlegroundRelation(this, chrs);

			chrs.ForeachCharacter(chr =>
				chr.ExecuteInContext(() => {
					chr.Battlegrounds.AddRelation(request);
				}));

			Enqueue(request);
			return request;
		}
Пример #8
0
		public int Invite(ICharacterSet chrs)
		{
			var added = 0;
			ReservedSlots += chrs.Count;

			chrs.ForeachCharacter(chr =>
			{
				if (chr.IsInWorld)
				{
					chr.ExecuteInContext(() => { chr.Battlegrounds.InviteTo(this); });
					++added;
				}
			});
			return added;
		}
Пример #9
0
		/// <summary>
		/// Make sure that Battleground.HasQueue is true before calling this method.
		/// Adds the given set of Characters to this team's queue. 
		/// Will invite immediately if there are enough open slots and
		/// <see cref="WCell.RealmServer.Battlegrounds.Battleground.IsAddingPlayers"/> is true.
		/// </summary>
		/// <param name="chrs"></param>
		public BattlegroundRelation Enqueue(ICharacterSet chrs)
		{
			_battleground.EnsureContext();

			var relation = new BattlegroundRelation(Queue, chrs);
			var shouldInvite = _battleground.IsAddingPlayers && chrs.Count <= OpenPlayerSlotCount;

			if (!shouldInvite)
			{
				Queue.Enqueue(relation);
			}
			else
			{
				ReservedSlots += chrs.Count;
				relation.IsEnqueued = false;
			}

			chrs.ForeachCharacter(chr => chr.ExecuteInContext(() =>
			{
				var index = chr.Battlegrounds.AddRelation(relation);
				if (shouldInvite)
				{
					chr.Battlegrounds.InviteTo(this, index, relation);
				}
			}));

			return relation;
		}
Пример #10
0
 internal void Cancel()
 {
     _participants.ForeachCharacter(chr => { chr.Battlegrounds.CancelIfEnqueued(BattlegroundId); });
 }