Exemple #1
0
        public async Task ListTags()
        {
            var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            var emb     = TagFunctions.BuildTagListEmbed(userAcc);

            await ReplyAsync("", false, emb);
        }
Exemple #2
0
        public async Task RemoveTag(string tagName)
        {
            var userAcc  = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            var response = TagFunctions.RemoveTag(tagName, userAcc);

            await ReplyAsync(response);
        }
Exemple #3
0
        public async Task UpdateTag(string tagName, [Remainder] string tagContent)
        {
            var userAcc  = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            var response = TagFunctions.UpdateTag(tagName, tagContent, userAcc);

            await ReplyAsync(response);
        }
Exemple #4
0
        internal static TransferResult UserToUser(IUser from, IUser to, ulong amount)
        {
            if (from.Id == to.Id)
            {
                return(TransferResult.SelfTransfer);
            }

            if (to.Id == Global.Client.CurrentUser.Id)
            {
                return(TransferResult.TransferToBot);
            }

            var transferSource = GlobalUserAccounts.GetUserAccount(from.Id);

            if (transferSource.Miunies < amount)
            {
                return(TransferResult.NotEnoughMiunies);
            }

            var transferTarget = GlobalUserAccounts.GetUserAccount(to.Id);

            transferSource.Miunies -= amount;
            transferTarget.Miunies += amount;

            GlobalUserAccounts.SaveAccounts(transferSource.Id, transferTarget.Id);

            return(TransferResult.Success);
        }
Exemple #5
0
        public static Task CheckDuelRewards(SocketUser user)
        {
            var  config = GlobalUserAccounts.GetUserAccount(user);
            uint wins   = config.Wins;

            switch (wins)
            {
            case (10):
                config.Title = "Classic Adventurer";
                break;

            case (20):
                config.Title = "Courageous Explorer";
                break;

            case (30):
                config.Title = "Daring Knight";
                break;

            case (40):
                config.Title = "Monster Hunter";
                break;

            case (50):
                config.Title = ("Noble Swordsman");
                break;

            case (60):
                config.Title = ("Valiant Paladin");
                break;

            case (70):
                config.Title = ("Dragon Slayer");
                break;

            case (80):
                config.Title = ("Respectable Hero");
                break;

            case (90):
                config.Title = ("Holy Protectorate");
                break;

            case (100):
                config.Title = ("Saint");
                break;

            case (120):
                config.Title = ("Defender of Gods");
                break;

            case (150):
                config.Title = ("God Eater");
                break;
            }

            GlobalUserAccounts.SaveAccounts(config.Id);
            return(Task.CompletedTask);
        }
Exemple #6
0
        public async Task ClearFavs()
        {
            var account = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            account.Favorites.Clear();
            GlobalUserAccounts.SaveAccounts(account.Id);
            await Context.Channel.SendMessageAsync("Favorites Cleared");
        }
        public async Task SetInvFromJson([Remainder] string jsonText)
        {
            // get the calling user
            userAccount     = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            userAccount.Inv = JsonConvert.DeserializeObject <Inventory>(jsonText);

            await Context.Channel.SendMessageAsync("RIGHTEOUS, we got itams!");
        }
Exemple #8
0
        public async Task RemoveTag(string tagName)
        {
            var userAcc  = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            var response = TagFunctions.RemoveTag(tagName, userAcc);
            var embed    = EmbedHandler.CreateEmbed(Context, "Success!", response, EmbedHandler.EmbedMessageType.Success,
                                                    false);

            await SendMessage(Context, embed);
        }
 public async Task GetJson([Remainder] string name = null)
 {
     // get the calling user
     userAccount = GlobalUserAccounts.GetUserAccount(Context.User.Id);
     // get json response
     string msg = "Your inventory itams... \n" + userAccount.Inv.ToJson(name);
     // send json response
     await Context.Channel.SendMessageAsync(msg);
 }
        public MiunieCommandContext(DiscordSocketClient client, SocketUserMessage msg) : base(client, msg)
        {
            if (User is null)
            {
                return;
            }

            UserAccount = GlobalUserAccounts.GetUserAccount(User);
        }
Exemple #11
0
        public async Task UpdateTag(string tagName, [Remainder] string tagContent)
        {
            var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            tagContent.Replace("@everyone", "@\u200beveryone").Replace("@here", "@\u200bhere");
            var response = TagFunctions.UpdateTag(tagName, tagContent, userAcc);

            await ReplyAsync(response);
        }
        public async Task AddJsonItem([Remainder] string jsonText)
        {
            // get the calling user
            userAccount = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            Item itm = JsonConvert.DeserializeObject <Item>(jsonText);

            userAccount.Inv.AddItem(itm);

            await Context.Channel.SendMessageAsync("GR00VY new itam we got there!");
        }
Exemple #13
0
        public async Task AddCapsules()
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            config.MythicalCapsule = +3;
            config.NormalCapsule   = +3;
            config.ShinyCapsule    = +3;
            GlobalUserAccounts.SaveAccounts(Context.User.Id);
            await SendMessage(Context, null, "done now u can go die");
        }
Exemple #14
0
        public async Task CheckPotatos([Remainder] string arg = "")
        {
            SocketUser target        = null;
            var        mentionedUser = Context.Message.MentionedUsers.FirstOrDefault();

            target = mentionedUser ?? Context.User;
            var account = GlobalUserAccounts.GetUserAccount(target);

            await ReplyAsync(GetPotatosReport(account.Money, target.Username, target.Mention));
        }
Exemple #15
0
        public async Task CoinFlip(string side, uint amount = 0)
        {
            var config = GlobalUserAccounts.GetUserAccount(Context.User);

            if (config.Taiyaki < amount)
            {
                await SendMessage(Context, null, "Do you think you can trick me, you liar? (Not enough Taiyaki)");

                return;
            }

            config.Taiyaki = config.Taiyaki - amount;
            Random rand  = new Random();
            string sid   = side.ToLower();
            var    embed = new EmbedBuilder();

            embed.WithColor(Global.NayuColor);
            embed.WithTitle($"<:coin:459944364546981909> Coin Flip for {amount} Taiyakis on the Side of {sid}.");
            if (sid == "tails")
            {
                int randomNumber =
                    rand.Next(1, 4);   //you know gambling is dangerous right lol you have a low chance of winning :)
                if (randomNumber == 1) //win
                {
                    config.Taiyaki = config.Taiyaki + ((ulong)amount * 2);
                    embed.WithDescription(
                        $"I guess heads. And the coin landed on tails! Alright, you beat me, for *now*. Here's **{amount * 2}** Taiyakis!");
                }
                else
                {
                    embed.WithDescription(
                        $"I guess heads. And the coin landed on heads! Sorry **{Context.User.Username}**, but your **{amount}** Taiyakis are mine non!");
                }
            }

            if (sid == "heads")
            {
                int randomNumber = rand.Next(1, 4); //you know gambling is dangerous right lol
                if (randomNumber == 1)              //win
                {
                    config.Taiyaki = config.Taiyaki + ((ulong)amount * 2);
                    embed.WithDescription(
                        $"I guess tails. And the coin landed on heads! Alright, you beat me, for *now*. Here's **{amount * 2}** Taiyakis!");
                }
                else
                {
                    embed.WithDescription(
                        $"I guess tails. And the coin landed on tails! Sorry **{Context.User.Username}**, but your **{amount}** Taiyakis are mine non!");
                }
            }

            GlobalUserAccounts.SaveAccounts(config.Id);
            await SendMessage(Context, embed.Build());
        }
Exemple #16
0
        public async Task UpdateTag(string tagName, [Remainder] string tagContent)
        {
            var userAcc = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            tagContent.Replace("@everyone", "@\u200beveryone").Replace("@here", "@\u200bhere");
            var response = TagFunctions.UpdateTag(tagName, tagContent, userAcc);
            var embed    = EmbedHandler.CreateEmbed(Context, "Success!", response, EmbedHandler.EmbedMessageType.Success,
                                                    false);

            await SendMessage(Context, embed);
        }
Exemple #17
0
        public static AttackResult SlashAttack(ShardedCommandContext context)
        {
            var config  = GlobalUserAccounts.GetUserAccount(context.User);
            var player2 = context.Guild.GetUser(config.OpponentId);
            var choms   = ActiveChomusuke.GetActiveChomusuke(config.Id, config.OpponentId);
            var chom1   = choms.Item1;
            var chom2   = choms.Item2;

            string response;
            var    dmg      = (int)Math.Round(Attack.Damage * chom1.CP * .05);
            var    accuracy = Global.Rng.Next(1, Attack.Accuracy + 1);

            if (accuracy > 1)
            {
                var result = CheckModifiers.GetDMGModifiers(context.User, player2, dmg);
                dmg = result.Item1;
                var modifier = result.Item2;

                var block   = CheckModifiers.CheckForBlock(context.User, player2, dmg);
                var deflect = CheckModifiers.CheckForDeflect(context.User, player2, dmg);
                if (block.Item1)
                {
                    chom2.Health -= (uint)block.Item3;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{block.Item2}** damage was blocked!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg = block.Item3;
                }
                else if (deflect.Item1)
                {
                    chom2.Health -= (uint)deflect.Item2;
                    chom1.Health -= (uint)deflect.Item2;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers), but **{deflect.Item2}** damage was deflected back!\n\n{Helpers.GetHpLeft(chom1, chom2)}";
                    dmg = deflect.Item2;
                }
                else
                {
                    chom2.Health -= (uint)dmg;
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    response =
                        $":dagger:  | **{context.User.Username}**, You hit and did **{dmg}** damage (buffed by {modifier}% due to active damage modifiers)!\n\n**{chom1.Name}** has **{chom1.Health}** health left!\n{Helpers.GetHpLeft(chom1, chom2)}";
                }
            }
            else
            {
                response = $":dash:  **|** **{context.User.Username}**, your attack missed!";
            }

            return(new AttackResult {
                Success = true, Response = response, Damage = dmg
            });
        }
Exemple #18
0
        public static async Task Slowmode(SocketMessage s)
        {
            var msg     = s as SocketUserMessage;
            var context = new ShardedCommandContext(_client, msg);
            var config  = GlobalGuildAccounts.GetGuildAccount(context.Guild.Id);

            if (config.IsSlowModeEnabled == true)
            {
                if (context.User is IGuildUser user && user.GuildPermissions.ManageChannels)
                {
                    return;
                }
                if (msg == null)
                {
                    return;
                }
                if (msg.Channel == msg.Author.GetOrCreateDMChannelAsync())
                {
                    return;
                }
                if (msg.Author.IsBot)
                {
                    return;
                }

                var userAcc = GlobalUserAccounts.GetUserAccount(msg.Author.Id);

                DateTime now = DateTime.UtcNow;

                if (now < userAcc.LastMessage.AddSeconds(config.SlowModeCooldown))
                {
                    var difference1    = now - userAcc.LastMessage;
                    var time           = new TimeSpan((long)config.SlowModeCooldown * 10000000);
                    var difference     = time - difference1;
                    var timeSpanString = string.Format("{0:%s} seconds", difference);
                    await msg.DeleteAsync();

                    var dm = await context.User.GetOrCreateDMChannelAsync();

                    await dm.SendMessageAsync($"Slow down! You can send a message in **{timeSpanString}** in **{context.Guild.Name}**.");

                    return;
                }
                else
                {
                    userAcc.LastMessage = now;
                    return;
                }
            }
            else
            {
                return;
            }
        }
Exemple #19
0
        public async Task AddReminder([Remainder] string args)
        {
            string[] splittedArgs = null;
            if (args.Contains(" in "))
            {
                splittedArgs = args.Split(new string[] { " in " }, StringSplitOptions.None);
            }
            if (splittedArgs == null || splittedArgs.Length < 2)
            {
                await ReplyAsync("I think you are confused about how to use this command... aren't you?\n" +
                                 "Let me REMIND you it is: `remind DO THE THING! :rage: in 2d 23h 3m 12s`\n" +
                                 "And the ` in ` before the timeparameters is very important you little dumbo you...");

                return;
            }

            var timeString = splittedArgs[splittedArgs.Length - 1];

            if (timeString == "24h")
            {
                timeString = "1d";
            }

            splittedArgs[splittedArgs.Length - 1] = "";
            var reminderString = string.Join(" in ", splittedArgs, 0, splittedArgs.Length - 1);

            var timeDateTime = DateTime.UtcNow + TimeSpan.ParseExact(timeString, ReminderFormat.Formats, CultureInfo.CurrentCulture);

            var newReminder = new ReminderEntry(timeDateTime, reminderString);

            var account = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            account.Reminders.Add(newReminder);
            GlobalUserAccounts.SaveAccounts(Context.User.Id);


            var          timezone  = account.TimeZone ?? "UTC";
            TimeZoneInfo tz        = TimeZoneInfo.FindSystemTimeZoneById($"{timezone}");
            var          localTime = TimeZoneInfo.ConvertTimeFromUtc(timeDateTime, tz);

            var bigmess2 =
                $"{reminderString}\n\n" +
                $"We will send you a DM in  __**{localTime}**__ `by {timezone}`\n";

            var embed = new EmbedBuilder();

            embed.WithAuthor(Context.User);
            embed.WithCurrentTimestamp();
            embed.WithColor(Color.Blue);
            embed.WithTitle("I will remind you through DM:");
            embed.AddField($"**____**", $"{bigmess2}");

            ReplyAsync("", false, embed.Build());
        }
        public async Task AddReminder([Remainder] string args)
        {
            string[] splittedArgs = null;
            if (args.Contains(" za "))
            {
                splittedArgs = args.Split(new string[] { " za " }, StringSplitOptions.None);
            }
            if (splittedArgs == null || splittedArgs.Length < 2)
            {
                await ReplyAsync("Pozwól biedna owieczko że wytłumaczę Ci jak to zrobić... OK?\n" +
                                 "Czyli tak: `<p>p <Czynności> za 2d 23h 3m 12s`\n" +
                                 "I to \"za\" jest troszkę ważne ^^");

                return;
            }

            var timeString = splittedArgs[splittedArgs.Length - 1];

            if (timeString == "24h")
            {
                timeString = "1d";
            }

            splittedArgs[splittedArgs.Length - 1] = "";
            var reminderString = string.Join(" za ", splittedArgs, 0, splittedArgs.Length - 1);

            var timeDateTime = DateTime.UtcNow + TimeSpan.ParseExact(timeString, ReminderFormat.Formats, CultureInfo.CurrentCulture);

            var newReminder = new ReminderEntry(timeDateTime, reminderString);

            var account = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            account.Reminders.Add(newReminder);
            GlobalUserAccounts.SaveAccounts(Context.User.Id);


            var          timezone  = account.TimeZone ?? "UTC";
            TimeZoneInfo tz        = TimeZoneInfo.FindSystemTimeZoneById($"{timezone}");
            var          localTime = TimeZoneInfo.ConvertTimeFromUtc(timeDateTime, tz);

            var bigmess2 =
                $"{reminderString}\n\n" +
                $"Wyślę Ci **DM**esa za  __**{localTime}**__ `by {timezone}`\n";

            var embed = new EmbedBuilder();

            embed.WithAuthor(Context.User);
            embed.WithCurrentTimestamp();
            embed.WithColor(Color.Blue);
            embed.WithTitle("Przypomnę Ci przez **DM**esa:");
            embed.AddField($"**____**", $"{bigmess2}");

            ReplyAsync("", false, embed.Build());
        }
Exemple #21
0
        public static PotionResult EqualizerPotion(ShardedCommandContext context, Core.Entities.Chomusuke chom1,
                                                   Core.Entities.Chomusuke chom2, ulong target)
        {
            var potionName = "Equalizer Potion";
            var config     = GlobalUserAccounts.GetUserAccount(context.User);
            var check      = CheckForPotion(potionName, config);

            if (!check.Success)
            {
                return new PotionResult {
                           Success = false, Response = check.Response
                }
            }
            ;
            string response = string.Empty;

            config.Items[potionName] -= 1;
            if (target == context.User.Id)
            {
                if (chom1.PotionEffects == null)
                {
                    response =
                        $"**{context.User.Mention}**, you cant use an **{potionName}** on yourself because you don't have any active potion effects!";
                    return(new PotionResult {
                        Success = false, Response = response
                    });
                }

                chom1.PotionEffects.Clear();

                response = $"**{context.User.Mention}** used a **{potionName}** on {chom1.Name}!";
                GlobalUserAccounts.SaveAccounts(config.Id);
                return(new PotionResult {
                    Success = true, Response = response
                });
            }

            //opponent
            if (chom2.PotionEffects == null)
            {
                response =
                    $"**{context.User.Mention}**, you cant use a **{potionName}** on your opponent because they don't have any active potion effects!";
                return(new PotionResult {
                    Success = false, Response = response
                });
            }

            chom2.PotionEffects.Clear();
            response = $"**{context.User.Mention}** used a **{potionName}** on {chom2.Name}!";
            GlobalUserAccounts.SaveAccounts(config.OpponentId);
            return(new PotionResult {
                Success = true, Response = response
            });
        }
Exemple #22
0
        public async Task CheckTaiyakis([Remainder] string arg = "")
        {
            SocketUser target;
            var        mentionedUser = Context.Message.MentionedUsers.FirstOrDefault();

            target = mentionedUser ?? Context.User;
            var config  = GlobalGuildAccounts.GetGuildAccount(Context.Guild.Id);
            var account = GlobalUserAccounts.GetUserAccount(target.Id);

            await SendMessage(Context, null,
                              $"{Global.ETaiyaki}  **|** {target.Mention} has **{account.Taiyaki} {config.Currency}**!");
        }
Exemple #23
0
        public async Task ShowFavs()
        {
            StringBuilder stringBuilder = new StringBuilder();
            var           account       = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            foreach (var keyValue in account.Favorites)
            {
                stringBuilder.Append($" {keyValue.Key}: {keyValue.Value}\n");
            }

            await Context.Channel.SendMessageAsync(stringBuilder.ToString());
        }
Exemple #24
0
        public async Task RemoveFav([Remainder] string phrase)
        {
            var account = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            if (account.Favorites.ContainsKey(phrase))
            {
                account.Favorites.Remove(phrase);
                GlobalUserAccounts.SaveAccounts(Context.User.Id);
            }

            await Context.Channel.SendMessageAsync($"Removed: {phrase}");
        }
Exemple #25
0
        public async Task FetchLink([Remainder] string phrase)
        {
            string responce = "";
            var    account  = GlobalUserAccounts.GetUserAccount(Context.User.Id);

            if (account.Favorites.ContainsKey(phrase))
            {
                responce = $"Successfully fetched {account.Favorites[phrase]}";
            }

            await Context.Channel.SendMessageAsync(responce);
        }
Exemple #26
0
        public static PotionResult DebuffPotion(ShardedCommandContext context, Core.Entities.Chomusuke chom1,
                                                Core.Entities.Chomusuke chom2, ulong target)
        {
            var potionName = "Debuff Potion";
            var config     = GlobalUserAccounts.GetUserAccount(context.User);
            var player2    = context.Guild.GetUser(config.OpponentId);
            var check      = CheckForPotion(potionName, config);

            if (!check.Success)
            {
                return new PotionResult {
                           Success = false, Response = check.Response
                }
            }
            ;
            string response = string.Empty;

            if (chom1.PotionEffects["Debuff"] <= 25 ||
                !chom1.PotionEffects.Keys.Contains("Debuff") || chom2.PotionEffects["Debuff"] <= 25 ||
                !chom2.PotionEffects.Keys.Contains("Debuff"))
            {
                config.Items[potionName] -= 1;

                if (target == context.User.Id)
                {
                    chom1.PotionEffects.Add("Debuff", 0);
                    chom1.PotionEffects["Debuff"] += 5;
                    response = $"**{context.User.Mention}** used a **{potionName}** on {chom1.Name}!";
                    GlobalUserAccounts.SaveAccounts(config.Id);
                    return(new PotionResult {
                        Success = true, Response = response
                    });
                }

                if (target == player2.Id)
                {
                    chom1.PotionEffects.Add("Debuff", 0);
                    chom2.PotionEffects["Debuff"] += 5;
                    response = $"**{context.User.Mention}** used a **{potionName}** on {chom2.Name}!";
                    GlobalUserAccounts.SaveAccounts(player2.Id);
                    return(new PotionResult {
                        Success = true, Response = response
                    });
                }
            }

            response =
                $"**{context.User.Mention}**, you cant use a **{potionName}** because both players are already at the max debuff level (25%)!";
            return(new PotionResult {
                Success = false, Response = response
            });
        }
        public async Task ShowTag(string tagName = "")
        {
            if (string.IsNullOrWhiteSpace(tagName))
            {
                await ReplyAsync("Musisz podać nazwę tagu. Spróbuj ``<p>t <NazwaTagu>``");

                return;
            }
            var userAcc  = GlobalUserAccounts.GetUserAccount(Context.User.Id);
            var response = TagFunctions.GetTag(tagName, userAcc);

            await ReplyAsync(response);
        }
Exemple #28
0
        public static bool CheckForReinforcedArmour(SocketUser defender)
        {
            var config = GlobalUserAccounts.GetUserAccount(defender);

            if (config.armour == "reinforced")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task DeleteReminder(int index)
        {
            var reminders      = GlobalUserAccounts.GetUserAccount(Context.User.Id).Reminders;
            var responseString = "Ehhh... może najpier użyj `<p> lista` zanim zaczniesz usuwać przypomnienia które nie istnieją? :grin:";

            if (index > 0 && index <= reminders.Count)
            {
                reminders.RemoveAt(index - 1);
                GlobalUserAccounts.SaveAccounts(Context.User.Id);
                responseString = $"Usunąłem przypomnienie numer {index}!";
            }
            await ReplyAsync(responseString);
        }
Exemple #30
0
        public static async Task CreateAndSendMessageAsync(string title, string content, DateTime time, SocketUser user)
        {
            var     config         = GlobalUserAccounts.GetUserAccount(user);
            Message createdMessage = new Message(null, null, DateTime.MinValue, false, 0);

            createdMessage.Title   = title;
            createdMessage.Content = content;
            createdMessage.Time    = time;
            createdMessage.ID      = config.InboxIDTracker;
            config.InboxIDTracker++;
            config.Inbox.Add(createdMessage);
            GlobalUserAccounts.SaveAccounts(user.Id);
        }