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(); }
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); }
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); }
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), });
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}") });
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(); }
/// <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);
public static bool TryParseClass(this IRole role, out WowClass wowClass) => role.Name.TryParseClass(out wowClass);
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))); }
/// <summary> /// Возвращает профиль для указанного класса. /// </summary> /// <param name="wowClass">Класс персонажа.</param> /// <returns>Профиль ротаций <see cref="YanittaProfile"/>.</returns> public Profile this[WowClass wowClass] { get { return(ProfileList.FirstOrDefault(n => n.Class == wowClass)); } }
public static Class ToDomainClass(this WowClass wowClass) { return(ConversionDictionary.ToDictionary(kvp => kvp.Value, kvp => kvp.Key)[wowClass]); }
/// <summary> /// Возвращает профиль для указанного класса. /// </summary> /// <param name="wowClass">Класс персонажа.</param> /// <returns>Профиль ротаций <see cref="YanittaProfile"/>.</returns> public Profile this[WowClass wowClass] { get { return ProfileList.FirstOrDefault(n => n.Class == wowClass); } }
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);
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(); }
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(); }
static string SpellToCheck(WowClass wowClass) => wowClass switch {
public static string GetEmoteName(this WowClass wowClass) { return(EmoteDictionary[wowClass]); }