Core/Quests: Unify quest objective updating into one function and replace iterating entire quest log to find objective with direct {type, id} lookup

Port From (https://github.com/TrinityCore/TrinityCore/commit/6352a84bf78a7afe0ea8d8caccee33dd09e09694)
This commit is contained in:
hondacrx
2021-05-11 12:22:07 -04:00
parent 5cbd815f53
commit 5915e1a9a0
4 changed files with 251 additions and 515 deletions
+39
View File
@@ -810,6 +810,26 @@ namespace Game
public string Description;
public int[] VisualEffects = new int[0];
public bool IsStoringValue()
{
switch (Type)
{
case QuestObjectiveType.Monster:
case QuestObjectiveType.Item:
case QuestObjectiveType.GameObject:
case QuestObjectiveType.TalkTo:
case QuestObjectiveType.PlayerKills:
case QuestObjectiveType.WinPvpPetBattles:
case QuestObjectiveType.HaveCurrency:
case QuestObjectiveType.ObtainCurrency:
case QuestObjectiveType.IncreaseReputation:
return true;
default:
break;
}
return false;
}
public bool IsStoringFlag()
{
switch (Type)
@@ -826,5 +846,24 @@ namespace Game
}
return false;
}
public static bool CanAlwaysBeProgressedInRaid(QuestObjectiveType type)
{
switch (type)
{
case QuestObjectiveType.Item:
case QuestObjectiveType.Currency:
case QuestObjectiveType.LearnSpell:
case QuestObjectiveType.MinReputation:
case QuestObjectiveType.MaxReputation:
case QuestObjectiveType.Money:
case QuestObjectiveType.HaveCurrency:
case QuestObjectiveType.IncreaseReputation:
return true;
default:
break;
}
return false;
}
}
}