Пример #1
0
        public IActionResult GetSoulBreaksBySearch([FromBody] D.SoulBreak searchPrototype)
        {
            _logger.LogInformation($"Controller Method invoked: {nameof(GetSoulBreaksBySearch)}");

            SoulBreak soulBreak = _mapper.Map <SoulBreak>(searchPrototype);

            IEnumerable <SoulBreak> model = _soulBreaksLogic.GetSoulBreaksBySearch(soulBreak);

            IEnumerable <D.SoulBreak> result = _mapper.Map <IEnumerable <D.SoulBreak> >(model);

            return(new ObjectResult(result));
        }
Пример #2
0
        public IEnumerable <SoulBreak> GetSoulBreaksBySearch(SoulBreak searchPrototype)
        {
            _logger.LogInformation($"Logic Method invoked: {nameof(GetSoulBreaksBySearch)}");


            //ignore: Description, Effects, EnlirId, Id, ImagePath, IntroducingEventId, IntroducingEventName, IsChecked, IsCounterable, SoulBreakPointsGainedJapan
            var query = _enlirRepository.GetMergeResultsContainer().SoulBreaks;

            if (searchPrototype.AbilityType != 0)
            {
                query = query.Where(a => a.AbilityType == searchPrototype.AbilityType);
            }
            if (!string.IsNullOrWhiteSpace(searchPrototype.SoulBreakName))
            {
                query = query.Where(a => a.SoulBreakName.ToLower().Contains(searchPrototype.SoulBreakName.ToLower()));
            }
            if (searchPrototype.Realm != 0)
            {
                query = query.Where(a => a.Realm == searchPrototype.Realm);
            }
            if (searchPrototype.CharacterId != 0)
            {
                query = query.Where(a => a.CharacterId == searchPrototype.CharacterId);
            }
            if (searchPrototype.Multiplier != 0)
            {
                query = query.Where(a => a.Multiplier >= searchPrototype.Multiplier);
            }
            if (searchPrototype.Elements != null && searchPrototype.Elements.Any())
            {
                query = query.Where(a => a.Elements.Contains(searchPrototype.Elements.First()) ||
                                    a.Commands.Any(c => c.Elements.Contains(searchPrototype.Elements.First())) ||
                                    a.OtherEffects.Any(e => e.Elements.Contains(searchPrototype.Elements.First())));
            }
            if (!string.IsNullOrWhiteSpace(searchPrototype.Effects))
            {
                query = query.Where(a => a.Effects.ToLower().Contains(searchPrototype.Effects.ToLower()));
            }
            if (searchPrototype.SoulBreakTier != 0)
            {
                query = query.Where(a => a.SoulBreakTier == searchPrototype.SoulBreakTier);
            }
            if (!string.IsNullOrWhiteSpace(searchPrototype.MasteryBonus))
            {
                query = query.Where(a => a.MasteryBonus.ToLower().Contains(searchPrototype.MasteryBonus.ToLower()));
            }
            if (searchPrototype.Statuses != null && searchPrototype.Statuses.Any())
            {
                query = query.Where(a => a.Statuses.Any(s => s.Id == searchPrototype.Statuses.First().Id));
            }
            if (searchPrototype.AutoTargetType != 0)
            {
                query = query.Where(a => a.AutoTargetType == searchPrototype.AutoTargetType);
            }
            if (searchPrototype.CastTime != 0)
            {
                query = query.Where(a => a.CastTime <= searchPrototype.CastTime);
            }
            if (searchPrototype.DamageFormulaType != 0)
            {
                query = query.Where(a => a.DamageFormulaType == searchPrototype.DamageFormulaType);
            }
            if (searchPrototype.TargetType != 0)
            {
                query = query.Where(a => a.TargetType == searchPrototype.TargetType);
            }


            return(query);
        }
Пример #3
0
        private void WireUpOtherSourceInfo(TransformResultsContainer transformResults)
        {
            foreach (Other other in transformResults.Others)
            {
                //first check statuses for match
                Status relatedStatus = transformResults.Statuses.SingleOrDefault(s => s.CommonName.Trim() == other.SourceName.Trim());
                if (relatedStatus != null) //this is the match
                {
                    other.SourceId   = relatedStatus.Id;
                    other.SourceType = nameof(Status);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                //next check soul breaks for match
                SoulBreak relatedSoulBreak = transformResults.SoulBreaks.SingleOrDefault(s => s.SoulBreakName.Trim() == other.SourceName.Trim() &&
                                                                                         (s.CharacterName.Trim() == other.CharacterName.Trim()));
                if (relatedSoulBreak != null) //this is the match
                {
                    other.SourceId   = relatedSoulBreak.Id;
                    other.SourceType = nameof(SoulBreak);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                RecordMateria relatedRecordMateria = transformResults.RecordMaterias.SingleOrDefault(r => r.RecordMateriaName.Trim() == other.SourceName.Trim());
                if (relatedRecordMateria != null) //this is the match
                {
                    other.SourceId   = relatedRecordMateria.Id;
                    other.SourceType = nameof(RecordMateria);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                Relic relatedRelic = transformResults.Relics.SingleOrDefault(r => r.RelicName.Trim() == other.SourceName.Trim());
                if (relatedRelic != null) //this is the match
                {
                    other.SourceId   = relatedRelic.Id;
                    other.SourceType = nameof(Relic);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                Command relatedCommand = transformResults.Commands.SingleOrDefault(c => c.CommandName.Trim() == other.SourceName.Trim());
                if (relatedCommand != null) //this is the match
                {
                    other.SourceId   = relatedCommand.Id;
                    other.SourceType = nameof(Command);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                IList <LegendMateria> relatedLegendMateria = transformResults.LegendMaterias.Where(l => l.LegendMateriaName == other.SourceName).ToList();
                if (relatedLegendMateria != null && relatedLegendMateria.Count == 1) //this is the match
                {
                    other.SourceId   = relatedLegendMateria.First().Id;
                    other.SourceType = nameof(LegendMateria);

                    _logger.LogDebug("wired up SourceId {SourceId} and SourceType {SourceType} to Other {Other}", other.SourceId, other.SourceType, other.Description);
                    continue;
                }

                _logger.LogWarning("FAILED to wire up SourceId and SourceType to Other {Other}", other.Description);
            }
        }