Example #1
0
        protected override Task <(bool Success, string Message)> CheckCustomPreconditionsAsync()
        {
            var guildResult = IsGameCommandAllowedInGuild();

            if (!guildResult.Success)
            {
                return(Task.FromResult(guildResult));
            }

            var acc = EntityConverter.ConvertUser(Context.User);

            var gauntletFromUser = _battleService.GetBattleEnvironment <EndlessBattleEnvironment>(b =>
                                                                                                  b.Name.Equals(Context.User.Username, StringComparison.CurrentCultureIgnoreCase));

            if (gauntletFromUser != null)
            {
                if (gauntletFromUser.IsActive)
                {
                    return(Task.FromResult((false, "What? You already are on an adventure!")));
                }
                _ = gauntletFromUser.Reset($"{gauntletFromUser.Name} overridden");
            }

            if (acc.LevelNumber < 50 && !acc.Tags.Contains("ColossoCompleted"))
            {
                return(Task.FromResult((false, "You are not yet ready to take on such endeavor. Come back when you are level 50 or aquired special permission from Lord Iodem.")));
            }

            if (FastTrack && !acc.Inv.HasBalance(Cost))
            {
                return(Task.FromResult((false, "You lack the funds to skip to stronger battles.")));
            }

            return(SuccessFullResult);
        }
Example #2
0
        protected override Task <(bool Success, string Message)> CheckCustomPreconditionsAsync()
        {
            var guildResult = IsGameCommandAllowedInGuild();

            if (!guildResult.Success)
            {
                return(Task.FromResult(guildResult));
            }

            var acc = EntityConverter.ConvertUser(Context.User);

            if (!TryGetDungeon(SelectedDungeonName, out _dungeon))
            {
                return(Task.FromResult((false, "I don't know where that place is.")));
            }

            if (!acc.Dungeons.Contains(_dungeon.Name) && !_dungeon.IsDefault)
            {
                return(Task.FromResult((false,
                                        "If you can't tell me where this place is, I can't take you there. And even if you knew, they probably wouldn't let you in! Bring me a map or show to me that you have the key to enter.")));
            }

            if (!_dungeon.Requirement.Applies(acc))
            {
                return(Task.FromResult((false,
                                        "I'm afraid that I can't take you to this place, it is too dangerous for you and me both.")));
            }

            var gauntletFromUser = _battleService.GetBattleEnvironment <GauntletBattleEnvironment>(b =>
                                                                                                   b.Name.Equals(Context.User.Username, StringComparison.CurrentCultureIgnoreCase));

            if (gauntletFromUser != null)
            {
                if (gauntletFromUser.IsActive)
                {
                    return(Task.FromResult((false, "What? You already are on an adventure!")));
                }
                _ = gauntletFromUser.Reset($"{gauntletFromUser.Name} overridden");
            }

            if (_dungeon.IsOneTimeOnly)
            {
                acc.Dungeons.Remove(_dungeon.Name);
                UserAccountProvider.StoreUser(acc);
            }

            return(SuccessFullResult);
        }
Example #3
0
        protected override Task <(bool Success, string Message)> CheckCustomPreconditionsAsync()
        {
            var guildResult = IsGameCommandAllowedInGuild();

            if (!guildResult.Success)
            {
                return(Task.FromResult(guildResult));
            }

            Scope         = ServiceProvider.CreateScope();
            BattleService = Scope.ServiceProvider.GetRequiredService <ColossoBattleService>();

            Battle = BattleService.GetBattleEnvironment(Context.Channel);
            if (Battle == null)
            {
                return(Task.FromResult((false, "Battle not found")));
            }

            return(Task.FromResult(guildResult));
        }