Пример #1
0
        public bool GenerateQuests()
        {
            configurationAdapter.LoadConfigs(_configRepository);
            var now           = DateTime.Now;
            var refreshResult = _refreshingMechnism.GetRefreshStatus(RefreshOption.Quests, now);

            if (refreshResult.Status == RefresStatus.Ready)
            {
                _questRepository.Clear(_accountManagement.GetLoggedAccount().ID);
                List <Quest> quests = new List <Quest>();
                for (int i = 1; i <= configurationAdapter.NumberOfQuests; i++)
                {
                    quests.Add(GenerateFightQuest(GetRandomLevel(configurationAdapter.QuestGenerateChances), i));
                }

                _questRepository.AddMany(quests, _accountManagement.GetLoggedAccount().ID);

                _refreshingMechnism.AddRefreshFactForLoggedAccount(RefreshOption.Quests, now);
                return(true);
            }
            else
            {
                return(false);
            }
        }