public void OnActiveTaskCompletedStateChanged(ServerPlayerActiveTask activeTask) { var isCompleted = activeTask.PlayerTaskState.IsCompleted; for (var index = 0; index < this.serverActiveTasks.Count; index++) { var entry = this.serverActiveTasks[index]; if (entry != activeTask) { continue; } // found entry if (isCompleted && !activeTask.PlayerTask.IsReversible) { // remove this active task entry as it's completed and cannot be reversed activeTask.IsActive = false; this.serverActiveTasks.RemoveAt(index); } this.ServerRefreshAllTasksCompleted(activeTask.Character); return; } Api.Logger.Error("Unknown task completed: " + activeTask); }
public void OnActiveTaskCompletedStateChanged(ServerPlayerActiveTask activeTask) { var quest = (IProtoQuest)activeTask.PlayerTask.TaskTarget; var questEntry = this.SharedFindQuestEntry(quest, out _); questEntry.OnActiveTaskCompletedStateChanged(activeTask); }
public void ServerCreateActiveTasks( ICharacter character, IPlayerActiveTasksHolder activeTasksHolder) { this.ServerResetActiveTasks(); if (this.IsCompleted) { // the quest is completed - no active tasks required in that case return; } var tasks = this.Quest.Tasks; this.serverActiveTasks = new List <ServerPlayerActiveTask>(tasks.Count); // refresh the task states for (byte index = 0; index < tasks.Count; index++) { var task = tasks[index]; var taskState = this.TaskStates[index]; task.ServerRefreshIsCompleted(character, taskState); if (taskState.IsCompleted && !task.IsReversible) { continue; } // create active task entry var questTask = new ServerPlayerActiveTask(task, taskState, activeTasksHolder, character); this.serverActiveTasks.Add(questTask); questTask.IsActive = true; } this.ServerRefreshAllTasksCompleted(character); }