Core/Quests: Allow quest objective items with effect type other than "On Looted" to be put in inventory even when QUEST_OBJECTIVE_FLAG_2_QUEST_BOUND_ITEM is set

Port From (https://github.com/TrinityCore/TrinityCore/commit/79347f72db13600a0cc326d9a61c4cf0396777d0)
This commit is contained in:
Hondacrx
2025-08-19 18:50:20 -04:00
parent 093311c394
commit 2e0d590901
+19 -4
View File
@@ -2483,10 +2483,25 @@ namespace Game.Entities
List<QuestObjective> updatedObjectives = new();
Func<QuestObjective, bool> objectiveFilter = null;
if (boundItemFlagRequirement.HasValue)
objectiveFilter = boundItemFlagRequirement.Value ? QuestBoundItemFunc : NotQuestBoundItemFunc;
ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(entry);
if (boundItemFlagRequirement.HasValue)
{
bool ignoresQuestBoundItemFlag = itemTemplate.Effects.Any(itemEffect =>
{
return itemEffect.TriggerType != ItemSpelltriggerType.OnLooted && itemEffect.TriggerType != ItemSpelltriggerType.OnLootedForced;
});
if (boundItemFlagRequirement.HasValue)
{
if (ignoresQuestBoundItemFlag)
return;
objectiveFilter = QuestBoundItemFunc;
}
else if (!ignoresQuestBoundItemFlag)
objectiveFilter = NotQuestBoundItemFunc;
}
UpdateQuestObjectiveProgress(QuestObjectiveType.Item, (int)itemTemplate.GetId(), count, ObjectGuid.Empty, updatedObjectives, objectiveFilter);
if (itemTemplate.QuestLogItemId != 0 && (updatedObjectives.Count != 1 || !updatedObjectives[0].Flags2.HasFlag(QuestObjectiveFlags2.QuestBoundItem)))
UpdateQuestObjectiveProgress(QuestObjectiveType.Item, itemTemplate.QuestLogItemId, count, ObjectGuid.Empty, updatedObjectives, objectiveFilter);
@@ -2498,7 +2513,7 @@ namespace Game.Entities
if (quest != null && quest.SourceItemId == entry)
return;
hadBoundItemObjective = updatedObjectives.Count == 1 && updatedObjectives[0].Flags2.HasFlag(QuestObjectiveFlags2.QuestBoundItem);
hadBoundItemObjective = true;
SendQuestUpdateAddItem(itemTemplate, updatedObjectives[0], (ushort)count);
}