Пример #1
0
        /// <summary>
        /// Fills the placeholders
        /// </summary>
        /// <param name="template">Template to use</param>
        /// <param name="errorCollection">Error Collection</param>
        /// <param name="parsedData">Parsed config data</param>
        /// <param name="itemObject">Item that was selected</param>
        /// <param name="npcObject">Npc that was selected</param>
        /// <param name="flexFieldObject">Flex field object to which the dialog belongs</param>
        /// <param name="curStep">Current step that is rendered</param>
        /// <param name="nextStep">Next step that is being rendered</param>
        /// <param name="exportSettings">Export Settings</param>
        /// <param name="stepRenderer">Action Step renderer</param>
        /// <returns>Filled placeholders</returns>
        protected override async Task <string> FillPlaceholders(ExportTemplate template, ExportPlaceholderErrorCollection errorCollection, InventoryChooseNpcActionData parsedData, IFlexFieldExportable itemObject, IFlexFieldExportable npcObject,
                                                                FlexFieldObject flexFieldObject, ExportDialogData curStep, ExportDialogData nextStep, ExportSettings exportSettings, IActionStepRenderer stepRenderer)
        {
            KortistoNpc npc = npcObject as KortistoNpc;

            if (npc == null)
            {
                errorCollection.AddDialogNpcNotFoundError();
                return(string.Empty);
            }

            ScribanInventoryChooseNpcActionData codeActionData = new ScribanInventoryChooseNpcActionData();

            codeActionData.Npc          = FlexFieldValueCollectorUtil.BuildFlexFieldValueObject <ScribanExportNpc>(null, null, npc, exportSettings, errorCollection);
            codeActionData.Npc.IsPlayer = npc.IsPlayerNpc;
            codeActionData.SelectedItem = FlexFieldValueCollectorUtil.BuildFlexFieldValueObject <ScribanExportItem>(null, null, itemObject, exportSettings, errorCollection);
            codeActionData.Quantity     = parsedData.Quantity.HasValue ? parsedData.Quantity.Value : 1;

            return(await ScribanActionRenderingUtil.FillPlaceholders(_cachedDbAccess, errorCollection, template.Code, codeActionData, flexFieldObject, curStep, nextStep, _scribanLanguageKeyGenerator, stepRenderer));
        }
Пример #2
0
        /// <summary>
        /// Fills the placeholders
        /// </summary>
        /// <param name="template">Template to use</param>
        /// <param name="errorCollection">Error Collection</param>
        /// <param name="parsedData">Parsed config data</param>
        /// <param name="itemObject">Item that was selected</param>
        /// <param name="npcObject">Npc that was selected</param>
        /// <param name="flexFieldObject">Flex field object to which the dialog belongs</param>
        /// <param name="curStep">Current step that is rendered</param>
        /// <param name="nextStep">Next step that is being rendered</param>
        /// <param name="exportSettings">Export Settings</param>
        /// <param name="stepRenderer">Action Step renderer</param>
        /// <returns>Filled placeholders</returns>
        protected override async Task <string> FillPlaceholders(ExportTemplate template, ExportPlaceholderErrorCollection errorCollection, InventoryChooseNpcActionData parsedData, IFlexFieldExportable itemObject, IFlexFieldExportable npcObject,
                                                                FlexFieldObject flexFieldObject, ExportDialogData curStep, ExportDialogData nextStep, ExportSettings exportSettings, IActionStepRenderer stepRenderer)
        {
            string actionCode = template.Code;

            actionCode = ExportUtil.BuildPlaceholderRegex(Placeholder_Quantity).Replace(actionCode, parsedData.Quantity.HasValue ? parsedData.Quantity.Value.ToString() : "1");

            ExportObjectData itemExportData = new ExportObjectData();

            itemExportData.ExportData.Add(ExportConstants.ExportDataObject, itemObject);
            itemExportData.ExportData.Add(ExportConstants.ExportDataObjectType, ExportConstants.ExportObjectTypeItem);
            _flexFieldPlaceholderResolverItem.SetErrorMessageCollection(errorCollection);
            actionCode = _flexFieldPlaceholderResolverItem.FillPlaceholders(actionCode, itemExportData).Result;

            ExportObjectData npcExportData = new ExportObjectData();

            npcExportData.ExportData.Add(ExportConstants.ExportDataObject, npcObject);
            npcExportData.ExportData.Add(ExportConstants.ExportDataObjectType, ExportConstants.ExportObjectTypeNpc);
            _flexFieldPlaceholderResolverNpc.SetErrorMessageCollection(errorCollection);
            actionCode = _flexFieldPlaceholderResolverNpc.FillPlaceholders(actionCode, npcExportData).Result;

            return(await stepRenderer.ReplaceBasePlaceholders(errorCollection, actionCode, curStep, nextStep, flexFieldObject));
        }