/// <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(); }
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?()); } }
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); } }
/// <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(); }