private void OnCreatureGathered(CollectEventArgs args)
{
var creature = args.Creature;
var quests = creature.Quests.GetAllIncomplete(this.Id);
foreach (var quest in quests)
{
if (!this.CanMakeProgress(creature, quest))
continue;
var progress = quest.CurrentObjectiveOrLast;
if (progress == null) return;
var objective = this.Objectives[progress.Ident];
if (objective == null || objective.Type != ObjectiveType.Gather) return;
var gatherObjective = (objective as QuestObjectiveGather);
if (!progress.Done && args.Success && args.ItemId == gatherObjective.ItemId)
{
progress.Count++;
if (progress.Count == gatherObjective.Amount)
quest.SetDone(progress.Ident);
UpdateQuest(creature, quest);
}
}
}