Core/Achievements: Optimized resetting achievement criteria by condition and changed the functionality to properly reset all possible criteria with given condition
Port From (https://github.com/TrinityCore/TrinityCore/commit/6f7ff9a3efd10cd4f776a67540109e7bb774f1c5)
This commit is contained in:
@@ -163,20 +163,17 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetCriteria(CriteriaTypes type, ulong miscValue1, ulong miscValue2, bool evenIfCriteriaComplete)
|
||||
public void ResetCriteria(CriteriaCondition condition, uint failAsset, bool evenIfCriteriaComplete)
|
||||
{
|
||||
Log.outDebug(LogFilter.Player, "QuestObjectiveCriteriaMgr.ResetCriteria({type}, {miscValue1}, {miscValue2})");
|
||||
Log.outDebug(LogFilter.Player, $"QuestObjectiveCriteriaMgr.ResetCriteria({condition}, {failAsset}, {evenIfCriteriaComplete})");
|
||||
|
||||
// disable for gamemasters with GM-mode enabled
|
||||
if (_owner.IsGameMaster())
|
||||
return;
|
||||
|
||||
var playerCriteriaList = GetCriteriaByType(type);
|
||||
var playerCriteriaList = Global.CriteriaMgr.GetCriteriaByFailEvent(condition, (int)failAsset);
|
||||
foreach (Criteria playerCriteria in playerCriteriaList)
|
||||
{
|
||||
if (playerCriteria.Entry.FailEvent != miscValue1 || (playerCriteria.Entry.FailAsset != 0 && playerCriteria.Entry.FailAsset != miscValue2))
|
||||
continue;
|
||||
|
||||
var trees = Global.CriteriaMgr.GetCriteriaTreesByCriteria(playerCriteria.Id);
|
||||
bool allComplete = true;
|
||||
foreach (CriteriaTree tree in trees)
|
||||
|
||||
Reference in New Issue
Block a user