示例#1
0
        public static void SendStatusActive(Character chr, Battleground bg, int queueIndex)
        {
            BattlegroundStatus battlegroundStatus = BattlegroundStatus.Active;
            BattlegroundSide   battlegroundSide   = chr.FactionGroup.GetBattlegroundSide();

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_STATUS))
            {
                packet.Write(queueIndex);
                BattlegroundId id = bg.Template.Id;
                packet.Write((byte)0);
                packet.Write((byte)1);
                packet.Write((uint)id);
                packet.Write((ushort)8080);
                packet.Write((byte)0);
                packet.Write((byte)0);
                packet.Write(bg.InstanceId);
                packet.Write((byte)0);
                packet.Write((int)battlegroundStatus);
                packet.Write((int)bg.Id);
                packet.Write(bg.RemainingShutdownDelay);
                packet.Write(bg.RuntimeMillis);
                packet.Write((byte)battlegroundSide);
                chr.Send(packet, false);
            }
        }
示例#2
0
 /// <summary>
 /// Enter the final state
 /// </summary>
 public virtual void FinishFight()
 {
     _status = BattlegroundStatus.Finished;
     RewardPlayers();
     SendPvpData();
     ExecuteInContext(() => FinalizeBattleground(false));
 }
示例#3
0
 /// <summary>Enter the final state</summary>
 public virtual void FinishFight()
 {
     this._status = BattlegroundStatus.Finished;
     this.RewardPlayers();
     this.SendPvpData();
     this.ExecuteInContext((Action)(() => this.FinalizeBattleground(false)));
 }
示例#4
0
        public Battleground()
        {
            if (this.HasQueue)
            {
                this._queueTimer = new TimerEntry((Action <int>)(dt => this.ProcessPendingPlayers()));
                this.RegisterUpdatable((IUpdatable)this._queueTimer);
            }

            this._status = BattlegroundStatus.None;
            this.AddPlayersToBiggerTeam = Battleground.AddPlayersToBiggerTeamDefault;
            this._teams         = new BattlegroundTeam[2];
            this._shutdownTimer = new TimerEntry((Action <int>)(dt => this.Delete()));
            this.RegisterUpdatable((IUpdatable)this._shutdownTimer);
        }
示例#5
0
		public Battleground()
		{
			if (HasQueue)
			{
				_queueTimer = new TimerEntry(dt => ProcessPendingPlayers());
				RegisterUpdatable(_queueTimer);
			}

			_status = BattlegroundStatus.None;
			AddPlayersToBiggerTeam = AddPlayersToBiggerTeamDefault;

			_teams = new BattlegroundTeam[2];

			_shutdownTimer = new TimerEntry(dt => Delete());
			RegisterUpdatable(_shutdownTimer);
		}
示例#6
0
        public Battleground()
        {
            if (HasQueue)
            {
                _queueTimer = new TimerEntry(dt => ProcessPendingPlayers());
                RegisterUpdatable(_queueTimer);
            }

            _status = BattlegroundStatus.None;
            AddPlayersToBiggerTeam = AddPlayersToBiggerTeamDefault;

            _teams = new BattlegroundTeam[2];

            _shutdownTimer = new TimerEntry(dt => Delete());
            RegisterUpdatable(_shutdownTimer);
        }
示例#7
0
 public virtual void StartFight()
 {
     ExecuteInContext(() =>
     {
         if (!IsDisposed && _status != BattlegroundStatus.Active)
         {
             _startTime = DateTime.Now;
             _status    = BattlegroundStatus.Active;
             foreach (var chr in m_characters)
             {
                 chr.Auras.Remove(_preparationSpell);
             }
             OnStart();
         }
     });
 }
示例#8
0
 public virtual void StartFight()
 {
     this.ExecuteInContext((Action)(() =>
     {
         if (this.IsDisposed || this._status == BattlegroundStatus.Active)
         {
             return;
         }
         this._startTime = DateTime.Now;
         this._status = BattlegroundStatus.Active;
         foreach (Unit character in this.m_characters)
         {
             character.Auras.Remove(this._preparationSpell);
         }
         this.OnStart();
     }));
 }
示例#9
0
        public virtual void StartPreparation()
        {
            this.ExecuteInContext((Action)(() =>
            {
                if (!this.IsOpen)
                {
                    return;
                }
                this._status = BattlegroundStatus.Preparing;
                if (this._preparationSpell != null)
                {
                    foreach (WorldObject character in this.m_characters)
                    {
                        character.SpellCast.TriggerSelf(this._preparationSpell);
                    }
                }

                this.CallDelayed(this.PreparationTimeMillis / 2, new Action(this.OnPrepareHalftime));
                this.OnPrepareBegin();
            }));
        }
示例#10
0
        public static void SendStatusEnqueued(Character chr, int index, BattlegroundRelation relation,
                                              BattlegroundQueue queue)
        {
            BattlegroundStatus battlegroundStatus = BattlegroundStatus.Enqueued;

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_STATUS))
            {
                packet.Write(index);
                BattlegroundId id = queue.Template.Id;
                packet.Write((byte)0);
                packet.Write((byte)1);
                packet.Write((uint)id);
                packet.Write((ushort)8080);
                packet.Write((byte)0);
                packet.Write((byte)0);
                packet.Write(queue.InstanceId);
                packet.Write(false);
                packet.Write((int)battlegroundStatus);
                packet.Write(queue.AverageWaitTime);
                packet.Write((int)relation.QueueTime.TotalMilliseconds);
                chr.Send(packet, false);
            }
        }
示例#11
0
        public virtual void StartPreparation()
        {
            ExecuteInContext(() =>
            {
                if (!IsOpen)
                {
                    return;
                }

                _status = BattlegroundStatus.Preparing;

                if (_preparationSpell != null)
                {
                    foreach (Character chr in m_characters)
                    {
                        chr.SpellCast.TriggerSelf(_preparationSpell);
                    }
                }

                CallDelayed(PreparationTimeMillis / 2, OnPrepareHalftime);

                OnPrepareBegin();
            });
        }
示例#12
0
        public static void SendStatusInvited(Character chr, int inviteTimeout)
        {
            BattlegroundStatus     battlegroundStatus = BattlegroundStatus.Preparing;
            BattlegroundInvitation invitation         = chr.Battlegrounds.Invitation;

            using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_STATUS))
            {
                packet.Write(invitation.QueueIndex);
                Battleground   battleground = invitation.Team.Battleground;
                BattlegroundId id           = battleground.Template.Id;
                packet.Write((byte)0);
                packet.Write((byte)1);
                packet.Write((uint)id);
                packet.Write((ushort)8080);
                packet.Write((byte)0);
                packet.Write((byte)0);
                packet.Write(battleground.InstanceId);
                packet.Write((byte)chr.FactionGroup.GetBattlegroundSide());
                packet.Write((int)battlegroundStatus);
                packet.Write((int)battleground.Id);
                packet.Write(inviteTimeout);
                chr.Send(packet, false);
            }
        }
示例#13
0
		/// <summary>
		/// Enter the final state
		/// </summary>
		public virtual void FinishFight()
		{
			_status = BattlegroundStatus.Finished;
			RewardPlayers();
			SendPvpData();
			ExecuteInContext(() => FinalizeBattleground(false));
		}
示例#14
0
		public virtual void StartFight()
		{
			ExecuteInContext(() =>
			{
				if (!IsDisposed && _status != BattlegroundStatus.Active)
				{
					_startTime = DateTime.Now;
					_status = BattlegroundStatus.Active;
					foreach (var chr in m_characters)
					{
						chr.Auras.Remove(_preparationSpell);
					}
					OnStart();
				}
			});
		}
示例#15
0
		public virtual void StartPreparation()
		{
			ExecuteInContext(() =>
			{
				if (!IsOpen) return;

				_status = BattlegroundStatus.Preparing;

				if (_preparationSpell != null)
				{
					foreach (Character chr in m_characters)
					{
						chr.SpellCast.TriggerSelf(_preparationSpell);
					}
				}

				CallDelayed(PreparationTimeMillis / 2, OnPrepareHalftime);

				OnPrepareBegin();
			});
		}
示例#16
0
		public virtual void StartPreparation()
		{
			ExecuteInContext(() =>
								{
									_status = BattlegroundStatus.Preparing;

									if (_preparationSpell != null)
									{
										foreach (Character chr in m_characters)
										{
											chr.SpellCast.TriggerSelf(_preparationSpell);
										}
									}

									CallDelayed(PreparationTimeSeconds / 2, () => { OnPrepareHalftime(); });

									OnPrepare();
								});
		}