Exemplo n.º 1
0
        public async Task Shoot(IGuildUser userToShoot, [Own][Remainder] Gun gun)
        {
            if (userToShoot.Id == Context.User.Id)
            {
                ReplyError("Hey, look at that retard! He's trying to shoot himself l0l.");
            }

            var dbUser = await _userRepo.GetUserAsync(userToShoot);

            if (CryptoRandom.Roll() < gun.Accuracy)
            {
                var invData = _gameService.InventoryData(dbUser);
                var damage  = invData.Any(x => x is Armour) ? (int)(gun.Damage * 0.8) : gun.Damage;
                //TODO: Rework armour.

                await _userRepo.ModifyAsync(dbUser, x => x.Health -= damage);

                await _gameService.ModifyInventoryAsync(Context.DbUser, "Bullet", -1);

                if (dbUser.Health <= 0)
                {
                    foreach (var item in dbUser.Inventory.Elements)
                    {
                        await _gameService.ModifyInventoryAsync(Context.DbUser, item.Name, item.Value.AsInt32);
                    }

                    await _userRepo.DeleteAsync(dbUser);

                    await userToShoot.TryDMAsync($"Unfortunately, you were killed by {Context.User.Boldify()}. All your data has been reset.");

                    await _userRepo.EditCashAsync(Context, dbUser.Bounty);

                    await ReplyAsync($"Woah, you just killed {userToShoot.Boldify()}. You just earned {dbUser.Bounty.USD()} **AND** their inventory, congrats.");
                }
                else
                {
                    await ReplyAsync($"Nice shot, you just dealt {damage} damage to {userToShoot.Boldify()}.");

                    await userToShoot.TryDMAsync($"{Context.User} tried to kill you, but n***a you *AH, HA, HA, HA, STAYIN' ALIVE*. -{damage} health. Current Health: {dbUser.Health}");
                }
            }
            else
            {
                await ReplyAsync($"The n***a f*****g dodged the bullet, literally. What in the sac of nuts.");
            }
            await _gameService.ModifyInventoryAsync(Context.DbUser, "Bullet", -1);

            _cooldownService.TryAdd(new CommandCooldown(Context.User.Id, Context.Guild.Id, "Shoot", Config.ShootCooldown));
        }
Exemplo n.º 2
0
        public async Task Donate(decimal money, [Remainder] IGuildUser user)
        {
            if (user.Id == Context.User.Id)
            {
                ReplyError("Hey kids! Look at that retard, he is trying to give money to himself!");
            }
            else if (money < Config.DONATE_MIN)
            {
                ReplyError($"Lowest donation is {Config.DONATE_MIN}$.");
            }
            else if (Context.Cash < money)
            {
                ReplyError($"You do not have enough money. Balance: {Context.Cash.USD()}.");
            }

            await _userRepo.EditCashAsync(Context, -money);

            decimal deaMoney = money * Config.DEA_CUT / 100;

            var otherDbUser = await _userRepo.GetUserAsync(user);

            await _userRepo.EditCashAsync(user, Context.DbGuild, otherDbUser, money - deaMoney);

            await ReplyAsync($"Successfully donated {(money - deaMoney).USD()} to {user.Boldify()}.\nDEA has taken a {deaMoney.USD()} cut out of this donation. Balance: {Context.Cash.USD()}.");
        }
Exemplo n.º 3
0
        public async Task Money([Remainder] IGuildUser user = null)
        {
            user = user ?? Context.GUser;
            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await SendAsync($"{user.Boldify()}'s balance: {dbUser.Cash.USD()}.");
        }
Exemplo n.º 4
0
        public async Task CustomMute(double hours, IGuildUser userToMute, [Remainder] string reason = null)
        {
            if (hours > 168)
            {
                ReplyError("You may not mute a user for more than a week.");
            }
            else if (hours < 1)
            {
                ReplyError("You may not mute a user for less than 1 hour.");
            }

            var time      = hours == 1 ? "hour" : "hours";
            var mutedRole = Context.Guild.GetRole(Context.DbGuild.MutedRoleId);

            if (mutedRole == null)
            {
                ReplyError($"You may not mute users if the muted role is not valid.\nPlease use the " +
                           $"{Context.DbGuild.Prefix}SetMutedRole command to change that.");
            }
            else if (_moderationService.GetPermLevel(Context.DbGuild, userToMute) > 0)
            {
                ReplyError("You cannot mute another mod.");
            }

            await userToMute.AddRoleAsync(mutedRole);

            await _muteRepo.InsertMuteAsync(userToMute, TimeSpan.FromHours(hours));

            await SendAsync($"{Context.User.Boldify()} has successfully muted {userToMute.Boldify()} for {hours} {time}.");

            await _moderationService.TryInformSubjectAsync(Context.User, "Mute", userToMute, reason);

            await _moderationService.TryModLogAsync(Context.DbGuild, Context.Guild, "Mute", Config.MuteColor, reason, Context.User, userToMute, "Length", $"{hours} {time}");
        }
Exemplo n.º 5
0
        public async Task ModifyInventory(int quantity, Item item, IGuildUser user = null)
        {
            user = user ?? Context.GUser;
            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _gameService.ModifyInventoryAsync(dbUser, item.Name, quantity);

            await ReplyAsync($"You have successfully modified {user.Boldify()}'s inventory.");
        }
Exemplo n.º 6
0
        public async Task ModifyCash(decimal money, [Remainder] IGuildUser user = null)
        {
            user = user ?? Context.GUser;

            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _userRepo.EditCashAsync(user, Context.DbGuild, dbUser, money);

            await ReplyAsync($"You have successfully modified {user.Boldify()}'s balance to: {dbUser.Cash.USD()}.");
        }
Exemplo n.º 7
0
        public async Task ResetUser([Remainder] IGuildUser user = null)
        {
            user = user ?? Context.GUser;

            await _userRepo.Collection.DeleteOneAsync(y => y.UserId == user.Id && y.GuildId == user.GuildId);

            await _rankHandler.HandleAsync(Context.Guild, user, Context.DbGuild, await _userRepo.GetUserAsync(user));

            await SendAsync($"Successfully reset {user.Boldify()}'s data.");
        }
Exemplo n.º 8
0
        public async Task ResetUser([Remainder] IGuildUser user = null)
        {
            user = user ?? Context.GUser;
            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _userRepo.DeleteAsync(dbUser);

            await _RankHandler.HandleAsync(user, Context.DbGuild, await _userRepo.GetUserAsync(user));

            await SendAsync($"You have successfully reset {user.Boldify()}'s data.");
        }
Exemplo n.º 9
0
        public async Task HundredK([Remainder] IGuildUser user = null)
        {
            user = user ?? Context.GUser;

            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _userRepo.ModifyAsync(dbUser, x => x.Cash = 100000);

            await _rankHandler.HandleAsync(Context.Guild, user, Context.DbGuild, await _userRepo.GetUserAsync(user));

            await SendAsync($"Successfully set {user.Boldify()}'s balance to $100,000.00.");
        }
Exemplo n.º 10
0
        public async Task Remove(decimal money, [Remainder] IGuildUser user)
        {
            if (money < 0)
            {
                ReplyError("You may not remove a negative amount of money from a user's balance.");
            }

            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _userRepo.EditCashAsync(user, Context.DbGuild, dbUser, -money);

            await SendAsync($"Successfully removed {money.USD()} from {user.Boldify()}'s balance.");
        }
Exemplo n.º 11
0
        public async Task Add(decimal money, [Remainder] IGuildUser user)
        {
            if (money < 0)
            {
                ReplyError("You may not add negative money to a user's balance.");
            }

            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _userRepo.EditCashAsync(user, Context.DbGuild, dbUser, money);

            await SendAsync($"Successfully added {money.USD()} to {user.Boldify()}'s balance.");
        }
Exemplo n.º 12
0
        public async Task Ban(IGuildUser userToBan, [Remainder] string reason = null)
        {
            if (_moderationService.GetPermLevel(Context.DbGuild, Context.GUser) <= _moderationService.GetPermLevel(Context.DbGuild, userToBan))
            {
                ReplyError("You cannot ban another mod with a permission level higher or equal to your own.");
            }

            await _moderationService.TryInformSubjectAsync(Context.User, "Ban", userToBan, reason);

            await Context.Guild.AddBanAsync(userToBan);

            await SendAsync($"{Context.User.Boldify()} has successfully banned {userToBan.Boldify()}.");

            await _moderationService.TryModLogAsync(Context.DbGuild, Context.Guild, "Ban", Config.ErrorColor, reason, Context.User, userToBan);
        }
Exemplo n.º 13
0
        public async Task Kick(IGuildUser userToKick, [Remainder] string reason = null)
        {
            if (_moderationService.GetPermLevel(Context.DbGuild, userToKick) > 0)
            {
                ReplyError("You cannot kick another mod!");
            }

            await _moderationService.TryInformSubjectAsync(Context.User, "Kick", userToKick, reason);

            await userToKick.KickAsync();

            await SendAsync($"{Context.User.Boldify()} has successfully kicked {userToKick.Boldify()}.");

            await _moderationService.TryModLogAsync(Context.DbGuild, Context.Guild, "Kick", Config.KickColor, reason, Context.User, userToKick);
        }
Exemplo n.º 14
0
        public async Task KickFromGang([Remainder] IGuildUser gangMember)
        {
            if (gangMember.Id == Context.User.Id)
            {
                ReplyError("You may not kick yourself!");
            }
            else if (!_gangRepo.IsMemberOfAsync(Context.Gang, gangMember.Id))
            {
                ReplyError("This user is not a member of your gang!");
            }

            await _gangRepo.RemoveMemberAsync(Context.Gang, gangMember.Id);

            await ReplyAsync($"You have successfully kicked {gangMember.Boldify()} from {Context.Gang.Name}.");

            await gangMember.Id.TryDMAsync(Context.Client, $"You have been kicked from {Context.Gang.Name}.");
        }
Exemplo n.º 15
0
        public async Task Inventory([Remainder] IGuildUser user)
        {
            user = user ?? Context.GUser;
            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            if (dbUser.Inventory.ElementCount == 0)
            {
                ReplyError("You have nothing in your inventory.");
            }
            var description = string.Empty;

            foreach (var item in dbUser.Inventory.Elements)
            {
                description += $"**{item.Name}** : {item.Value}.";
            }
            await SendAsync(description, $"Inventory of {user.Boldify()}");
        }
Exemplo n.º 16
0
        public async Task Unmute(IGuildUser userToUnmute, [Remainder] string reason = null)
        {
            if (!userToUnmute.RoleIds.Any(x => x == Context.DbGuild.MutedRoleId))
            {
                ReplyError("You cannot unmute a user who isn't muted.");
            }

            await userToUnmute.RemoveRoleAsync(Context.Guild.GetRole(Context.DbGuild.MutedRoleId));

            await _muteRepo.RemoveMuteAsync(userToUnmute.Id, userToUnmute.GuildId);

            await SendAsync($"{Context.User.Boldify()} has successfully unmuted {userToUnmute.Boldify()}.");

            await _moderationService.TryInformSubjectAsync(Context.User, "Unmute", userToUnmute, reason);

            await _moderationService.TryModLogAsync(Context.DbGuild, Context.Guild, "Unmute", Config.UnmuteColor, reason, Context.User, userToUnmute);
        }
Exemplo n.º 17
0
        public async Task ModifyHealth(int modifyHealth, [Remainder] IGuildUser user = null)
        {
            user = user ?? Context.GUser;

            var dbUser = user.Id == Context.User.Id ? Context.DbUser : await _userRepo.GetUserAsync(user);

            await _userRepo.ModifyAsync(dbUser, x => x.Health += modifyHealth);

            if (dbUser.Health <= 0)
            {
                await _userRepo.DeleteAsync(dbUser);
                await ReplyAsync("N***A! You just killed him!");
            }
            else
            {
                await ReplyAsync($"You have successfully modified {user.Boldify()}'s health to: {dbUser.Health}.");
            }
        }
Exemplo n.º 18
0
        public async Task Bully(IGuildUser userToBully, [Remainder] string nickname)
        {
            if (nickname.Length > 32)
            {
                ReplyError("The length of a nickname may not be longer than 32 characters.");
            }
            else if (_moderationService.GetPermLevel(Context, userToBully) > 0)
            {
                ReplyError("You may not bully a moderator.");
            }
            else if ((await _userRepo.GetUserAsync(userToBully)).Cash >= Context.Cash)
            {
                ReplyError("You may not bully a user with more money than you.");
            }

            await userToBully.ModifyAsync(x => x.Nickname = nickname);

            await SendAsync($"{userToBully.Boldify()} just got ***BULLIED*** by {Context.User.Boldify()} with his new nickname: \"{nickname}\".");
        }
Exemplo n.º 19
0
        public async Task Stab(IGuildUser userToStab, [Own][Remainder] Knife knife)
        {
            if (userToStab.Id == Context.User.Id)
            {
                ReplyError("Hey, look at that retard! He's trying to stab himself lmfao.");
            }

            var dbUser = await _userRepo.GetUserAsync(userToStab);

            if (CryptoRandom.Roll() < knife.Accuracy)
            {
                var invData = _gameService.InventoryData(dbUser);
                var damage  = invData.Any(x => x is Armour) ? (int)(knife.Damage * 0.8) : knife.Damage;
                //TODO: Rework armour.

                await _userRepo.ModifyAsync(dbUser, x => x.Health -= damage);

                if (dbUser.Health <= 0)
                {
                    foreach (var item in dbUser.Inventory.Elements)
                    {
                        await _gameService.ModifyInventoryAsync(Context.DbUser, item.Name, item.Value.AsInt32);
                    }

                    await _userRepo.DeleteAsync(dbUser);

                    await userToStab.TryDMAsync($"Unfortunately, you were killed by {Context.User.Boldify()}. All your data has been reset.");

                    await _userRepo.EditCashAsync(Context, dbUser.Bounty);
                    await ReplyAsync($"Woah, you just killed {userToStab.Boldify()}. You just earned {dbUser.Bounty.USD()} **AND** their inventory, congrats.");
                }
                else
                {
                    await userToStab.TryDMAsync($"{Context.User} tried to kill you, but n***a *AH, HA, HA, HA, STAYIN' ALIVE*. -{damage} health. Current Health: {dbUser.Health}");
                    await ReplyAsync($"Just stabbed that n***a in the heart, you just dealt {damage} damage to {userToStab.Boldify()}.");
                }
            }
            else
            {
                await ReplyAsync($"This n***a actually did some acrobatics shit and bounced out of the way before you stabbed him.");
            }
            _cooldownService.TryAdd(new CommandCooldown(Context.User.Id, Context.Guild.Id, "Stab", Config.StabCooldown));
        }
Exemplo n.º 20
0
        public async Task Enslave(IGuildUser userToEnslave, [Own][Remainder] Weapon weapon)
        {
            var user = await _userRepo.GetUserAsync(userToEnslave);

            if (userToEnslave.Id == Context.User.Id)
            {
                ReplyError("Hey good buddies, look at that retard, trying to enslave himself.");
            }
            else if (Context.DbUser.SlaveOf != 0)
            {
                ReplyError("You cannot enslave someone if you are a slave.");
            }
            else if (user.SlaveOf != 0)
            {
                ReplyError("This user is already a slave.");
            }
            else if (user.Health > Config.MaxEnslaveHealth)
            {
                ReplyError($"The user must be under {Config.MaxEnslaveHealth} health to enslave.");
            }

            if (weapon.Accuracy >= CryptoRandom.Roll())
            {
                await _userRepo.ModifyAsync(user, x => x.SlaveOf = Context.User.Id);
                await ReplyAsync($"You have successfully enslaved {userToEnslave.Boldify()}. {Config.SlaveCollection.ToString("P")} of all cash earned by all your slaves will go straight to you when you use `{Context.DbGuild.Prefix}Collect`.");

                await userToEnslave.TryDMAsync($"AH SHIT N***A! Looks like {Context.User.Boldify()} got you enslaved. The only way out is `{Context.DbGuild.Prefix}suicide`.");
            }
            else
            {
                await ReplyAsync("YOU GOT SLAMMED RIGHT IN THE C**T BY A N***A! :joy: :joy: :joy: Only took him 10 seconds to get you to the ground LMFAO.");

                await userToEnslave.TryDMAsync($"{Context.User.Boldify()} tried to enslave you but accidentally got pregnant and now he can't move :joy: :joy: :joy:.");
            }
            _cooldownService.TryAdd(new CommandCooldown(Context.User.Id, Context.Guild.Id, "Enslave", Config.EnslaveCooldown));
        }
Exemplo n.º 21
0
        public async Task Mute(IGuildUser userToMute, [Remainder] string reason = null)
        {
            var mutedRole = Context.Guild.GetRole(Context.DbGuild.MutedRoleId);

            if (mutedRole == null)
            {
                ReplyError($"You may not mute users if the muted role is not valid.\nPlease use the " +
                           $"`{Context.Prefix}SetMutedRole` command to change that.");
            }
            else if (_moderationService.GetPermLevel(Context.DbGuild, userToMute) > 0)
            {
                ReplyError("You cannot mute another mod.");
            }

            await userToMute.AddRoleAsync(mutedRole);

            await _muteRepo.InsertMuteAsync(userToMute, TimeSpan.FromDays(365));

            await SendAsync($"{Context.User.Boldify()} has successfully muted {userToMute.Boldify()}.");

            await _moderationService.TryInformSubjectAsync(Context.User, "Mute", userToMute, reason);

            await _moderationService.TryModLogAsync(Context.DbGuild, Context.Guild, "Mute", Config.MuteColor, reason, Context.User, userToMute);
        }
Exemplo n.º 22
0
        public async Task Trade(IGuildUser userToTrade, int exchangeItemQuantity, [Own] Item itemInExchange, int requestedItemQuantity, Item requestedItem)
        {
            if (userToTrade.Id == Context.User.Id)
            {
                ReplyError("It takes great skill and concetration to actually reach full retard by trading with yourself. You are not quite there.");
            }
            else if (exchangeItemQuantity < 0 || requestedItemQuantity < 0)
            {
                ReplyError("You may not trade negative items.");
            }

            var userDM = await userToTrade.CreateDMChannelAsync();

            var key     = CryptoRandom.Next();
            var firstS  = exchangeItemQuantity == 1 ? string.Empty : "s";
            var secondS = requestedItemQuantity == 1 ? string.Empty : "s";

            await userDM.SendAsync($"**Offer:** {exchangeItemQuantity} {itemInExchange.Name}{firstS}\n" +
                                   $"**Request:** {requestedItemQuantity} {requestedItem.Name}{secondS}\n\n" +
                                   $"Please respond with \"{key}\" within 5 minutes to accept this trade.",
                                   $"Trade Request from {Context.User}");

            await ReplyAsync($"You have successfully informed {userToTrade.Boldify()} of your trade request.");

            var answer = await _interactiveService.WaitForMessage(userDM, x => x.Content == key.ToString(), TimeSpan.FromMinutes(5));

            if (answer != null)
            {
                var newOffererDbuser = await _userRepo.GetUserAsync(Context.GUser);

                var newRequesterDbuser = await _userRepo.GetUserAsync(userToTrade);

                if (!newOffererDbuser.Inventory.Contains(itemInExchange.Name))
                {
                    await userDM.SendErrorAsync($"{Context.User.Boldify()} does not own the following item: {itemInExchange.Name}.");
                }
                else if (!newRequesterDbuser.Inventory.Contains(requestedItem.Name))
                {
                    await userDM.SendErrorAsync($"You do not own the following item: {requestedItem.Name}.");
                }
                else if (!(newOffererDbuser.Inventory[itemInExchange.Name].AsInt32 >= exchangeItemQuantity))
                {
                    await userDM.SendErrorAsync($"{Context.User.Boldify()} does not own {exchangeItemQuantity} {itemInExchange.Name}{firstS}.");
                }
                else if (!(newRequesterDbuser.Inventory[requestedItem.Name].AsInt32 >= requestedItemQuantity))
                {
                    await userDM.SendErrorAsync($"You do not own {requestedItemQuantity} {requestedItem.Name}{secondS}.");
                }
                else
                {
                    await _gameService.ModifyInventoryAsync(newOffererDbuser, itemInExchange.Name, -exchangeItemQuantity);

                    await _gameService.ModifyInventoryAsync(newOffererDbuser, requestedItem.Name, requestedItemQuantity);

                    await _gameService.ModifyInventoryAsync(newRequesterDbuser, itemInExchange.Name, exchangeItemQuantity);

                    await _gameService.ModifyInventoryAsync(newRequesterDbuser, requestedItem.Name, -requestedItemQuantity);

                    var message = $"**Offer:** {exchangeItemQuantity} {itemInExchange.Name}{firstS}\n" +
                                  $"**Request:** {requestedItemQuantity} {requestedItem.Name}{secondS}\n\n";

                    await userDM.SendAsync(message, $"Completed Trade with {Context.User}");

                    await Context.GUser.TryDMAsync(message, $"Completed Trade with {userToTrade}");
                }
            }
        }