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:
hondacrx
2020-05-06 17:52:14 -04:00
parent 4f6447cc0b
commit 43fcc558e4
8 changed files with 53 additions and 46 deletions
@@ -53,10 +53,10 @@ namespace Game.Entities
m_achievementSys.RemoveCriteriaTimer(type, entry);
}
public void ResetCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, bool evenIfCriteriaComplete = false)
public void ResetCriteria(CriteriaCondition condition, uint failAsset, bool evenIfCriteriaComplete = false)
{
m_achievementSys.ResetCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete);
m_questObjectiveCriteriaMgr.ResetCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete);
m_achievementSys.ResetCriteria(condition, failAsset, evenIfCriteriaComplete);
m_questObjectiveCriteriaMgr.ResetCriteria(condition, failAsset, evenIfCriteriaComplete);
}
public void UpdateCriteria(CriteriaTypes type, ulong miscValue1 = 0, ulong miscValue2 = 0, ulong miscValue3 = 0, Unit unit = null)
+3 -3
View File
@@ -774,9 +774,9 @@ namespace Game.Entities
UpdateCriteria(CriteriaTypes.DeathAtMap, 1);
UpdateCriteria(CriteriaTypes.Death, 1);
UpdateCriteria(CriteriaTypes.DeathInDungeon, 1);
ResetCriteria(CriteriaTypes.BgObjectiveCapture, (uint)CriteriaCondition.NoDeath);
ResetCriteria(CriteriaTypes.HonorableKill, (uint)CriteriaCondition.NoDeath);
ResetCriteria(CriteriaTypes.GetKillingBlows, (uint)CriteriaCondition.NoDeath);
// reset all death criterias
ResetCriteria(CriteriaCondition.NoDeath, 0);
}
base.SetDeathState(s);