Aura.Channel.World.Entities.Creatures.CreatureQuests.Complete C# (CSharp) Метод

Complete() публичный Метод

Completes quest and takes rewards from group and the result based on the progress on the current or last objective. Primarily used by PTJs.
public Complete ( Aura.Channel.World.Quests.Quest quest, int rewardGroup, bool owl ) : bool
quest Aura.Channel.World.Quests.Quest
rewardGroup int Reward group to use.
owl bool Show owl delivering the quest?
Результат bool
		public bool Complete(Quest quest, int rewardGroup, bool owl)
		{
			if (!this.Has(quest))
				throw new ArgumentException("Quest not found in this manager.");

			var success = this.EndQuest(quest, rewardGroup, owl);
			if (success)
			{
				quest.State = QuestState.Complete;

				// Remove quest item after the state was set, so the item
				// is removed, but not the quest.
				_creature.Inventory.Remove(quest.QuestItem);

				// Remove collected items for Collect objectives at the end
				// of the objectives. This way all items that were to be
				// collected are removed automatically, unless the last
				// objectives are different, like Talk, in which case the
				// NPC should control what happens.
				// Starts at the last objective and goes back until the first
				// one or a non-Collect objective is reached.
				for (var i = quest.Data.Objectives.Count - 1; i >= 0; --i)
				{
					var progress = quest.GetProgress(i);
					var objective = quest.Data.Objectives[progress.Ident];

					var collectObjective = objective as QuestObjectiveCollect;
					if (collectObjective == null)
						break;

					_creature.Inventory.Remove(collectObjective.ItemId, Math.Min(collectObjective.Amount, progress.Count));
				}

				ChannelServer.Instance.Events.OnPlayerCompletesQuest(_creature, quest.Id);

				// Complete event
				quest.Data.OnComplete(_creature);
			}
			return success;
		}

Same methods

CreatureQuests::Complete ( Aura.Channel.World.Quests.Quest quest, bool owl ) : bool
CreatureQuests::Complete ( int questId, bool owl ) : bool