示例#1
0
文件: Edges.cs 项目: Damitrix/Sabrina
        public async Task DisplayEdges(CommandContext ctx)
        {
            var user = await UserExtension.GetUser(Convert.ToInt64(Convert.ToInt64(ctx.Message.Author.Id)));

            await ctx.RespondAsync(
                $"Your Edge Balance is {user.WalletEdges} edges.");
        }
示例#2
0
        /// <summary>
        /// Call when client Message is created. Logs all Messages to Database.
        /// </summary>
        /// <param name="e">The Message Event Args.</param>
        /// <returns>A <see cref="Task"/>.</returns>
        private async Task ClientMessageCreated(MessageCreateEventArgs e)
        {
            var context = new DiscordContext();

            if (context.Messages.Any(msg => msg.MessageId == Convert.ToInt64(e.Message.Id)))
            {
                return;
            }

            var user = await UserExtension.GetUser(e.Message.Author.Id, context);

            var cMsg = new Messages()
            {
                AuthorId     = Convert.ToInt64(user.UserId),
                MessageText  = e.Message.Content,
                ChannelId    = Convert.ToInt64(e.Message.Channel.Id),
                CreationDate = e.Message.CreationTimestamp.DateTime,
                MessageId    = Convert.ToInt64(e.Message.Id)
            };

            try
            {
                user = await UserExtension.GetUser(e.Message.Author.Id, context);

                await _context.Messages.AddAsync(cMsg);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error trying to enter Message into Database");
                Console.WriteLine(ex.Message);
            }
        }
示例#3
0
文件: Game.cs 项目: Damitrix/Sabrina
        public BlackJackGame(int betEdges, CommandContext ctx)
        {
            _context  = new DiscordContext();
            this.user = UserExtension.GetUser(ctx.Message.Author.Id).GetAwaiter().GetResult();
            this.ctx  = ctx;

            // 2 Decks
            for (var i = 0; i < 2; i++)
            {
                // Iterate through each Card Variant
                foreach (Card.CardVariation variation in Enum.GetValues(typeof(Card.CardVariation)))
                {
                    foreach (Card.CardValue cardValue in Enum.GetValues(typeof(Card.CardValue)))
                    {
                        this.Deck.Add(new Card {
                            Variation = variation, Value = cardValue
                        });
                    }
                }
            }

            this.BetEdges = betEdges;
            for (var i = 0; i < 2; i++)
            {
                this.DrawCardHouse();
                this.DrawCardPlayer();
            }
        }
示例#4
0
文件: Edges.cs 项目: Damitrix/Sabrina
        public async Task AssignEdgesToAsync(CommandContext ctx, DiscordUser dcUser, int edges)
        {
            var user = await UserExtension.GetUser(Convert.ToInt64(Convert.ToInt64(ctx.Message.Author.Id)));

            user.WalletEdges += edges;

            await _context.SaveChangesAsync();

            await ctx.RespondAsync(
                $"I've assigned {dcUser.Username} {edges} edges. Their balance is now {user.WalletEdges} edges.");
        }
示例#5
0
文件: Edges.cs 项目: Damitrix/Sabrina
        public async Task HasEdgedAsync(CommandContext ctx)
        {
            var user = await UserExtension.GetUser(Convert.ToInt64(Convert.ToInt64(ctx.Message.Author.Id)));

            user.WalletEdges -= 1;
            user.TotalEdges  += 1;

            await _context.SaveChangesAsync();

            await ctx.RespondAsync(
                $"You've told me you've edged 1 time. Your balance is now {user.WalletEdges} edges.");
        }
示例#6
0
        /// <summary>
        /// Call when client Message is created. Logs all Messages to Database.
        /// </summary>
        /// <param name="e">The Message Event Args.</param>
        /// <returns>A <see cref="Task"/>.</returns>
        private async Task ClientMessageCreated(MessageCreateEventArgs e)
        {
            var ohMatch = Regex.Match(e.Message.Content, "oh([.,!,?]?)", RegexOptions.IgnoreCase);

            if (ohMatch.Success && e.Message.Content.Length < 4 && _lastHiMark < DateTime.Now - TimeSpan.FromMinutes(60))
            {
                string himark = e.Message.Content.StartsWith("OH") ? "HI MARK" : "Hi Mark";
                string mark   = ohMatch.Groups.Count > 0 && ohMatch.Groups[1].Value.Contains('.', '?', '!') ? ohMatch.Groups[1].Value : "";
                await e.Channel.SendMessageAsync($"{himark}{mark}");

                _lastHiMark = DateTime.Now;
            }

            if (e.Author.Id == 503662068050952192 && e.Message.Content.Contains("horny", StringComparison.InvariantCultureIgnoreCase) && _lastCheeseHorny < DateTime.Now - TimeSpan.FromMinutes(60))
            {
                await e.Channel.SendMessageAsync("Yes Cheese, we know you're horny");

                _lastCheeseHorny = DateTime.Now;
            }

            using var context = new DiscordContext();

            if (context.Messages.Any(msg => msg.MessageId == Convert.ToInt64(e.Message.Id)))
            {
                return;
            }

            var user = await UserExtension.GetUser(e.Message.Author.Id, context);

            var cMsg = new Messages()
            {
                AuthorId     = Convert.ToInt64(user.UserId),
                MessageText  = e.Message.Content,
                ChannelId    = Convert.ToInt64(e.Message.Channel.Id),
                CreationDate = e.Message.CreationTimestamp.DateTime,
                MessageId    = Convert.ToInt64(e.Message.Id)
            };

            try
            {
                user = await UserExtension.GetUser(e.Message.Author.Id, context);

                await _context.Messages.AddAsync(cMsg);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error trying to enter Message into Database");
                Console.WriteLine(ex.Message);
            }
        }
示例#7
0
文件: Edges.cs 项目: Damitrix/Sabrina
        public async Task AssignEdgesAsync(CommandContext ctx, int edges)
        {
            if (edges < 1)
            {
                await ctx.RespondAsync("You cannot assign yourself less than 1 Edge. For obvious reasons");
            }

            var user = await UserExtension.GetUser(Convert.ToInt64(Convert.ToInt64(ctx.Message.Author.Id)));

            user.WalletEdges += edges;
            await _context.SaveChangesAsync();

            await ctx.RespondAsync(
                $"I've assigned you {edges} edges. Your balance is now {user.WalletEdges} edges.");
        }
示例#8
0
        public async Task ResetProfileAsync(CommandContext ctx,
                                            [Description("Mention the user here")] DiscordUser dcUser)
        {
            using DiscordContext context = new DiscordContext();
            Users user = await UserExtension.GetUser(Convert.ToInt64(dcUser.Id), context);

            user.DenialTime  = DateTime.Now;
            user.BanTime     = DateTime.Now;
            user.LockTime    = DateTime.Now;
            user.SpecialTime = DateTime.Now;
            user.RuinTime    = DateTime.Now;

            await context.SaveChangesAsync();

            await ctx.RespondAsync($"I've reset the Profile of {dcUser.Mention}.");
        }
示例#9
0
        /// <summary>
        /// </summary>
        /// <returns>true, if checks are passed</returns>
        private async Task <bool> DoInitialCheck(CommandContext ctx)
        {
            using DiscordContext context = new DiscordContext();
            Users user = await UserExtension.GetUser(Convert.ToInt64(ctx.Message.Author.Id), context);

            SabrinaSettings sabrinaSettings = await context.SabrinaSettings.FindAsync(Convert.ToInt64(ctx.Guild.Id));

            if (sabrinaSettings == null)
            {
                sabrinaSettings = new SabrinaSettings
                {
                    GuildId      = Convert.ToInt64(ctx.Guild.Id),
                    WheelChannel = Convert.ToInt64(ctx.Channel.Id)
                };

                await context.SabrinaSettings.AddAsync(sabrinaSettings);

                await context.SaveChangesAsync();
            }

            if (sabrinaSettings.WheelChannel == null)
            {
                sabrinaSettings.WheelChannel = Convert.ToInt64(ctx.Channel.Id);
                await context.SaveChangesAsync();
            }

            if (Convert.ToInt64(ctx.Channel.Id) != sabrinaSettings.WheelChannel.Value)
            {
                DiscordChannel channel =
                    await ctx.Client.GetChannelAsync(Convert.ToUInt64(sabrinaSettings.WheelChannel));

                await ctx.RespondAsync(
                    $"You cannot issue this command from this Channel. Please use {channel.Mention}");

                return(false);
            }

            return(true);
        }
示例#10
0
        public async Task Came(CommandContext ctx)
        {
            using var context = new DiscordContext();
            bool punish = true;
            var  userId = Convert.ToInt64(ctx.Message.Author.Id);
            var  user   = await UserExtension.GetUser(userId, context);

            var difficulty  = (await UserSetting.GetSettingAsync(userId, UserSetting.SettingID.WheelDifficulty, context)).GetValue <UserSetting.WheelDifficultyPreference>();
            var lastOutcome = await WheelOutcomeExtension.GetLastOutcome(userId, false, context);

            var lastallowedOrgasm = await WheelOutcomeExtension.GetLastOutcome(UserSetting.Outcome.O****m, userId, true, context);

            var lastUserOrgasm = await WheelOutcomeExtension.GetLastOutcome(UserSetting.Outcome.O****m, userId, true, context);

            if (lastOutcome == null)
            {
                await ctx.RespondAsync("Please start your *training* with ``//orgasmwheel`` first.");

                return;
            }

            DiscordEmbedBuilder builder = new DiscordEmbedBuilder();

            var denialTime = TimeSpan.FromTicks(1);

            if (lastallowedOrgasm != null && lastUserOrgasm != null)
            {
                if (lastUserOrgasm.Time > lastallowedOrgasm.Time)
                {
                    denialTime = TimeSpan.FromDays(Math.Round((int)difficulty + 1 * 1.5, 0, MidpointRounding.AwayFromZero));

                    builder.Description = "What!? You already came after i allowed you to!!" + Environment.NewLine
                                          + "Can you not even follow simple instructions?" + Environment.NewLine
                                          + $"I'll give you {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial for that!";
                }
            }

            switch ((UserSetting.Outcome)lastOutcome.Type)
            {
            case UserSetting.Outcome.NotSet:
                builder.Description = "Yes, i hope you enjoyed that." + Environment.NewLine
                                      + "I do reward my subs every now and then." + Environment.NewLine
                                      + $"But don't get used to it.";
                break;

            case UserSetting.Outcome.Denial:
                denialTime = TimeSpan.FromDays(Math.Round((int)difficulty + 1 * 1.5, 0, MidpointRounding.AwayFromZero));

                builder.Description = "What!? I told you, that you'd be denied!" + Environment.NewLine
                                      + "Can you not even follow simple instructions?" + Environment.NewLine
                                      + $"I'll give you {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial for that!";
                break;

            case UserSetting.Outcome.Ruin:
                denialTime = TimeSpan.FromDays((int)difficulty + 1);

                builder.Description = "Oh, was my poor little boy not strong enough, to follow through with the ruin?" + Environment.NewLine
                                      + "Guess you're gonna learn the hard way, to do what i say." + Environment.NewLine
                                      + $"That means no cumming for {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")}. And no ruins of course!";
                break;

            case UserSetting.Outcome.O****m:
                punish = Helpers.RandomGenerator.RandomInt(0, 50) < (int)difficulty * 2;

                if (punish)
                {
                    builder.Description = "That must've felt sooo good." + Environment.NewLine
                                          + "But your luck ends here." + Environment.NewLine
                                          + $"I don't really feel, like you should've come after all.";
                }
                else
                {
                    builder.Description = "Yes, i hope you enjoyed that." + Environment.NewLine
                                          + "I do reward my subs every now and then." + Environment.NewLine
                                          + $"But don't get used to it.";
                }

                break;

            case UserSetting.Outcome.Edge:
                denialTime = TimeSpan.FromDays(Math.Round((int)difficulty + 1 * 1.5, 0, MidpointRounding.AwayFromZero));

                builder.Description = "So... you tipped over and didn't even ruin it? What a shame..." + Environment.NewLine
                                      + "You're naturally going to have to make up for that." + Environment.NewLine
                                      + $"I guess {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial should do for now.";
                break;

            case UserSetting.Outcome.Task:
                denialTime = TimeSpan.FromDays(Math.Round((int)difficulty + 1 * 1.5, 0, MidpointRounding.AwayFromZero));

                builder.Description = "So... you tipped over and didn't even ruin it? What a shame..." + Environment.NewLine
                                      + "You're naturally going to have to make up for that." + Environment.NewLine
                                      + $"I guess {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial should do for now.";
                break;
            }

            var prevDenialTime = user.DenialTime > DateTime.Now ? user.DenialTime : DateTime.Now;

            user.DenialTime = prevDenialTime + denialTime;

            var thisOutcome = new DbWheelOutcome()
            {
                IsUserReport = 1,
                Time         = DateTime.Now,
                Type         = (int)UserSetting.Outcome.O****m,
                UserId       = userId
            };

            await context.WheelOutcome.AddAsync(thisOutcome);

            await context.SaveChangesAsync();

            if (punish)
            {
                builder.Description += Environment.NewLine + " And here's your punishment <3";
            }

            await ctx.RespondAsync(embed : builder.Build());

            if (punish)
            {
                await PunishmentInternal(ctx);
            }
        }
示例#11
0
        private async Task PunishmentInternal(CommandContext ctx)
        {
            using var context = new DiscordContext();
            var user = await UserExtension.GetUser(ctx.Message.Author.Id);

            var settings = UserSetting.GetAllSettings(Convert.ToInt64(ctx.User.Id), context).ToDictionary(setting => (UserSetting.SettingID)setting.SettingId);
            var items    = await WheelItemExtension.GetUserItemsAsync(user.UserId, context);

            var punishmentModules = PunishmentModule.GetAll(settings, items.ToList());

            var sumChances = punishmentModules.Sum(cModule => cModule.Chance);

            var chanceValue = Helpers.RandomGenerator.RandomInt(0, sumChances);

            int cChance             = 0;
            PunishmentModule module = null;
            DiscordEmbed     embed  = null;

            foreach (var cModule in punishmentModules)
            {
                cChance += cModule.Chance;

                if (chanceValue < cChance)
                {
                    module = cModule;
                    break;
                }
            }

            if (module == null)
            {
                DiscordEmbedBuilder builder = new DiscordEmbedBuilder()
                {
                    Title       = "No suitable punishment found :(",
                    Description = "Please set up your preferences with ``//settings setup``. You should at least enable cbt and set up some bondage gear."
                };
                await ctx.RespondAsync(embed : builder.Build());

                return;
            }

            await module.Generate();

            embed = module.Embed;

            if (module.WheelLockTime != null && user.LockTime <= DateTime.Now)
            {
                user.LockTime += module.WheelLockTime;

                var builder = new DiscordEmbedBuilder(embed);
                builder.Description += " You are not allowed to re-roll until then.";
                embed = builder.Build();
            }

            if (module.WheelLockTime != null && user.DenialTime <= DateTime.Now)
            {
                user.DenialTime += module.DenialTime;
            }

            await ctx.RespondAsync(embed : embed);

            await context.SaveChangesAsync();
        }
示例#12
0
        public async Task DenialTimeAsync(CommandContext ctx)
        {
            using DiscordContext context = new DiscordContext();

            var   userId = Convert.ToInt64(ctx.Message.Author.Id);
            Users user   = await UserExtension.GetUser(ctx.Message.Author.Id);

            var difficulty        = (await UserSetting.GetSettingAsync(userId, UserSetting.SettingID.WheelDifficulty, context)).GetValue <UserSetting.WheelDifficultyPreference>();
            var denialString      = "I guess I could give you another chance to cum...";
            var wheelLockedString = "So how about you test your luck?";

            if (user.DenialTime != null && user.DenialTime > DateTime.Now)
            {
                TimeSpan timeLeft = user.DenialTime.Value - DateTime.Now;

                difficulty = difficulty == 0 ? UserSetting.WheelDifficultyPreference.Default : difficulty;

                var ballChance      = 100 - (20 / (int)difficulty) - (timeLeft.TotalDays * 5);
                var generatedChance = Helpers.RandomGenerator.RandomInt(0, 101);

                if (generatedChance > ballChance)
                {
                    denialString = "*shakes a magic ball*" + Environment.NewLine
                                   + $"*the ball reads {Math.Round(timeLeft.TotalHours, 0)}*" + Environment.NewLine
                                   + $"...I say no.";
                }
                else if (timeLeft > TimeSpan.FromHours(24))
                {
                    denialString = "Haha, no, you won't cum today.";
                }
                else if (timeLeft > TimeSpan.FromHours(12))
                {
                    denialString =
                        "Ask me again after you've slept a bit... Or gone to work or whatever, I don't care.";
                }
                else if (timeLeft > TimeSpan.FromHours(6))
                {
                    denialString = "Don't be ridiculous. You won't get a chance to cum now.";
                }
                else if (timeLeft > TimeSpan.FromHours(2))
                {
                    denialString = "Maybe later. I don't feel like you should cum right now.";
                }
                else if (timeLeft > TimeSpan.FromMinutes(20))
                {
                    denialString = "You won't cum right now. How about you try again in... say... 30 minutes? An hour?";
                }
                else
                {
                    denialString = "No, you won't get a chance now. I want to see you squirm for just a few more minutes~";
                }

                if (user.LockTime != null && user.LockTime < DateTime.Now)
                {
                    wheelLockedString = $"But i would allow you to spin right now, if you want {Environment.NewLine}" +
                                        $"*grins* {Environment.NewLine}" +
                                        "There\'s no way I\'ll let you cum though. You didn\'t deserve it yet.";
                }
                else
                {
                    wheelLockedString = "";
                }
            }
            else
            {
                if (user.LockTime != null && user.LockTime > DateTime.Now)
                {
                    TimeSpan lockTimeLeft = user.LockTime.Value - DateTime.Now;

                    if (lockTimeLeft > TimeSpan.FromHours(24))
                    {
                        wheelLockedString = "But not today.";
                    }
                    else if (lockTimeLeft > TimeSpan.FromHours(12))
                    {
                        wheelLockedString = "But i don't want to, right now. Maybe later today.";
                    }
                    else if (lockTimeLeft > TimeSpan.FromHours(6))
                    {
                        wheelLockedString = "But I'm not in the mood right now. Ask me again in a few hours.";
                    }
                    else if (lockTimeLeft > TimeSpan.FromHours(2))
                    {
                        wheelLockedString = "But i'm kinda in the middle of something right now. We can play later.";
                    }
                    else
                    {
                        wheelLockedString = "I won't let you spin for the moment though :)";
                    }
                }
            }

            await ctx.RespondAsync($"Hey {(await ctx.Client.GetUserAsync(Convert.ToUInt64(user.UserId))).Mention},\n" +
                                   $"{denialString}\n" +
                                   $"{wheelLockedString}");
        }
示例#13
0
        public async Task FullOrgasmWheel(CommandContext ctx)
        {
            await ctx.TriggerTypingAsync();

            using DiscordContext context = new DiscordContext();
            Users user = await UserExtension.GetUser(Convert.ToInt64(ctx.Message.Author.Id), context);

            if (!await DoInitialCheck(ctx))
            {
                return;
            }

            var wheelMode = await WheelSettingExtension.GetMode(ctx.Guild.Id, context);

            if (wheelMode == WheelSettingExtension.WheelMode.Infinite)
            {
                await ctx.RespondAsync("Wheel is set to infinite Mode. Please Change it to a Mode where an outcome is possible");

                return;
            }

            var isLocked = !await CheckLocked(ctx, user, context);

            if (isLocked)
            {
                return;
            }

            List <WheelOutcome> outcomes = new List <WheelOutcome>();

            var outcome = await GetOutcome(ctx, context);

            while (outcomes.All(o => o.Outcome != UserSetting.Outcome.Denial && o.Outcome != UserSetting.Outcome.Ruin && o.Outcome != UserSetting.Outcome.O****m))
            {
                outcome = await GetOutcome(ctx, context);

                outcome = await CheckDenial(ctx, user, outcome);

                outcomes.Add(await GetWheelOutcome(context, user, outcome));
            }

            //Last outcome will be end of wheel

            var outcomeTime = DateTime.Now;

            foreach (var wheelOutcome in outcomes)
            {
                outcomeTime += TimeSpan.FromSeconds(1);
                if (wheelOutcome.Embed != null)
                {
                    await ctx.RespondAsync(embed : wheelOutcome.Embed);
                }
                else
                {
                    await ctx.RespondAsync(wheelOutcome.Text);
                }

                DbWheelOutcome dbOutcome = new DbWheelOutcome()
                {
                    IsUserReport = 0,
                    Time         = outcomeTime,
                    Type         = (int)outcome,
                    UserId       = user.UserId
                };

                context.WheelOutcome.Add(dbOutcome);

                if (wheelOutcome.GetType() == typeof(Entities.WheelOutcomes.Content))
                {
                    ((Entities.WheelOutcomes.Content)wheelOutcome).CleanUp(context);
                }
            }

            var endOutcome = outcomes.First(o => o.Outcome == UserSetting.Outcome.Denial || o.Outcome == UserSetting.Outcome.Ruin || o.Outcome == UserSetting.Outcome.O****m);

            if (endOutcome.WheelLockedTime != null && endOutcome.WheelLockedTime > TimeSpan.Zero)
            {
                switch (outcome)
                {
                case UserSetting.Outcome.Edge:
                case UserSetting.Outcome.Task:
                    user.LockReason = ((int)UserSetting.LockReason.Task).ToString();
                    break;

                default:
                    user.LockReason = ((int)UserSetting.LockReason.Cooldown).ToString();
                    break;
                }
            }

            if (user.DenialTime == null || user.DenialTime < DateTime.Now)
            {
                user.DenialTime = DateTime.Now;
            }

            if (user.LockTime == null || user.LockTime < DateTime.Now)
            {
                user.LockTime = DateTime.Now;
            }

            user.DenialTime += endOutcome.DenialTime;
            user.LockTime   += endOutcome.WheelLockedTime;

            await context.SaveChangesAsync();

            await CheckUserHasOrgasm(ctx, outcome);
        }
示例#14
0
        public async Task ReportAsync(
            CommandContext ctx,
            [Description("Your outcome (denial/ruin/o****m)")]
            string outcome = null,
            [Description("How many edges it took")]
            int edges = 0,
            [Description("How long it took (5m = 5 minutes | 5m12s = 5 minutes, 12 seconds)")]
            string time = null)
        {
            // TODO: Check for Channel

            if (outcome == null || time == null)
            {
                await ctx.RespondAsync("Please supply information about your report (``//report denial 5 12m5s`` to report denial after 5 edges and 12 minutes and 5 seconds)");

                return;
            }

            outcome = outcome.ToUpperInvariant();

            IQueryable <Slavereports> slaveReports =
                from report in _context.Slavereports.Where(report => report.TimeOfReport > DateTime.Now.AddHours(-16))
                where report.UserId == Convert.ToInt64(ctx.User.Id)
                select report;

            var lastReport = slaveReports.FirstOrDefault();

            if (lastReport != null)
            {
                await ctx.RespondAsync(
                    $"You can only report once every 20 hours. You can report again in {TimeResolver.TimeToString(lastReport.TimeOfReport.AddHours(20) - DateTime.Now)}");

                var dm = await(await ctx.Guild.GetMemberAsync(Config.Users.Aki)).CreateDmChannelAsync();
                await dm.SendMessageAsync(
                    $"{ctx.Message.Author} has reported {TimeResolver.TimeToString(lastReport.TimeOfReport.AddHours(20) - DateTime.Now)} too early.");

                return;
            }

            if (Enum.TryParse(outcome, true, out UserSetting.Outcome result))
            {
                TimeSpan span;
                try
                {
                    var user = await UserExtension.GetUser(ctx.Message.Author.Id);

                    span = TimeResolver.GetTimeSpan(time);

                    await Task.Run(
                        async() =>
                    {
                        var report = new Slavereports()
                        {
                            TimeOfReport   = DateTime.Now,
                            UserId         = user.UserId,
                            Edges          = edges,
                            TimeSpan       = span.Ticks,
                            SessionOutcome = outcome
                        };

                        _context.Slavereports.Add(report);

                        await _context.SaveChangesAsync();
                    });
                }
                catch
                {
                    var builder = new DiscordEmbedBuilder
                    {
                        Title       = "Error",
                        Description =
                            "That's not how this works, you can enter your time in one of the following formats:",
                        Footer = new DiscordEmbedBuilder.EmbedFooter {
                            Text = "You get the Idea..."
                        }
                    };

                    builder.AddField("1h5m12s", "1 hour, 5 minutes, 12 seconds");
                    builder.AddField("5m", "5 minutes");
                    builder.AddField("2h", "2 hours");
                    builder.AddField("1200s", "1200 seconds");

                    await ctx.RespondAsync(embed : builder.Build());

                    return;
                }
            }
            else
            {
                var builder = new DiscordEmbedBuilder
                {
                    Title       = "Error",
                    Description = "That's not how this works, you gotta use one of the following:"
                };

                foreach (string possibleOutcome in Enum.GetNames(typeof(UserSetting.Outcome)))
                {
                    builder.AddField(possibleOutcome, $"``//report {possibleOutcome} {edges} {time}``");
                }

                await ctx.RespondAsync(embed : builder.Build());

                return;
            }

            var    formatText    = "{0}{1}{2}";
            var    prefix        = "Hey, ";
            var    postfix       = ". Thanks for reporting your task.";
            string name          = ctx.User.Mention;
            var    parsedOutcome = Enum.Parse <UserSetting.Outcome>(outcome, true);

            var responseColor = DiscordColor.Green;

            if (parsedOutcome == UserSetting.Outcome.Denial)
            {
                Tuple <string, string>[] templates =
                {
                    new Tuple <string,                                                        string>("Hehe, looks like that's it for you for today, ", " ^^"),
                    new Tuple <string,                                                        string>(
                        "That's what i like to see, ",
                        ". Now, can you do me a favor and report that again next time?~"),
                    new Tuple <string,                                                        string>(
                        "Ohh, is little ",
                        " denied? Well, too bad, you'll have to wait for your next chance~"),
                    new Tuple <string,                                                        string>(
                        "1, 2, 3, 4, ",
                        " is denied! ...Were you expecting a rhyme? Sucks being you, then.")
                };

                Tuple <string, string> template = templates[Helpers.RandomGenerator.RandomInt(0, templates.Length)];
                prefix  = template.Item1;
                postfix = template.Item2;

                responseColor = DiscordColor.Red;
            }

            if (parsedOutcome == UserSetting.Outcome.Ruin)
            {
                Tuple <string, string>[] templates =
                {
                    new Tuple <string,                                                                                             string>(
                        "Hmm, better than nothing, right, ",
                        "? Did it feel good?~ haha, of course not."),
                    new Tuple <string,                                                                                             string>(
                        "Oh ",
                        ", I don't know what i like more, denial or ruin... Do you think you get to deny yourself next time? :3"),
                    new Tuple <string,                                                                                             string>(
                        "It's not even a full o****m, but our ",
                        " still followed Orders. I bet you'll be even more obedient with your next chance..."),
                    new Tuple <string,                                                                                             string>("Another ruined one for ", " . Check.")
                };

                Tuple <string, string> template = templates[Helpers.RandomGenerator.RandomInt(0, templates.Length)];
                prefix  = template.Item1;
                postfix = template.Item2;

                responseColor = DiscordColor.Yellow;
            }

            if (parsedOutcome == UserSetting.Outcome.O****m)
            {
                Tuple <string, string>[] templates =
                {
                    new Tuple <string,                                                              string>(
                        "Meh, ",
                        " got a full O****m. How boring. It hope you get a ruined one next time."),
                    new Tuple <string,                                                              string>(
                        "And Mistress allowed that? You got lucky, ",
                        ". But i think i should ask Mistress to ruin your next one."),
                    new Tuple <string,                                                              string>("... ",                                 " ..."),
                    new Tuple <string,                                                              string>("Are you sure, you did it correctly, ", " ?")
                };

                Tuple <string, string> template = templates[Helpers.RandomGenerator.RandomInt(0, templates.Length)];
                prefix  = template.Item1;
                postfix = template.Item2;

                responseColor = DiscordColor.Green;
            }

            var responseBuilder = new DiscordEmbedBuilder
            {
                Author = new DiscordEmbedBuilder.EmbedAuthor
                {
                    Name    = ctx.User.Username,
                    IconUrl = ctx.User.AvatarUrl
                },
                Color       = responseColor,
                Description = string.Format(formatText, prefix, name, postfix),
                Footer      = new DiscordEmbedBuilder.EmbedFooter
                {
                    Text = "You can report back in 16 hours"
                }
            };

            await ctx.RespondAsync(embed : responseBuilder.Build());
        }
示例#15
0
        private async Task <UserSetting.Outcome> GetOutcome(CommandContext ctx, DiscordContext context)
        {
            Users user = await UserExtension.GetUser(Convert.ToInt64(ctx.Message.Author.Id), context);

            var wheelMode = await WheelSettingExtension.GetMode(ctx.Guild.Id, context);

            var wheelDifficultySetting = await UserSetting.GetSettingAsync(user.UserId, UserSetting.SettingID.WheelDifficulty, context);

            var difficulty = UserSettingExtensions.GetValue <UserSetting.WheelDifficultyPreference>(wheelDifficultySetting);

            WheelChances chances = await context.WheelChances.FindAsync((int)difficulty);

            var cumScore = await CalculateCumScore(context, user);

            var cumChance = Convert.ToInt32(cumScore * chances.O****m);

            if (wheelMode.HasFlag(WheelSettingExtension.WheelMode.NoCum))
            {
                cumChance = 0;
            }

            var ruinChance = Convert.ToInt32(cumScore * chances.Ruin);

            if (wheelMode.HasFlag(WheelSettingExtension.WheelMode.NoRuin))
            {
                ruinChance = 0;
            }

            var denialChance = chances.Denial;

            if (wheelMode.HasFlag(WheelSettingExtension.WheelMode.NoDenial))
            {
                denialChance = 0;
            }

            var outcomeChanceValue = Helpers.RandomGenerator.RandomInt(
                0,
                denialChance + chances.Task + chances.Edge + ruinChance + cumChance);

            UserSetting.Outcome outcome;
            if (outcomeChanceValue < denialChance)
            {
                outcome = UserSetting.Outcome.Denial;
            }
            else if (outcomeChanceValue < denialChance + chances.Edge)
            {
                outcome = UserSetting.Outcome.Edge;
            }
            else if (outcomeChanceValue < denialChance + chances.Edge + chances.Task)
            {
                outcome = UserSetting.Outcome.Task;
            }
            else if (outcomeChanceValue < denialChance + chances.Edge + chances.Task + cumChance)
            {
                outcome = UserSetting.Outcome.Ruin;
            }
            else
            {
                outcome = UserSetting.Outcome.O****m;
            }

            return(outcome);
        }
示例#16
0
        public async Task SpinNewWheelAsync(CommandContext ctx)
        {
            DiscordContext context = new DiscordContext();
            Users          user    = await UserExtension.GetUser(Convert.ToInt64(ctx.Message.Author.Id), context);

            SabrinaSettings sabrinaSettings = await context.SabrinaSettings.FindAsync(Convert.ToInt64(ctx.Guild.Id));

            if (sabrinaSettings == null)
            {
                sabrinaSettings = new SabrinaSettings
                {
                    GuildId      = Convert.ToInt64(ctx.Guild.Id),
                    WheelChannel = Convert.ToInt64(ctx.Channel.Id)
                };

                await context.SabrinaSettings.AddAsync(sabrinaSettings);

                await context.SaveChangesAsync();
            }

            if (sabrinaSettings.WheelChannel == null)
            {
                sabrinaSettings.WheelChannel = Convert.ToInt64(ctx.Channel.Id);
                await context.SaveChangesAsync();
            }

            if (Convert.ToInt64(ctx.Channel.Id) != sabrinaSettings.WheelChannel.Value)
            {
                DiscordChannel channel =
                    await ctx.Client.GetChannelAsync(Convert.ToUInt64(sabrinaSettings.WheelChannel));

                await ctx.RespondAsync(
                    $"You cannot issue this command from this Channel. Please use {channel.Mention}");

                return;
            }

            var wheelDifficultySetting = await UserSettingExtension.GetSettingAsync(user.UserId, UserSettingExtension.SettingID.WheelDifficulty, context);

            var difficulty = WheelExtension.WheelDifficultyPreference.Default;

            if (wheelDifficultySetting != null)
            {
                difficulty = (WheelExtension.WheelDifficultyPreference) int.Parse(wheelDifficultySetting.Value);
            }

            WheelChances chances = await context.WheelChances.FindAsync((int)difficulty);

            if (user.LockTime != null && user.LockTime > DateTime.Now)
            {
                TimeSpan?timeUntilFree = user.LockTime - DateTime.Now;

                TimeSpan newTimeUntilFree =
                    TimeSpan.FromTicks(timeUntilFree.Value.Ticks * Helpers.RandomGenerator.RandomInt(1, 4));

                if (newTimeUntilFree > TimeSpan.FromDays(365))
                {
                    await ctx.RespondAsync("F**k off");

                    return;
                }

                var responseText = "Oho, it seems like I told you to stay away from spinning the wheel...\n" +
                                   $"That means you get some more extra time of no spinning {DiscordEmoji.FromName(ctx.Client, Config.Emojis.Blush)}";

                if (int.TryParse(user.LockReason, out int reasonInt))
                {
                    var reason = (UserSettingExtension.LockReason)reasonInt;

                    switch (reason)
                    {
                    case UserSettingExtension.LockReason.Cooldown:
                        responseText =
                            "Oho, it seems like I told you to stay away from spinning the wheel...\n" +
                            $"That means you get some more extra time of no spinning {DiscordEmoji.FromName(ctx.Client, Config.Emojis.Blush)}";
                        user.LockTime += newTimeUntilFree;
                        break;

                    case UserSettingExtension.LockReason.Extension:
                        responseText =
                            "Hey! I already told you, that you'd get a longer lock on the Wheel! You still want more? Sure!";
                        user.LockTime += TimeSpan.FromMinutes(1);
                        break;

                    case UserSettingExtension.LockReason.Task:
                        responseText = "Haha, there's no way you were able to finish your Task so quickly. Do your Task, " +
                                       "and then I'll give you another minute to think about your Actions.";
                        user.LockTime += TimeSpan.FromMinutes(1);
                        break;
                    }
                }

                user.LockReason = ((int)UserSettingExtension.LockReason.Extension).ToString();

                await ctx.RespondAsync(responseText);

                await context.SaveChangesAsync().ConfigureAwait(false);

                return;
            }

            float cumScore   = 1;
            var   lastOrgasm = await WheelOutcomeExtension.GetLastOutcome(WheelExtension.Outcome.O****m, user.UserId, null, context);

            var lastRuin = await WheelOutcomeExtension.GetLastOutcome(WheelExtension.Outcome.Ruin, user.UserId, null, context);

            if (lastOrgasm != null || lastRuin != null)
            {
                DbWheelOutcome lastCum = null;
                if (lastOrgasm != null && lastRuin != null)
                {
                    lastCum = lastOrgasm?.Time > lastRuin?.Time ? lastOrgasm : lastRuin;
                }
                else
                {
                    lastCum = lastOrgasm != null ? lastOrgasm : lastRuin;
                }

                var allSinceLastCum = (await WheelOutcomeExtension.GetLastOutcomesUntil(lastCum, context)).ToList();

                var denialSinceLastCum = allSinceLastCum.Where(cOutcome => cOutcome.Type == (int)WheelExtension.Outcome.Denial);
                var taskSinceLastCum   = allSinceLastCum.Where(cOutcome => cOutcome.Type == (int)WheelExtension.Outcome.Task);
                var edgeSinceLastCum   = allSinceLastCum.Where(cOutcome => cOutcome.Type == (int)WheelExtension.Outcome.Edge);

                cumScore = (denialSinceLastCum.Count() * 6 + taskSinceLastCum.Count() * 2 + edgeSinceLastCum.Count()) / 4f;
                cumScore = cumScore == 0 ? 1 : cumScore;
            }

            var outcomeChanceValue = Helpers.RandomGenerator.RandomInt(
                0,
                chances.Denial + chances.Task + chances.Edge + Convert.ToInt32(cumScore * chances.Ruin) + Convert.ToInt32(cumScore * chances.O****m));

            WheelExtension.Outcome outcome = WheelExtension.Outcome.Edge;
            if (outcomeChanceValue < chances.Denial)
            {
                outcome = WheelExtension.Outcome.Denial;
            }
            else if (outcomeChanceValue < chances.Denial + chances.Edge)
            {
                outcome = WheelExtension.Outcome.Edge;
            }
            else if (outcomeChanceValue < chances.Denial + chances.Edge + chances.Task)
            {
                outcome = WheelExtension.Outcome.Task;
            }
            else if (outcomeChanceValue < chances.Denial + chances.Edge + chances.Task + Convert.ToInt32(cumScore * chances.Ruin))
            {
                outcome = WheelExtension.Outcome.Ruin;
            }
            else
            {
                outcome = WheelExtension.Outcome.O****m;
            }

            if (user.DenialTime != null && user.DenialTime > DateTime.Now)
            {
                TimeSpan?timeUntilFree = user.DenialTime - DateTime.Now;

                if (outcome.HasFlag(WheelExtension.Outcome.O****m) ||
                    outcome.HasFlag(WheelExtension.Outcome.Ruin))
                {
                    await ctx.RespondAsync(
                        "Haha, I would\'ve let you cum this time, but since you\'re still denied, "
                        + $"that won't happen {DiscordEmoji.FromName(ctx.Client, Config.Emojis.Blush)}.\n" +
                        "As a punishment, you\'re gonna do your Task anyways though:");
                }
                else
                {
                    await ctx.RespondAsync(
                        "Well, i told you, that you\'d be denied now.\n"
                        + "You still want to do something? Hmm... let's see...");
                }

                await Task.Delay(1500);

                outcome = WheelExtension.Outcome.Denial | WheelExtension.Outcome.Edge;
            }

            WheelOutcome wheelOutcome = null;

            while (wheelOutcome == null)
            {
                try
                {
                    wheelOutcomes = ReflectiveEnumerator.GetEnumerableOfType <WheelOutcome>(outcome, UserSettingExtension.GetAllSettings(user.UserId, context).ToDictionary(setting => (UserSettingExtension.SettingID)setting.SettingId), await WheelItemExtension.GetUserItemsAsync(user.UserId, context), _dependencies)
                                    .ToList();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                foreach (var wheeloutcome in wheelOutcomes)
                {
                    await wheeloutcome.BuildAsync();
                }

                wheelOutcomes = wheelOutcomes.Where(e => !e.Outcome.HasFlag(WheelExtension.Outcome.NotSet)).ToList();

                if (wheelOutcomes.Count < 1)
                {
                    continue;
                }

                // Choose an outcome by summing up the chance values of all possible outcomes and
                // then generating a random number inside those.
                var combinedChance = 0;

                foreach (WheelOutcome currentOutcome in wheelOutcomes)
                {
                    combinedChance += currentOutcome.Chance;
                }

                var chance    = 0;
                var minChance = Helpers.RandomGenerator.RandomInt(0, combinedChance);

                foreach (WheelOutcome currentOutcome in wheelOutcomes)
                {
                    chance += currentOutcome.Chance;
                    if (minChance < chance)
                    {
                        wheelOutcome = currentOutcome;
                        break;
                    }
                }
            }

            if (wheelOutcome.Embed != null)
            {
                await ctx.RespondAsync(embed : wheelOutcome.Embed);
            }
            else
            {
                await ctx.RespondAsync(wheelOutcome.Text);
            }

            DbWheelOutcome dbOutcome = new DbWheelOutcome()
            {
                IsUserReport = 0,
                Time         = DateTime.Now,
                Type         = (int)outcome,
                UserId       = user.UserId
            };

            context.WheelOutcome.Add(dbOutcome);

            if (wheelOutcome.GetType() == typeof(Entities.WheelOutcomes.Content))
            {
                ((Entities.WheelOutcomes.Content)wheelOutcome).CleanUp(context);
            }

            if (user.DenialTime == null)
            {
                user.DenialTime = DateTime.Now;
            }

            if (user.LockTime == null)
            {
                user.LockTime = DateTime.Now;
            }

            if (user.DenialTime < DateTime.Now)
            {
                user.DenialTime = DateTime.Now;
            }

            if (user.LockTime < DateTime.Now)
            {
                user.LockTime = DateTime.Now;
            }

            if (wheelOutcome.WheelLockedTime != null && wheelOutcome.WheelLockedTime > TimeSpan.Zero)
            {
                switch (outcome)
                {
                case WheelExtension.Outcome.Edge:
                case WheelExtension.Outcome.Task:
                    user.LockReason = ((int)UserSettingExtension.LockReason.Task).ToString();
                    break;

                default:
                    user.LockReason = ((int)UserSettingExtension.LockReason.Cooldown).ToString();
                    break;
                }
            }

            user.DenialTime += wheelOutcome.DenialTime;
            user.LockTime   += wheelOutcome.WheelLockedTime;

            await Task.Run(async() => await context.SaveChangesAsync());

            if (outcome == WheelExtension.Outcome.O****m || outcome == WheelExtension.Outcome.Ruin)
            {
                var m = await ctx.Client.GetInteractivityModule().WaitForMessageAsync(
                    x => x.Channel.Id == ctx.Channel.Id && x.Author.Id == ctx.Member.Id &&
                    x.Content.Contains(@"//ruin") || x.Content.Contains(@"//cum") || x.Content.Contains(@"//came"),
                    TimeSpan.FromSeconds(120));

                if (m == null)
                {
                    string text = outcome == WheelExtension.Outcome.Ruin ? "ruin it like a good boy" : "cum in the end";

                    var builder = new DiscordEmbedBuilder()
                    {
                        Title       = $"Did you {text}?",
                        Description = $"{ctx.Message.Author.Mention} You didn't tell me, if you properly did {text} :(" + Environment.NewLine
                                      + "Please use either ``//ruined`` or ``//came`` depending on what you did"
                    };

                    await ctx.RespondAsync(embed : builder.Build());
                }
            }
        }
示例#17
0
        public async Task SpinNewWheelAsync(CommandContext ctx)
        {
            using DiscordContext context = new DiscordContext();
            Users user = await UserExtension.GetUser(Convert.ToInt64(ctx.Message.Author.Id), context);

            if (!await DoInitialCheck(ctx))
            {
                return;
            }

            var outcome = await GetOutcome(ctx, context);

            var isLocked = !await CheckLocked(ctx, user, context);

            if (isLocked)
            {
                return;
            }

            outcome = await CheckDenial(ctx, user, outcome);

            await ctx.TriggerTypingAsync();

            WheelOutcome wheelOutcome = await GetWheelOutcome(context, user, outcome);

            if (wheelOutcome.Embed != null)
            {
                await ctx.RespondAsync(embed : wheelOutcome.Embed);
            }
            else
            {
                await ctx.RespondAsync(wheelOutcome.Text);
            }

            DbWheelOutcome dbOutcome = new DbWheelOutcome()
            {
                IsUserReport = 0,
                Time         = DateTime.Now,
                Type         = (int)outcome,
                UserId       = user.UserId
            };

            context.WheelOutcome.Add(dbOutcome);

            if (wheelOutcome.GetType() == typeof(Entities.WheelOutcomes.Content))
            {
                ((Entities.WheelOutcomes.Content)wheelOutcome).CleanUp(context);
            }

            if (wheelOutcome.WheelLockedTime != null && wheelOutcome.WheelLockedTime > TimeSpan.Zero)
            {
                switch (outcome)
                {
                case UserSetting.Outcome.Edge:
                case UserSetting.Outcome.Task:
                    user.LockReason = ((int)UserSetting.LockReason.Task).ToString();
                    break;

                default:
                    user.LockReason = ((int)UserSetting.LockReason.Cooldown).ToString();
                    break;
                }
            }

            if (user.DenialTime == null || user.DenialTime < DateTime.Now)
            {
                user.DenialTime = DateTime.Now;
            }

            if (user.LockTime == null || user.LockTime < DateTime.Now)
            {
                user.LockTime = DateTime.Now;
            }

            user.DenialTime += wheelOutcome.DenialTime;
            user.LockTime   += wheelOutcome.WheelLockedTime;

            await context.SaveChangesAsync();

            _ = CheckUserHasOrgasm(ctx, outcome);
        }
示例#18
0
        public async Task Ruin(CommandContext ctx)
        {
            using var context = new DiscordContext();
            bool punish = true;
            var  userId = Convert.ToInt64(ctx.Message.Author.Id);
            var  user   = await UserExtension.GetUser(userId, context);

            var difficulty  = (await UserSetting.GetSettingAsync(userId, UserSetting.SettingID.WheelDifficulty, context)).GetValue <UserSetting.WheelDifficultyPreference>();
            var lastOutcome = await WheelOutcomeExtension.GetLastOutcome(userId, false, context);

            if (lastOutcome == null)
            {
                await ctx.RespondAsync("Please start your *session* with ``//orgasmwheel`` first.");

                return;
            }

            DiscordEmbedBuilder builder = new DiscordEmbedBuilder();

            var denialTime = TimeSpan.FromTicks(1);

            switch ((UserSetting.Outcome)lastOutcome.Type)
            {
            case UserSetting.Outcome.NotSet:

                break;

            case UserSetting.Outcome.Denial:
                denialTime = TimeSpan.FromDays((int)difficulty + 1);

                builder.Description = "What!? I told you, that you'd be denied!" + Environment.NewLine
                                      + "I mean... at least you tried. Still, you didn't do what i said, and this must be punished!" + Environment.NewLine
                                      + $"I'll give you {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial for that!";
                break;

            case UserSetting.Outcome.Ruin:
                builder.Description = "Oh, this makes me so happy." + Environment.NewLine
                                      + "I love seeing it just dribble out." + Environment.NewLine
                                      + $"You're a good little sub.";
                punish = false;
                break;

            case UserSetting.Outcome.O****m:
                punish = Helpers.RandomGenerator.RandomInt(0, 50) < (int)difficulty * 2;

                if (punish)
                {
                    builder.Description = "I can see, that my conditioning worked!" + Environment.NewLine
                                          + "Even when you're allowed to cum, you still ruin it." + Environment.NewLine
                                          + $"But... this wasn't a suggestion. It was an order.";
                }
                else
                {
                    builder.Description = "I can see, that my conditioning worked!" + Environment.NewLine
                                          + "Even when you're allowed to cum, you still ruin it." + Environment.NewLine
                                          + $"Good boy.";
                }

                break;

            case UserSetting.Outcome.Edge:
                denialTime = TimeSpan.FromDays(Math.Round((int)difficulty + 1 * 1.5, 0, MidpointRounding.AwayFromZero));

                builder.Description = "So... you couldn't control it and just tipped over?" + Environment.NewLine
                                      + "You're naturally going to have to make up for that." + Environment.NewLine
                                      + $"I guess {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial should do it for now.";
                break;

            case UserSetting.Outcome.Task:
                denialTime = TimeSpan.FromDays(Math.Round((int)difficulty + 1 * 1.5, 0, MidpointRounding.AwayFromZero));

                builder.Description = "I'm not sure, how you can be so useless." + Environment.NewLine
                                      + "You're naturally going to have to make up for that." + Environment.NewLine
                                      + $"At least you tried... so I guess {denialTime.Days} day{(denialTime.Days > 1 ? "s" : "")} of denial should do it for now.";
                break;
            }

            var prevDenialTime = user.DenialTime > DateTime.Now ? user.DenialTime : DateTime.Now;

            user.DenialTime = prevDenialTime + denialTime;

            var thisOutcome = new DbWheelOutcome()
            {
                IsUserReport = 1,
                Time         = DateTime.Now,
                Type         = (int)UserSetting.Outcome.O****m,
                UserId       = userId
            };

            await context.WheelOutcome.AddAsync(thisOutcome);

            await context.SaveChangesAsync();

            if (punish)
            {
                builder.Description += Environment.NewLine + "And here's your punishment <3";
            }

            await ctx.RespondAsync(embed : builder.Build());

            if (punish)
            {
                await PunishmentInternal(ctx);
            }
        }