/// <summary> /// Sets the current kill count for the <paramref name="target"/>. /// </summary> /// <param name="target">The target to set the kill count for.</param> /// <param name="count">The new kill count value. If greater than the required number of kills, /// the required number of kills will be used instead.</param> /// <returns>True if the value was successfully set; otherwise false.</returns> public bool SetCount(TKillID target, ushort count) { foreach (var counter in _killCounters) { if (_killIDEqualityComparer.Equals(counter.KillID, target)) { counter.KillCount = Math.Min(count, counter.RequiredKills); return(true); } } return(false); }
/// <summary> /// Increments the kill count of the <paramref name="target"/>. /// </summary> /// <param name="target">The ID of the target to increment the kill count of.</param> /// <param name="count">When this method returns true, contains the current kill count for /// the <paramref name="target"/>.</param> /// <param name="reqCount">When this method returns true, contains the required kill count for /// the <paramref name="target"/>.</param> /// <returns> /// True if the count was incremented; false if the <paramref name="target"/> is not required /// by this quest or the required kill count has been reached. /// </returns> public bool Increment(TKillID target, out ushort count, out ushort reqCount) { foreach (var counter in _killCounters) { if (_killIDEqualityComparer.Equals(counter.KillID, target)) { if (counter.KillCount < counter.RequiredKills) { counter.KillCount++; count = counter.KillCount; reqCount = counter.RequiredKills; return(true); } break; } } count = 0; reqCount = 0; return(false); }
/// <summary> /// Initializes this object. /// </summary> /// <param name="killID">The ID of the character to kill.</param> /// <param name="requiredKills">The required number of kills to complete the quest.</param> public void Initialize(TKillID killID, ushort requiredKills) { _killID = killID; _requiredKills = requiredKills; _killCount = 0; }