protected override void FillProcessorMap() { if (this.processorMap.Count > 0) { Service.Logger.Error("Attempting to fill an already-full processorMap!"); } CurrentPlayer currentPlayer = Service.CurrentPlayer; string planetId = currentPlayer.PlanetId; if (currentPlayer.Objectives.ContainsKey(planetId)) { ObjectiveGroup objectiveGroup = currentPlayer.Objectives[planetId]; int i = 0; int count = objectiveGroup.ProgressObjects.Count; while (i < count) { ObjectiveProgress objectiveProgress = objectiveGroup.ProgressObjects[i]; if (objectiveProgress.State == ObjectiveState.Active) { BaseGoalProcessor processor = GoalFactory.GetProcessor(objectiveProgress.VO, this); this.processorMap.Add(processor, objectiveProgress); } i++; } } }
public override void Progress(BaseGoalProcessor processor, int amount, object cookie) { if (Service.PlanetRelocationController.IsRelocationInProgress()) { return; } if (!this.processorMap.ContainsKey(processor)) { return; } EventManager eventManager = Service.EventManager; ObjectiveProgress objectiveProgress = this.processorMap[processor]; objectiveProgress.Count = Math.Min(objectiveProgress.Count + amount, objectiveProgress.Target); if (objectiveProgress.Count >= objectiveProgress.Target) { objectiveProgress.State = ObjectiveState.Complete; eventManager.SendEvent(EventId.UpdateObjectiveToastData, objectiveProgress); int objectiveProgressIndex = this.GetObjectiveProgressIndex(objectiveProgress.ObjectiveUid); eventManager.SendEvent(EventId.ObjectiveCompleted, objectiveProgressIndex); this.processorMap.Remove(processor); processor.Destroy(); } eventManager.SendEvent(EventId.ObjectivesUpdated, objectiveProgress); }
public override void Progress(BaseGoalProcessor processor, int amount, object cookie) { if (cookie == null) { CurrentPlayer currentPlayer = Service.CurrentPlayer; EpisodeProgressInfo episodeProgressInfo = currentPlayer.EpisodeProgressInfo; EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask; EpisodeProgressData episodeProgressData = new EpisodeProgressData(episodeProgressInfo.uid, currentTask.uid, amount, currentTask.count, EventId.EpisodeComplexTask, 1); cookie = episodeProgressData; } Service.EventManager.SendEvent(EventId.EpisodeProgressMade, cookie); if (Service.PlanetRelocationController.IsRelocationInProgress()) { return; } if (!this.processorMap.ContainsKey(processor)) { return; } EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress(); if (currentEpisodeTaskProgress != null && processor.GetGoalUid() == currentEpisodeTaskProgress.uid) { currentEpisodeTaskProgress.count = Math.Min(currentEpisodeTaskProgress.count + amount, currentEpisodeTaskProgress.target); if (currentEpisodeTaskProgress.count == currentEpisodeTaskProgress.target && currentEpisodeTaskProgress.type != "EpisodePoint") { currentEpisodeTaskProgress.completed = true; } } if (currentEpisodeTaskProgress == null || currentEpisodeTaskProgress.count >= currentEpisodeTaskProgress.target || processor.GetGoalUid() != currentEpisodeTaskProgress.uid) { this.processorMap.Remove(processor); processor.Destroy(); } }
protected override void FillProcessorMap() { if (this.processorMap.Count > 0) { Service.Logger.Error("Attempting to fill an already-full processorMap!"); } EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress(); if (currentEpisodeTaskProgress != null) { EpisodeTaskVO vo = Service.StaticDataController.Get <EpisodeTaskVO>(currentEpisodeTaskProgress.uid); BaseGoalProcessor processor = GoalFactory.GetProcessor(vo, this); this.processorMap.Add(processor, currentEpisodeTaskProgress); } }
public virtual void Progress(BaseGoalProcessor processor, int amount, object cookie) { }
public void Progress(BaseGoalProcessor processor, int amount) { this.Progress(processor, amount, null); }