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); }
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)); }
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); }
/// <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); }
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(); }
/// <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); }
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(); } }
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); }
/// <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); }
/// <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); }
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); }
/// <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); }
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(); }
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); } }
/// <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; }
public void Win(BattlegroundTeam team) { Winner = team; FinishFight(); }
public BattlegroundInvitation(BattlegroundTeam team, int queueIndex) { Team = team; QueueIndex = queueIndex; }
public BattlegroundInvitation(BattlegroundTeam team, int queueIndex) { this.Team = team; this.QueueIndex = queueIndex; }
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; }
private void Graveyards(Character chr, BattlegroundTeam team) { }
private void InformNearVictory(BattlegroundTeam team, int score) { Characters.SendSystemMessage(DefaultAddonLocalizer.Instance.GetTranslations(AddonMsgKey.EOTSNearVictory), team.Side.ToString(), score); isInformatedNearVictory = true; }