public SkillsEditingViewModel( SkillDefinitions skillDefinitions, ItemImageService itemImageService, ItemAttributes itemAttributes) { SkillsInSlots = SlotsWithSkills .Select(s => new SkillsInSlotEditingViewModel(skillDefinitions, itemImageService, itemAttributes, s)) .ToList(); }
private static AdditionalSkillLevelParser CreateSut(bool isSpell = false, Dictionary <int, SkillLevelDefinition>?supportLevelDefinitions = null) { supportLevelDefinitions ??= new Dictionary <int, SkillLevelDefinition>(); var skillDefinitions = new SkillDefinitions(new[] { SkillDefinition.CreateActive("a", 0, "", "b", Array.Empty <string>(), new SkillBaseItemDefinition("a", "a", ReleaseState.Released, new[] { "g1", "g2", isSpell ? "spell" : "attack" }), CreateActiveSkillDefinition("a"), new Dictionary <int, SkillLevelDefinition>()), SkillDefinition.CreateActive("b", 1, "", null, Array.Empty <string>(), null, CreateActiveSkillDefinition("b"), new Dictionary <int, SkillLevelDefinition>()), SkillDefinition.CreateSupport("s1", 2, "", "s2", Array.Empty <string>(), new SkillBaseItemDefinition("s1", "s1", ReleaseState.Released, new[] { "g2", "g3" }), CreateSupportSkillDefinition(), supportLevelDefinitions), SkillDefinition.CreateSupport("s2", 3, "", null, Array.Empty <string>(), null, CreateSupportSkillDefinition(), supportLevelDefinitions), SkillDefinition.CreateSupport("s3", 4, "", null, Array.Empty <string>(), null, CreateSupportSkillDefinition(), supportLevelDefinitions), }); var statFactory = new StatFactory(); return(new AdditionalSkillLevelParser(skillDefinitions, new GemStatBuilders(statFactory), new GemTagBuilders(), new ValueBuilders(), new MetaStatBuilders(statFactory), new SkillBuilders(statFactory, skillDefinitions))); }
public AdditionalSkillQualityParser( SkillDefinitions skillDefinitions, IGemStatBuilders gemStatBuilders, IValueBuilders valueBuilders, IMetaStatBuilders metaStatBuilders) : base(skillDefinitions) { _gemStatBuilders = gemStatBuilders; _valueBuilders = valueBuilders; _metaStatBuilders = metaStatBuilders; }
public ActiveSkillParser( SkillDefinitions skillDefinitions, IBuilderFactories builderFactories, UntranslatedStatParserFactory statParserFactory) { (_skillDefinitions, _builderFactories, _statParserFactory) = (skillDefinitions, builderFactories, statParserFactory); _partialParsers = CreatePartialParsers(); }
private static SupportSkillParser CreateSut( SkillDefinition activeSkillDefinition, SkillDefinition supportSkillDefinition, UntranslatedStatParserFactory statParserFactory) { var skillDefinitions = new SkillDefinitions(new[] { activeSkillDefinition, supportSkillDefinition }); var builderFactories = new BuilderFactories(skillDefinitions); return(new SupportSkillParser(skillDefinitions, builderFactories, statParserFactory)); }
public SkillsParser( SkillDefinitions skillDefinitions, IParser <ActiveSkillParserParameter> activeSkillParser, IParser <SupportSkillParserParameter> supportSkillParser) { _skillDefinitions = skillDefinitions; _supportabilityTester = new SupportabilityTester(skillDefinitions); _activeSkillParser = activeSkillParser; _supportSkillParser = supportSkillParser; }
public GemsParser( SkillDefinitions skillDefinitions, IParser <GemParserParameter> gemParser, IParser <AdditionalSkillStatParserParameter> additionalSkillStatParser) { _skillDefinitions = skillDefinitions; _supportabilityTester = new SupportabilityTester(skillDefinitions); _gemParser = gemParser; _additionalSkillStatParser = additionalSkillStatParser; }
public static MainSkillSelectionViewModel Create( SkillDefinitions skillDefinitions, IBuilderFactories builderFactories, CalculationNodeViewModelFactory nodeFactory, ObservableSet <IReadOnlyList <Skill> > skills) { var vm = new MainSkillSelectionViewModel(skillDefinitions, builderFactories, nodeFactory); vm.Initialize(skills); return(vm); }
public AdditionalSkillLevelParser( SkillDefinitions skillDefinitions, IGemStatBuilders gemStatBuilders, IGemTagBuilders gemTagBuilders, IValueBuilders valueBuilders, IMetaStatBuilders metaStatBuilders, ISkillBuilders skillBuilders) : base(skillDefinitions) { _gemStatBuilders = gemStatBuilders; _gemTagBuilders = gemTagBuilders; _valueBuilders = valueBuilders; _metaStatBuilders = metaStatBuilders; _skillBuilders = skillBuilders; }
public AdditionalSkillStatParser(SkillDefinitions skillDefinitions, IBuilderFactories builderFactories) { _parsers = new IParser <AdditionalSkillStatParserParameter>[] { new AdditionalSkillLevelParser(skillDefinitions, builderFactories.StatBuilders.Gem, builderFactories.GemTagBuilders, builderFactories.ValueBuilders, builderFactories.MetaStatBuilders, builderFactories.SkillBuilders), new AdditionalSkillLevelMaximumParser(skillDefinitions, builderFactories.StatBuilders.Gem, builderFactories.ValueBuilders), new AdditionalSkillQualityParser(skillDefinitions, builderFactories.StatBuilders.Gem, builderFactories.ValueBuilders, builderFactories.MetaStatBuilders), }; }
public BuffBuilders(IStatFactory statFactory, SkillDefinitions skills) { _statFactory = statFactory; Fortify = Create("Fortify"); Maim = Create("Maim"); Intimidate = Create("Intimidate"); Taunt = Create("Taunt"); Blind = Create("Blind"); Onslaught = Create("Onslaught"); UnholyMight = Create("UnholyMight"); Phasing = Create("Phasing"); ArcaneSurge = Create("ArcaneSurge"); Tailwind = Create("Tailwind"); CoveredInAsh = Create("CoveredInAsh"); Innervation = Create("Innervation"); Impale = Create("Impale"); Infusion = Create("Infusion"); Conflux = new ConfluxBuffBuilders(statFactory); GenericMine = Create("Mine"); CurseLimit = StatBuilderUtils.FromIdentity(statFactory, "CurseLimit", typeof(uint)); var allBuffs = new List <BuffBuilderWithKeywords> { new BuffBuilderWithKeywords(Fortify), new BuffBuilderWithKeywords(Maim), new BuffBuilderWithKeywords(Intimidate), new BuffBuilderWithKeywords(Taunt), new BuffBuilderWithKeywords(Blind), new BuffBuilderWithKeywords(Onslaught), new BuffBuilderWithKeywords(UnholyMight), new BuffBuilderWithKeywords(Phasing), new BuffBuilderWithKeywords(ArcaneSurge), new BuffBuilderWithKeywords(Tailwind, Keyword.Aura), new BuffBuilderWithKeywords(CoveredInAsh), new BuffBuilderWithKeywords(Innervation), new BuffBuilderWithKeywords(Impale), new BuffBuilderWithKeywords(Infusion), new BuffBuilderWithKeywords(Conflux.Chilling), new BuffBuilderWithKeywords(Conflux.Elemental), new BuffBuilderWithKeywords(Conflux.Igniting), new BuffBuilderWithKeywords(Conflux.Shocking), // Generic buff effect increase (used for Buff()) new BuffBuilderWithKeywords(Create("Buff")), // Aura effect increase (used for Aura()) new BuffBuilderWithKeywords(Create("Aura"), Keyword.Aura), new BuffBuilderWithKeywords(GenericMine, Keyword.Aura, Keyword.Mine), }; var skillBuffBuilders = skills.Skills .Where(s => !s.IsSupport && s.ActiveSkill.ProvidesBuff) .Select(s => new BuffBuilderWithKeywords(Create(s.Id), s.ActiveSkill.Keywords)); allBuffs.AddRange(skillBuffBuilders); _allBuffs = allBuffs; }
private static AdditionalSkillLevelMaximumParser CreateSut(IEnumerable <int> activeLevels, IEnumerable <int> supportLevels) { var skillDefinitions = new SkillDefinitions(new[] { CreateActive("a", CreateActiveSkillDefinition("a"), activeLevels.ToDictionary(l => l, _ => CreateLevelDefinition())), CreateSupport("s", CreateSupportSkillDefinition(), supportLevels.ToDictionary(l => l, _ => CreateLevelDefinition())), }); var statFactory = new StatFactory(); return(new AdditionalSkillLevelMaximumParser(skillDefinitions, new GemStatBuilders(statFactory), new ValueBuilders())); }
private async Task InitializeAsync( SkillDefinitions skillDefinitions, IBuilderFactories f, ObservableSet <IReadOnlyList <Skill> > skills) { MainSkillSelection = MainSkillSelectionViewModel.Create(skillDefinitions, f, _nodeFactory, skills); InitializeOffensiveStats(f); InitializeDefensiveStats(f); ConfigurationStats = await ConfigurationStatsViewModel.CreateAsync(_observableCalculator, _nodeFactory); AddConfigurationStat(f.StatBuilders.Level, Entity.Enemy); GainOnActionStats = await GainOnActionStatsViewModel.CreateAsync(_observableCalculator, _nodeFactory); SharedConfiguration = SharedConfigurationViewModel.Create(_nodeFactory, f); }
private ParsingData( IBuilderFactories builderFactories, SkillDefinitions skills, PassiveTreeDefinition passives, CharacterBaseStats characterBaseStats, MonsterBaseStats monsterBaseStats) { _builderFactories = builderFactories; _statMatchers = new Lazy <IReadOnlyList <IStatMatchers> >( () => CreateStatMatchers(ModifierBuilder.Empty, passives.Nodes)); _referencedMatchers = new Lazy <IReadOnlyList <IReferencedMatchers> >( () => CreateReferencedMatchers(skills.Skills)); _givenStats = new Lazy <IReadOnlyList <IGivenStats> >( () => new GivenStatsCollection(builderFactories, characterBaseStats, monsterBaseStats)); _statMatchersSelector = new Lazy <StatMatchersSelector>( () => new StatMatchersSelector(StatMatchers)); }
private Parser( PassiveTreeDefinition passiveTree, BaseItemDefinitions baseItems, SkillDefinitions skills, StatTranslators statTranslators, IBuilderFactories builderFactories, IParsingData <TStep> parsingData) { _statTranslators = statTranslators; _coreParser = new CoreParser <TStep>(parsingData, builderFactories); _givenStats = parsingData.GivenStats; _passiveNodeParser = Caching(new PassiveNodeParser(passiveTree, builderFactories, _coreParser)); _skilledPassiveNodeParser = Caching(new SkilledPassiveNodeParser(passiveTree, builderFactories)); _itemParser = Caching(new ItemParser(baseItems, builderFactories, _coreParser, statTranslators[StatTranslationFileNames.Main])); _activeSkillParser = Caching(new ActiveSkillParser(skills, builderFactories, GetOrAddUntranslatedStatParser)); _supportSkillParser = Caching(new SupportSkillParser(skills, builderFactories, GetOrAddUntranslatedStatParser)); _skillsParser = new SkillsParser(skills, _activeSkillParser, _supportSkillParser); }
private MainSkillSelectionViewModel( SkillDefinitions skillDefinitions, IBuilderFactories builderFactories, CalculationNodeViewModelFactory nodeFactory) { _skillDefinitions = skillDefinitions; var selectedSkillItemSlotStat = builderFactories.MetaStatBuilders.MainSkillItemSlot .BuildToStats(Entity.Character).Single(); _selectedSkillItemSlot = nodeFactory.CreateConfiguration(selectedSkillItemSlotStat, new NodeValue(0)); var selectedSkillSocketIndexStat = builderFactories.MetaStatBuilders.MainSkillSocketIndex .BuildToStats(Entity.Character).Single(); _selectedSkillSocketIndex = nodeFactory.CreateConfiguration(selectedSkillSocketIndexStat, new NodeValue(0)); var selectedSkillPartStat = builderFactories.StatBuilders.MainSkillPart .BuildToStats(Entity.Character).Single(); _selectedSkillPart = nodeFactory.CreateConfiguration(selectedSkillPartStat, new NodeValue(0)); ConfigurationNodes = new[] { _selectedSkillItemSlot, _selectedSkillSocketIndex, _selectedSkillPart }; }
private static AdditionalSkillQualityParser CreateSut(Dictionary <int, SkillLevelDefinition>?supportLevelDefinitions = null) { supportLevelDefinitions ??= new Dictionary <int, SkillLevelDefinition>(); var skillDefinitions = new SkillDefinitions(new[] { SkillDefinition.CreateActive("a", 0, "", null, Array.Empty <string>(), new SkillBaseItemDefinition("a", "a", ReleaseState.Released, Array.Empty <string>()), CreateActiveSkillDefinition("a"), new Dictionary <int, SkillLevelDefinition>()), SkillDefinition.CreateSupport("s1", 2, "", null, Array.Empty <string>(), new SkillBaseItemDefinition("s1", "s1", ReleaseState.Released, Array.Empty <string>()), CreateSupportSkillDefinition(), supportLevelDefinitions), }); var statFactory = new StatFactory(); return(new AdditionalSkillQualityParser(skillDefinitions, new GemStatBuilders(statFactory), new ValueBuilders(), new MetaStatBuilders(statFactory))); }
public BuilderFactories(SkillDefinitions skills) { var statFactory = new StatFactory(); ActionBuilders = new ActionBuilders(statFactory); BuffBuilders = new BuffBuilders(statFactory, skills); ChargeTypeBuilders = new ChargeTypeBuilders(statFactory); ConditionBuilders = new ConditionBuilders(statFactory); DamageTypeBuilders = new DamageTypeBuilders(statFactory); EffectBuilders = new EffectBuilders(statFactory); EntityBuilders = new EntityBuilders(statFactory); EquipmentBuilders = new EquipmentBuilders(statFactory); FormBuilders = new FormBuilders(); KeywordBuilders = new KeywordBuilders(); SkillBuilders = new SkillBuilders(statFactory, skills); StatBuilders = new StatBuilders(statFactory); ValueBuilders = new ValueBuilders(); MetaStatBuilders = new MetaStatBuilders(statFactory); MatchContexts = new MatchContexts(statFactory); }
/// <summary> /// Initializes a new instance of the <see cref="BotServices"/> class. /// </summary> /// <param name="botConfiguration">The <see cref="BotConfiguration"/> instance for the bot.</param> /// <param name="skills">List of <see cref="SkillDefinition"/> for loading skill configurations.</param> /// <param name="languageModels">The locale specifc language model configs for each supported language.</param> public BotServices(BotConfiguration botConfiguration, Dictionary <string, Dictionary <string, string> > languageModels, List <SkillDefinition> skills) { // Create service clients for each service in the .bot file. foreach (var service in botConfiguration.Services) { switch (service.Type) { case ServiceTypes.AppInsights: { var appInsights = service as AppInsightsService; var telemetryConfig = new TelemetryConfiguration(appInsights.InstrumentationKey); TelemetryClient = new TelemetryClient(telemetryConfig); break; } case ServiceTypes.CosmosDB: { var cosmos = service as CosmosDbService; CosmosDbOptions = new CosmosDbStorageOptions { AuthKey = cosmos.Key, CollectionId = cosmos.Collection, DatabaseId = cosmos.Database, CosmosDBEndpoint = new Uri(cosmos.Endpoint), }; break; } case ServiceTypes.Generic: { if (service.Name == "Authentication") { var authentication = service as GenericService; AuthenticationConnections = authentication.Configuration; } break; } } } // Create locale configuration object for each language config in appsettings.json foreach (var language in languageModels) { var localeConfig = new LocaleConfiguration { Locale = language.Key }; var path = language.Value["botFilePath"]; var secret = language.Value["botFileSecret"]; var config = BotConfiguration.Load(path, !string.IsNullOrEmpty(secret) ? secret : null); foreach (var service in config.Services) { switch (service.Type) { case ServiceTypes.Dispatch: { var dispatch = service as DispatchService; var dispatchApp = new LuisApplication(dispatch.AppId, dispatch.SubscriptionKey, dispatch.GetEndpoint()); localeConfig.DispatchRecognizer = new TelemetryLuisRecognizer(dispatchApp); break; } case ServiceTypes.Luis: { var luis = service as LuisService; var luisApp = new LuisApplication(luis.AppId, luis.SubscriptionKey, luis.GetEndpoint()); localeConfig.LuisServices.Add(service.Id, new TelemetryLuisRecognizer(luisApp)); break; } case ServiceTypes.QnA: { var qna = service as QnAMakerService; var qnaEndpoint = new QnAMakerEndpoint() { KnowledgeBaseId = qna.KbId, EndpointKey = qna.EndpointKey, Host = qna.Hostname, }; var qnaMaker = new TelemetryQnAMaker(qnaEndpoint); localeConfig.QnAServices.Add(qna.Id, qnaMaker); break; } } } LocaleConfigurations.Add(language.Key, localeConfig); } // Create a skill configurations for each skill in appsettings.json foreach (var skill in skills) { var skillConfig = new SkillConfiguration() { CosmosDbOptions = CosmosDbOptions, TelemetryClient = TelemetryClient, }; foreach (var localeConfig in LocaleConfigurations) { skillConfig.LocaleConfigurations.Add(localeConfig.Key, new LocaleConfiguration { LuisServices = localeConfig.Value.LuisServices.Where(l => skill.LuisServiceIds.Contains(l.Key) == true).ToDictionary(l => l.Key, l => l.Value) }); } if (skill.SupportedProviders != null) { foreach (var provider in skill.SupportedProviders) { var matches = AuthenticationConnections.Where(x => x.Value == provider); foreach (var match in matches) { skillConfig.AuthenticationConnections.Add(match.Key, match.Value); } } } foreach (var set in skill.Configuration) { skillConfig.Properties.Add(set.Key, set.Value); } SkillDefinitions.Add(skill); SkillConfigurations.Add(skill.Id, skillConfig); } }
protected AdditionalSkillStatParserBase(SkillDefinitions skillDefinitions) { _skillDefinitions = skillDefinitions; }
/// <summary> /// Initializes a new instance of the <see cref="BotServices"/> class. /// </summary> /// <param name="botConfiguration">The <see cref="BotConfiguration"/> instance for the bot.</param> /// <param name="skills">List of <see cref="SkillDefinition"/> for loading skill configurations.</param> /// <param name="languageModels">The locale specifc language model configs for each supported language.</param> /// <param name="skillEventsConfig">The configuration for skill events.</param> public BotServices(BotConfiguration botConfiguration, Dictionary <string, Dictionary <string, string> > languageModels, List <SkillDefinition> skills, List <SkillEvent> skillEventsConfig) { // Create service clients for each service in the .bot file. foreach (var service in botConfiguration.Services) { switch (service.Type) { case ServiceTypes.AppInsights: { var appInsights = (AppInsightsService)service; if (appInsights == null) { throw new InvalidOperationException("The Application Insights is not configured correctly in your '.bot' file."); } if (string.IsNullOrWhiteSpace(appInsights.InstrumentationKey)) { throw new InvalidOperationException("The Application Insights Instrumentation Key ('instrumentationKey') is required to run this sample. Please update your '.bot' file."); } var telemetryConfig = new TelemetryConfiguration(appInsights.InstrumentationKey); TelemetryClient = new TelemetryClient(telemetryConfig) { InstrumentationKey = appInsights.InstrumentationKey, }; break; } case ServiceTypes.CosmosDB: { var cosmos = service as CosmosDbService; CosmosDbOptions = new CosmosDbStorageOptions { AuthKey = cosmos.Key, CollectionId = cosmos.Collection, DatabaseId = cosmos.Database, CosmosDBEndpoint = new Uri(cosmos.Endpoint), }; break; } case ServiceTypes.Generic: { if (service.Name == "Authentication") { var authentication = service as GenericService; AuthenticationConnections = authentication.Configuration; } break; } } } // Create locale configuration object for each language config in appsettings.json foreach (var language in languageModels) { if (language.Value.TryGetValue("botFilePath", out var botFilePath) && File.Exists(botFilePath)) { var botFileSecret = language.Value["botFileSecret"]; var config = BotConfiguration.Load(botFilePath, !string.IsNullOrEmpty(botFileSecret) ? botFileSecret : null); var localeConfig = new LocaleConfiguration { Locale = language.Key }; foreach (var service in config.Services) { switch (service.Type) { case ServiceTypes.Dispatch: { var dispatch = service as DispatchService; if (dispatch == null) { throw new InvalidOperationException("The Dispatch service is not configured correctly in your '.bot' file."); } if (string.IsNullOrWhiteSpace(dispatch.AppId)) { throw new InvalidOperationException("The Dispatch Luis Model Application Id ('appId') is required to run this sample. Please update your '.bot' file."); } if (string.IsNullOrWhiteSpace(dispatch.SubscriptionKey)) { throw new InvalidOperationException("The Subscription Key ('subscriptionKey') is required to run this sample. Please update your '.bot' file."); } var dispatchApp = new LuisApplication(dispatch.AppId, dispatch.SubscriptionKey, dispatch.GetEndpoint()); localeConfig.DispatchRecognizer = new TelemetryLuisRecognizer(dispatchApp); break; } case ServiceTypes.Luis: { var luis = service as LuisService; if (luis == null) { throw new InvalidOperationException("The Luis service is not configured correctly in your '.bot' file."); } if (string.IsNullOrWhiteSpace(luis.AppId)) { throw new InvalidOperationException("The Luis Model Application Id ('appId') is required to run this sample. Please update your '.bot' file."); } if (string.IsNullOrWhiteSpace(luis.AuthoringKey)) { throw new InvalidOperationException("The Luis Authoring Key ('authoringKey') is required to run this sample. Please update your '.bot' file."); } if (string.IsNullOrWhiteSpace(luis.SubscriptionKey)) { throw new InvalidOperationException("The Subscription Key ('subscriptionKey') is required to run this sample. Please update your '.bot' file."); } if (string.IsNullOrWhiteSpace(luis.Region)) { throw new InvalidOperationException("The Region ('region') is required to run this sample. Please update your '.bot' file."); } var luisApp = new LuisApplication(luis.AppId, luis.SubscriptionKey, luis.GetEndpoint()); var recognizer = new TelemetryLuisRecognizer(luisApp, logPersonalInformation: true); localeConfig.LuisServices.Add(service.Id, recognizer); break; } case ServiceTypes.QnA: { var qna = service as QnAMakerService; var qnaEndpoint = new QnAMakerEndpoint() { KnowledgeBaseId = qna.KbId, EndpointKey = qna.EndpointKey, Host = qna.Hostname, }; var qnaMaker = new TelemetryQnAMaker(qnaEndpoint, logPersonalInformation: true); localeConfig.QnAServices.Add(qna.Id, qnaMaker); break; } } } LocaleConfigurations.Add(language.Key, localeConfig); } } // Create a skill configurations for each skill in appsettings.json foreach (var skill in skills) { var skillConfig = new SkillConfiguration() { CosmosDbOptions = CosmosDbOptions }; foreach (var localeConfig in LocaleConfigurations) { skillConfig.LocaleConfigurations.Add(localeConfig.Key, new LocaleConfiguration { LuisServices = localeConfig.Value.LuisServices.Where(l => skill.LuisServiceIds.Contains(l.Key) == true).ToDictionary(l => l.Key, l => l.Value) }); } if (skill.SupportedProviders != null) { foreach (var provider in skill.SupportedProviders) { var matches = AuthenticationConnections.Where(x => x.Value == provider); foreach (var match in matches) { skillConfig.AuthenticationConnections.Add(match.Key, match.Value); } } } foreach (var set in skill.Configuration) { skillConfig.Properties.Add(set.Key, set.Value); } SkillDefinitions.Add(skill); SkillConfigurations.Add(skill.Id, skillConfig); SkillEvents = skillEventsConfig != null?skillEventsConfig.ToDictionary(i => i.Event) : null; } }
public async Task SetUpAsync() { _skillDefinitions = await GameData.Skills.ConfigureAwait(false); _parser = await ParserTask.ConfigureAwait(false); }
public AdditionalSkillLevelMaximumParser(SkillDefinitions skillDefinitions, IGemStatBuilders gemStatBuilders, IValueBuilders valueBuilders) : base(skillDefinitions) { _gemStatBuilders = gemStatBuilders; _valueBuilders = valueBuilders; }
public ActiveSkillParser( SkillDefinitions skillDefinitions, IBuilderFactories builderFactories, UntranslatedStatParserFactory statParserFactory) => (_skillDefinitions, _builderFactories, _statParserFactory) =
public SkillPreParser(SkillDefinitions skillDefinitions, IMetaStatBuilders metaStatBuilders) => (_skillDefinitions, _metaStatBuilders) = (skillDefinitions, metaStatBuilders);
public SkillBuilders(IStatFactory statFactory, SkillDefinitions skills) { _statFactory = statFactory; _skills = skills; }
/// <summary> /// Initializes a new instance of the <see cref="BotServices"/> class. /// </summary> /// <param name="botConfiguration">The <see cref="BotConfiguration"/> instance for the bot.</param> public BotServices(BotConfiguration botConfiguration, List <SkillDefinition> skills) { foreach (var service in botConfiguration.Services) { switch (service.Type) { case ServiceTypes.AppInsights: { var appInsights = service as AppInsightsService; var telemetryConfig = new TelemetryConfiguration(appInsights.InstrumentationKey); TelemetryClient = new TelemetryClient(telemetryConfig); break; } case ServiceTypes.Dispatch: { var dispatch = service as DispatchService; var dispatchApp = new LuisApplication(dispatch.AppId, dispatch.SubscriptionKey, dispatch.GetEndpoint()); DispatchRecognizer = new TelemetryLuisRecognizer(dispatchApp); break; } case ServiceTypes.Luis: { var luis = service as LuisService; var luisApp = new LuisApplication(luis.AppId, luis.SubscriptionKey, luis.GetEndpoint()); LuisServices.Add(service.Id, new TelemetryLuisRecognizer(luisApp)); break; } case ServiceTypes.QnA: { var qna = service as QnAMakerService; var qnaEndpoint = new QnAMakerEndpoint() { KnowledgeBaseId = qna.KbId, EndpointKey = qna.EndpointKey, Host = qna.Hostname, }; var qnaMaker = new TelemetryQnAMaker(qnaEndpoint); QnAServices.Add(qna.Id, qnaMaker); break; } case ServiceTypes.Generic: { if (service.Name == "Authentication") { var authentication = service as GenericService; AuthenticationConnections = authentication.Configuration; } break; } case ServiceTypes.CosmosDB: { var cosmos = service as CosmosDbService; CosmosDbOptions = new CosmosDbStorageOptions { AuthKey = cosmos.Key, CollectionId = cosmos.Collection, DatabaseId = cosmos.Database, CosmosDBEndpoint = new Uri(cosmos.Endpoint), }; break; } } } foreach (var skill in skills) { var skillConfig = new SkillConfiguration() { CosmosDbOptions = CosmosDbOptions, TelemetryClient = TelemetryClient, LuisServices = LuisServices.Where(l => skill.LuisServiceIds.Contains(l.Key) == true).ToDictionary(l => l.Key, l => l.Value as IRecognizer), }; if (skill.SupportedProviders != null) { foreach (var provider in skill.SupportedProviders) { var matches = AuthenticationConnections.Where(x => x.Value == provider); foreach (var match in matches) { skillConfig.AuthenticationConnections.Add(match.Key, match.Value); } } } foreach (var set in skill.Configuration) { skillConfig.Properties.Add(set.Key, set.Value); } SkillDefinitions.Add(skill); SkillConfigurations.Add(skill.Id, skillConfig); } }
public GemParser(SkillDefinitions skillDefinitions, IBuilderFactories builderFactories) { _skillDefinitions = skillDefinitions; _builderFactories = builderFactories; }