Exemplo n.º 1
0
        public async static void LoadRoles(IUser User)
        {
            string race = GetAttribute("RACE", User).ToLower();

            if (race == "human")
            {
                if (await Funcs.InGuild(Bot.client.GetGuild(Constants.Guilds.DBZ_EARTH), User))
                {
                    var guild = Bot.client.GetGuild(Constants.Guilds.DBZ_EARTH);
                    var gUser = guild.GetUser(User.Id);
                    await gUser.AddRoleAsync(guild.GetRole(Constants.Roles.ON_EARTH));

                    for (int i = 0; i < 3; i++)
                    {
                        var rGuild = Bot.client.GetGuild(Constants.Guilds.PLANETS[i]);
                        var rRole  = rGuild.GetRole(Constants.Roles.HUMAN[i]);
                        if (await Funcs.InGuild(rGuild, User))
                        {
                            var rUser = rGuild.GetUser(User.Id);
                            await rUser.AddRoleAsync(rRole);
                        }
                    }
                }
            }
            else if (race == "saiyan")
            {
                if (await Funcs.InGuild(Bot.client.GetGuild(Constants.Guilds.DBZ_VEGETA), User))
                {
                    var guild = Bot.client.GetGuild(Constants.Guilds.DBZ_VEGETA);
                    var gUser = guild.GetUser(User.Id);
                    await gUser.AddRoleAsync(guild.GetRole(Constants.Roles.ON_VEGETA));

                    for (int i = 0; i < 3; i++)
                    {
                        var rGuild = Bot.client.GetGuild(Constants.Guilds.PLANETS[i]);
                        var rRole  = rGuild.GetRole(Constants.Roles.SAIYAN[i]);
                        if (await Funcs.InGuild(rGuild, User))
                        {
                            var rUser = rGuild.GetUser(User.Id);
                            await rUser.AddRoleAsync(rRole);
                        }
                    }
                }
            }
            else if (race == "namekian")
            {
                if (await Funcs.InGuild(Bot.client.GetGuild(Constants.Guilds.DBZ_NAMEK), User))
                {
                    var guild = Bot.client.GetGuild(Constants.Guilds.DBZ_NAMEK);
                    var gUser = guild.GetUser(User.Id);
                    await gUser.AddRoleAsync(guild.GetRole(Constants.Roles.ON_NAMEK));

                    for (int i = 0; i < 3; i++)
                    {
                        var rGuild = Bot.client.GetGuild(Constants.Guilds.PLANETS[i]);
                        var rRole  = rGuild.GetRole(Constants.Roles.NAMEKIAN[i]);
                        if (await Funcs.InGuild(rGuild, User))
                        {
                            var rUser = rGuild.GetUser(User.Id);
                            await rUser.AddRoleAsync(rRole);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public async Task Train(string npcChoice)
        {
            bool npcfound = false;

            foreach (DBNPC npc in NPCList.NPCs)
            {
                if (Context.Channel.Id == npc.Location)
                {
                    if (npc.Name.ToLower().Contains(npcChoice.ToLower()))
                    {
                        npcfound = true;
                        JEmbed JEmb = new JEmbed();
                        JEmb.ThumbnailUrl = $@"DragonBall\Images\{npc.Name}.jpg";
                        JEmb.Author.Name  = npc.Name;
                        JEmb.Description  = npc.Dialogue;

                        JEmb.Fields.Add(new JEmbedField(x =>
                        {
                            x.Header = "Race:";
                            x.Text   = $"{npc.Race}";
                            x.Inline = true;
                        }));

                        JEmb.Fields.Add(new JEmbedField(x =>
                        {
                            x.Header = "Power Level:";
                            x.Text   = $"~{npc.Power_Level}";
                            x.Inline = true;
                        }));

                        string name = npc.Name;
                        if (npc.Name.Contains(" "))
                        {
                            name = $"\"{npc.Name}\"";
                        }

                        JEmb.Fields.Add(new JEmbedField(x =>
                        {
                            x.Header = $"db!train {name} 1";
                            x.Text   = "Train me!";
                        }));

                        JEmb.Fields.Add(new JEmbedField(x =>
                        {
                            x.Header = $"db!train {name} 2";
                            x.Text   = "Nevermind.";
                        }));

                        JEmb.ColorStripe = Funcs.GetColour(Context.User, Context.Guild);

                        await Context.Channel.SendMessageAsync("", embed : JEmb.Build());

                        break;
                    }
                }
            }
            if (!npcfound)
            {
                await Context.Channel.SendMessageAsync($"Cannot find NPC with name {npcChoice}.");
            }
        }
Exemplo n.º 3
0
        public async Task Train()
        {
            List <DBNPC>  inLocation = new List <DBNPC>();
            List <DBUser> here       = new List <DBUser>();

            foreach (DBNPC npc in NPCList.NPCs)
            {
                if (Context.Channel.Id == npc.Location)
                {
                    inLocation.Add(npc);
                }
            }

            foreach (DBUser user in Bot.sess.Players)
            {
                string location = DBFuncs.GetAttribute("LOCATION", user.User);
                if (location != "null")
                {
                    if (Context.Channel.Id == Convert.ToUInt64(location) && user.User.Id != Context.User.Id)
                    {
                        here.Add(user);
                    }
                }
            }

            var JEmb = new JEmbed();

            JEmb.Description = "People in area:";

            if (inLocation.Count > 0 || here.Count > 0)
            {
                foreach (DBNPC npc in inLocation)
                {
                    JEmb.Fields.Add(new JEmbedField(x =>
                    {
                        x.Header = npc.Name + " [NPC]";
                        x.Text   = $"Power Level: ~{npc.Power_Level}";
                    }));
                }

                foreach (DBUser user in here)
                {
                    JEmb.Fields.Add(new JEmbedField(x =>
                    {
                        x.Header = user.User.Username + " [PLAYER]";
                        x.Text   = $"Power Level: ~{DBFuncs.GetPowerLVL(user.User)}";
                    }));
                }

                JEmb.ColorStripe = Funcs.GetColour(Context.User, Context.Guild);
                JEmb.Footer.Text = "Type 'db!train [name]' to request to train with them!";
            }
            else
            {
                JEmb.Fields.Add(new JEmbedField(x =>
                {
                    x.Header = "None";
                    x.Text   = "There seems to be no one here.. Check another area.";
                }));
            }

            await Context.Channel.SendMessageAsync("", embed : JEmb.Build());
        }
Exemplo n.º 4
0
        public async Task Power(string direction, int amount)
        {
            if (direction == "up")
            {
                string race  = DBFuncs.GetAttribute("RACE", Context.User);
                IGuild guild = Bot.client.GetGuild(Constants.Guilds.DBZ_EARTH);
                var    user  = await guild.GetUserAsync(Context.User.Id);

                ulong[] role = new ulong[3];

                for (int i = 0; i < amount; i++)
                {
                    if ((user.RoleIds.Contains(Constants.Roles.KAIOKEN[0]) || role == Constants.Roles.KAIOKEN) && DBFuncs.HasSkill("Super Saiyan", Context.User))
                    {
                        await Power("down");

                        role = Constants.Roles.SUPER;
                    }
                    else if ((user.RoleIds.Contains(Constants.Roles.SUPER[0]) || role == Constants.Roles.SUPER) && DBFuncs.HasSkill("SSGSS", Context.User))
                    {
                        await Power("down");

                        role = Constants.Roles.SSGSS;
                    }
                    else if (DBFuncs.HasSkill("Kaioken", Context.User) && !user.RoleIds.Contains(Constants.Roles.SSGSS[0]))
                    {
                        role = Constants.Roles.KAIOKEN;
                    }
                }

                if (role[0] != 0)
                {
                    Funcs.GiveRole(role, Context.User);
                    DBSkill skill = DBFuncs.GetSkill(guild.GetRole(role[0]).Name);
                    DBFuncs.SetAttribute("MULTIPLIER", Context.User, Convert.ToString(skill.Power));
                }
                else
                {
                    await Context.Channel.SendMessageAsync("You attempt to power up further, but fail.");
                }
            }
            else if (direction == "down")
            {
                var guilds = Constants.Guilds.PLANETS;
                for (int i = 0; i < 3; i++)
                {
                    var guildID = guilds.ElementAt(i);
                    var guild   = Bot.client.GetGuild(guildID);
                    if (await Funcs.InGuild(guild, Context.User))
                    {
                        var user = guild.GetUser(Context.User.Id);
                        if (user.Roles.Contains(guild.GetRole(Constants.Roles.KAIOKEN[i])))
                        {
                            await user.RemoveRoleAsync(guild.GetRole(Constants.Roles.KAIOKEN[i]));
                        }
                        else if (user.Roles.Contains(guild.GetRole(Constants.Roles.SUPER[i])))
                        {
                            await user.RemoveRoleAsync(guild.GetRole(Constants.Roles.SUPER[i]));
                        }
                        else if (user.Roles.Contains(guild.GetRole(Constants.Roles.SSGSS[i])))
                        {
                            await user.RemoveRoleAsync(guild.GetRole(Constants.Roles.SSGSS[i]));
                        }
                    }
                    DBFuncs.SetAttribute("FORM", Context.User, "1");
                }
                DBFuncs.SetAttribute("MULTIPLIER", Context.User, "1");
            }
        }