Exemplo n.º 1
0
        private void Init(uint contractId, Player player)
        {
            Init(contractId);

            if (player == null)
            {
                return;
            }

            // Started, Stamped, Timer or Progress
            CheckAndSetStage(player);

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagFinished))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagFinished))
                {
                    Stage = ContractStage.DoneOrPendingRepeat;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagRepeatTime))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagRepeatTime))
                {
                    TimeWhenRepeats = player.QuestManager.GetNextSolveTime(Contract.QuestflagRepeatTime).TotalSeconds;

                    if (TimeWhenRepeats > 0)
                    {
                        Stage = ContractStage.DoneOrPendingRepeat;
                    }
                    else
                    {
                        Stage = ContractStage.Available;

                        // Recheck for Started, Stamped, Timer or Progress and update accordingly
                        CheckAndSetStage(player);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CheckAndSetStage(Player player)
        {
            if (!string.IsNullOrWhiteSpace(Contract.QuestflagStarted))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagStarted))
                {
                    Stage = ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagStamped))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagStamped))
                {
                    Stage = ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagTimer))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagTimer))
                {
                    TimeWhenDone = player.QuestManager.GetNextSolveTime(Contract.QuestflagTimer).TotalSeconds;

                    Stage = ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagProgress))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagProgress))
                {
                    var quest    = player.QuestManager.GetQuest(Contract.QuestflagProgress);
                    var progress = quest.NumTimesCompleted;

                    Stage = progress > 0 ? ContractStage.ProgressCounter + progress : ContractStage.InProgress;
                }
            }
        }
Exemplo n.º 3
0
        private void Init(uint contractId, Player player)
        {
            Init(contractId);

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagStarted))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagStarted))
                {
                    Stage = ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagStamped))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagStamped))
                {
                    Stage = ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagTimer))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagTimer))
                {
                    TimeWhenDone = player.QuestManager.GetNextSolveTime(Contract.QuestflagTimer).TotalSeconds;

                    Stage = ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagProgress))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagProgress))
                {
                    var quest    = player.QuestManager.GetQuest(Contract.QuestflagProgress);
                    var progress = quest.NumTimesCompleted;

                    Stage = progress > 0 ? ContractStage.ProgressCounter + progress : ContractStage.InProgress;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagFinished))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagFinished))
                {
                    Stage = ContractStage.DoneOrPendingRepeat;
                }
            }

            if (!string.IsNullOrWhiteSpace(Contract.QuestflagRepeatTime))
            {
                if (player.QuestManager.HasQuest(Contract.QuestflagRepeatTime))
                {
                    TimeWhenRepeats = player.QuestManager.GetNextSolveTime(Contract.QuestflagRepeatTime).TotalSeconds;

                    if (TimeWhenRepeats > 0)
                    {
                        Stage = ContractStage.DoneOrPendingRepeat;
                    }
                    else
                    {
                        Stage = ContractStage.Available;
                    }
                }
            }
        }