Beispiel #1
0
        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());
        }
Beispiel #2
0
        //[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)));
        }
Beispiel #3
0
        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.
            }
        }
Beispiel #4
0
        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;
        }
Beispiel #5
0
        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;
        }
Beispiel #6
0
 private long ComputeKey(int spellId, EntityPlayerClassType classType)
 {
     return(((long)spellId << 32) + (long)classType);
 }
Beispiel #7
0
 public async Task <SpellLevelLearnedCollectionResponseModel> GetLevelLearnedSpellsAsync(EntityPlayerClassType classType, int level)
 {
     return(await(await GetService().ConfigureAwaitFalse()).GetLevelLearnedSpellsAsync(classType, level).ConfigureAwaitFalse());
 }
Beispiel #8
0
 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));
 }