Esempio n. 1
0
 public async Task SetClass(CommandContext context,
                            [Description(Descriptions.WowCharacter)] UserWowCharacter character,
                            [Description(Descriptions.WowClass)] WowClass wowClass)
 {
     character.Character.WowClassId = wowClass.Id;
     await m_dbContext.SaveChangesAsync();
 }
Esempio n. 2
0
        public IReadOnlyList <PvpApiRowModel> Get(BlizzardLocale locale = BlizzardLocale.All, WowPvpBracket bracket = WowPvpBracket.All,
                                                  WowClass wowClass     = WowClass.All, WowSpec spec = WowSpec.All, uint skip = 0, uint take = 100)
        {
            var query = _liteDbRepo.Query <PvpApiRowModel>();

            if (locale != BlizzardLocale.All)
            {
                query = query.Where(row => row.Locale == (byte)locale);
            }

            if (bracket != WowPvpBracket.All)
            {
                query = query.Where(row => row.Bracket == (byte)bracket);
            }

            if (wowClass != WowClass.All)
            {
                query = query.Where(row => row.ClassId == (byte)wowClass);
            }

            if (spec != WowSpec.All)
            {
                query = query.Where(row => row.SpecId == (ushort)spec);
            }

            query = query.Where(Query.All("Rating"))
                    .Where(Query.All("Name"))
                    .Skip((int)skip)
                    .Limit((int)take);

            IReadOnlyList <PvpApiRowModel> result = query.ToList();

            return(result);
        }
Esempio n. 3
0
        public static bool TryParseClass(this string classString, out WowClass wowClass)
        {
            wowClass = WowClass.Unknown;
            switch (classString)
            {
            case { } s when s.Equals("warrior", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Warrior;

                break;

            case { } s when s.Equals("paladin", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Paladin;

                break;

            case { } s when s.Equals("hunter", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Hunter;

                break;

            case { } s when s.Equals("shaman", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Shaman;

                break;

            case { } s when s.Equals("rogue", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Rogue;

                break;

            case { } s when s.Equals("druid", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Druid;

                break;

            case { } s when s.Equals("warlock", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Warlock;

                break;

            case { } s when s.Equals("priest", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Priest;

                break;

            case { } s when s.Equals("mage", StringComparison.CurrentCultureIgnoreCase):
                wowClass = WowClass.Mage;

                break;
            }

            return(wowClass != WowClass.Unknown);
        }
Esempio n. 4
0
 public static Brush GetClassPrimaryBrush(WowClass wowClass)
 {
     return(wowClass switch
     {
         WowClass.Deathknight => dkPrimaryBrush,
         WowClass.Druid => druidPrimaryBrush,
         WowClass.Hunter => hunterPrimaryBrush,
         WowClass.Mage => magePrimaryBrush,
         WowClass.Paladin => paladinPrimaryBrush,
         WowClass.Priest => priestPrimaryBrush,
         WowClass.Rogue => roguePrimaryBrush,
         WowClass.Shaman => shamanPrimaryBrush,
         WowClass.Warlock => warlockPrimaryBrush,
         WowClass.Warrior => warriorPrimaryBrush,
         _ => new SolidBrush(Color.White),
     });
Esempio n. 5
0
 static string SpellToCheck(WowClass wowClass)
 {
     return(wowClass switch
     {
         WowClass.None => string.Empty,
         WowClass.Warrior => Warrior335a.HeroicStrike,
         WowClass.Paladin => string.Empty,
         WowClass.Hunter => string.Empty,
         WowClass.Rogue => string.Empty,
         WowClass.Priest => Priest335a.Smite,
         WowClass.Deathknight => string.Empty,
         WowClass.Shaman => Shaman335a.LightningBolt,
         WowClass.Mage => Mage335a.Fireball,
         WowClass.Warlock => string.Empty,
         WowClass.Druid => string.Empty,
         _ => throw new ArgumentOutOfRangeException(nameof(wowClass), $"Not expected wowClass value: {wowClass}")
     });
Esempio n. 6
0
            public async Task AddCharacter(CommandContext context,
                                           [Description(Descriptions.WowCharacter)] QualifiedWowCharacter character,
                                           [Description(Descriptions.WowClass)] WowClass characterClass,
                                           [Description(Descriptions.WowFaction)] WowFaction faction)
            {
                if (User.WowCharacters.Any(x => x.WowServerId == character.Server.Id && x.Name.Equals(character.Name, StringComparison.InvariantCultureIgnoreCase)))
                {
                    return;
                }

                var wowCharacter = new WowCharacter()
                {
                    Name        = character.Name,
                    WowFaction  = faction,
                    GuildId     = Guild.Id,
                    UserId      = User.Id,
                    WowClassId  = characterClass.Id,
                    WowServerId = character.Server.Id,
                };

                m_dbContext.WowCharacters.Add(wowCharacter);
                await m_dbContext.SaveChangesAsync();
            }
Esempio n. 7
0
 /// <summary>
 /// Return current <see cref="Profile"/>.
 /// </summary>
 /// <param name="wowClass">Character's <see cref="WowClass"/></param>
 /// <returns><see cref="Profile"/>.</returns>
 public Profile this[WowClass wowClass] = > ProfileList.FirstOrDefault(n => n.Class == wowClass);
Esempio n. 8
0
 public static bool TryParseClass(this IRole role, out WowClass wowClass)
 => role.Name.TryParseClass(out wowClass);
Esempio n. 9
0
 public Task <IReadOnlyList <PvpApiRowModel> > GetAsync(BlizzardLocale locale = BlizzardLocale.All, WowPvpBracket bracket = WowPvpBracket.All,
                                                        WowClass wowClass     = WowClass.All, WowSpec spec = WowSpec.All, uint skip = 0, uint take = 100)
 {
     return(Task.Run(() => Get(locale, bracket, wowClass, spec, skip, take)));
 }
Esempio n. 10
0
 /// <summary>
 /// Возвращает профиль для указанного класса.
 /// </summary>
 /// <param name="wowClass">Класс персонажа.</param>
 /// <returns>Профиль ротаций <see cref="YanittaProfile"/>.</returns>
 public Profile this[WowClass wowClass]
 {
     get { return(ProfileList.FirstOrDefault(n => n.Class == wowClass)); }
 }
Esempio n. 11
0
 public static Class ToDomainClass(this WowClass wowClass)
 {
     return(ConversionDictionary.ToDictionary(kvp => kvp.Value, kvp => kvp.Key)[wowClass]);
 }
Esempio n. 12
0
 /// <summary>
 /// Возвращает профиль для указанного класса.
 /// </summary>
 /// <param name="wowClass">Класс персонажа.</param>
 /// <returns>Профиль ротаций <see cref="YanittaProfile"/>.</returns>
 public Profile this[WowClass wowClass]
 {
     get { return ProfileList.FirstOrDefault(n => n.Class == wowClass); }
 }
Esempio n. 13
0
 public Task AddCharacterAsync([Description("Mention or username")] CachedMember user, [Description("Character Name")] string characterName, [Description("Role: Tank|Healer|Melee|Ranged")] ClassRole role, [Description("Class: Druid|Hunter|Mage|Paladin|Priest|Rogue|Warlock|Warrior")] WowClass @class)
 => AddCharacterAsync(user, characterName, @class, role);
Esempio n. 14
0
        public async Task AddCharacterAsync([Description("Mention or username")] CachedMember user, [Description("Character Name")] string characterName, [Description("Class: Druid|Hunter|Mage|Paladin|Priest|Rogue|Warlock|Warrior")] WowClass @class, [Description("Role: Tank|Healer|Melee|Ranged")] ClassRole role)
        {
            var dbUser = await DbContext.Database.RequestRepository <UserRepository>().GetOrAddAsync(user.Id);

            var character = new WowCharacter
            {
                CharacterName = characterName,
                Class         = @class,
                Role          = role,
                Owner         = dbUser
            };

            dbUser.Characters.Add(character);

            await DbContext.Database.SaveChangesAsync();

            await ConfirmAsync();
        }
Esempio n. 15
0
        public async Task AddCharacterAsync([Description("Character Name")] string characterName, [Description("Class: Druid|Hunter|Mage|Paladin|Priest|Rogue|Warlock|Warrior")] WowClass @class, [Description("Role: Tank|Healer|Melee|Ranged")] ClassRole role)
        {
            if (DbContext.User.Characters.Any(c => c.Class == @class))
            {
                var msg = await ReplyAsync("You can only add one character per class.");

                _ = Task.Run(async() => { await Task.Delay(TimeSpan.FromSeconds(15)); await msg.DeleteAsync(); });
                return;
            }

            var character = new WowCharacter
            {
                CharacterName = characterName,
                Class         = @class,
                Role          = role,
                Owner         = DbContext.User
            };

            DbContext.User.Characters.Add(character);
            await ConfirmAsync();
        }
Esempio n. 16
0
 static string SpellToCheck(WowClass wowClass) => wowClass switch
 {
Esempio n. 17
0
 public static string GetEmoteName(this WowClass wowClass)
 {
     return(EmoteDictionary[wowClass]);
 }