Пример #1
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);
        }
Пример #2
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);
        }
Пример #3
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();
            }
        }
Пример #4
0
        public override GoalType GetGoalType(IValueObject goalVO)
        {
            EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress();

            if (currentEpisodeTaskProgress != null)
            {
                EpisodeTaskActionVO episodeTaskActionVO = Service.StaticDataController.Get <EpisodeTaskActionVO>(currentEpisodeTaskProgress.actionUID);
                return(StringUtils.ParseEnum <GoalType>(episodeTaskActionVO.Type));
            }
            return(GoalType.Invalid);
        }
Пример #5
0
        public override string GetGoalItem(IValueObject goalVO)
        {
            EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress();

            if (currentEpisodeTaskProgress != null)
            {
                EpisodeTaskActionVO episodeTaskActionVO = Service.StaticDataController.Get <EpisodeTaskActionVO>(currentEpisodeTaskProgress.actionUID);
                return(episodeTaskActionVO.Item);
            }
            return(null);
        }
Пример #6
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();
                }
            }
        }
Пример #7
0
        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);
            }
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
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);
        }
Пример #12
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);
        }
Пример #13
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);
        }
Пример #14
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);
        }
Пример #15
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);
        }