Exemplo n.º 1
0
        public static async Task Maindo(SocketMessage arg)
        {
            if (arg.MentionedUsers.Count > 0)
            {
                var User = arg.MentionedUsers.First();
                try
                {
                    string[] args = arg.Content.ToLower().Split(' ');
                    foreach (string sarg in args)
                    {
                        if (long.TryParse(sarg, out long DonNum))
                        {
                            if (ShopClass.ReadCurrency(arg.Author.Id) >= DonNum)
                            {
                                if (DonNum < 0)
                                {
                                    await arg.Channel.SendMessageAsync("We don't do negative numbers here.");

                                    return;
                                }
                                if (User.Id == arg.Author.Id)
                                {
                                    await arg.Channel.SendMessageAsync("Look, I know you want money quickly .. But you're broke, and you're most likely always going to be that way. Don't donate to yourself kids.");

                                    return;
                                }
                                bool Success = await ShopClass.SpendCurrency(arg.Author.Id, DonNum, arg.Channel);

                                if (Success)
                                {
                                    await arg.Channel.SendMessageAsync($"You've donated ${DonNum} to {User.Username} .. Your new balance is ${ShopClass.ReadCurrency(arg.Author.Id)}");

                                    ShopClass.AddCurrency(User.Id, DonNum);
                                }
                            }
                            else
                            {
                                await arg.Channel.SendMessageAsync($"You don't have ${DonNum} or more.");
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    await arg.Channel.SendMessageAsync($"Did you type a number? Usage: `{Program.Prefix}donate <amount> <user>`");
                }
            }
            else
            {
                await arg.Channel.SendMessageAsync("Please mention a user to donate to.");
            }
        }
Exemplo n.º 2
0
        public static async Task Maindo(SocketMessage arg)
        {
            var Embed = new EmbedBuilder()
            {
                Author = new EmbedAuthorBuilder()
                {
                    IconUrl = arg.Author.GetAvatarUrl(),
                    Name    = $"{arg.Author.Username}'s Balance",
                },
                Color  = new Color(255, 125, 125),
                Footer = new EmbedFooterBuilder()
                {
                    Text = "MGX"
                },
                Timestamp   = DateTime.UtcNow,
                Description = $"${ShopClass.ReadCurrency(arg.Author.Id)}"
            };

            await arg.Channel.SendMessageAsync("", false, Embed.Build());
        }
Exemplo n.º 3
0
        public static async Task Maindo(SocketMessage arg)
        {
            try
            {
                string KeyForJob = $"JOB";
                if (StoreHandler.LoadData(arg.Author.Id, KeyForJob) != null)
                {
                    long   ToAdd  = long.Parse(StoreHandler.LoadData(arg.Author.Id, $"{KeyForJob}-PAY"));
                    Random Random = new Random();

                    double WaitTime = 3600;
                    if (!NotDone.ContainsKey(arg.Author.Id))
                    {
                        NotDone.Add(arg.Author.Id, WaitTime);
                        new Thread(x =>
                        {
                            while (true)
                            {
                                Thread.Sleep(1000);
                                NotDone[arg.Author.Id]--;
                                if (NotDone[arg.Author.Id] <= 0)
                                {
                                    NotDone.Remove(arg.Author.Id);
                                    break;
                                }
                            }
                        }).Start();
                        var Embed = new EmbedBuilder()
                        {
                            Color     = Color.Teal,
                            Timestamp = DateTime.UtcNow,
                            Footer    = new EmbedFooterBuilder()
                            {
                                Text = "MGX"
                            },
                            ThumbnailUrl = arg.Author.GetAvatarUrl() ?? Program.Client.CurrentUser.GetAvatarUrl(),
                        };

                        ShopClass.AddCurrency(arg.Author.Id, ToAdd);

                        var Field = new EmbedFieldBuilder()
                        {
                            IsInline = false,
                            Name     = $"`{Program.Prefix}work`",
                            Value    = $"Here's your pay! - `${ToAdd}`\nBalance - `${ShopClass.ReadCurrency(arg.Author.Id)}`"
                        };
                        Embed.AddField(Field);
                        await arg.Channel.SendMessageAsync("", false, Embed.Build());
                    }
                    else
                    {
                        await arg.Channel.SendMessageAsync($"Hot hands! Gotta wait! `{(NotDone[arg.Author.Id] / 60).ToString().Substring(0, 3)}min` left.");
                    }
                }
                else
                {
                    var Prompt = new Prompt()
                    {
                        ChannelForPrompt = arg.Channel,
                        MaxTime          = 15,
                        Options          = new List <Emoji>()
                        {
                            { new Emoji("\uD83D\uDC4D") },
                            { new Emoji("\uD83D\uDC4E") }
                        }.ToArray(),
                        Target = arg.Author,
                        Title  = "You don't have a job (noob), wanna get one?"
                    };

                    var Response = await Prompt.ShowPrompt();

                    if (Response == null || Response.Name != "👍")
                    {
                        await arg.Channel.SendMessageAsync("you're broke but ok.");
                    }
                    else
                    {
                        await joblist.Maindo(arg);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 4
0
        public static async Task Maindo(SocketMessage arg)
        {
            try
            {
                SocketUser Victim = arg.MentionedUsers.Count() > 0 ? arg.MentionedUsers.First() : null;
                if (Victim != null && Victim.Id != arg.Author.Id)
                {
                    long AuthorBalance = ShopClass.ReadCurrency(arg.Author.Id);
                    long VictimBalance = ShopClass.ReadCurrency(Victim.Id);

                    string VictimPadlockKey = $"PADLOCK-ACTIVE";
                    bool   VictimHasPadlock = StoreHandler.LoadData(Victim.Id, VictimPadlockKey) != null;

                    if (AuthorBalance >= 1000 && VictimBalance >= 1000)
                    {
                        if (Wait.Contains(arg.Author.Id))
                        {
                            await arg.Channel.SendMessageAsync($"You have to wait! You're robbing people too much, maybe hang low for a bit? :weary:");
                        }
                        else
                        {
                            new Thread(x =>
                            {
                                Wait.Add(arg.Author.Id);
                                Thread.Sleep(WaitTime_Minutes * 60000);
                                Wait.Remove(arg.Author.Id);
                            }).Start();
                            if (VictimHasPadlock)
                            {
                                int Lost = (int)(AuthorBalance * 0.1);
                                await arg.Channel.SendMessageAsync($"Your victim had a padlock! You had no chance );  ..  Lost 10% of your balance (`${Lost}`)");

                                StoreHandler.RemoveData(Victim.Id, VictimPadlockKey);
                                Thread.Sleep(3500);
                                await arg.Channel.TriggerTypingAsync();

                                Thread.Sleep(3500);
                                await arg.Channel.SendMessageAsync($"My bad! Ima ping you so you know your padlock is gone noob <@{Victim.Id}>");
                            }
                            else
                            {
                                Random Ran         = new Random();
                                int    SuccessRate = Ran.Next(0, 20) - 10;
                                int    Took        = (int)(((double)SuccessRate) / 100 * VictimBalance);
                                int    LostIfFail  = (int)(((double)SuccessRate) / 100 * AuthorBalance);

                                if (SuccessRate >= 0)
                                {
                                    ShopClass.AddCurrency(Victim.Id, -Took);
                                    ShopClass.AddCurrency(arg.Author.Id, Took);
                                    await arg.Channel.SendMessageAsync($"Hope you're happy with your trash life decisions, take the money you stole: `${Took}`");
                                }
                                else
                                {
                                    ShopClass.AddCurrency(arg.Author.Id, LostIfFail);
                                    await arg.Channel.SendMessageAsync($"For once you thought maybe you were good at something. Keep looking, you're terrible at this; you got caught. Paid `${LostIfFail}` to the authorities so they'd leave you alone.");
                                }
                            }
                        }
                    }
                    else if (VictimBalance <= 1000 && AuthorBalance >= 1000)
                    {
                        await arg.Channel.SendMessageAsync($"You're gonna steal basically everything they have. :pleading_face: (Victim must have over `$1000`)");
                    }
                    else
                    {
                        await arg.Channel.SendMessageAsync($"You need more than `$1000` to rob someone.");
                    }
                }
                else if (Victim != null && arg.Author.Id == Victim.Id)
                {
                    await arg.Channel.SendMessageAsync($"you cant rob yourself - please mention a *different* user.");
                }
                else
                {
                    await arg.Channel.SendMessageAsync($"lol you cant rob yourself - please mention a user.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 5
0
        public static async Task Maindo(SocketMessage arg)
        {
            try
            {
                string ToBuy = arg.Content.ToLower().Contains(' ') ? arg.Content.ToLower().Split(' ')[1] : null;
                long   Count = 1;

                if (arg.Content.ToLower().Split(' ').Length >= 3)
                {
                    if (!long.TryParse(arg.Content.ToLower().Split(' ')[2], out Count))
                    {
                        Count = 1;
                    }
                }

                if (ToBuy != null)
                {
                    if (Enum.TryParse(ToBuy, out Product ProductBuying))
                    {
                        Receipt Buy = Economy.Buy(ProductBuying, Count, arg.Author.Id);
                        if (Buy.Success)
                        {
                            await arg.Channel.SendMessageAsync($"Successfully bought `{ProductBuying}` (x{Buy.Amount}) for `${Buy.Cost}`.");
                        }
                        else
                        {
                            await arg.Channel.SendMessageAsync($"Not enough money! You have `${ShopClass.ReadCurrency(arg.Author.Id)}` and need `${Buy.Cost}`");
                        }
                    }
                    else
                    {
                        await arg.Channel.SendMessageAsync($@"The item ""`{ToBuy}`"" doesn't exist. :pensive");
                    }
                }
                else
                {
                    await arg.Channel.SendMessageAsync($"Please specify what you'd like to buy!");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }