Example #1
0
        public async Task Jump(IUser target)
        {
            UserData d = GetUserData(Context.Message.Author.Id);

            if (d.HasCooldown(Cooldown.Steal))
            {
                CooldownData cd = d.cooldowns[Cooldown.Steal];
                await QuickEmbed($"You have to wait {cd.remainingTime} before stealing again!");

                return;
            }

            d.AddCooldown(Cooldown.Steal, configs.steal_cooldown);

            UserData t = GetUserData(target.Id);

            if (rnd.Next(0, 100) <= configs.steal_success_percentage) //successful
            {
                int stealamount = (int)(t.cash * configs.steal_money_percentage / 100f);

                d.cash += stealamount;
                t.cash -= stealamount;

                users[Context.Message.Author.Id] = d; //didn't use method because this is used twice
                users[target.Id] = t;

                SaveUserDataToJson();
                await QuickEmbed($"{Context.Message.Author.Mention} just stole **${stealamount}** from {target.Mention}!");

                return;
            }
            SaveUserDataToJson();

            await QuickEmbed($"{Context.Message.Author.Mention} has been caught stealing from {target.Mention}!");
        }
Example #2
0
        public async Task Work()
        {
            UserData temp = GetUserData(Context.Message.Author.Id); //temp not getting anything

            //cooldown

            if (temp.HasCooldown(Cooldown.Work))
            {
                await QuickEmbed($"You have to wait " +
                                 $"{temp.cooldowns[Cooldown.Work].remainingTime} more seconds before working");

                return;
            }

            temp.AddCooldown(Cooldown.Work, configs.work_cooldown);

            //money

            int moneyearned = (int)(configs.work_base * (1 + (rnd.Next(0, configs.work_random_percentage) / 100f)));

            temp.cash += moneyearned;

            ChangeUserData(Context.Message.Author.Id, temp);

            //ALL THE BACKEND CODE IS DONE. THIS IS JUST DISPLAY

            await QuickEmbed($"{Context.Message.Author.Mention} just worked and got **{moneyearned}** dollars!");
        }