コード例 #1
0
ファイル: Duel.cs プロジェクト: NecroSharper/WCell
        /// <summary>
        /// Ends the duel with the given win-condition and the given loser
        /// </summary>
        /// <param name="loser">The opponent that lost the match or null if its a draw</param>
        /// <remarks>Requires map context</remarks>
        public void Finish(DuelWin win, Character loser)
        {
            if (IsActive)
            {
                if (loser != null)
                {
                    // user casts stun on himself
                    loser.SpellCast.Start(SpellId.NotDisplayedGrovel, false);
                    var winner = loser.DuelOpponent;
                    winner.Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.WinDuel, 1);
                    loser.Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.LoseDuel, 1);
                    DuelHandler.SendWinner(win, winner, loser);
                }

                // remove all debuffs
                m_challenger.FirstAttacker = null;
                m_rival.FirstAttacker      = null;
                m_challenger.Auras.RemoveWhere(aura => !aura.IsBeneficial && aura.CasterReference.EntityId == m_rival.EntityId);
                m_rival.Auras.RemoveWhere(aura => !aura.IsBeneficial && aura.CasterReference.EntityId == m_challenger.EntityId);
                if (m_rival.ComboTarget == m_challenger)
                {
                    m_rival.ResetComboPoints();
                }
                if (m_challenger.ComboTarget == m_rival)
                {
                    m_challenger.ResetComboPoints();
                }
            }

            Dispose();
        }
コード例 #2
0
 public static void SendWinner(DuelWin win, Unit winner, INamed loser)
 {
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_WINNER))
     {
         packet.Write((byte)win);
         packet.Write(winner.Name);
         packet.Write(loser.Name);
         winner.SendPacketToArea(packet, true, true, Locale.Any, new float?());
     }
 }
コード例 #3
0
ファイル: DuelHandler.cs プロジェクト: ray2006/WCell
		public static void SendWinner(DuelWin win, Unit winner, INamed loser)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_DUEL_WINNER))
			{
				packet.Write((byte)win);
				packet.Write(winner.Name);
				packet.Write(loser.Name);

				winner.SendPacketToArea(packet);
			}
		}
コード例 #4
0
        /// <summary>
        /// Ends the duel with the given win-condition and the given loser
        /// </summary>
        /// <param name="loser">The opponent that lost the match or null if its a draw</param>
        /// <remarks>Requires map context</remarks>
        public void Finish(DuelWin win, Character loser)
        {
            if (IsActive)
            {
                if (loser != null)
                {
                    int       num          = (int)loser.SpellCast.Start(SpellId.NotDisplayedGrovel, false);
                    Character duelOpponent = loser.DuelOpponent;
                    duelOpponent.Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.WinDuel, 1U, 0U,
                                                                              null);
                    loser.Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.LoseDuel, 1U, 0U,
                                                                       null);
                    DuelHandler.SendWinner(win, duelOpponent, loser);
                }

                m_challenger.FirstAttacker = null;
                m_rival.FirstAttacker      = null;
                m_challenger.Auras.RemoveWhere(aura =>
                {
                    if (!aura.IsBeneficial)
                    {
                        return(aura.CasterReference.EntityId == m_rival.EntityId);
                    }
                    return(false);
                });
                m_rival.Auras.RemoveWhere(aura =>
                {
                    if (!aura.IsBeneficial)
                    {
                        return(aura.CasterReference.EntityId == m_challenger.EntityId);
                    }
                    return(false);
                });
                if (m_rival.ComboTarget == m_challenger)
                {
                    m_rival.ResetComboPoints();
                }
                if (m_challenger.ComboTarget == m_rival)
                {
                    m_challenger.ResetComboPoints();
                }
            }

            Dispose();
        }
コード例 #5
0
ファイル: Duel.cs プロジェクト: KroneckerX/WCell
		/// <summary>
		/// Ends the duel with the given win-condition and the given loser
		/// </summary>
		/// <param name="loser">The opponent that lost the match or null if its a draw</param>
		/// <remarks>Requires map context</remarks>
		public void Finish(DuelWin win, Character loser)
		{
			if (IsActive)
			{
				if (loser != null)
				{
					// user casts stun on himself
					loser.SpellCast.Start(SpellId.NotDisplayedGrovel, false);
					var winner = loser.DuelOpponent;
					winner.Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.WinDuel, 1);
					loser.Achievements.CheckPossibleAchievementUpdates(AchievementCriteriaType.LoseDuel, 1);
					DuelHandler.SendWinner(win, winner, loser);
				}

				// remove all debuffs
				m_challenger.FirstAttacker = null;
				m_rival.FirstAttacker = null;
				m_challenger.Auras.RemoveWhere(aura => !aura.IsBeneficial && aura.CasterReference.EntityId == m_rival.EntityId);
				m_rival.Auras.RemoveWhere(aura => !aura.IsBeneficial && aura.CasterReference.EntityId == m_challenger.EntityId);
				if (m_rival.ComboTarget == m_challenger)
				{
					m_rival.ResetComboPoints();
				}
				if (m_challenger.ComboTarget == m_rival)
				{
					m_challenger.ResetComboPoints();
				}
			}

			Dispose();
		}