Beispiel #1
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));
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        internal void RemoveRelation(int index, BattlegroundRelation relation, bool isCharActive)
        {
            this._chr.EnsureContext();
            this._relations[index] = (BattlegroundRelation)null;
            BattlegroundInvitation invitation = this.Invitation;

            if (invitation != null)
            {
                --invitation.Team.ReservedSlots;
                this.Invitation = (BattlegroundInvitation)null;
            }

            BattlegroundId bgId = relation.BattlegroundId;
            Battleground   map  = this._chr.Map as Battleground;

            if (map != null && map.Template.Id == bgId && (!relation.IsEnqueued && !this._chr.IsTeleporting) &&
                isCharActive)
            {
                map.TeleportOutside(this._chr);
            }
            if (isCharActive)
            {
                BattlegroundHandler.ClearStatus((IPacketReceiver)this._chr, index);
            }
            if (!relation.IsEnqueued || relation.Characters.CharacterCount <= 1)
            {
                return;
            }
            Group group = this._chr.Group;

            if (group == null || !group.IsLeader(this._chr))
            {
                return;
            }
            relation.Characters.ForeachCharacter((Action <Character>)(chr =>
            {
                if (chr == this._chr)
                {
                    return;
                }
                chr.ExecuteInContext((Action)(() => chr.Battlegrounds.RemoveRelation(bgId)));
            }));
        }
Beispiel #5
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);
            }
        }
Beispiel #6
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);
		}
Beispiel #7
0
		public void Cancel(BattlegroundInvitation invite)
		{
			RemoveRelation(invite.QueueIndex);
		}
Beispiel #8
0
 public void Cancel(BattlegroundInvitation invite)
 {
     RemoveRelation(invite.QueueIndex);
 }