Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        public bool GenerateMercenaries()
        {
            configurationAdapter.LoadConfigs(_configRepository);
            var now = DateTime.Now;

            if (_refreshingMechnism.GetRefreshStatus(RefreshOption.Mercenaries, now).Status == RefresStatus.Ready)
            {
                _recruitsRepository.Clear(_accountManagement.GetLoggedAccount().ID);
                AddRandomMercenaries(configurationAdapter.NumberOfRecruits);
                _refreshingMechnism.AddRefreshFactForLoggedAccount(RefreshOption.Mercenaries, now);
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        private void UpdateRefresh()
        {
            var now    = DateTime.Now;
            var result = _refreshingMechnism.GetRefreshStatus(RefreshOption.Mercenaries, now);

            btRefresh.Enabled = result.Status == RefresStatus.Ready;
            var lastRefreshTime = _refreshingMechnism.GetLastRefresh(RefreshOption.Mercenaries);

            if (result.Status == RefresStatus.Ready)
            {
                btRefresh.Text       = "Refresh";
                refreshTimer.Enabled = false;
            }
            else
            {
                btRefresh.Text       = DateTime.MinValue.AddSeconds(result.SecondsLeft).ToLongTimeString();
                refreshTimer.Enabled = true;
            }
        }