/// <summary> /// This method is called by the BaseQuest whenever a event associated with the Quest accurs /// or a automatically added eventhandler for the trigers fires /// </summary> /// <param name="e">DolEvent of notify call</param> /// <param name="sender">Sender of notify call</param> /// <param name="args">EventArgs of notify call</param> public override void Notify(DOLEvent e, object sender, EventArgs args) { GamePlayer player = BehaviourUtils.GuessGamePlayerFromNotify(e, sender, args); if (player == null) { //if (Log.IsDebugEnabled) // Log.Debug("Couldn't guess player for EventArgs " + args + ". Triggers with this eventargs type won't work within quests."); return; } AbstractQuest quest = player.IsDoingQuest(QuestType); int executions = 0; if (quest != null && quest.GetCustomProperty(this.ID + "_" + NUMBER_OF_EXECUTIONS) != null) { executions = Convert.ToInt32(quest.GetCustomProperty(ID + "_" + NUMBER_OF_EXECUTIONS)); } if (MaxNumberOfExecutions < 0 || executions < this.MaxNumberOfExecutions) { if (CheckTriggers(e, sender, args) && CheckRequirements(e, sender, args) && Actions != null) { foreach (IBehaviourAction action in Actions) { action.Perform(e, sender, args); } if (quest != null) { quest.SetCustomProperty(this.ID + "_" + NUMBER_OF_EXECUTIONS, Convert.ToString(executions + 1)); } } } }