/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { KortistoNpc inputNpc = data.ExportData[ExportConstants.ExportDataObject] as KortistoNpc; if(inputNpc == null) { return; } _languageKeyGenerator.SetErrorCollection(_errorCollection); List<ScribanExportInventoryItem> items = await LoadInventory(parsedTemplate, inputNpc); scriptObject.AddOrUpdate(ExportConstants.ScribanNpcInventoryObjectKey, items); scriptObject.AddOrUpdate(ExportConstants.ScribanLanguageKeyName, _languageKeyGenerator); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { IFlexFieldExportable exportable = data.ExportData[ExportConstants.ExportDataObject] as IFlexFieldExportable; if (exportable == null) { return; } _languageKeyGenerator.SetErrorCollection(_errorCollection); GoNorthProject project = await _cachedDbAccess.GetUserProject(); ExportSettings exportSettings = await _cachedDbAccess.GetExportSettings(project.Id); scriptObject.AddOrUpdate(ObjectKey, FlexFieldValueCollectorUtil.ExtractScribanFields(exportable, exportSettings, _errorCollection)); scriptObject.AddOrUpdate(ExportConstants.ScribanLanguageKeyName, _languageKeyGenerator); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { List <DailyRoutineFunction> inputFunction = data.ExportData[ExportConstants.ExportDataObject] as List <DailyRoutineFunction>; if (inputFunction == null) { return(Task.CompletedTask); } List <ScribanExportDailyRoutineFunction> scribanFunctions = inputFunction.Select(i => new ScribanExportDailyRoutineFunction(i)).ToList(); scriptObject.AddOrUpdate(ExportConstants.ScribanDailyRoutineFunctionListObjectKey, scribanFunctions); if (!scriptObject.ContainsKey(DailyRoutineEventFunctionRenderer.DailyRoutineEventFunctionName)) { scriptObject.AddOrUpdate(DailyRoutineEventFunctionRenderer.DailyRoutineEventFunctionName, new DailyRoutineEventFunctionRenderer(_templatePlaceholderResolver, _cachedDbAccess, _defaultTemplateProvider, _errorCollection)); } return(Task.CompletedTask); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { DailyRoutineFunction inputFunction = data.ExportData[ExportConstants.ExportDataObject] as DailyRoutineFunction; if (inputFunction == null) { return(Task.CompletedTask); } scriptObject.AddOrUpdate(ExportConstants.ScribanDailyRoutineFunctionObjectKey, new ScribanExportDailyRoutineFunction(inputFunction)); return(Task.CompletedTask); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { FlexFieldObject inputObject = data.ExportData[ExportConstants.ExportDataObject] as FlexFieldObject; if (inputObject == null) { return; } _exportSnippetFunctionRenderer.SetErrorCollection(_errorCollection); List <ObjectExportSnippet> exportSnippets = await _exportCachedDbAccess.GetObjectExportSnippetsByObject(inputObject.Id); Dictionary <string, ScribanExportSnippet> mappedSnippets = await MapExportSnippets(exportSnippets, inputObject); ScribanExportSnippetsData scribanExportSnippets = new ScribanExportSnippetsData(); scribanExportSnippets.Snippets = new ScribanExportSnippetDictionary(mappedSnippets); scriptObject.AddOrUpdate(ExportConstants.ScribanExportSnippetsObjectKey, scribanExportSnippets); scriptObject.AddOrUpdate(ExportSnippetFunctionPipeRenderer.ExportSnippetFunctionName, new ExportSnippetFunctionPipeRenderer(_templatePlaceholderResolver, _exportCachedDbAccess, _defaultTemplateProvider, _errorCollection)); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { KortistoNpc inputNpc = data.ExportData[ExportConstants.ExportDataObject] as KortistoNpc; if (inputNpc == null) { return; } _languageKeyGenerator.SetErrorCollection(_errorCollection); GoNorthProject project = await _exportCachedDbAccess.GetUserProject(); TaleDialog dialog = await _taleDbAccess.GetDialogByRelatedObjectId(inputNpc.Id); ExportDialogData parsedDialog = await ParseDialog(inputNpc, project, dialog); ScribanExportDialog exportDialog = await BuildExportDialog(parsedDialog, inputNpc); scriptObject.AddOrUpdate(ExportConstants.ScribanDialogKey, exportDialog); scriptObject.AddOrUpdate(DialogFunctionRenderer.DialogFunctionName, new DialogFunctionRenderer(_templatePlaceholderResolver, _exportCachedDbAccess, _defaultTemplateProvider, _errorCollection, data)); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { KortistoNpc inputNpc = data.ExportData[ExportConstants.ExportDataObject] as KortistoNpc; if (inputNpc == null) { return; } SharedDailyRoutineExportUtil.SortDailyRoutine(inputNpc.DailyRoutine); ScribanExportDailyRoutine dailyRoutine = new ScribanExportDailyRoutine(); dailyRoutine.Events = await ScribanDailyRoutineEventUtil.MapNpcDailyRoutineEvents(_cachedDbAccess, _dailyRoutineFunctionNameGenerator, inputNpc, inputNpc.DailyRoutine); dailyRoutine.EventFunctions = await BuildDailyRoutineFunctions(inputNpc, inputNpc.DailyRoutine); scriptObject.AddOrUpdate(ExportConstants.ScribanDailyRoutineObjectKey, dailyRoutine); scriptObject.AddOrUpdate(DailyRoutineEventListRenderer.DailyRoutineEventListFunctionName, new DailyRoutineEventListRenderer(_templatePlaceholderResolver, _cachedDbAccess, _defaultTemplateProvider, _errorCollection, data)); scriptObject.AddOrUpdate(DailyRoutineEventFunctionRenderer.DailyRoutineEventFunctionName, new DailyRoutineEventFunctionRenderer(_templatePlaceholderResolver, _cachedDbAccess, _defaultTemplateProvider, _errorCollection)); scriptObject.AddOrUpdate(DailyRoutineEventFunctionListRenderer.DailyRoutineEventFunctionListFunctionName, new DailyRoutineEventFunctionListRenderer(_templatePlaceholderResolver, _cachedDbAccess, _defaultTemplateProvider, _errorCollection)); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { KortistoNpc inputNpc = data.ExportData[ExportConstants.ExportDataObject] as KortistoNpc; if (inputNpc == null) { return; } SharedDailyRoutineExportUtil.SortDailyRoutine(inputNpc.DailyRoutine); List <ScribanExportDailyRoutineEvent> events = await ScribanDailyRoutineEventUtil.MapNpcDailyRoutineEvents(_cachedDbAccess, _dailyRoutineFunctionNameGenerator, inputNpc, inputNpc.DailyRoutine); scriptObject.AddOrUpdate(ExportConstants.ScribanDailyRoutineEventsObjectKey, events); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { KortistoNpc inputNpc = data.ExportData[ExportConstants.ExportDataObject] as KortistoNpc; if (inputNpc == null) { return; } StateMachine inputStateMachine = null; if (data.ExportData.ContainsKey(ExportConstants.ExportDataStateMachine)) { inputStateMachine = data.ExportData[ExportConstants.ExportDataStateMachine] as StateMachine; } ScribanExportStateMachine stateMachine = new ScribanExportStateMachine(); stateMachine.States = await BuildStateMachineFunctions(inputNpc, inputStateMachine); scriptObject.AddOrUpdate(ExportConstants.ScribanStateMachineObjectKey, stateMachine); scriptObject.AddOrUpdate(StateMachineFunctionPipeRenderer.StateMachineFunctionName, new StateMachineFunctionPipeRenderer(_templatePlaceholderResolver, _cachedDbAccess, _defaultTemplateProvider, _errorCollection)); }
/// <summary> /// Collects the values for an export /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> /// <returns>Task</returns> public override async Task CollectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { IFlexFieldExportable flexFieldObject = data.ExportData[ExportConstants.ExportDataObject] as IFlexFieldExportable; if (flexFieldObject == null) { return; } List <LanguageKey> referencedLanguageKeys = null; if (data.ExportData.ContainsKey(ExportConstants.ExportDataReferencedLanguageIds)) { referencedLanguageKeys = data.ExportData[ExportConstants.ExportDataReferencedLanguageIds] as List <LanguageKey>; } if (referencedLanguageKeys == null) { referencedLanguageKeys = new List <LanguageKey>(); } GoNorthProject project = await _exportCachedDbAccess.GetUserProject(); List <LanguageKey> languageKeys = await _languageKeyDbAccess.GetLanguageKeysByGroupId(project.Id, flexFieldObject.Id); ExportSettings exportSettings = await _exportCachedDbAccess.GetExportSettings(project.Id); languageKeys = languageKeys.OrderBy(l => GetLanguageKeySortOrder(l, flexFieldObject)).ToList(); ScribanExportLanguageFile languageFileData = new ScribanExportLanguageFile(); languageFileData.Object = FlexFieldValueCollectorUtil.ConvertScribanFlexFieldObject(flexFieldObject, exportSettings, _errorCollection); languageFileData.LanguageKeys = ConvertLanguageKeysToScriban(languageKeys, exportSettings); languageFileData.ReferencedLanguageKeys = ConvertLanguageKeysToScriban(referencedLanguageKeys, exportSettings); scriptObject.AddOrUpdate(LanguageObjectKey, languageFileData); }
/// <summary> /// Adds additional script object values /// </summary> /// <param name="templateType">Template type</param> /// <param name="parsedTemplate">Parsed scriban template</param> /// <param name="scriptObject">Scriban script object to fill</param> /// <param name="data">Export Data</param> protected override void AddAdditionalScriptObjectValues(TemplateType templateType, Template parsedTemplate, ScriptObject scriptObject, ExportObjectData data) { scriptObject.AddOrUpdate(InventoryListRenderer.InventoryListFunctionName, new InventoryListRenderer(_templatePlaceholderResolver, _exportCachedDbAccess, _defaultTemplateProvider, _errorCollection, data)); scriptObject.AddOrUpdate(SkillListRenderer.SkillListFunctionName, new SkillListRenderer(_templatePlaceholderResolver, _exportCachedDbAccess, _defaultTemplateProvider, _errorCollection, data)); }