/// <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); }
/// <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); }
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); }
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); }
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); }
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); }
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; }
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; }
/// <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; }
internal void Cancel() { _participants.ForeachCharacter(chr => { chr.Battlegrounds.CancelIfEnqueued(BattlegroundId); }); }