public Task <CharacterDefaultActionBarEntry[]> RetrieveAllActionsAsync(EntityPlayerClassType classType) { if (!Enum.IsDefined(typeof(EntityPlayerClassType), classType)) { throw new InvalidEnumArgumentException(nameof(classType), (int)classType, typeof(EntityPlayerClassType)); } return(Context.DefaultCharacterActionBars .Where(dab => dab.ClassType == classType) .ToArrayAsync()); }
//[ResponseCache(Duration = 5000)] public async Task <IActionResult> GetLevelLearnedSpellsForClassAsync([FromRoute(Name = "class")] EntityPlayerClassType classType, [FromServices] ILevelLearnedSpellRepository levelLearnedSpellRepository, [FromServices] ITypeConverterProvider <SpellLevelLearned, SpellLevelLearnedDefinition> converter) { if (!Enum.IsDefined(typeof(EntityPlayerClassType), classType)) { throw new InvalidEnumArgumentException(nameof(classType), (int)classType, typeof(EntityPlayerClassType)); } SpellLevelLearned[] levelLearneds = await levelLearnedSpellRepository.RetrieveAllAsync(classType); return(Json(CreatedSpellLevelLearnedCollectionResponse(levelLearneds, converter))); }
public bool IsSpellKnown(int spellId, EntityPlayerClassType classType, int level) { long key = ComputeKey(spellId, classType); if (LevelLearnedDefinitions.ContainsKey(key)) { return(LevelLearnedDefinitions[key].LevelLearned <= level); } else { return(false); //not a level learned spell. } }
public CharacterDefaultActionBarEntry(EntityPlayerClassType classType, ActionBarIndex barIndex, int linkedSpellId) { if (!Enum.IsDefined(typeof(ActionBarIndex), barIndex)) { throw new InvalidEnumArgumentException(nameof(barIndex), (int)barIndex, typeof(ActionBarIndex)); } if (linkedSpellId <= 0) { throw new ArgumentOutOfRangeException(nameof(linkedSpellId)); } if (!Enum.IsDefined(typeof(EntityPlayerClassType), classType)) { throw new InvalidEnumArgumentException(nameof(classType), (int)classType, typeof(EntityPlayerClassType)); } BarIndex = barIndex; LinkedSpellId = linkedSpellId; }
public SpellLevelLearnedDefinition(EntityPlayerClassType characterClassType, int levelLearned, int spellId) { if (!Enum.IsDefined(typeof(EntityPlayerClassType), characterClassType)) { throw new InvalidEnumArgumentException(nameof(characterClassType), (int)characterClassType, typeof(EntityPlayerClassType)); } if (levelLearned < 0) { throw new ArgumentOutOfRangeException(nameof(levelLearned)); } if (spellId <= 0) { throw new ArgumentOutOfRangeException(nameof(spellId)); } CharacterClassType = characterClassType; LevelLearned = levelLearned; SpellId = spellId; }
private long ComputeKey(int spellId, EntityPlayerClassType classType) { return(((long)spellId << 32) + (long)classType); }
public async Task <SpellLevelLearnedCollectionResponseModel> GetLevelLearnedSpellsAsync(EntityPlayerClassType classType, int level) { return(await(await GetService().ConfigureAwaitFalse()).GetLevelLearnedSpellsAsync(classType, level).ConfigureAwaitFalse()); }
public Task <SpellLevelLearned[]> RetrieveAllAsync(EntityPlayerClassType classType, int level, CancellationToken cancellationToken = default(CancellationToken)) { return(Context.LevelLearnedSpells .Where(lls => lls.CharacterClassType == classType && lls.LevelLearned <= level) .ToArrayAsync(cancellationToken)); }