Exemple #1
0
        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();
            }
        }
Exemple #2
0
        public void CompleteTaskProgress()
        {
            bool flag = false;

            if (!this.IsEpisodeActive())
            {
                flag = true;
            }
            CurrentPlayer           currentPlayer       = Service.CurrentPlayer;
            EpisodeProgressInfo     episodeProgressInfo = currentPlayer.EpisodeProgressInfo;
            EpisodeTaskProgressInfo currentTask         = episodeProgressInfo.currentTask;

            if (currentTask.count < currentTask.target)
            {
                Service.Logger.ErrorFormat("Trying to complete a task. actiondUID:{0} target progress:{1} != count:{2} ", new object[]
                {
                    currentTask.actionUID,
                    currentTask.target,
                    currentTask.count
                });
                flag = true;
            }
            if (flag)
            {
                Service.EventManager.SendEvent(EventId.EpisodeTaskProgressCompleteFailed, null);
                return;
            }
            PlayerIdChecksumRequest            request = new PlayerIdChecksumRequest();
            EpisodeTaskProgressCompleteCommand episodeTaskProgressCompleteCommand = new EpisodeTaskProgressCompleteCommand(request);

            episodeTaskProgressCompleteCommand.AddSuccessCallback(new AbstractCommand <PlayerIdChecksumRequest, EpisodeTaskProgressCompleteResponse> .OnSuccessCallback(this.OnCompleteTaskProgressSuccess));
            episodeTaskProgressCompleteCommand.AddFailureCallback(new AbstractCommand <PlayerIdChecksumRequest, EpisodeTaskProgressCompleteResponse> .OnFailureCallback(this.OnCompleteTaskProgressFailure));
            Service.ServerAPI.Sync(episodeTaskProgressCompleteCommand);
        }
Exemple #3
0
        private string GetTaskCrateIcon()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeProgressInfo  episodeProgressInfo  = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: No episode progress found", new object[0]);
                return("episode_hudicon_crate_ready_bronzium");
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            if (currentTask == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: No current task found", new object[0]);
                return("episode_hudicon_crate_ready_bronzium");
            }
            EpisodeTaskVO optional = staticDataController.GetOptional <EpisodeTaskVO>(currentTask.uid);

            if (optional == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: Missing task data for {0}", new object[]
                {
                    currentTask.uid
                });
                return("episode_hudicon_crate_ready_bronzium");
            }
            if (string.IsNullOrEmpty(optional.CrateIconAsset))
            {
                return("episode_hudicon_crate_ready_bronzium");
            }
            return(optional.CrateIconAsset);
        }
Exemple #4
0
        public bool PlayMostRecentStoryAction()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeProgressInfo  episodeProgressInfo  = Service.CurrentPlayer.EpisodeProgressInfo;
            EpisodeDataVO        episodeDataVO        = staticDataController.Get <EpisodeDataVO>(episodeProgressInfo.uid);
            string text = string.Empty;

            if (episodeProgressInfo.grindInfo.Started > 0)
            {
                text = staticDataController.Get <EpisodeTaskVO>(episodeDataVO.GrindTask).StoryID;
            }
            if (string.IsNullOrEmpty(text))
            {
                int num = Math.Min(episodeProgressInfo.currentTaskIndex, episodeDataVO.Tasks.Length - 1);
                for (int i = num; i >= 0; i--)
                {
                    EpisodeTaskVO optional = staticDataController.GetOptional <EpisodeTaskVO>(episodeDataVO.Tasks[i]);
                    if (optional != null && !string.IsNullOrEmpty(optional.StoryID))
                    {
                        text = optional.StoryID;
                        break;
                    }
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                Service.Logger.Error("EpisodeInfoScreen: Could not determine most recent story ID");
            }
            return(this.PlayTaskStoryAction(text));
        }
Exemple #5
0
        private void ShowProgress(EpisodeProgressData progressData, bool showReward)
        {
            EpisodeProgressInfo     episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;
            EpisodeTaskProgressInfo currentTask         = episodeProgressInfo.currentTask;

            if (progressData != null && progressData.progress > 0 && progressData.episodeUid == episodeProgressInfo.uid && progressData.taskUid == currentTask.uid)
            {
                if (progressData.progressType != EventId.EpisodeComplexTask)
                {
                    this.progressQueue.Enqueue(progressData);
                }
                else
                {
                    EpisodeProgressData episodeProgressData = null;
                    foreach (EpisodeProgressData current in this.progressQueue)
                    {
                        if (current.taskUid == progressData.taskUid)
                        {
                            episodeProgressData = current;
                            break;
                        }
                    }
                    if (episodeProgressData != null)
                    {
                        episodeProgressData.progress += progressData.progress;
                    }
                    else
                    {
                        this.progressQueue.Enqueue(progressData);
                    }
                }
            }
            if (this.widget != null)
            {
                if (this.progressQueue.Count > 0)
                {
                    bool flag = this.widget.ShowProgress(this.progressQueue.Peek());
                    if (flag)
                    {
                        this.progressQueue.Dequeue();
                    }
                }
                else if (showReward)
                {
                    Service.EpisodeController.ForceRefreshState();
                    this.widget.HideProgress();
                    this.widget.ShowCTA();
                }
                else
                {
                    this.widget.HideProgress();
                }
            }
        }
Exemple #6
0
        public bool IsEpisodeComplete()
        {
            if (this.CurrentEpisodeData == null)
            {
                return(false);
            }
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;
            bool flag  = episodeProgressInfo.currentTaskIndex >= this.CurrentEpisodeData.Tasks.Length - 1;
            bool flag2 = episodeProgressInfo.currentTask == null;

            return(flag && flag2);
        }
Exemple #7
0
        public bool IsTaskTimeGateComplete()
        {
            if (!this.IsCurrentTaskTimeGated())
            {
                return(false);
            }
            if (!this.IsTaskTimeGateActive())
            {
                return(false);
            }
            EpisodeProgressInfo     episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;
            EpisodeTaskProgressInfo currentTask         = episodeProgressInfo.currentTask;

            return(currentTask.endTimestamp <= ServerTime.Time);
        }
Exemple #8
0
        public bool IsCurrentTaskProgressMarkedComplete()
        {
            if (this.CurrentEpisodeData == null)
            {
                return(false);
            }
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                return(false);
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            return(currentTask != null && currentTask.count >= currentTask.target && currentTask.completed);
        }
Exemple #9
0
        public void MarkEpisodePanelOpened()
        {
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo.introStoryViewed)
            {
                return;
            }
            episodeProgressInfo.introStoryViewed = true;
            EpisodeTaskIntroViewedCommand command = new EpisodeTaskIntroViewedCommand(new PlayerIdRequest
            {
                PlayerId = Service.CurrentPlayer.PlayerId
            });

            Service.ServerAPI.Sync(command);
            Service.EpisodeWidgetViewController.RefreshCTAState();
        }
Exemple #10
0
        public bool PlayIntroStoryAction()
        {
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo.uid == null || episodeProgressInfo.currentTaskIndex != 0 || episodeProgressInfo.introStoryViewed)
            {
                return(false);
            }
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeDataVO        episodeDataVO        = staticDataController.Get <EpisodeDataVO>(episodeProgressInfo.uid);
            bool flag = this.PlayStoryActionForTaskUid(episodeDataVO.Tasks[0]);

            if (flag)
            {
                Service.EpisodeWidgetViewController.ResetWidget();
                this.MarkEpisodePanelOpened();
            }
            return(flag);
        }
Exemple #11
0
        public uint GetTaskTimeGateEndTime()
        {
            if (this.CurrentEpisodeData == null)
            {
                return(0u);
            }
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                return(0u);
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            if (currentTask == null)
            {
                return(0u);
            }
            return(currentTask.endTimestamp);
        }
Exemple #12
0
        public EpisodeTaskProgressInfo GetCurrentEpisodeTaskProgress()
        {
            CurrentPlayer       currentPlayer       = Service.CurrentPlayer;
            EpisodeProgressInfo episodeProgressInfo = currentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                return(null);
            }
            if (string.IsNullOrEmpty(episodeProgressInfo.uid))
            {
                return(null);
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            if (currentTask == null)
            {
                return(null);
            }
            return(currentTask);
        }
Exemple #13
0
        public bool ShowProgress(EpisodeProgressData progressData)
        {
            Animator component = this.widgetBtn.Root.GetComponent <Animator>();

            if (!this.widgetBtn.Visible || !component.isActiveAndEnabled)
            {
                return(false);
            }
            if (this.lastState != "Show")
            {
                return(false);
            }
            if (Service.WorldTransitioner.IsTransitioning())
            {
                return(false);
            }
            EpisodeProgressInfo     episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;
            EpisodeTaskProgressInfo currentTask         = episodeProgressInfo.currentTask;

            if (progressData == null || progressData.progress <= 0 || progressData.episodeUid != episodeProgressInfo.uid || progressData.taskUid != currentTask.uid)
            {
                return(false);
            }
            if (this.hideProgressTimerId != 0u || this.hideProgressCompleteTimerId != 0u)
            {
                return(false);
            }
            if (!this.UpdateTaskProgressUI(progressData))
            {
                return(false);
            }
            if (!this.progressEarnedToast.Visible)
            {
                this.ResetAllAnims();
                this.AnimSetTrigger(component, "ShowProgress");
                this.progressEarnedToast.Visible = true;
            }
            return(true);
        }
Exemple #14
0
        public int GetCurrentTaskTimeGate()
        {
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                return(0);
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            if (currentTask == null)
            {
                return(0);
            }
            EpisodeTaskVO optional = Service.StaticDataController.GetOptional <EpisodeTaskVO>(currentTask.uid);

            if (optional == null)
            {
                return(0);
            }
            return(optional.TimeGate);
        }
Exemple #15
0
        private void RefreshEpisodeData()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeProgressInfo  episodeProgressInfo  = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                this.CurrentEpisodeData = null;
                return;
            }
            string uid = episodeProgressInfo.uid;

            if (string.IsNullOrEmpty(uid))
            {
                Service.EventManager.RegisterObserver(this, EventId.FueCompleted);
                this.CurrentEpisodeData = null;
            }
            else if (this.CurrentEpisodeData == null || (this.CurrentEpisodeData != null && this.CurrentEpisodeData.Uid != uid))
            {
                EpisodeDataVO optional = staticDataController.GetOptional <EpisodeDataVO>(uid);
                if (optional != null)
                {
                    this.CurrentEpisodeData = staticDataController.GetOptional <EpisodeDataVO>(uid);
                }
            }
            if (this.CurrentEpisodeData != null)
            {
                Service.Logger.Debug(string.Concat(new string[]
                {
                    "Current Episode: ",
                    this.CurrentEpisodeData.Uid,
                    " is active: ",
                    this.CurrentEpisodeData.StartTime.ToString(),
                    " ---> ",
                    this.CurrentEpisodeData.EndTime.ToString()
                }));
            }
        }
Exemple #16
0
        private bool UpdateTaskProgressUI(EpisodeProgressData progressData)
        {
            if (progressData == null)
            {
                Service.Logger.Error("EpisodeWidgetView: no progress data given to show");
                return(false);
            }
            string  arg          = string.Empty;
            EventId progressType = progressData.progressType;

            if (progressType != EventId.PvpBattleWon)
            {
                if (progressType != EventId.TournamentTierReached)
                {
                    if (progressType != EventId.RaidComplete)
                    {
                        if (progressType != EventId.ObjectiveCompleted)
                        {
                            if (progressType != EventId.EpisodeComplexTask)
                            {
                                Service.Logger.ErrorFormat("Unknown event type {0} when displaying episode points", new object[]
                                {
                                    progressData.progressType
                                });
                                return(false);
                            }
                            arg = "epw_event_points_generic_";
                        }
                        else
                        {
                            arg = "epw_event_point_obje_";
                        }
                    }
                    else
                    {
                        arg = "epw_event_point_raid_";
                    }
                }
                else
                {
                    arg = "epw_event_point_conf_";
                }
            }
            else
            {
                arg = "epw_event_point_pvp_";
            }
            this.progressLabel.Text = this.lang.Get(arg + progressData.progressIndex, new object[]
            {
                progressData.progress
            });
            EpisodeProgressInfo     episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;
            EpisodeTaskProgressInfo currentTask         = episodeProgressInfo.currentTask;
            int target = currentTask.target;

            this.animatingProgress = new HUDResourceView("episodeProgress", this.progressSlider, null, null);
            this.animatingProgress.SetAmount(progressData.prevProgress, target, false);
            float delay = 0f;

            if (!this.progressEarnedToast.Visible)
            {
                this.progressSliderGoal.Value = (float)progressData.prevProgress / (float)target;
                delay = 1.5f;
            }
            KeyValuePair <int, int> keyValuePair = new KeyValuePair <int, int>(progressData.prevProgress + progressData.progress, target);

            this.animateProgressTimerId = Service.ViewTimerManager.CreateViewTimer(delay, false, new TimerDelegate(this.AnimateProgressStartCallback), keyValuePair);
            return(true);
        }
Exemple #17
0
        public bool IsNewEpisode()
        {
            EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo;

            return(!episodeProgressInfo.introStoryViewed);
        }
Exemple #18
0
        private void RewardEpisodePointsForEvent(EventId id, int pointIndex)
        {
            if (pointIndex <= 0)
            {
                return;
            }
            EpisodeTaskManager      episodeTaskManager         = Service.EpisodeTaskManager;
            EpisodeTaskProgressInfo currentEpisodeTaskProgress = episodeTaskManager.GetCurrentEpisodeTaskProgress();

            if (currentEpisodeTaskProgress == null || currentEpisodeTaskProgress.type != "EpisodePoint")
            {
                return;
            }
            EpisodePointScaleVO currentEpisodePointScaleVO = Service.EpisodeController.GetCurrentEpisodePointScaleVO();

            if (currentEpisodePointScaleVO == null)
            {
                return;
            }
            int[] array = null;
            if (id != EventId.PvpBattleWon)
            {
                if (id != EventId.TournamentTierReached)
                {
                    if (id != EventId.RaidComplete)
                    {
                        if (id != EventId.ObjectiveCompleted)
                        {
                            Service.Logger.ErrorFormat("Unknown event type {0} when awarding episode points", new object[]
                            {
                                id
                            });
                        }
                        else
                        {
                            array = currentEpisodePointScaleVO.Objective;
                        }
                    }
                    else
                    {
                        array = currentEpisodePointScaleVO.Raid;
                    }
                }
                else
                {
                    array = currentEpisodePointScaleVO.Conflict;
                }
            }
            else
            {
                array = currentEpisodePointScaleVO.PvP;
            }
            if (array == null)
            {
                return;
            }
            int                 num                 = Math.Min(pointIndex, array.Length) - 1;
            int                 num2                = array[num];
            CurrentPlayer       currentPlayer       = Service.CurrentPlayer;
            EpisodeProgressInfo episodeProgressInfo = currentPlayer.EpisodeProgressInfo;
            EpisodeProgressData cookie              = new EpisodeProgressData(episodeProgressInfo.uid, currentEpisodeTaskProgress.uid, num2, episodeProgressInfo.currentTask.count, id, pointIndex);

            this.parent.Progress(this, num2, cookie);
        }