├── FunctionApp.ETL ├── host.json ├── DISupport │ ├── InjectAttribute.cs │ ├── InjectBindingProvider.cs │ ├── ScopeCleanupFilter.cs │ ├── InjectConfiguration.cs │ └── InjectBinding.cs ├── Properties │ └── PublishProfiles │ │ └── FFRKFunctionApp - Web Deploy.pubxml ├── ExecuteImport.cs ├── ExecuteMerge.cs ├── ValidateSourceData.cs ├── ExecuteTransform.cs ├── StoreImport.cs ├── StoreMerge.cs ├── StoreTransform.cs └── GetFormattedDate.cs ├── Infra.Options.EnlirETL ├── ApplicationOptions.cs ├── SheetsServiceOptions.cs ├── OtherImporterOptions.cs ├── AbilityImporterOptions.cs ├── CommandImporterOptions.cs ├── DungeonImporterOptions.cs ├── EventImporterOptions.cs ├── MissionImporterOptions.cs ├── RelicImporterOptions.cs ├── StatusImporterOptions.cs ├── MagiciteImporterOptions.cs ├── SoulBreakImporterOptions.cs ├── BraveActionImporterOptions.cs ├── ExperienceImporterOptions.cs ├── LegendMateriaImporterOptions.cs ├── MagiciteSkillImporterOptions.cs ├── RecordMateriaImporterOptions..cs ├── FileMergeStorageOptions.cs ├── FileImportStorageOptions.cs ├── FileTransformStorageOptions.cs ├── LoggingOptions.cs ├── Infra.Options.EnlirETL.csproj ├── CharacterImporterOptions.cs ├── ApiExternalWebsiteOptions.cs ├── CachingOptions.cs ├── LegendSphereImporterOptions.cs ├── RecordSphereImporterOptions.cs ├── ImporterOptions.cs └── AzureBlobStorageOptions.cs ├── Dto.Api ├── ItemWithItemCount.cs ├── ItemWithStarLevel.cs ├── ItemWithCountAndStarLevel.cs ├── Banners │ ├── SelectionDomain.cs │ ├── PrizeResultRow.cs │ ├── PrizeSelectionRow.cs │ ├── BannerRelicMetadata.cs │ ├── PullResultRow.cs │ └── PrizeSelectionsForSuccessInfo.cs ├── CharacterRating │ ├── LegendMateriaSummaryInfo.cs │ ├── RatingPoolRankInfo.cs │ ├── RatingPool.cs │ ├── CharacterRatingContextInfo.cs │ └── AltemaCharacterInfo.cs ├── Dto.Api.csproj ├── Mission.cs ├── Status.cs ├── RecordMateria.cs ├── RecordSphere.cs ├── LegendMateria.cs ├── LegendSphere.cs ├── TypeListBundle.cs ├── Dungeon.cs ├── MagiciteSkill.cs ├── Command.cs ├── Event.cs ├── Experience.cs ├── Other.cs ├── IdListBundle.cs ├── BraveAction.cs ├── Ability.cs ├── SoulBreak.cs ├── Magicite.cs └── Relic.cs ├── Api.FFRK ├── appsettings.Development.json ├── appsettings.json ├── Properties │ ├── launchSettings.json │ └── PublishProfiles │ │ └── FFRKApi - Web Deploy.pubxml ├── config.local.json ├── config.json ├── CharacterRatingMappingProfile.cs ├── BannersMappingProfile.cs ├── Controllers │ └── MaintenanceController.cs └── Program.cs ├── Model.Api ├── Model.Api.csproj ├── Banners │ ├── SelectionDomain.cs │ ├── PrizeResultRow.cs │ ├── PrizeSelectionRow.cs │ ├── BannerRelicMetadata.cs │ ├── PullResultRow.cs │ └── PrizeSelectionsForSuccessInfo.cs ├── CharacterRating │ ├── LegendMateriaSummaryInfo.cs │ ├── RatingPoolRankInfo.cs │ ├── RatingPool.cs │ ├── CharacterRatingContextInfo.cs │ └── AltemaCharacterInfo.cs ├── TypeListBundle.cs └── IdListBundle.cs ├── Model.EnlirTransform ├── IdLists │ ├── ITypeList.cs │ ├── StatSetTypeList.cs │ ├── DamageFormulaTypeList.cs │ ├── StatTypeList.cs │ ├── AbilityTypeList.cs │ ├── SoulBreakTierList.cs │ ├── EventTypeList.cs │ └── MissionTypeList.cs ├── ItemWithItemCount.cs ├── ItemWithStarLevel.cs ├── Model.EnlirTransform.csproj ├── ItemWithCountAndStarLevel.cs ├── Mission.cs ├── Status.cs ├── Converters │ ├── DateConverter.cs │ ├── IntConverter.cs │ ├── StringToBooleanConverter.cs │ ├── PercentConverter.cs │ └── TypeListConverter.cs ├── RecordMateria.cs ├── RecordSphere.cs ├── LegendMateria.cs ├── LegendSphere.cs ├── Dungeon.cs ├── IModelDescriptor.cs ├── TransformResultsContainer.cs ├── Command.cs ├── Event.cs ├── MagiciteSkill.cs ├── Experience.cs ├── Other.cs ├── BraveAction.cs ├── Ability.cs ├── SoulBreak.cs └── Magicite.cs ├── Logic.EnlirImport ├── IRowImporter.cs ├── Logic.EnlirImport.csproj ├── MissionImporter.cs ├── StatusImporter.cs ├── RecordMateriaImporter.cs ├── LegendMateriaImporter.cs └── DungeonImporter.cs ├── Model.EnlirImport ├── Model.EnlirImport.csproj ├── MissionRow.cs ├── StatusRow.cs ├── RecordMateriaRow.cs ├── LegendMateriaRow.cs ├── DungeonRow.cs ├── OtherRow.cs ├── EventRow.cs ├── ImportResultsContainer.cs ├── CommandRow.cs ├── MagiciteSkillRow.cs ├── LegendSphereRow.cs ├── SoulBreakRow.cs ├── BraveActionRow.cs └── ExperienceRow.cs ├── Logic.EnlirTransform ├── IRowTransformer.cs ├── Logic.EnlirTransform.csproj ├── MissionTransformer.cs ├── StatusTransformer.cs └── RecordMateriaTransformer.cs ├── Model.EnlirMerge └── Model.EnlirMerge.csproj ├── Logic.EnlirMerge └── Logic.EnlirMerge.csproj ├── Data.Api ├── Data.Api.csproj ├── AltemaCharacterRatingFileRepository.cs ├── AltemaCharacterRatingWebRepository.cs └── EnlirRepository.cs ├── Logic.Validation └── Logic.Validation.csproj ├── Logic.Api ├── Logic.Api.csproj ├── CharacterRating │ ├── AltemaCharacterNodeComponents.cs │ └── AltemaCharacterNodeParser.cs ├── MaintenanceLogic.cs └── ExperiencesLogic.cs ├── SheetsApiHelper └── SheetsApiHelper.csproj ├── Test.Logic.Api └── Test.Logic.Api.csproj └── Data.Storage ├── Data.Storage.csproj ├── IImportStorageProvider.cs ├── IMergeStorageProvider.cs ├── ITransformStorageProvider.cs ├── FileMergeStorageProvider.cs └── FileImportStorageProvider.cs /FunctionApp.ETL/host.json: -------------------------------------------------------------------------------- 1 | { 2 | } -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/ApplicationOptions.cs: -------------------------------------------------------------------------------- 1 | namespace FFRK.Api.Infra.Options.EnlirETL 2 | { 3 | public class ApplicationOptions 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Dto.Api/ItemWithItemCount.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class ItemWithItemCount 4 | { 5 | public string ItemName { get; set; } 6 | public int ItemCount { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Dto.Api/ItemWithStarLevel.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class ItemWithStarLevel 4 | { 5 | public string ItemName { get; set; } 6 | public int ItemStarLevel { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Api.FFRK/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/SheetsServiceOptions.cs: -------------------------------------------------------------------------------- 1 | namespace FFRK.Api.Infra.Options.EnlirETL 2 | { 3 | public class SheetsServiceOptions 4 | { 5 | public string Name { get; set; } 6 | public string ApiKey { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/OtherImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class OtherImporterOptions: ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/AbilityImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class AbilityImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/CommandImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class CommandImporterOptions: ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/DungeonImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class DungeonImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/EventImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class EventImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/MissionImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class MissionImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/RelicImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class RelicImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/StatusImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class StatusImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/MagiciteImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class MagiciteImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/SoulBreakImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class SoulBreakImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/BraveActionImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class BraveActionImporterOptions: ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/ExperienceImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class ExperienceImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/LegendMateriaImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class LegendMateriaImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/MagiciteSkillImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class MagiciteSkillImporterOptions: ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/RecordMateriaImporterOptions..cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class RecordMateriaImporterOptions : ImporterOptions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Dto.Api/ItemWithCountAndStarLevel.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class ItemWithCountAndStarLevel 4 | { 5 | public string ItemName { get; set; } 6 | public int ItemCount { get; set; } 7 | public int ItemStarLevel { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Api.FFRK/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "Debug": { 5 | "LogLevel": { 6 | "Default": "Warning" 7 | } 8 | }, 9 | "Console": { 10 | "LogLevel": { 11 | "Default": "Warning" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Model.Api/Model.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Model.Api 6 | FFRKApi.Model.Api 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/ITypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public interface ITypeList 8 | { 9 | IList> TypeList { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/FileMergeStorageOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class FileMergeStorageOptions 8 | { 9 | public string MergeResultsStoragePath { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Logic.EnlirImport/IRowImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace FFRKApi.Logic.EnlirImport 7 | { 8 | public interface IRowImporter where T : class 9 | { 10 | IEnumerable Import(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/FileImportStorageOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class FileImportStorageOptions 8 | { 9 | public string ImportResultsStoragePath { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/FileTransformStorageOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class FileTransformStorageOptions 8 | { 9 | public string TransformResultsStoragePath { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/LoggingOptions.cs: -------------------------------------------------------------------------------- 1 | namespace FFRK.Api.Infra.Options.EnlirETL 2 | { 3 | public class LoggingOptions 4 | { 5 | public string LogFilePath { get; set; } 6 | 7 | public string ApplicationInsightsKey { get; set; } 8 | 9 | public string AppComponentName { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Model.EnlirImport/Model.EnlirImport.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Model.EnlirImport 6 | FFRKApi.Model.EnlirImport 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Model.EnlirTransform/ItemWithItemCount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class ItemWithItemCount 8 | { 9 | public string ItemName { get; set; } 10 | public int ItemCount { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Model.EnlirTransform/ItemWithStarLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class ItemWithStarLevel 8 | { 9 | public string ItemName { get; set; } 10 | public int ItemStarLevel { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /FunctionApp.ETL/DISupport/InjectAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Azure.WebJobs.Description; 3 | 4 | namespace FunctionApp.ETL.DISupport 5 | 6 | { 7 | [Binding] 8 | [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)] 9 | public class InjectAttribute : Attribute 10 | { 11 | 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /Model.EnlirTransform/Model.EnlirTransform.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Model.EnlirTransform 6 | FFRKApi.Model.EnlirTransform 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/Infra.Options.EnlirETL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRK.Api.Infra.Options.EnlirETL 6 | FFRK.Api.Infra.Options.EnlirETL 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/CharacterImporterOptions.cs: -------------------------------------------------------------------------------- 1 | namespace FFRK.Api.Infra.Options.EnlirETL 2 | { 3 | public class CharacterImporterOptions : ImporterOptions 4 | { 5 | //public string SpreadsheetId { get; set; } 6 | //public string WorkSheetName { get; set; } 7 | //public string RangeExpression { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Dto.Api/Banners/SelectionDomain.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api.Banners 4 | { 5 | public class SelectionDomain 6 | { 7 | public string SelectionDomainName { get; set; } 8 | public int PrizesToSelectFromDomainCount { get; set; } 9 | public IList PrizeSelectionTable { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/ApiExternalWebsiteOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class ApiExternalWebsiteOptions 8 | { 9 | public string AltemaCharacterRatingsUrl { get; set; } 10 | 11 | public string PrizeSelectionUrl { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Dto.Api/CharacterRating/LegendMateriaSummaryInfo.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api.CharacterRating 2 | { 3 | public class LegendMateriaSummaryInfo 4 | { 5 | public int LegendMateriaId { get; set; } 6 | public string LegendMateriaName { get; set; } 7 | public string Effect { get; set; } 8 | public int RelicId { get; set; } //0 = LM1 or LM2 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Dto.Api/CharacterRating/RatingPoolRankInfo.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api.CharacterRating 2 | { 3 | public class RatingPoolRankInfo 4 | { 5 | public string RatingPoolName { get; set; } //e.g. LegendDiveMoteType 6 | public int RatingPoolMemberCount { get; set; } //e.g. 55 7 | 8 | public int CharacterRankInRatingPool { get; set; } //e.g. 4 9 | 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Model.Api/Banners/SelectionDomain.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Model.Api.Banners 4 | { 5 | public class SelectionDomain 6 | { 7 | public string SelectionDomainName { get; set; } 8 | public int PrizesToSelectFromDomainCount { get; set; } 9 | public IList PrizeSelectionTable { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Model.EnlirTransform/ItemWithCountAndStarLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class ItemWithCountAndStarLevel 8 | { 9 | public string ItemName { get; set; } 10 | public int ItemCount { get; set; } 11 | public int ItemStarLevel { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Dto.Api/Dto.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Dto.Api 6 | FFRKApi.Dto.Api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/CachingOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class CachingOptions 8 | { 9 | public string ConnectionString { get; set; } 10 | public string DefaultTimeToLiveInHours { get; set; } 11 | public string UseCache { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Logic.EnlirTransform/IRowTransformer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Logic.EnlirTransform 6 | { 7 | public interface IRowTransformer where TRow : class 8 | where TModel : class 9 | { 10 | IEnumerable Transform(IEnumerable importedRows); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Dto.Api/CharacterRating/RatingPool.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api.CharacterRating 4 | { 5 | public class RatingPool 6 | { 7 | public string RatingPoolName { get; set; } //e.g. LegendDiveMoteType 8 | public int RatingPoolMemberCount => CharactersInRatingPool?.Count ?? 0; 9 | public IList CharactersInRatingPool { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/LegendSphereImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class LegendSphereImporterOptions : ImporterOptions 8 | { 9 | //public string SpreadsheetId { get; set; } 10 | //public string WorkSheetName { get; set; } 11 | //public string RangeExpression { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/RecordSphereImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class RecordSphereImporterOptions : ImporterOptions 8 | { 9 | //public string SpreadsheetId { get; set; } 10 | //public string WorkSheetName { get; set; } 11 | //public string RangeExpression { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/ImporterOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class ImporterOptions 8 | { 9 | public string SpreadsheetId { get; set; } 10 | public string WorkSheetName { get; set; } 11 | public string RangeExpression { get; set; } 12 | public int ValueRenderOption { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Model.EnlirMerge/Model.EnlirMerge.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Model.EnlirMerge 6 | FFRKApi.Model.EnlirMerge 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Model.Api/CharacterRating/LegendMateriaSummaryInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api.CharacterRating 6 | { 7 | public class LegendMateriaSummaryInfo 8 | { 9 | public int LegendMateriaId { get; set; } 10 | public string LegendMateriaName { get; set; } 11 | public string Effect { get; set; } 12 | public int RelicId { get; set; } //0 = LM1 or LM2 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Model.Api/CharacterRating/RatingPoolRankInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api.CharacterRating 6 | { 7 | public class RatingPoolRankInfo 8 | { 9 | public string RatingPoolName { get; set; } //e.g. LegendDiveMoteType 10 | public int RatingPoolMemberCount { get; set; } //e.g. 55 11 | 12 | public int CharacterRankInRatingPool { get; set; } //e.g. 4 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Model.Api/CharacterRating/RatingPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace FFRKApi.Model.Api.CharacterRating 7 | { 8 | public class RatingPool 9 | { 10 | public string RatingPoolName { get; set; } //e.g. LegendDiveMoteType 11 | public int RatingPoolMemberCount => CharactersInRatingPool?.Count ?? 0; 12 | public IList CharactersInRatingPool { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Logic.EnlirMerge/Logic.EnlirMerge.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Logic.EnlirMerge 6 | FFRKApi.Logic.EnlirMerge 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Dto.Api/Banners/PrizeResultRow.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api.Banners 2 | { 3 | public class PrizeResultRow 4 | { 5 | public int PrizeIndex { get; set; } //starting from 1 6 | public string PrizeCategoryName { get; set; } 7 | public string PrizeName { get; set; } 8 | public int PrizeSelectedCount { get; set; } 9 | 10 | public override string ToString() 11 | { 12 | return $"{PrizeIndex,-8}{PrizeSelectedCount,-8}{PrizeCategoryName,-25}{PrizeName,-50}"; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Model.Api/Banners/PrizeResultRow.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Model.Api.Banners 2 | { 3 | public class PrizeResultRow 4 | { 5 | public int PrizeIndex { get; set; } //starting from 1 6 | public string PrizeCategoryName { get; set; } 7 | public string PrizeName { get; set; } 8 | public int PrizeSelectedCount { get; set; } 9 | 10 | public override string ToString() 11 | { 12 | return $"{PrizeIndex,-8}{PrizeSelectedCount,-8}{PrizeCategoryName,-25}{PrizeName,-50}"; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Dto.Api/Banners/PrizeSelectionRow.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api.Banners 2 | { 3 | public class PrizeSelectionRow 4 | { 5 | public int PrizeIndex { get; set; } //starting from 1 6 | public double PrizeProbabilityLowerBound { get; set; } 7 | public string PrizeCategoryName { get; set; } 8 | public string PrizeName { get; set; } 9 | 10 | public override string ToString() 11 | { 12 | return $"{PrizeIndex,-8}{PrizeProbabilityLowerBound,-25}{PrizeCategoryName,-20}{PrizeName,-50}"; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Dto.Api/Mission.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Mission 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public int MissionType { get; set; } 13 | public string AssociatedEvent { get; set; } 14 | public int AssociatedEventId { get; set; } 15 | public IEnumerable Rewards { get; set; } 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Model.Api/Banners/PrizeSelectionRow.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Model.Api.Banners 2 | { 3 | public class PrizeSelectionRow 4 | { 5 | public int PrizeIndex { get; set; } //starting from 1 6 | public double PrizeProbabilityLowerBound { get; set; } 7 | public string PrizeCategoryName { get; set; } 8 | public string PrizeName { get; set; } 9 | 10 | public override string ToString() 11 | { 12 | return $"{PrizeIndex,-8}{PrizeProbabilityLowerBound,-25}{PrizeCategoryName,-20}{PrizeName,-50}"; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Model.EnlirImport/MissionRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum MissionColumn 8 | { 9 | Type = 0, 10 | Event = 1, 11 | Description = 2, 12 | Reward = 3 13 | } 14 | 15 | 16 | public class MissionRow 17 | { 18 | public string Type { get; set; } 19 | public string Event { get; set; } 20 | public string Description { get; set; } 21 | public string Reward { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Logic.EnlirImport/Logic.EnlirImport.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Logic.EnlirImport 6 | FFRKApi.Logic.EnlirImport 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Mission.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Mission: IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public int MissionType { get; set; } 15 | public string AssociatedEvent { get; set; } 16 | public int AssociatedEventId { get; set; } 17 | public IEnumerable Rewards { get; set; } 18 | } 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Data.Api/Data.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Data.Api 6 | FFRKApi.Data.Api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Infra.Options.EnlirETL/AzureBlobStorageOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRK.Api.Infra.Options.EnlirETL 6 | { 7 | public class AzureBlobStorageOptions 8 | { 9 | public string StorageAccountName { get; set; } 10 | public string ContainerName { get; set; } 11 | public string ConnectionString { get; set; } 12 | 13 | public string ImportResultsStoragePath { get; set; } 14 | 15 | public string TransformResultsStoragePath { get; set; } 16 | 17 | public string MergeResultsStoragePath { get; set; } 18 | 19 | public string BannerStoragePath { get; set; } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Dto.Api/Banners/BannerRelicMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api.Banners 2 | { 3 | public class BannerRelicMetadata 4 | { 5 | public int BannerSlot { get; set; } 6 | public int RelicId { get; set; } 7 | public string RelicName { get; set; } 8 | public int CharacterId { get; set; } 9 | public string CharacterName { get; set; } 10 | public int SoulBreakId { get; set; } 11 | public string SoulBreakName { get; set; } 12 | public int LegendMateriaId { get; set; } 13 | public string LegendMateriaName { get; set; } 14 | public int SoulBreakTierType { get; set; } 15 | public string SoulBreakTierName { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Logic.Validation/Logic.Validation.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Logic.Validation 6 | FFRKApi.Logic.Validation 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Dto.Api/Status.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Status 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public int StatusId { get; set; } 13 | public string CommonName { get; set; } 14 | public string Effects { get; set; } 15 | public int DefaultDuration { get; set; } 16 | public double MindModifier { get; set; } 17 | public IEnumerable ExclusiveStatuses { get; set; } 18 | public string CodedName { get; set; } 19 | public string Notes { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Logic.Api/Logic.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Logic.Api 6 | FFRKApi.Logic.Api 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Logic.EnlirTransform/Logic.EnlirTransform.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Logic.EnlirTransform 6 | FFRKApi.Logic.EnlirTransform 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /SheetsApiHelper/SheetsApiHelper.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.SheetsApiHelper 6 | FFRKApi.SheetsApiHelper 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Model.Api/Banners/BannerRelicMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api.Banners 6 | { 7 | public class BannerRelicMetadata 8 | { 9 | public int BannerSlot { get; set; } 10 | public int RelicId { get; set; } 11 | public string RelicName { get; set; } 12 | public int CharacterId { get; set; } 13 | public string CharacterName { get; set; } 14 | public int SoulBreakId { get; set; } 15 | public string SoulBreakName { get; set; } 16 | public int LegendMateriaId { get; set; } 17 | public string LegendMateriaName { get; set; } 18 | public int SoulBreakTierType { get; set; } 19 | public string SoulBreakTierName { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Dto.Api/Banners/PullResultRow.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api.Banners 2 | { 3 | public class PullResultRow 4 | { 5 | public int BannerSlot { get; set; } 6 | public int RelicId { get; set; } 7 | public string RelicName { get; set; } 8 | public string CategoryName { get; set; } 9 | public int SelectedCount { get; set; } 10 | public int CharacterId { get; set; } 11 | public string CharacterName { get; set; } 12 | public int SoulBreakId { get; set; } 13 | public string SoulBreakName { get; set; } 14 | public int LegendMateriaId { get; set; } 15 | public string LegendMateriaName { get; set; } 16 | public int SoulBreakTierType { get; set; } 17 | public string SoulBreakTierName { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Status.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Status : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public int StatusId { get; set; } 15 | public string CommonName { get; set; } 16 | public string Effects { get; set; } 17 | public int DefaultDuration { get; set; } 18 | public double MindModifier { get; set; } 19 | public IEnumerable ExclusiveStatuses { get; set; } 20 | public string CodedName { get; set; } 21 | public string Notes { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Api.FFRK/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:25746/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "swagger/ui", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "local" 17 | } 18 | }, 19 | "Api.FFRK": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "launchUrl": "api/values", 23 | "environmentVariables": { 24 | "ASPNETCORE_ENVIRONMENT": "local" 25 | }, 26 | "applicationUrl": "http://localhost:25747/" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Model.Api/Banners/PullResultRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api.Banners 6 | { 7 | public class PullResultRow 8 | { 9 | public int BannerSlot { get; set; } 10 | public int RelicId { get; set; } 11 | public string RelicName { get; set; } 12 | public string CategoryName { get; set; } 13 | public int SelectedCount { get; set; } 14 | public int CharacterId { get; set; } 15 | public string CharacterName { get; set; } 16 | public int SoulBreakId { get; set; } 17 | public string SoulBreakName { get; set; } 18 | public int LegendMateriaId { get; set; } 19 | public string LegendMateriaName { get; set; } 20 | public int SoulBreakTierType { get; set; } 21 | public string SoulBreakTierName { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Model.EnlirImport/StatusRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum StatusColumn 8 | { 9 | ID = 0, 10 | CommonName = 1, 11 | Effects = 2, 12 | DefaultDuration = 3, 13 | MindModifier = 4, 14 | ExclusiveStatus = 5, 15 | CodedName = 6, 16 | Notes = 7 17 | } 18 | 19 | public class StatusRow 20 | { 21 | public string ID { get; set; } 22 | public string CommonName { get; set; } 23 | public string Effects { get; set; } 24 | public string DefaultDuration { get; set; } 25 | public string MindModifier { get; set; } 26 | public string ExclusiveStatus { get; set; } 27 | public string CodedName { get; set; } 28 | public string Notes { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dto.Api/RecordMateria.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class RecordMateria 4 | { 5 | #region IModelDescriptor Implementation 6 | public int Id { get; set; } 7 | public string Description { get; set; } 8 | #endregion 9 | 10 | public string RecordMateriaName { get; set; } 11 | public string JapaneseName { get; set; } 12 | 13 | public string ImagePath { get; set; } 14 | 15 | 16 | public string CharacterName { get; set; } 17 | public int CharacterId { get; set; } //filled in during merge phase 18 | public int Realm { get; set; } 19 | 20 | 21 | public string Effect { get; set; } 22 | public string UnlockCriteria { get; set; } 23 | public string EnlirId { get; set; } 24 | public bool IsInGlobal { get; set; } 25 | public bool IsChecked { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Converters/DateConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | 6 | namespace FFRKApi.Model.EnlirTransform.Converters 7 | { 8 | public class DateConverter 9 | { 10 | public DateTime ConvertFromEuropeanDateString(string europeanDate) 11 | { 12 | DateTime utcDate = DateTime.MaxValue; 13 | 14 | if (!String.IsNullOrWhiteSpace(europeanDate)) 15 | { 16 | try 17 | { 18 | utcDate = DateTime.Parse(europeanDate, new CultureInfo("fr-FR")); 19 | } 20 | catch (Exception) 21 | { 22 | ; //swallow error, it is enough that we report a default data of MaxDate 23 | } 24 | } 25 | 26 | 27 | return utcDate; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Test.Logic.Api/Test.Logic.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Dto.Api/RecordSphere.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class RecordSphere 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public string RecordSphereName { get; set; } 13 | 14 | public string CharacterName { get; set; } 15 | public int CharacterId { get; set; } //filled in during merge phase 16 | public int Realm { get; set; } 17 | 18 | public string RecordSpherePrerequisites { get; set; } 19 | 20 | public IEnumerable RecordSphereLevels { get; set; } 21 | } 22 | 23 | public class RecordSphereLevel 24 | { 25 | public int Level { get; set; } 26 | public string Benefit { get; set; } 27 | 28 | public IList RequiredMotes { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /FunctionApp.ETL/DISupport/InjectBindingProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Concurrent; 3 | using System.Threading.Tasks; 4 | using Microsoft.Azure.WebJobs.Host.Bindings; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | namespace FunctionApp.ETL.DISupport 8 | { 9 | public class InjectBindingProvider : IBindingProvider 10 | 11 | { 12 | public static readonly ConcurrentDictionary Scopes = new ConcurrentDictionary(); 13 | 14 | private readonly IServiceProvider _serviceProvider; 15 | 16 | public InjectBindingProvider(IServiceProvider serviceProvider) => _serviceProvider = serviceProvider; 17 | 18 | public Task TryCreateAsync(BindingProviderContext context) 19 | { 20 | IBinding binding = new InjectBinding(_serviceProvider, context.Parameter.ParameterType); 21 | 22 | return Task.FromResult(binding); 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Dto.Api/LegendMateria.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class LegendMateria 4 | { 5 | #region IModelDescriptor Implementation 6 | public int Id { get; set; } 7 | public string Description { get; set; } 8 | #endregion 9 | 10 | public string LegendMateriaName { get; set; } 11 | public string JapaneseName { get; set; } 12 | public int Realm { get; set; } 13 | public string CharacterName { get; set; } 14 | public int CharacterId { get; set; } //filled in during merge phase 15 | public string ImagePath { get; set; } 16 | 17 | public string Effect { get; set; } 18 | public string MasteryBonus { get; set; } 19 | public string RelicName { get; set; } 20 | public int RelicId { get; set; }//filled in during merge phase 21 | public string EnlirId { get; set; } 22 | public bool IsInGlobal { get; set; } 23 | public bool IsChecked { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Dto.Api/CharacterRating/CharacterRatingContextInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api.CharacterRating 4 | { 5 | public class CharacterRatingContextInfo 6 | { 7 | public int CharacterId { get; set; } 8 | public string CharacterName { get; set; } 9 | 10 | public int AltemaCharacterRating { get; set; } 11 | public int AltemaOrder { get; set; } 12 | 13 | public IList Roles { get; set; } 14 | 15 | public IList ProficientSchools { get; set; } 16 | 17 | 18 | public string LegendDiveMote1Type { get; set; } 19 | public string LegendDiveMote2Type { get; set; } 20 | 21 | public LegendMateriaSummaryInfo LegendMateria1 { get; set; } 22 | public LegendMateriaSummaryInfo LegendMateria2 { get; set; } 23 | 24 | public IList LegendMateriaFromRelics { get; set; } 25 | 26 | public IList RatingPoolRankInfos { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Model.EnlirTransform/RecordMateria.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class RecordMateria : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string RecordMateriaName { get; set; } 15 | public string JapaneseName { get; set; } 16 | 17 | public string ImagePath { get; set; } 18 | 19 | 20 | public string CharacterName { get; set; } 21 | public int CharacterId { get; set; } //filled in during merge phase 22 | public int Realm { get; set; } 23 | 24 | 25 | public string Effect { get; set; } 26 | public string UnlockCriteria { get; set; } 27 | public string EnlirId { get; set; } 28 | public bool IsInGlobal { get; set; } 29 | public bool IsChecked { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Model.EnlirTransform/RecordSphere.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class RecordSphere : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string RecordSphereName { get; set; } 15 | 16 | public string CharacterName { get; set; } 17 | public int CharacterId { get; set; } //filled in during merge phase 18 | public int Realm { get; set; } 19 | 20 | public string RecordSpherePrerequisites { get; set; } 21 | 22 | public IEnumerable RecordSphereLevels { get; set; } 23 | } 24 | 25 | public class RecordSphereLevel 26 | { 27 | public int Level { get; set; } 28 | public string Benefit { get; set; } 29 | 30 | public IList RequiredMotes { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Model.Api/CharacterRating/CharacterRatingContextInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api.CharacterRating 6 | { 7 | public class CharacterRatingContextInfo 8 | { 9 | public int CharacterId { get; set; } 10 | public string CharacterName { get; set; } 11 | 12 | public int AltemaCharacterRating { get; set; } 13 | public int AltemaOrder { get; set; } 14 | 15 | public IList Roles { get; set; } 16 | 17 | public IList ProficientSchools { get; set; } 18 | 19 | 20 | public string LegendDiveMote1Type { get; set; } 21 | public string LegendDiveMote2Type { get; set; } 22 | 23 | public LegendMateriaSummaryInfo LegendMateria1 { get; set; } 24 | public LegendMateriaSummaryInfo LegendMateria2 { get; set; } 25 | 26 | public IList LegendMateriaFromRelics { get; set; } 27 | 28 | public IList RatingPoolRankInfos { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/StatSetTypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class StatSetTypeList : ITypeList 8 | { 9 | private readonly IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, "Base"), 13 | new KeyValuePair(2, "Standard"), 14 | new KeyValuePair(3, "Max") 15 | }; 16 | 17 | 18 | public IList> TypeList => _typeList; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Model.EnlirImport/RecordMateriaRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum RecordMateriaColumn 8 | { 9 | Realm = 0, 10 | Character = 1, 11 | ImagePath = 2, 12 | RecordMateriaName = 3, 13 | Effect = 4, 14 | UnlockCriteria = 5, 15 | JapaneseName = 6, 16 | ID = 7, 17 | IsInGlobal = 8, 18 | Checked = 9 19 | } 20 | 21 | public class RecordMateriaRow 22 | { 23 | //General 24 | public string Realm { get; set; } 25 | public string Character { get; set; } 26 | public string ImagePath { get; set; } 27 | public string RecordMateriaName { get; set; } 28 | public string Effect { get; set; } 29 | public string UnlockCriteria { get; set; } 30 | public string JapaneseName { get; set; } 31 | public string ID { get; set; } 32 | public string IsInGlobal { get; set; } 33 | public string Checked { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Api.FFRK/config.local.json: -------------------------------------------------------------------------------- 1 | { 2 | "FileMergeStorageOptions": { 3 | "MergeResultsStoragePath": "D:\\Temp\\FFRKApi\\MergeResults-{Date}.json" 4 | }, 5 | "AzureBlobStorageOptions": { 6 | "StorageAccountName": "Placeholder", 7 | "ContainerName": "Placeholder", 8 | "ConnectionString": "Placeholder", 9 | "ImportResultsStoragePath": "Import\\ImportResults-{Date}.json", 10 | "TransformResultsStoragePath": "Transform\\TransformResults-{Date}.json", 11 | "MergeResultsStoragePath": "Merge\\MergeResults-{Date}.json", 12 | "BannerStoragePath": "Banner" 13 | }, 14 | "LoggingOptions": { 15 | "LogFilePath": "FFRKApi.ETL.Log-{Date}.txt", 16 | "ApplicationInsightsKey": "Placeholder", 17 | "AppComponentName": "Api.FFRK" 18 | }, 19 | "CachingOptions": { 20 | "ConnectionString": "Placeholder", 21 | "DefaultTimeToLiveInHours": "2", 22 | "UseCache": "false" 23 | }, 24 | "ApiExternalWebsiteOptions": { 25 | "AltemaCharacterRatingsUrl": "https://altema.jp/ffrk/charahyoka", 26 | "PrizeSelectionUrl": "http://localhost:14831/api/v1.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Api.FFRK/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "FileMergeStorageOptions": { 3 | "MergeResultsStoragePath": "D:\\Temp\\FFRKApi\\MergeResults-{Date}.json" 4 | }, 5 | "AzureBlobStorageOptions": { 6 | "StorageAccountName": "Placeholder", 7 | "ContainerName": "Placeholder", 8 | "ConnectionString": "Placeholder", 9 | "ImportResultsStoragePath": "Import\\ImportResults-{Date}.json", 10 | "TransformResultsStoragePath": "Transform\\TransformResults-{Date}.json", 11 | "MergeResultsStoragePath": "Merge\\MergeResults-{Date}.json", 12 | "BannerStoragePath": "Banner" 13 | }, 14 | "LoggingOptions": { 15 | "LogFilePath": "FFRKApi.ETL.Log-{Date}.txt", 16 | "ApplicationInsightsKey": "Placeholder", 17 | "AppComponentName": "Api.FFRK" 18 | }, 19 | "CachingOptions": { 20 | "ConnectionString": "Placeholder", 21 | "DefaultTimeToLiveInHours": "2", 22 | "UseCache": "true" 23 | }, 24 | "ApiExternalWebsiteOptions": { 25 | "AltemaCharacterRatingsUrl": "https://altema.jp/ffrk/charahyoka", 26 | "PrizeSelectionUrl": "http://prizeselectionapi.azurewebsites.net/api/v1.0" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Model.EnlirTransform/LegendMateria.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class LegendMateria : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string LegendMateriaName { get; set; } 15 | public string JapaneseName { get; set; } 16 | public int Realm { get; set; } 17 | public string CharacterName { get; set; } 18 | public int CharacterId { get; set; } //filled in during merge phase 19 | public string ImagePath { get; set; } 20 | 21 | public string Effect { get; set; } 22 | public string MasteryBonus { get; set; } 23 | public string RelicName { get; set; } 24 | public int RelicId { get; set; }//filled in during merge phase 25 | public string EnlirId { get; set; } 26 | public bool IsInGlobal { get; set; } 27 | public bool IsChecked { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Data.Storage/Data.Storage.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | FFRKApi.Data.Storage 6 | FFRKApi.Data.Storage 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Dto.Api/Banners/PrizeSelectionsForSuccessInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FFRKApi.Dto.Api.Banners 4 | { 5 | public class PrizeSelectionsForSuccessInfo 6 | { 7 | public int TrialsConducted { get; set; } 8 | public int MinSelectionsRequired { get; set; } 9 | public int MaxSelectionsRequired { get; set; } 10 | public double MedianSelectionsRequired { get; set; } 11 | public int ModeSelectionsRequired { get; set; } 12 | public double MeanSelectionsRequired { get; set; } 13 | 14 | public override string ToString() 15 | { 16 | return $"TrialsConducted: {TrialsConducted}{Environment.NewLine}" + 17 | $"MinPullsRequired: {MinSelectionsRequired}{Environment.NewLine}" + 18 | $"MaxPullsRequired: {MaxSelectionsRequired}{Environment.NewLine}" + 19 | $"MedianPullsRequired: {MedianSelectionsRequired}{Environment.NewLine}" + 20 | $"ModePullsRequired: {ModeSelectionsRequired}{Environment.NewLine}" + 21 | $"MeanPullsRequired: {MeanSelectionsRequired}{Environment.NewLine}"; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Model.EnlirImport/LegendMateriaRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum LegendMateriaColumn 8 | { 9 | Realm = 0, 10 | Character = 1, 11 | ImagePath = 2, 12 | LegendMateriaName = 3, 13 | Effect = 4, 14 | Master = 5, 15 | Relic = 6, 16 | JapaneseName = 7, 17 | ID = 8, 18 | IsInGlobal = 9, 19 | Checked = 10 20 | } 21 | 22 | 23 | public class LegendMateriaRow 24 | { 25 | 26 | //General 27 | public string Realm { get; set; } 28 | public string Character { get; set; } 29 | public string ImagePath { get; set; } 30 | public string LegendMateriaName { get; set; } 31 | public string Effect { get; set; } 32 | public string Master { get; set; } 33 | public string Relic { get; set; } 34 | public string JapaneseName { get; set; } 35 | public string ID { get; set; } 36 | public string IsInGlobal { get; set; } 37 | public string Checked { get; set; } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Model.Api/Banners/PrizeSelectionsForSuccessInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FFRKApi.Model.Api.Banners 4 | { 5 | public class PrizeSelectionsForSuccessInfo 6 | { 7 | public int TrialsConducted { get; set; } 8 | public int MinSelectionsRequired { get; set; } 9 | public int MaxSelectionsRequired { get; set; } 10 | public double MedianSelectionsRequired { get; set; } 11 | public int ModeSelectionsRequired { get; set; } 12 | public double MeanSelectionsRequired { get; set; } 13 | 14 | public override string ToString() 15 | { 16 | return $"TrialsConducted: {TrialsConducted}{Environment.NewLine}" + 17 | $"MinPullsRequired: {MinSelectionsRequired}{Environment.NewLine}" + 18 | $"MaxPullsRequired: {MaxSelectionsRequired}{Environment.NewLine}" + 19 | $"MedianPullsRequired: {MedianSelectionsRequired}{Environment.NewLine}" + 20 | $"ModePullsRequired: {ModeSelectionsRequired}{Environment.NewLine}" + 21 | $"MeanPullsRequired: {MeanSelectionsRequired}{Environment.NewLine}"; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Dto.Api/LegendSphere.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class LegendSphere 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public int Realm { get; set; } 13 | public string CharacterName { get; set; } 14 | public int CharacterId { get; set; } //filled in during merge phase 15 | 16 | //1 is the top of the legend sphere grid, with the least valuable benefits. 17 | //5 is the bottom of the legend sphere grid, with the most valuable benefits. 18 | public int Tier { get; set; } //filled in during merge phase 19 | 20 | public IEnumerable LegendSphereInfos { get; set; } 21 | } 22 | 23 | public class LegendSphereInfo 24 | { 25 | 26 | //in a given tier, this is the position of the benefit from left to right. 27 | public int Index { get; set; } 28 | 29 | public string Benefit { get; set; } 30 | 31 | public IList RequiredMotes { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Api.FFRK/CharacterRatingMappingProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using AutoMapper; 6 | using FFRKApi.Model.Api.CharacterRating; 7 | using D = FFRKApi.Dto.Api.CharacterRating; 8 | 9 | namespace FFRKApi.Api.FFRK 10 | { 11 | public class CharacterRatingMappingProfile : Profile 12 | { 13 | public CharacterRatingMappingProfile() 14 | { 15 | CreateMap(); 16 | CreateMap(); 17 | 18 | CreateMap(); 19 | CreateMap(); 20 | 21 | CreateMap(); 22 | CreateMap(); 23 | 24 | CreateMap(); 25 | CreateMap(); 26 | 27 | CreateMap(); 28 | CreateMap(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/DamageFormulaTypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class DamageFormulaTypeList : ITypeList 8 | { 9 | private readonly IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, String.Empty), 13 | new KeyValuePair(2, "Hybrid"), 14 | new KeyValuePair(3, "Magical"), 15 | new KeyValuePair(4, "Physical") 16 | }; 17 | 18 | 19 | public IList> TypeList => _typeList; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Dto.Api/TypeListBundle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class TypeListBundle 6 | { 7 | public IEnumerable> AbilityType { get; set; } 8 | public IEnumerable> AutoTargetType { get; set; } 9 | public IEnumerable> DamageFormulaType { get; set; } 10 | public IEnumerable> ElementType { get; set; } 11 | public IEnumerable> EquipmentType { get; set; } 12 | public IEnumerable> EventType { get; set; } 13 | public IEnumerable> MissionType { get; set; } 14 | public IEnumerable> OrbType { get; set; } 15 | public IEnumerable> RealmType { get; set; } 16 | public IEnumerable> RelicType { get; set; } 17 | public IEnumerable> SchoolType { get; set; } 18 | public IEnumerable> SoulBreakTierType { get; set; } 19 | public IEnumerable> TargetType { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Converters/IntConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | 6 | namespace FFRKApi.Model.EnlirTransform.Converters 7 | { 8 | public class IntConverter 9 | { 10 | public int ConvertFromStringToInt(string input) 11 | { 12 | int result = 0; 13 | 14 | if (!String.IsNullOrWhiteSpace(input)) 15 | { 16 | //trim for safety 17 | string trimmedInput = input.Trim(); 18 | 19 | //input number from enlir are in French format when using group separators 20 | NumberFormatInfo provider = new NumberFormatInfo(); 21 | provider.NumberDecimalSeparator = ","; 22 | provider.NumberGroupSeparator = "."; 23 | provider.NumberGroupSizes = new int[] { 3 }; 24 | 25 | bool converted = Int32.TryParse(trimmedInput, NumberStyles.AllowThousands, provider, out int candidateResult); 26 | 27 | if (converted) 28 | { 29 | result = candidateResult; 30 | } 31 | } 32 | 33 | return result; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /FunctionApp.ETL/DISupport/ScopeCleanupFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Microsoft.Azure.WebJobs.Host; 5 | 6 | namespace FunctionApp.ETL.DISupport 7 | { 8 | public class ScopeCleanupFilter : IFunctionInvocationFilter, IFunctionExceptionFilter 9 | { 10 | public Task OnExceptionAsync(FunctionExceptionContext exceptionContext, CancellationToken cancellationToken) 11 | { 12 | RemoveScope(exceptionContext.FunctionInstanceId); 13 | 14 | return Task.CompletedTask; 15 | } 16 | 17 | 18 | 19 | public Task OnExecutedAsync(FunctionExecutedContext executedContext, CancellationToken cancellationToken) 20 | { 21 | RemoveScope(executedContext.FunctionInstanceId); 22 | 23 | return Task.CompletedTask; 24 | } 25 | 26 | public Task OnExecutingAsync(FunctionExecutingContext executingContext, CancellationToken cancellationToken) => Task.CompletedTask; 27 | 28 | private void RemoveScope(Guid id) 29 | { 30 | if (InjectBindingProvider.Scopes.TryRemove(id, out var scope)) 31 | { 32 | scope.Dispose(); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Model.EnlirTransform/LegendSphere.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class LegendSphere : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public int Realm { get; set; } 15 | public string CharacterName { get; set; } 16 | public int CharacterId { get; set; } //filled in during merge phase 17 | 18 | //1 is the top of the legend sphere grid, with the least valuable benefits. 19 | //5 is the bottom of the legend sphere grid, with the most valuable benefits. 20 | public int Tier { get; set; } //filled in during merge phase 21 | 22 | public IEnumerable LegendSphereInfos { get; set; } 23 | } 24 | 25 | public class LegendSphereInfo 26 | { 27 | 28 | //in a given tier, this is the position of the benefit from left to right. 29 | public int Index { get; set; } 30 | 31 | public string Benefit { get; set; } 32 | 33 | public IList RequiredMotes { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Logic.Api/CharacterRating/AltemaCharacterNodeComponents.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using HtmlAgilityPack; 5 | 6 | namespace FFRKApi.Logic.Api.CharacterRating 7 | { 8 | public class AltemaCharacterNodeComponents 9 | { 10 | public HtmlNode CharacterNode { get; set; } 11 | 12 | public HtmlNode NameNode { get; set; } 13 | public HtmlNode ImageNode { get; set; } 14 | public HtmlNode RoleNode { get; set; } 15 | public HtmlNode RatingNode { get; set; } 16 | 17 | public HtmlAttribute CharacterIdAttribute { get; set; } 18 | public HtmlAttribute ImageLazyLoadedAttribute { get; set; } 19 | public HtmlAttribute ImageLazySourceAttribute { get; set; } 20 | public HtmlAttribute ImageSourceAttribute { get; set; } 21 | 22 | public bool IsRatedCharacter => 23 | CharacterNode != null && 24 | NameNode != null && 25 | ImageNode != null && 26 | RoleNode != null && 27 | RatingNode != null && 28 | CharacterIdAttribute != null && 29 | ( 30 | ImageLazySourceAttribute != null || 31 | ImageSourceAttribute != null 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /FunctionApp.ETL/DISupport/InjectConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Azure.WebJobs.Host; 3 | using Microsoft.Azure.WebJobs.Host.Config; 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | namespace FunctionApp.ETL.DISupport 7 | { 8 | public class InjectConfiguration : IExtensionConfigProvider 9 | { 10 | #region Class Variables 11 | private IServiceProvider _serviceProvider; 12 | #endregion 13 | 14 | public void Initialize(ExtensionConfigContext context) 15 | { 16 | var services = new ServiceCollection(); 17 | 18 | Startup startup = new Startup(); 19 | 20 | startup.ConfigureServices(services); 21 | 22 | var serviceProvider = services.BuildServiceProvider(true); 23 | 24 | context 25 | .AddBindingRule() 26 | .Bind(new InjectBindingProvider(serviceProvider)); 27 | 28 | 29 | var registry = context.Config.GetService(); 30 | var filter = new ScopeCleanupFilter(); 31 | 32 | registry.RegisterExtension(typeof(IFunctionInvocationFilter), filter); 33 | registry.RegisterExtension(typeof(IFunctionExceptionFilter), filter); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Data.Storage/IImportStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRKApi.Model.EnlirImport; 5 | 6 | namespace FFRKApi.Data.Storage 7 | { 8 | public interface IImportStorageProvider 9 | { 10 | /// 11 | /// Stores the passed in import results to a storage medium 12 | /// 13 | /// 14 | /// in format yyyy-MM-dd_hh-mm-ss, if null passed in, implementation should use DateTime.UtcNow 15 | /// 16 | string StoreImportResults(ImportResultsContainer importResultsContainer, string formattedDateString); 17 | 18 | /// 19 | /// Gets latest import results. 20 | /// 21 | /// 22 | ImportResultsContainer RetrieveImportResults(); 23 | 24 | /// 25 | /// Returns the ImportResults at the given path, or empty ImportResultsContainer if nothing exists at that path 26 | /// 27 | /// 28 | /// 29 | ImportResultsContainer RetrieveImportResults(string path); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Data.Storage/IMergeStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRKApi.Model.EnlirMerge; 5 | 6 | namespace FFRKApi.Data.Storage 7 | { 8 | 9 | public interface IMergeStorageProvider 10 | { 11 | /// 12 | /// Stores the passed in transform results to a storage medium 13 | /// 14 | /// 15 | /// in format yyyy-MM-dd_hh-mm-ss, if null passed in, implementation should use DateTime.UtcNow 16 | /// 17 | string StoreMergeResults(MergeResultsContainer mergeResultsContainer, string formattedDateString); 18 | 19 | /// 20 | /// Gets latest transform results. 21 | /// 22 | /// 23 | MergeResultsContainer RetrieveMergeResults(); 24 | 25 | /// 26 | /// Returns the MergeResults at the given path, or empty MergeResultsContainer if nothing exists at that path 27 | /// 28 | /// 29 | /// 30 | MergeResultsContainer RetrieveMergeResults(string path); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Model.Api/TypeListBundle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api 6 | { 7 | public class TypeListBundle 8 | { 9 | public IEnumerable> AbilityType { get; set; } 10 | public IEnumerable> AutoTargetType { get; set; } 11 | public IEnumerable> DamageFormulaType { get; set; } 12 | public IEnumerable> ElementType { get; set; } 13 | public IEnumerable> EquipmentType { get; set; } 14 | public IEnumerable> EventType { get; set; } 15 | public IEnumerable> MissionType { get; set; } 16 | public IEnumerable> OrbType { get; set; } 17 | public IEnumerable> RealmType { get; set; } 18 | public IEnumerable> RelicType { get; set; } 19 | public IEnumerable> SchoolType { get; set; } 20 | public IEnumerable> SoulBreakTierType { get; set; } 21 | public IEnumerable> TargetType { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Dto.Api/Dungeon.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Dungeon 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public int Realm { get; set; } 13 | public string DungeonName { get; set; } 14 | 15 | public string IntroducingEvent { get; set; } 16 | public int IntroducingEventId { get; set; } 17 | 18 | //Classic 19 | public int StaminaClassic { get; set; } 20 | public int DifficultyClassic { get; set; } 21 | public int CompletionGilClassic { get; set; } 22 | public IEnumerable FirstTimeRewardsClassic { get; set; } 23 | public IEnumerable MasteryRewardsClassic { get; set; } 24 | 25 | //Elite 26 | public int StaminaElite { get; set; } 27 | public int DifficultyElite { get; set; } 28 | public int CompletionGilElite { get; set; } 29 | public IEnumerable FirstTimeRewardsElite { get; set; } 30 | public IEnumerable MasteryRewardsElite { get; set; } 31 | 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Converters/StringToBooleanConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.Converters 6 | { 7 | public class StringToBooleanConverter 8 | { 9 | #region Constants 10 | private const string IsCheckedIndicator = "✓"; 11 | #endregion 12 | 13 | #region Public Methods 14 | public bool ConvertFromStringToBool(string input) 15 | { 16 | bool result = false; 17 | 18 | if (!String.IsNullOrWhiteSpace(input)) 19 | { 20 | switch (input) 21 | { 22 | case "Y": 23 | result = true; 24 | break; 25 | case IsCheckedIndicator: 26 | result = true; 27 | break; 28 | case "N": 29 | result = false; 30 | break; 31 | default: 32 | //leave result false, this is as good a default as any 33 | break; 34 | 35 | } 36 | } 37 | 38 | return result; 39 | } 40 | #endregion 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Api.FFRK/BannersMappingProfile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using AutoMapper; 6 | using FFRKApi.Model.Api.Banners; 7 | using D = FFRKApi.Dto.Api.Banners; 8 | 9 | namespace FFRKApi.Api.FFRK 10 | { 11 | public class BannersMappingProfile : Profile 12 | { 13 | public BannersMappingProfile() 14 | { 15 | CreateMap(); 16 | CreateMap(); 17 | 18 | CreateMap(); 19 | CreateMap(); 20 | 21 | CreateMap(); 22 | CreateMap(); 23 | 24 | CreateMap(); 25 | CreateMap(); 26 | 27 | CreateMap(); 28 | CreateMap(); 29 | 30 | CreateMap(); 31 | CreateMap(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Data.Storage/ITransformStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRKApi.Model.EnlirTransform; 5 | 6 | namespace FFRKApi.Data.Storage 7 | { 8 | public interface ITransformStorageProvider 9 | { 10 | /// 11 | /// Stores the passed in transform results to a storage medium 12 | /// 13 | /// 14 | /// in format yyyy-MM-dd_hh-mm-ss, if null passed in, implementation should use DateTime.UtcNow 15 | /// 16 | string StoreTransformResults(TransformResultsContainer transformResultsContainer, string formattedDateString); 17 | 18 | /// 19 | /// Gets latest transform results. 20 | /// 21 | /// 22 | TransformResultsContainer RetrieveTransformResults(); 23 | 24 | /// 25 | /// Returns the TransformResults at the given path, or empty TransformResultsContainer if nothing exists at that path 26 | /// 27 | /// 28 | /// 29 | TransformResultsContainer RetrieveTransformResults(string path); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Data.Api/AltemaCharacterRatingFileRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace FFRKApi.Data.Api 8 | { 9 | public interface IAltemaCharacterRatingRepository 10 | { 11 | Stream GetAltemaCharacterRatingStream(); 12 | 13 | string GetAltemaCharacterRatingString(); 14 | } 15 | 16 | //just for testing 17 | public class AltemaCharacterRatingFileRepository : IAltemaCharacterRatingRepository 18 | { 19 | private const string fileName = "Altema_Charyoka_JP_20180418.html"; 20 | 21 | public Stream GetAltemaCharacterRatingStream() 22 | { 23 | string directory = Directory.GetCurrentDirectory(); 24 | 25 | Stream fileStream = null; 26 | 27 | string filePath = $"{directory}\\{fileName}"; 28 | 29 | fileStream = new StreamReader(filePath).BaseStream; 30 | 31 | return fileStream; 32 | } 33 | 34 | public string GetAltemaCharacterRatingString() 35 | { 36 | string directory = Directory.GetCurrentDirectory(); 37 | 38 | string filePath = $"{directory}\\{fileName}"; 39 | 40 | string text = File.ReadAllText(filePath); 41 | 42 | return text; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Dto.Api/CharacterRating/AltemaCharacterInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Dto.Api.CharacterRating 6 | { 7 | public class AltemaCharacterInfo 8 | { 9 | public string Id { get; set; } 10 | public string Name { get; set; } 11 | public string JapaneseName { get; set; } 12 | public string JapaneseRoleSummary { get; set; } 13 | public string RoleSummary { get; set; } 14 | public IList Roles { get; set; } 15 | public int Rating { get; set; } 16 | public int AltemaOrder { get; set; } 17 | public string ImageUrl { get; set; } 18 | 19 | public override string ToString() 20 | { 21 | string rolesText = String.Empty; 22 | StringBuilder rolesBuilder = new StringBuilder(); 23 | 24 | foreach (string role in Roles) 25 | { 26 | rolesBuilder.Append(role); 27 | rolesBuilder.Append("; "); 28 | } 29 | rolesText = rolesBuilder.ToString(); 30 | 31 | return $"{Id, -25}{Name, -23}{Rating,-6}{rolesText, -50}{JapaneseName, -30}{JapaneseRoleSummary, -25}{ImageUrl, -40}"; 32 | //return $"{PrizeIndex}\t\t{PrizeSelectedCount}\t\t{PrizeCategoryName}\t\t{PrizeName}"; 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Logic.EnlirImport/MissionImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRK.Api.Infra.Options.EnlirETL; 5 | using FFRKApi.Model.EnlirImport; 6 | using FFRKApi.SheetsApiHelper; 7 | using Microsoft.Extensions.Logging; 8 | using Microsoft.Extensions.Options; 9 | 10 | namespace FFRKApi.Logic.EnlirImport 11 | { 12 | public class MissionImporter : RowImporterBase 13 | { 14 | public MissionImporter(ISheetsApiHelper sheetsApiHelper, IOptions importerOptionsAccessor, ILogger> logger) 15 | : base(sheetsApiHelper, importerOptionsAccessor, logger) 16 | { 17 | } 18 | 19 | protected override MissionRow AssignColumnToProperty(int columnCount, IList row) 20 | { 21 | MissionRow importedRow = new MissionRow(); 22 | 23 | importedRow.Type = ResolveColumnContents(columnCount, MissionColumn.Type, row); 24 | importedRow.Event = ResolveColumnContents(columnCount, MissionColumn.Event, row); 25 | importedRow.Description = ResolveColumnContents(columnCount, MissionColumn.Description, row); 26 | importedRow.Reward = ResolveColumnContents(columnCount, MissionColumn.Reward, row); 27 | 28 | 29 | return importedRow; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Dungeon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Dungeon : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public int Realm { get; set; } 15 | public string DungeonName { get; set; } 16 | 17 | public string IntroducingEvent { get; set; } 18 | public int IntroducingEventId { get; set; } 19 | 20 | //Classic 21 | public int StaminaClassic { get; set; } 22 | public int DifficultyClassic { get; set; } 23 | public int CompletionGilClassic { get; set; } 24 | public IEnumerable FirstTimeRewardsClassic { get; set; } 25 | public IEnumerable MasteryRewardsClassic { get; set; } 26 | 27 | //Elite 28 | public int StaminaElite { get; set; } 29 | public int DifficultyElite { get; set; } 30 | public int CompletionGilElite { get; set; } 31 | public IEnumerable FirstTimeRewardsElite { get; set; } 32 | public IEnumerable MasteryRewardsElite { get; set; } 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Model.Api/CharacterRating/AltemaCharacterInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.CompilerServices; 5 | using System.Text; 6 | 7 | namespace FFRKApi.Model.Api.CharacterRating 8 | { 9 | public class AltemaCharacterInfo 10 | { 11 | public string Id { get; set; } 12 | public string Name { get; set; } 13 | public string JapaneseName { get; set; } 14 | public string JapaneseRoleSummary { get; set; } 15 | public string RoleSummary { get; set; } 16 | public IList Roles { get; set; } 17 | public int Rating { get; set; } 18 | public int AltemaOrder { get; set; } 19 | public string ImageUrl { get; set; } 20 | 21 | public override string ToString() 22 | { 23 | string rolesText = String.Empty; 24 | StringBuilder rolesBuilder = new StringBuilder(); 25 | 26 | foreach (string role in Roles) 27 | { 28 | rolesBuilder.Append(role); 29 | rolesBuilder.Append("; "); 30 | } 31 | rolesText = rolesBuilder.ToString(); 32 | 33 | return $"{Id, -25}{Name, -23}{Rating,-6}{rolesText, -50}{JapaneseName, -30}{JapaneseRoleSummary, -25}{ImageUrl, -40}"; 34 | //return $"{PrizeIndex}\t\t{PrizeSelectedCount}\t\t{PrizeCategoryName}\t\t{PrizeName}"; 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Dto.Api/MagiciteSkill.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class MagiciteSkill 4 | { 5 | 6 | #region IModelDescriptor Implementation 7 | public int Id { get; set; } 8 | public string Description { get; set; } 9 | #endregion 10 | 11 | public string MagiciteName { get; set; } 12 | public int MagiciteId { get; set; } 13 | public string SkillName { get; set; } 14 | 15 | public string JapaneseName { get; set; } 16 | public string ImagePath { get; set; } 17 | 18 | public int AbilityType { get; set; } 19 | 20 | public int AutoTargetType { get; set; } 21 | 22 | public int DamageFormulaType { get; set; } 23 | 24 | public double Multiplier { get; set; } 25 | 26 | public int Element { get; set; } 27 | 28 | public double CastTime { get; set; } 29 | 30 | public string Effects { get; set; } 31 | 32 | public bool IsCounterable { get; set; } 33 | public string EnlirId { get; set; } 34 | public bool IsInGlobal { get; set; } 35 | public bool IsChecked { get; set; } 36 | 37 | public double ChanceForSkillUseWith0LevelCapBreaks { get; set; } 38 | public double ChanceForSkillUseWith1LevelCapBreaks { get; set; } 39 | public double ChanceForSkillUseWith2LevelCapBreaks { get; set; } 40 | public double ChanceForSkillUseWith3LevelCapBreaks { get; set; } 41 | 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IModelDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | /// 8 | /// An interface which provides a basic way of tagging each model item with a numeric id and some 9 | /// human readable way of distinguishing between one model and another. 10 | /// 11 | /// The intended use is for api callers to get a list of descriptors for any type of model in which they 12 | /// are interested so they decide which they cared about (using the description), and then have easy access 13 | /// to get data about that model (using the id) 14 | /// 15 | public interface IModelDescriptor 16 | { 17 | /// 18 | /// A generated int id for each model. This is useful because most of the rows from the Enlir 19 | /// spreadsheet have a string natural key (or none at all), and those strings are not always 20 | /// HTML Friendly for calling in a rest Api 21 | /// 22 | int Id { get; set; } 23 | 24 | /// 25 | /// Whatever string content/title best would help a human decide in which model instances they have interest. Although 26 | /// some models will have properties using the name Description, this field does not always have to map to those properties. 27 | /// 28 | string Description { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Dto.Api/Command.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Command 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public string CharacterName { get; set; } 13 | public int CharacterId { get; set; } //filled in during merge phase 14 | 15 | public string SourceSoulBreakName { get; set; } 16 | public int SourceSoulBreakId { get; set; } //filled in during merge phase 17 | 18 | public string ImagePath { get; set; } 19 | 20 | public string CommandName { get; set; } 21 | public string JapaneseName { get; set; } 22 | 23 | public int AbilityType { get; set; } 24 | public int TargetType { get; set; } 25 | public int AutoTargetType { get; set; } 26 | public int DamageFormulaType { get; set; } 27 | public double Multiplier { get; set; } 28 | public IEnumerable Elements { get; set; } 29 | public double CastTime { get; set; } 30 | public string Effects { get; set; } 31 | public bool IsCounterable { get; set; } 32 | public bool IsInGlobal { get; set; } 33 | public bool IsChecked { get; set; } 34 | public int SoulBreakPointsGained { get; set; } 35 | public int School { get; set; } 36 | 37 | public string EnlirId { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Dto.Api/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace FFRKApi.Dto.Api 5 | { 6 | public class Event 7 | { 8 | #region IModelDescriptor Implementation 9 | public int Id { get; set; } 10 | public string Description { get; set; } 11 | #endregion 12 | 13 | public string EventName { get; set; } 14 | 15 | public int RealmId { get; set; } 16 | 17 | public string RealmName { get; set; } 18 | 19 | public DateTime GlobalEventDate { get; set; } 20 | 21 | public DateTime JapaneseEventDate { get; set; } 22 | 23 | public int EventTypeId { get; set; } 24 | public string EventTypeName { get; set; } 25 | 26 | public IEnumerable HeroRecordsAwarded { get; set; } 27 | 28 | //public int SoulOfHerosAwarded { get; set; } 29 | 30 | public IEnumerable MemoryCrystalsLevel1Awarded { get; set; } 31 | 32 | //public int MemoryCrystalLodesLevel1Awarded { get; set; } 33 | 34 | public IEnumerable MemoryCrystalsLevel2Awarded { get; set; } 35 | 36 | //public int MemoryCrystalLodesLevel2Awarded { get; set; } 37 | 38 | public IEnumerable MemoryCrystalsLevel3Awarded { get; set; } 39 | 40 | //public int MemoryCrystalLodesLevel3Awarded { get; set; } 41 | 42 | public IEnumerable WardrobeRecordsAwarded { get; set; } 43 | 44 | public IEnumerable AbilitiesAwarded { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Logic.Api/MaintenanceLogic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Data.Api; 5 | using FFRKApi.Data.Api; 6 | using FFRKApi.Data.Storage; 7 | using FFRKApi.Model.EnlirMerge; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace FFRKApi.Logic.Api 11 | { 12 | public interface IMaintenanceLogic 13 | { 14 | void RefreshMergeResultsContainer(); 15 | } 16 | 17 | public class MaintenanceLogic : IMaintenanceLogic 18 | { 19 | #region Class Variables 20 | private readonly IEnlirRepository _enlirRepository; 21 | private readonly ILogger _logger; 22 | private readonly ICacheProvider _cacheProvider; 23 | #endregion 24 | 25 | 26 | #region Constructors 27 | 28 | public MaintenanceLogic(IEnlirRepository enlirRepository, ICacheProvider cacheProvider, ILogger logger) 29 | { 30 | _enlirRepository = enlirRepository; 31 | _logger = logger; 32 | _cacheProvider = cacheProvider; 33 | } 34 | #endregion 35 | 36 | 37 | #region IMaintenanceController Implementation 38 | public void RefreshMergeResultsContainer() 39 | { 40 | _enlirRepository.LoadMergeResultsContainer(); 41 | 42 | _cacheProvider.Flush(); 43 | 44 | _logger.LogInformation($"Logic Method invoked: {nameof(RefreshMergeResultsContainer)}"); 45 | } 46 | #endregion 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Model.EnlirTransform/TransformResultsContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class TransformResultsContainer 8 | { 9 | public IEnumerable Events { get; set; } 10 | public IEnumerable Missions { get; set; } 11 | public IEnumerable Experiences { get; set; } 12 | 13 | public IEnumerable Dungeons { get; set; } 14 | 15 | public IEnumerable MagiciteSkills { get; set; } 16 | 17 | public IEnumerable Magicites { get; set; } 18 | 19 | public IEnumerable Statuses { get; set; } 20 | 21 | public IEnumerable Others { get; set; } 22 | 23 | public IEnumerable Commands { get; set; } 24 | 25 | public IEnumerable BraveActions { get; set; } 26 | 27 | public IEnumerable SoulBreaks { get; set; } 28 | 29 | public IEnumerable Relics { get; set; } 30 | 31 | public IEnumerable Abilities { get; set; } 32 | 33 | public IEnumerable LegendMaterias { get; set; } 34 | 35 | public IEnumerable RecordMaterias { get; set; } 36 | 37 | public IEnumerable RecordSpheres { get; set; } 38 | 39 | public IEnumerable LegendSpheres { get; set; } 40 | 41 | public IEnumerable Characters { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Dto.Api/Experience.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Experience 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public IEnumerable GenericCharacterLevelInfo { get; set; } 13 | public IEnumerable TyroCharacterLevelInfo { get; set; } 14 | public IEnumerable Magicite1StarLevelInfo { get; set; } 15 | public IEnumerable Magicite2StarLevelInfo { get; set; } 16 | public IEnumerable Magicite3StarLevelInfo { get; set; } 17 | public IEnumerable Magicite4StarLevelInfo { get; set; } 18 | public IEnumerable Magicite5StarLevelInfo { get; set; } 19 | public IEnumerable Magicite3StarInheritanceLevelInfo { get; set; } 20 | public IEnumerable Magicite4StarInheritanceLevelInfo { get; set; } 21 | public IEnumerable Magicite5StarInheritanceLevelInfo { get; set; } 22 | 23 | } 24 | 25 | public class ExperienceByLevelInfo 26 | { 27 | public int Level { get; set; } 28 | 29 | public int ExperienceNeededToReachLevel { get; set; } 30 | 31 | public int ExperienceNeededToReachNextLevel { get; set; } 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Model.EnlirImport/DungeonRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum DungeonColumn 8 | { 9 | //General 10 | Realm = 0, 11 | DungeonName = 1, 12 | 13 | //Classic 14 | StaminaClassic = 2, 15 | DifficultyClassic = 3, 16 | CompletionClassic = 4, 17 | FirstTimeClassic = 5, 18 | MasteryClassic = 6, 19 | 20 | //Elite 21 | StaminaElite = 7, 22 | DifficultyElite = 8, 23 | CompletionElite = 9, 24 | FirstTimeElite = 10, 25 | MasteryElite = 11, 26 | Update = 12 27 | } 28 | 29 | public class DungeonRow 30 | { 31 | //General 32 | public string Realm { get; set; } 33 | public string DungeonName { get; set; } 34 | 35 | //Classic 36 | public string StaminaClassic { get; set; } 37 | public string DifficultyClassic { get; set; } 38 | public string CompletionClassic { get; set; } 39 | public string FirstTimeClassic { get; set; } 40 | public string MasteryClassic { get; set; } 41 | 42 | //Elite 43 | public string StaminaElite { get; set; } 44 | public string DifficultyElite { get; set; } 45 | public string CompletionElite { get; set; } 46 | public string FirstTimeElite { get; set; } 47 | public string MasteryElite { get; set; } 48 | public string Update { get; set; } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/StatTypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class StatTypeList : ITypeList 8 | { 9 | private readonly IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, "ACC"), 13 | new KeyValuePair(2, "ATK"), 14 | new KeyValuePair(3, "DEF"), 15 | new KeyValuePair(4, "EVA"), 16 | new KeyValuePair(5, "MAG"), 17 | new KeyValuePair(6, "MND"), 18 | new KeyValuePair(7, "RES") 19 | }; 20 | 21 | 22 | public IList> TypeList => _typeList; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Command : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string CharacterName { get; set; } 15 | public int CharacterId { get; set; } //filled in during merge phase 16 | 17 | public string SourceSoulBreakName { get; set; } 18 | public int SourceSoulBreakId { get; set; } //filled in during merge phase 19 | 20 | public string ImagePath { get; set; } 21 | 22 | public string CommandName { get; set; } 23 | public string JapaneseName { get; set; } 24 | 25 | public int AbilityType { get; set; } 26 | public int TargetType { get; set; } 27 | public int AutoTargetType { get; set; } 28 | public int DamageFormulaType { get; set; } 29 | public double Multiplier { get; set; } 30 | public IEnumerable Elements { get; set; } 31 | public double CastTime { get; set; } 32 | public string Effects { get; set; } 33 | public bool IsCounterable { get; set; } 34 | public bool IsInGlobal { get; set; } 35 | public bool IsChecked { get; set; } 36 | public int SoulBreakPointsGained { get; set; } 37 | public int School { get; set; } 38 | 39 | public string EnlirId { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Event.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Event: IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string EventName { get; set; } 15 | 16 | public int RealmId { get; set; } 17 | 18 | public string RealmName { get; set; } 19 | 20 | public DateTime GlobalEventDate { get; set; } 21 | 22 | public DateTime JapaneseEventDate { get; set; } 23 | 24 | public int EventTypeId { get; set; } 25 | public string EventTypeName { get; set; } 26 | 27 | public IEnumerable HeroRecordsAwarded { get; set; } 28 | 29 | //public int SoulOfHerosAwarded { get; set; } 30 | 31 | public IEnumerable MemoryCrystalsLevel1Awarded { get; set; } 32 | 33 | //public int MemoryCrystalLodesLevel1Awarded { get; set; } 34 | 35 | public IEnumerable MemoryCrystalsLevel2Awarded { get; set; } 36 | 37 | //public int MemoryCrystalLodesLevel2Awarded { get; set; } 38 | 39 | public IEnumerable MemoryCrystalsLevel3Awarded { get; set; } 40 | 41 | //public int MemoryCrystalLodesLevel3Awarded { get; set; } 42 | 43 | public IEnumerable WardrobeRecordsAwarded { get; set; } 44 | 45 | public IEnumerable AbilitiesAwarded { get; set; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /FunctionApp.ETL/Properties/PublishProfiles/FFRKFunctionApp - Web Deploy.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | MSDeploy 9 | AzureWebSite 10 | Release 11 | Any CPU 12 | http://ffrkfunctionapp.azurewebsites.net 13 | False 14 | False 15 | ffrkfunctionapp.scm.azurewebsites.net:443 16 | /subscriptions/ecd8bdc2-d60c-46f3-a328-98611b0ca04b/resourcegroups/FFRK/providers/Microsoft.Web/sites/FFRKFunctionApp 17 | FFRKFunctionApp 18 | True 19 | WMSVC 20 | True 21 | $FFRKFunctionApp 22 | <_SavePWD>True 23 | False 24 | 25 | -------------------------------------------------------------------------------- /Model.EnlirTransform/MagiciteSkill.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class MagiciteSkill : IModelDescriptor 8 | { 9 | 10 | #region IModelDescriptor Implementation 11 | public int Id { get; set; } 12 | public string Description { get; set; } 13 | #endregion 14 | 15 | public string MagiciteName { get; set; } 16 | public int MagiciteId { get; set; } 17 | public string SkillName { get; set; } 18 | 19 | public string JapaneseName { get; set; } 20 | public string ImagePath { get; set; } 21 | 22 | public int AbilityType { get; set; } 23 | 24 | public int AutoTargetType { get; set; } 25 | 26 | public int DamageFormulaType { get; set; } 27 | 28 | public double Multiplier { get; set; } 29 | 30 | public int Element { get; set; } 31 | 32 | public double CastTime { get; set; } 33 | 34 | public string Effects { get; set; } 35 | 36 | public bool IsCounterable { get; set; } 37 | 38 | public string EnlirId { get; set; } 39 | public bool IsInGlobal { get; set; } 40 | 41 | public bool IsChecked { get; set; } 42 | 43 | public double ChanceForSkillUseWith0LevelCapBreaks { get; set; } 44 | public double ChanceForSkillUseWith1LevelCapBreaks { get; set; } 45 | public double ChanceForSkillUseWith2LevelCapBreaks { get; set; } 46 | public double ChanceForSkillUseWith3LevelCapBreaks { get; set; } 47 | 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Dto.Api/Other.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Other 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public string CharacterName { get; set; } //use string so we don't get circular references 13 | public string SourceName { get; set; } //use string because it may not be possible to tie to owners: soul breaks, record materia (and circ ref) 14 | public string SourceType { get; set; } //null during transform, set during merge 15 | public int SourceId { get; set; } //0 during transform, set during merge 16 | public string ImagePath { get; set; } 17 | public string Name { get; set; } 18 | 19 | public int AbilityType { get; set; } 20 | 21 | public int TargetType { get; set; } 22 | 23 | public int DamageFormulaType { get; set; } 24 | 25 | public double Multiplier { get; set; } 26 | 27 | public IEnumerable Elements { get; set; } 28 | 29 | public double CastTime { get; set; } 30 | 31 | public string Effects { get; set; } 32 | 33 | public bool IsCounterable { get; set; } 34 | 35 | public int AutoTargetType { get; set; } 36 | 37 | public int SoulBreakPointsGained { get; set; } 38 | 39 | public int School { get; set; } 40 | public string EnlirId { get; set; } 41 | public bool IsInGlobal { get; set; } 42 | public bool IsChecked { get; set; } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Model.EnlirImport/OtherRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum OtherColumn 8 | { 9 | //General 10 | Character = 0, 11 | Source = 1, 12 | ImagePath = 2, 13 | OtherName = 3, 14 | Type = 4, 15 | Target = 5, 16 | Formula = 6, 17 | Multiplier = 7, 18 | Element = 8, 19 | Time = 9, 20 | Effects = 10, 21 | Counter = 11, 22 | AutoTarget = 12, 23 | SB = 13, 24 | School = 14, 25 | ID = 15, 26 | IsInGlobal = 16, 27 | Checked = 17 28 | } 29 | 30 | public class OtherRow 31 | { 32 | public string Character { get; set; } 33 | public string Source { get; set; } 34 | public string ImagePath { get; set; } 35 | public string OtherName { get; set; } 36 | public string Type { get; set; } 37 | public string Target { get; set; } 38 | public string Formula { get; set; } 39 | public string Multiplier { get; set; } 40 | public string Element { get; set; } 41 | public string Time { get; set; } 42 | public string Effects { get; set; } 43 | public string Counter { get; set; } 44 | public string AutoTarget { get; set; } 45 | public string SB { get; set; } 46 | public string School { get; set; } 47 | public string ID { get; set; } 48 | public string IsInGlobal { get; set; } 49 | public string Checked { get; set; } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Dto.Api/IdListBundle.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class IdListBundle 6 | { 7 | public IEnumerable> Ability { get; set; } 8 | public IEnumerable> Character { get; set; } 9 | public IEnumerable> Command { get; set; } 10 | public IEnumerable> BraveAction { get; set; } 11 | 12 | //public IEnumerable> Dungeon { get; set; } 13 | public IEnumerable> Event { get; set; } 14 | public IEnumerable> Experience { get; set; } 15 | public IEnumerable> LegendMateria { get; set; } 16 | public IEnumerable> LegendSphere { get; set; } 17 | public IEnumerable> Magicite { get; set; } 18 | public IEnumerable> MagiciteSkill { get; set; } 19 | public IEnumerable> Mission { get; set; } 20 | public IEnumerable> Other { get; set; } 21 | public IEnumerable> RecordMateria { get; set; } 22 | public IEnumerable> RecordSphere { get; set; } 23 | public IEnumerable> Relic { get; set; } 24 | public IEnumerable> SoulBreak { get; set; } 25 | public IEnumerable> Status { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Experience.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Experience : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public IEnumerable GenericCharacterLevelInfo { get; set; } 15 | public IEnumerable TyroCharacterLevelInfo { get; set; } 16 | public IEnumerable Magicite1StarLevelInfo { get; set; } 17 | public IEnumerable Magicite2StarLevelInfo { get; set; } 18 | public IEnumerable Magicite3StarLevelInfo { get; set; } 19 | public IEnumerable Magicite4StarLevelInfo { get; set; } 20 | public IEnumerable Magicite5StarLevelInfo { get; set; } 21 | public IEnumerable Magicite3StarInheritanceLevelInfo { get; set; } 22 | public IEnumerable Magicite4StarInheritanceLevelInfo { get; set; } 23 | public IEnumerable Magicite5StarInheritanceLevelInfo { get; set; } 24 | 25 | } 26 | 27 | public class ExperienceByLevelInfo 28 | { 29 | public int Level { get; set; } 30 | 31 | public int ExperienceNeededToReachLevel { get; set; } 32 | 33 | public int ExperienceNeededToReachNextLevel { get; set; } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Model.EnlirImport/EventRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum EventColumn 8 | { 9 | EventName = 0, 10 | Realm = 1, 11 | GlobalDate = 2, 12 | JapanDate = 3, 13 | Type = 4, 14 | HeroRecords = 5, 15 | //SpiritOfAHero = 6, 16 | MemoryCrystalsLevel1 = 6, 17 | //MemoryCrystalLodesLevel1 = 8, 18 | MemoryCrystalsLevel2 = 7, 19 | //MemoryCrystalLodesLevel2 = 10, 20 | MemoryCrystalsLevel3 = 8, 21 | //MemoryCrystalLodesLevel3 = 12, 22 | WardrobeRecords = 9, 23 | AbilitiesAwarded = 10 24 | } 25 | 26 | public class EventRow 27 | { 28 | public string EventName { get; set; } 29 | public string Realm { get; set; } 30 | public string GlobalDate { get; set; } 31 | public string JapanDate { get; set; } 32 | public string Type { get; set; } 33 | public string HeroRecords { get; set; } 34 | //public string SpiritOfAHero { get; set; } 35 | public string MemoryCrystalsLevel1 { get; set; } 36 | //public string MemoryCrystalLodesLevel1 { get; set; } 37 | public string MemoryCrystalsLevel2 { get; set; } 38 | //public string MemoryCrystalLodesLevel2 { get; set; } 39 | public string MemoryCrystalsLevel3 { get; set; } 40 | //public string MemoryCrystalLodesLevel3 { get; set; } 41 | public string WardrobeRecords { get; set; } 42 | public string AbilitiesAwarded { get; set; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Dto.Api/BraveAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Dto.Api 6 | { 7 | public class BraveAction 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string CharacterName { get; set; } 15 | public int CharacterId { get; set; } //filled in during merge phase 16 | public string SourceSoulBreakName { get; set; } 17 | public int SourceSoulBreakId { get; set; } //filled in during merge phase 18 | 19 | public string ImagePath { get; set; } 20 | public string BraveActionName { get; set; } 21 | public string JapaneseName { get; set; } 22 | 23 | public string BraveCondition { get; set; } 24 | public int BraveLevel { get; set; } 25 | 26 | 27 | public int AbilityType { get; set; } 28 | public int TargetType { get; set; } 29 | public int AutoTargetType { get; set; } 30 | public int DamageFormulaType { get; set; } 31 | public double Multiplier { get; set; } 32 | public IEnumerable Elements { get; set; } 33 | 34 | public double CastTime { get; set; } 35 | public string Effects { get; set; } 36 | public bool IsCounterable { get; set; } 37 | 38 | public string EnlirId { get; set; } 39 | public bool IsInGlobal { get; set; } 40 | public bool IsChecked { get; set; } 41 | 42 | public int SoulBreakPointsGained { get; set; } 43 | public int School { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Model.Api/IdListBundle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.Api 6 | { 7 | public class IdListBundle 8 | { 9 | public IEnumerable> Ability { get; set; } 10 | public IEnumerable> Character { get; set; } 11 | public IEnumerable> Command { get; set; } 12 | public IEnumerable> BraveAction { get; set; } 13 | //public IEnumerable> Dungeon { get; set; } 14 | public IEnumerable> Event { get; set; } 15 | public IEnumerable> Experience { get; set; } 16 | public IEnumerable> LegendMateria { get; set; } 17 | public IEnumerable> LegendSphere { get; set; } 18 | public IEnumerable> Magicite { get; set; } 19 | public IEnumerable> MagiciteSkill { get; set; } 20 | public IEnumerable> Mission { get; set; } 21 | public IEnumerable> Other { get; set; } 22 | public IEnumerable> RecordMateria { get; set; } 23 | public IEnumerable> RecordSphere { get; set; } 24 | public IEnumerable> Relic { get; set; } 25 | public IEnumerable> SoulBreak { get; set; } 26 | public IEnumerable> Status { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Model.EnlirImport/ImportResultsContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Model.EnlirImport; 5 | 6 | namespace FFRKApi.Model.EnlirImport 7 | { 8 | public class ImportResultsContainer 9 | { 10 | public IEnumerable CharacterRows { get; set; } 11 | 12 | public IEnumerable RecordSphereRows { get; set; } 13 | 14 | public IEnumerable LegendSphereRows { get; set; } 15 | 16 | public IEnumerable RecordMateriaRows { get; set; } 17 | 18 | public IEnumerable LegendMateriaRows { get; set; } 19 | 20 | public IEnumerable AbilityRows { get; set; } 21 | 22 | public IEnumerable SoulBreakRows { get; set; } 23 | 24 | public IEnumerable CommandRows { get; set; } 25 | 26 | public IEnumerable BraveActionRows { get; set; } 27 | 28 | public IEnumerable OtherRows { get; set; } 29 | 30 | public IEnumerable StatusRows { get; set; } 31 | 32 | public IEnumerable RelicRows { get; set; } 33 | 34 | public IEnumerable MagiciteRows { get; set; } 35 | 36 | public IEnumerable MagiciteSkillRows { get; set; } 37 | 38 | public IEnumerable DungeonRows { get; set; } 39 | 40 | public IEnumerable EventRows { get; set; } 41 | 42 | public IEnumerable MissionRows { get; set; } 43 | 44 | public IEnumerable ExperienceRows { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/AbilityTypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class AbilityTypeList : ITypeList 8 | { 9 | private readonly IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, "?"), 13 | new KeyValuePair(2, "BLK"), 14 | new KeyValuePair(3, "BLU"), 15 | new KeyValuePair(4, "NAT"), 16 | new KeyValuePair(5, "NIN"), 17 | new KeyValuePair(6, "PHY"), 18 | new KeyValuePair(7, "SUM"), 19 | new KeyValuePair(8, "WHT"), 20 | //new KeyValuePair(9, "") 21 | }; 22 | 23 | 24 | public IList> TypeList => _typeList; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Other.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Other : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string CharacterName { get; set; } //use string so we don't get circular references 15 | public string SourceName { get; set; } //use string because it may not be possible to tie to owners: soul breaks, record materia (and circ ref) 16 | public string SourceType { get; set; } //null during transform, set during merge 17 | public int SourceId { get; set; } //0 during transform, set during merge 18 | public string ImagePath { get; set; } 19 | public string Name { get; set; } 20 | 21 | public int AbilityType { get; set; } 22 | 23 | public int TargetType { get; set; } 24 | 25 | public int DamageFormulaType { get; set; } 26 | 27 | public double Multiplier { get; set; } 28 | 29 | public IEnumerable Elements { get; set; } 30 | 31 | public double CastTime { get; set; } 32 | 33 | public string Effects { get; set; } 34 | 35 | public bool IsCounterable { get; set; } 36 | 37 | public int AutoTargetType { get; set; } 38 | 39 | public int SoulBreakPointsGained { get; set; } 40 | 41 | public int School { get; set; } 42 | public string EnlirId { get; set; } 43 | public bool IsInGlobal { get; set; } 44 | public bool IsChecked { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /FunctionApp.ETL/ExecuteImport.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | using FFRK.Api.Infra.Options.EnlirETL; 7 | using FFRKApi.Logic.EnlirImport; 8 | using FFRKApi.Logic.EnlirTransform; 9 | using FFRKApi.Model.EnlirImport; 10 | using FunctionApp.ETL.DISupport; 11 | using Microsoft.Azure.WebJobs; 12 | using Microsoft.Azure.WebJobs.Extensions.Http; 13 | using Microsoft.Azure.WebJobs.Host; 14 | using Microsoft.Extensions.Logging; 15 | using Microsoft.Extensions.Options; 16 | 17 | namespace FunctionApp.ETL 18 | { 19 | public static class ExecuteImport 20 | { 21 | [FunctionName("ExecuteImport")] 22 | public static async Task Run( 23 | [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 24 | [Inject]IImportManager importManager, [Inject]ILogger logger) 25 | { 26 | logger.LogInformation("Azure Function ExecuteImport processed a request."); 27 | 28 | try 29 | { 30 | ImportResultsContainer irc = importManager.ImportAll(); 31 | 32 | var response = req.CreateResponse(HttpStatusCode.OK, irc); 33 | 34 | return response; 35 | } 36 | catch (System.Exception ex) 37 | { 38 | 39 | logger.LogError(ex, $"Error in Azure Function ExecuteImport : {ex.Message}"); 40 | 41 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 42 | 43 | return response; 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Model.EnlirTransform/BraveAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class BraveAction : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public string CharacterName { get; set; } 15 | public int CharacterId { get; set; } //filled in during merge phase 16 | public string SourceSoulBreakName { get; set; } 17 | public int SourceSoulBreakId { get; set; } //filled in during merge phase 18 | 19 | public string ImagePath { get; set; } 20 | public string BraveActionName { get; set; } 21 | public string JapaneseName { get; set; } 22 | 23 | public string BraveCondition { get; set; } 24 | public int BraveLevel { get; set; } 25 | 26 | 27 | public int AbilityType { get; set; } 28 | public int TargetType { get; set; } 29 | public int AutoTargetType { get; set; } 30 | public int DamageFormulaType { get; set; } 31 | public double Multiplier { get; set; } 32 | public IEnumerable Elements { get; set; } 33 | 34 | public double CastTime { get; set; } 35 | public string Effects { get; set; } 36 | public bool IsCounterable { get; set; } 37 | public string EnlirId { get; set; } 38 | public bool IsInGlobal { get; set; } 39 | public bool IsChecked { get; set; } 40 | 41 | public int SoulBreakPointsGained { get; set; } 42 | public int School { get; set; } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Converters/PercentConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Runtime.CompilerServices; 5 | using System.Text; 6 | 7 | namespace FFRKApi.Model.EnlirTransform.Converters 8 | { 9 | public class PercentConverter 10 | { 11 | #region Constants 12 | 13 | private char[] _percentCharArray = "%".ToCharArray(); 14 | private const int percentageConversionFactor = 100; 15 | #endregion 16 | 17 | //e.g., from "65%" to 0.65 18 | public double ConvertFromStringToDouble(string input) 19 | { 20 | double result = 0; 21 | 22 | if (!String.IsNullOrWhiteSpace(input)) 23 | { 24 | //input number from enlir are in French format when using group separators 25 | NumberFormatInfo provider = new NumberFormatInfo(); 26 | provider.NumberDecimalSeparator = ","; 27 | provider.NumberGroupSeparator = "."; 28 | provider.NumberGroupSizes = new int[] { 3 }; 29 | 30 | //cleanse input 31 | string cleansedInput = input.TrimEnd(_percentCharArray).Trim(); 32 | 33 | bool converted = Double.TryParse(cleansedInput, NumberStyles.AllowDecimalPoint, provider, out double candidateResult); 34 | 35 | if (converted) 36 | { 37 | //result would still be a number greater than 1 (e.g. 65), so we need to divide by 100 38 | result = (double)candidateResult / percentageConversionFactor; 39 | } 40 | } 41 | 42 | return result; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Model.EnlirImport/CommandRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum CommandColumn 8 | { 9 | //General 10 | Character = 0, 11 | Source = 1, 12 | ImagePath = 2, 13 | CommandName = 3, 14 | Type = 4, 15 | Target = 5, 16 | Formula = 6, 17 | Multiplier = 7, 18 | Element = 8, 19 | Time = 9, 20 | Effects = 10, 21 | Counter = 11, 22 | AutoTarget = 12, 23 | SB = 13, 24 | School = 14, 25 | JapaneseName = 15, 26 | ID = 16, 27 | IsInGlobal = 17, 28 | Checked = 18 29 | } 30 | 31 | public class CommandRow 32 | { 33 | //General 34 | public string Character { get; set; } 35 | public string Source { get; set; } 36 | public string ImagePath { get; set; } 37 | public string CommandName { get; set; } 38 | public string Type { get; set; } 39 | public string Target { get; set; } 40 | public string Formula { get; set; } 41 | public string Multiplier { get; set; } 42 | public string Element { get; set; } 43 | public string Time { get; set; } 44 | public string Effects { get; set; } 45 | public string Counter { get; set; } 46 | public string AutoTarget { get; set; } 47 | public string SB { get; set; } 48 | public string School { get; set; } 49 | public string JapaneseName { get; set; } 50 | public string ID { get; set; } 51 | public string IsInGlobal { get; set; } 52 | public string Checked { get; set; } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Logic.EnlirTransform/MissionTransformer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using FFRKApi.Model.EnlirImport; 6 | using FFRKApi.Model.EnlirTransform; 7 | using FFRKApi.Model.EnlirTransform.Converters; 8 | using FFRKApi.Model.EnlirTransform.IdLists; 9 | using Microsoft.Extensions.Logging; 10 | 11 | namespace FFRKApi.Logic.EnlirTransform 12 | { 13 | public class MissionTransformer : RowTransformerBase 14 | { 15 | #region Class Variables 16 | private readonly TypeListConverter _missionTypeConverter; 17 | #endregion 18 | 19 | #region Constructors 20 | public MissionTransformer(ILogger> logger): base(logger) 21 | { 22 | _missionTypeConverter = new TypeListConverter(new MissionTypeList()); 23 | } 24 | #endregion 25 | 26 | #region RowTransformerBase Overrides 27 | protected override Mission ConvertRowToModel(int generatedId, MissionRow row) 28 | { 29 | Mission model = new Mission(); 30 | 31 | model.Id = generatedId; 32 | model.Description = row.Description; 33 | 34 | model.MissionType = _missionTypeConverter.ConvertFromNameToId(row.Type); 35 | model.AssociatedEvent = row.Event; 36 | model.AssociatedEventId = 0; //Fill in during Merge Phase 37 | 38 | model.Rewards = ExtractItemWithCountAndStarLevel(row.Reward); 39 | 40 | _logger.LogDebug("Converted MissionRow to Mission: {Id} - {Description}", model.Id, model.Description); 41 | 42 | return model; 43 | } 44 | #endregion 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Model.EnlirImport/MagiciteSkillRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum MagiciteSkillColumn 8 | { 9 | Magicite = 0, 10 | ImagePath = 1, 11 | Name = 2, 12 | ChanceToUseTier0 = 3, 13 | ChanceToUseTier1 = 4, 14 | ChanceToUseTier2 = 5, 15 | ChanceToUseTier3 = 6, 16 | Type = 7, 17 | AutoTarget = 8, 18 | Formula = 9, 19 | Multiplier = 10, 20 | Element = 11, 21 | Time = 12, 22 | Effects = 13, 23 | Counter = 14, 24 | JapaneseName = 15, 25 | ID = 16, 26 | IsInGlobal = 17, 27 | Checked = 18 28 | } 29 | 30 | public class MagiciteSkillRow 31 | { 32 | public string Magicite { get; set; } 33 | public string ImagePath { get; set; } 34 | public string Name { get; set; } 35 | public string ChanceToUseTier0 { get; set; } 36 | public string ChanceToUseTier1 { get; set; } 37 | public string ChanceToUseTier2 { get; set; } 38 | public string ChanceToUseTier3 { get; set; } 39 | public string Type { get; set; } 40 | public string AutoTarget { get; set; } 41 | public string Formula { get; set; } 42 | public string Multiplier { get; set; } 43 | public string Element { get; set; } 44 | public string Time { get; set; } 45 | public string Effects { get; set; } 46 | public string Counter { get; set; } 47 | public string JapaneseName { get; set; } 48 | public string ID { get; set; } 49 | public string IsInGlobal { get; set; } 50 | public string Checked { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Logic.EnlirImport/StatusImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRK.Api.Infra.Options.EnlirETL; 5 | using FFRKApi.Model.EnlirImport; 6 | using FFRKApi.SheetsApiHelper; 7 | using Microsoft.Extensions.Logging; 8 | using Microsoft.Extensions.Options; 9 | 10 | namespace FFRKApi.Logic.EnlirImport 11 | { 12 | public class StatusImporter : RowImporterBase 13 | { 14 | public StatusImporter(ISheetsApiHelper sheetsApiHelper, IOptions importerOptionsAccessor, ILogger> logger) 15 | : base(sheetsApiHelper, importerOptionsAccessor, logger) 16 | { 17 | } 18 | 19 | protected override StatusRow AssignColumnToProperty(int columnCount, IList row) 20 | { 21 | StatusRow importedRow = new StatusRow(); 22 | 23 | importedRow.ID = ResolveColumnContents(columnCount, StatusColumn.ID, row); 24 | importedRow.CommonName = ResolveColumnContents(columnCount, StatusColumn.CommonName, row); 25 | importedRow.Effects = ResolveColumnContents(columnCount, StatusColumn.Effects, row); 26 | importedRow.DefaultDuration = ResolveColumnContents(columnCount, StatusColumn.DefaultDuration, row); 27 | importedRow.MindModifier = ResolveColumnContents(columnCount, StatusColumn.MindModifier, row); 28 | importedRow.ExclusiveStatus = ResolveColumnContents(columnCount, StatusColumn.ExclusiveStatus, row); 29 | importedRow.CodedName = ResolveColumnContents(columnCount, StatusColumn.CodedName, row); 30 | importedRow.Notes = ResolveColumnContents(columnCount, StatusColumn.Notes, row); 31 | 32 | return importedRow; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Logic.Api/ExperiencesLogic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Data.Api; 5 | using FFRKApi.Data.Api; 6 | using FFRKApi.Model.EnlirTransform; 7 | using Microsoft.Extensions.Logging; 8 | 9 | namespace FFRKApi.Logic.Api 10 | { 11 | public interface IExperiencesLogic 12 | { 13 | IEnumerable GetAllExperiences(); 14 | } 15 | 16 | public class ExperiencesLogic : IExperiencesLogic 17 | { 18 | #region Class Variables 19 | private readonly IEnlirRepository _enlirRepository; 20 | private readonly ILogger _logger; 21 | private readonly ICacheProvider _cacheProvider; 22 | #endregion 23 | 24 | #region Constructors 25 | 26 | public ExperiencesLogic(IEnlirRepository enlirRepository, ICacheProvider cacheProvider, ILogger logger) 27 | { 28 | _enlirRepository = enlirRepository; 29 | _logger = logger; 30 | _cacheProvider = cacheProvider; 31 | } 32 | #endregion 33 | 34 | #region IExperiencesLogic Implementation 35 | public IEnumerable GetAllExperiences() 36 | { 37 | _logger.LogInformation($"Logic Method invoked: {nameof(GetAllExperiences)}"); 38 | 39 | string cacheKey = $"{nameof(GetAllExperiences)}"; 40 | IEnumerable results = _cacheProvider.ObjectGet>(cacheKey); 41 | 42 | if (results == null) 43 | { 44 | results = _enlirRepository.GetMergeResultsContainer().Experiences; 45 | 46 | _cacheProvider.ObjectSet(cacheKey, results); 47 | } 48 | 49 | return results; 50 | } 51 | #endregion 52 | 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Api.FFRK/Properties/PublishProfiles/FFRKApi - Web Deploy.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | MSDeploy 9 | /subscriptions/ecd8bdc2-d60c-46f3-a328-98611b0ca04b/resourcegroups/FFRK/providers/Microsoft.Web/sites/FFRKApi 10 | FFRK 11 | AzureWebSite 12 | Release 13 | Any CPU 14 | http://ffrkapi.azurewebsites.net/swagger/ui/ 15 | True 16 | False 17 | 72cde731-b014-44d1-b4b4-0847e9b104ab 18 | ffrkapi.scm.azurewebsites.net:443 19 | FFRKApi 20 | 21 | True 22 | WMSVC 23 | True 24 | $FFRKApi 25 | <_SavePWD>True 26 | <_DestinationType>AzureWebSite 27 | netcoreapp2.0 28 | False 29 | 30 | -------------------------------------------------------------------------------- /Model.EnlirImport/LegendSphereRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum LegendSphereColumn 8 | { 9 | 10 | Realm = 0, 11 | Character = 1, 12 | 13 | 14 | BenefitColumn1 = 2, 15 | BenefitColumn2 = 3, 16 | BenefitColumn3 = 4, 17 | BenefitColumn4 = 5, 18 | 19 | Mote1Type = 6, 20 | Mote1AmountColumn1 = 7, 21 | Mote1AmountColumn2 = 8, 22 | Mote1AmountColumn3 = 9, 23 | Mote1AmountColumn4 = 10, 24 | 25 | 26 | Mote2Type = 11, 27 | Mote2AmountColumn1 = 12, 28 | Mote2AmountColumn2 = 13, 29 | Mote2AmountColumn3 = 14, 30 | Mote2AmountColumn4 = 15 31 | 32 | } 33 | 34 | public class LegendSphereRow 35 | { 36 | //General 37 | public string Realm { get; set; } 38 | public string Character { get; set; } 39 | 40 | //Legend Sphere Benefits 41 | public string BenefitColumn1 { get; set; } 42 | public string BenefitColumn2 { get; set; } 43 | public string BenefitColumn3 { get; set; } 44 | public string BenefitColumn4 { get; set; } 45 | 46 | //Mote 1 47 | public string Mote1Type { get; set; } 48 | public string Mote1AmountColumn1 { get; set; } 49 | public string Mote1AmountColumn2 { get; set; } 50 | public string Mote1AmountColumn3 { get; set; } 51 | public string Mote1AmountColumn4 { get; set; } 52 | 53 | //Mote 2 54 | public string Mote2Type { get; set; } 55 | public string Mote2AmountColumn1 { get; set; } 56 | public string Mote2AmountColumn2 { get; set; } 57 | public string Mote2AmountColumn3 { get; set; } 58 | public string Mote2AmountColumn4 { get; set; } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Dto.Api/Ability.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Ability 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | //General 13 | public string AbilityName { get; set; } 14 | public string ImagePath { get; set; } 15 | 16 | public int School { get; set; } 17 | 18 | public int Rarity { get; set; } 19 | public int MinUses { get; set; } 20 | public int MaxUses { get; set; } 21 | 22 | public int AbilityType { get; set; } 23 | public int TargetType { get; set; } 24 | public int AutoTargetType { get; set; } 25 | public int DamageFormulaType { get; set; } 26 | public double Multiplier { get; set; } 27 | public IEnumerable Elements { get; set; } 28 | public double CastTime { get; set; } 29 | public string Effects { get; set; } 30 | public bool IsCounterable { get; set; } 31 | public bool IsInGlobal { get; set; } 32 | public bool IsChecked { get; set; } 33 | public int SoulBreakPointsGained { get; set; } 34 | 35 | public string IntroducingEventName { get; set; } 36 | public int IntroducingEventId { get; set; } //filled in during merge phase 37 | public string JapaneseName { get; set; } 38 | public string EnlirId { get; set; } 39 | 40 | public IEnumerableOrbRequirements { get; set; } 41 | 42 | } 43 | 44 | public class OrbRequirementsByRankInfo 45 | { 46 | public int HoneRank { get; set; } 47 | 48 | public string OrbName { get; set; } 49 | 50 | public int OrbId { get; set; } 51 | 52 | public int OrbCount { get; set; } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Model.EnlirImport/SoulBreakRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum SoulBreakColumn 8 | { 9 | //General 10 | Realm = 0, 11 | Character = 1, 12 | ImagePath = 2, 13 | SoulBreakName = 3, 14 | Type = 4, 15 | Target = 5, 16 | Formula = 6, 17 | Multiplier = 7, 18 | Element = 8, 19 | Time = 9, 20 | Effects = 10, 21 | Counter = 11, 22 | AutoTarget = 12, 23 | Points = 13, 24 | Tier = 14, 25 | Master = 15, 26 | Relic = 16, 27 | JapaneseName = 17, 28 | ID = 18, 29 | IsInGlobal = 19, 30 | Checked = 20 31 | 32 | } 33 | 34 | public class SoulBreakRow 35 | { 36 | //General 37 | public string Realm { get; set; } 38 | public string Character { get; set; } 39 | public string ImagePath { get; set; } 40 | public string SoulBreakName { get; set; } 41 | public string Type { get; set; } 42 | public string Target { get; set; } 43 | public string Formula { get; set; } 44 | public string Multiplier { get; set; } 45 | public string Element { get; set; } 46 | public string Time { get; set; } 47 | public string Effects { get; set; } 48 | public string Counter { get; set; } 49 | public string AutoTarget { get; set; } 50 | public string Points { get; set; } 51 | public string Tier { get; set; } 52 | public string Master { get; set; } 53 | public string Relic { get; set; } 54 | public string JapaneseName { get; set; } 55 | public string ID { get; set; } 56 | public string IsInGlobal { get; set; } 57 | public string Checked { get; set; } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Model.EnlirImport/BraveActionRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum BraveActionColumn 8 | { 9 | //General 10 | Character = 0, 11 | Source = 1, 12 | ImagePath = 2, 13 | BraveName = 3, 14 | BraveLevel = 4, 15 | Type = 5, 16 | Target = 6, 17 | Formula = 7, 18 | Multiplier = 8, 19 | Element = 9, 20 | Time = 10, 21 | Effects = 11, 22 | Counter = 12, 23 | AutoTarget = 13, 24 | SB = 14, 25 | School = 15, 26 | BraveCondition = 16, 27 | JapaneseName = 17, 28 | ID = 18, 29 | IsInGlobal = 19, 30 | Checked = 20 31 | } 32 | 33 | public class BraveActionRow 34 | { 35 | //General 36 | public string Character { get; set; } 37 | public string Source { get; set; } 38 | public string ImagePath { get; set; } 39 | public string BraveName { get; set; } 40 | public string BraveLevel { get; set; } 41 | public string Type { get; set; } 42 | public string Target { get; set; } 43 | public string Formula { get; set; } 44 | public string Multiplier { get; set; } 45 | public string Element { get; set; } 46 | public string Time { get; set; } 47 | public string Effects { get; set; } 48 | public string Counter { get; set; } 49 | public string AutoTarget { get; set; } 50 | public string SB { get; set; } 51 | public string School { get; set; } 52 | public string BraveCondition { get; set; } 53 | public string JapaneseName { get; set; } 54 | public string ID { get; set; } 55 | public string IsInGlobal { get; set; } 56 | public string Checked { get; set; } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Api.FFRK/Controllers/MaintenanceController.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using FFRKApi.Api.FFRK.Constants; 3 | using FFRKApi.Logic.Api; 4 | using FFRKApi.Model.EnlirMerge; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Microsoft.Extensions.Logging; 7 | using Swashbuckle.AspNetCore.SwaggerGen; 8 | 9 | namespace FFRKApi.Api.FFRK.Controllers 10 | { 11 | public interface IMaintenanceController 12 | { 13 | IActionResult RefreshMergeResultsContainer(); 14 | } 15 | 16 | [Produces(RouteConstants.ContentType_ApplicationJson)] 17 | [Route(RouteConstants.BaseRoute)] 18 | public class MaintenanceController : Controller, IMaintenanceController 19 | { 20 | #region Class Variables 21 | 22 | private readonly IMaintenanceLogic _maintenanceLogic; 23 | private readonly ILogger _logger; 24 | #endregion 25 | 26 | 27 | #region Constructors 28 | 29 | public MaintenanceController(IMaintenanceLogic maintenanceLogic, ILogger logger) 30 | { 31 | _maintenanceLogic = maintenanceLogic; 32 | _logger = logger; 33 | } 34 | #endregion 35 | 36 | 37 | #region IMaintenanceController Implementation 38 | [HttpGet] 39 | [Route(RouteConstants.MaintenanceRoute_DataStatus)] 40 | [SwaggerOperation(nameof(RefreshMergeResultsContainer))] 41 | [ProducesResponseType(typeof(string), (int)HttpStatusCode.OK)] 42 | [ApiExplorerSettings(IgnoreApi = true)] 43 | public IActionResult RefreshMergeResultsContainer() 44 | { 45 | _logger.LogInformation($"Controller Method invoked: {nameof(RefreshMergeResultsContainer)}"); 46 | _maintenanceLogic.RefreshMergeResultsContainer(); 47 | 48 | return new OkResult(); 49 | } 50 | 51 | //comment to force push to azure 52 | #endregion 53 | } 54 | } -------------------------------------------------------------------------------- /FunctionApp.ETL/DISupport/InjectBinding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Microsoft.Azure.WebJobs.Host.Bindings; 4 | using Microsoft.Azure.WebJobs.Host.Protocols; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | namespace FunctionApp.ETL.DISupport 8 | { 9 | public class InjectBinding : IBinding 10 | { 11 | private readonly Type _type; 12 | private readonly IServiceProvider _serviceProvider; 13 | 14 | 15 | public InjectBinding(IServiceProvider serviceProvider, Type type) 16 | { 17 | _type = type; 18 | _serviceProvider = serviceProvider; 19 | } 20 | 21 | public bool FromAttribute => true; 22 | 23 | public Task BindAsync(object value, ValueBindingContext context) => Task.FromResult((IValueProvider)new InjectValueProvider(value)); 24 | 25 | public async Task BindAsync(BindingContext context) 26 | { 27 | await Task.Yield(); 28 | 29 | var scope = InjectBindingProvider.Scopes.GetOrAdd(context.FunctionInstanceId, (_) => ServiceProviderServiceExtensions.CreateScope(_serviceProvider)); 30 | var value = ServiceProviderServiceExtensions.GetRequiredService(scope.ServiceProvider, _type); 31 | 32 | return await BindAsync(value, context.ValueContext); 33 | } 34 | 35 | public ParameterDescriptor ToParameterDescriptor() => new ParameterDescriptor(); 36 | 37 | private class InjectValueProvider : IValueProvider 38 | { 39 | private readonly object _value; 40 | 41 | public InjectValueProvider(object value) => _value = value; 42 | 43 | public Type Type => _value.GetType(); 44 | 45 | public Task GetValueAsync() => Task.FromResult(_value); 46 | 47 | public string ToInvokeString() => _value.ToString(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Data.Api/AltemaCharacterRatingWebRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Net.Http; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using FFRK.Api.Infra.Options.EnlirETL; 8 | using Microsoft.Extensions.Options; 9 | 10 | namespace FFRKApi.Data.Api 11 | { 12 | public class AltemaCharacterRatingWebRepository : IAltemaCharacterRatingRepository 13 | { 14 | #region Class Variables 15 | 16 | private readonly ApiExternalWebsiteOptions _apiExternalWebsiteOptions; 17 | #endregion 18 | 19 | #region Constructors 20 | 21 | public AltemaCharacterRatingWebRepository(IOptions apiExternalWebsiteOptionsAccessor) 22 | { 23 | _apiExternalWebsiteOptions = apiExternalWebsiteOptionsAccessor.Value; 24 | } 25 | #endregion 26 | 27 | public Stream GetAltemaCharacterRatingStream() 28 | { 29 | HttpClient client = new HttpClient(); 30 | 31 | Stream webStream = null; 32 | 33 | try 34 | { 35 | webStream = client.GetStreamAsync(_apiExternalWebsiteOptions.AltemaCharacterRatingsUrl).Result; 36 | } 37 | catch (Exception) 38 | { 39 | //swallow, leave webStream null 40 | } 41 | 42 | return webStream; 43 | } 44 | 45 | public string GetAltemaCharacterRatingString() 46 | { 47 | HttpClient client = new HttpClient(); 48 | 49 | string html = null; 50 | 51 | try 52 | { 53 | html = client.GetStringAsync(_apiExternalWebsiteOptions.AltemaCharacterRatingsUrl).Result; 54 | } 55 | catch (Exception) 56 | { 57 | //swallow, leave html null 58 | } 59 | 60 | return html; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Ability.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Ability : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | //General 15 | public string AbilityName { get; set; } 16 | public string ImagePath { get; set; } 17 | 18 | public int School { get; set; } 19 | 20 | public int Rarity { get; set; } 21 | public int MinUses { get; set; } 22 | public int MaxUses { get; set; } 23 | 24 | public int AbilityType { get; set; } 25 | public int TargetType { get; set; } 26 | public int AutoTargetType { get; set; } 27 | public int DamageFormulaType { get; set; } 28 | public double Multiplier { get; set; } 29 | public IEnumerable Elements { get; set; } 30 | public double CastTime { get; set; } 31 | public string Effects { get; set; } 32 | public bool IsCounterable { get; set; } 33 | public bool IsInGlobal { get; set; } 34 | public bool IsChecked { get; set; } 35 | public int SoulBreakPointsGained { get; set; } 36 | 37 | public string IntroducingEventName { get; set; } 38 | public int IntroducingEventId { get; set; } //filled in during merge phase 39 | public string JapaneseName { get; set; } 40 | public string EnlirId { get; set; } 41 | 42 | public IEnumerableOrbRequirements { get; set; } 43 | 44 | } 45 | 46 | public class OrbRequirementsByRankInfo 47 | { 48 | public int HoneRank { get; set; } 49 | 50 | public string OrbName { get; set; } 51 | 52 | public int OrbId { get; set; } 53 | 54 | public int OrbCount { get; set; } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /FunctionApp.ETL/ExecuteMerge.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using FFRKApi.Logic.EnlirMerge; 6 | using FFRKApi.Logic.EnlirTransform; 7 | using FFRKApi.Model.EnlirMerge; 8 | using FFRKApi.Model.EnlirTransform; 9 | using FunctionApp.ETL.DISupport; 10 | using Microsoft.Azure.WebJobs; 11 | using Microsoft.Azure.WebJobs.Extensions.Http; 12 | using Microsoft.Azure.WebJobs.Host; 13 | using Microsoft.Extensions.Logging; 14 | using Newtonsoft.Json; 15 | 16 | namespace FunctionApp.ETL 17 | { 18 | public static class ExecuteMerge 19 | { 20 | [FunctionName("ExecuteMerge")] 21 | public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 22 | [Inject]IMergeManager mergeManager, [Inject]ILogger logger) 23 | { 24 | logger.LogInformation("Azure Function ExecuteMerge processed a request."); 25 | 26 | try 27 | { 28 | dynamic data = await req.Content.ReadAsAsync(); 29 | 30 | string datastring = data.ToString(); 31 | 32 | //this data had better be serializable to TranformResultsContainer 33 | TransformResultsContainer trc = JsonConvert.DeserializeObject(datastring); 34 | 35 | MergeResultsContainer mrc = mergeManager.MergeAll(trc); 36 | 37 | var response = req.CreateResponse(HttpStatusCode.OK, mrc); 38 | 39 | return response; 40 | } 41 | catch (System.Exception ex) 42 | { 43 | logger.LogError(ex, $"Error in Azure Function ExecuteMerge : {ex.Message}"); 44 | 45 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 46 | 47 | return response; 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Dto.Api/SoulBreak.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class SoulBreak 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | public int Realm { get; set; } 13 | 14 | public string CharacterName { get; set; } 15 | public int CharacterId { get; set; } //filled in during merge phase 16 | public string RelicName { get; set; } 17 | public int RelicId { get; set; } //filled in during merge phase 18 | 19 | public IEnumerable Commands { get; set; } //filled in during merge phase 20 | public IEnumerable BraveActions { get; set; } //filled in during merge phase 21 | public IEnumerable Statuses { get; set; } //filled in during merge phase 22 | public IEnumerable OtherEffects { get; set; } //filled in during merge phase 23 | 24 | public string ImagePath { get; set; } 25 | 26 | public string SoulBreakName { get; set; } 27 | public string JapaneseName { get; set; } 28 | 29 | public int AbilityType { get; set; } 30 | public int TargetType { get; set; } 31 | public int AutoTargetType { get; set; } 32 | public int DamageFormulaType { get; set; } 33 | public double Multiplier { get; set; } 34 | public IEnumerable Elements { get; set; } 35 | public double CastTime { get; set; } 36 | public string Effects { get; set; } 37 | public bool IsCounterable { get; set; } 38 | public bool IsInGlobal { get; set; } 39 | public bool IsChecked { get; set; } 40 | 41 | 42 | public int SoulBreakPointsRequired { get; set; } 43 | public int SoulBreakTier { get; set; } 44 | public string MasteryBonus { get; set; } 45 | 46 | 47 | 48 | public string EnlirId { get; set; } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /FunctionApp.ETL/ValidateSourceData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | using FFRKApi.Logic.EnlirImport; 7 | using FunctionApp.ETL.DISupport; 8 | using Microsoft.Azure.WebJobs; 9 | using Microsoft.Azure.WebJobs.Extensions.Http; 10 | using Microsoft.Azure.WebJobs.Host; 11 | using Microsoft.Extensions.Logging; 12 | using FFRKApi.Logic.Validation.Enlir; 13 | 14 | namespace FFRKApi.FunctionApp.ETL 15 | { 16 | public static class ValidateSourceData 17 | { 18 | [FunctionName("ValidateSourceData")] 19 | public static async Task Run( 20 | [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 21 | [Inject]IImportValidator importValidator, [Inject]ILogger logger) 22 | { 23 | logger.LogInformation("Azure Function ValidateSourceData processed a request."); 24 | 25 | try 26 | { 27 | string failureInfo; 28 | 29 | bool isDataSourceValid = importValidator.TryValidateDataSource(out failureInfo); 30 | if (!isDataSourceValid) 31 | { 32 | logger.LogWarning("Enlir Import Data not in Expected Format: \n" + failureInfo); 33 | throw new Exception("Enlir Import Data not in Expected Format: \n" + failureInfo); 34 | } 35 | 36 | var response = req.CreateResponse(HttpStatusCode.OK, true); 37 | 38 | return response; 39 | } 40 | catch (System.Exception ex) 41 | { 42 | 43 | logger.LogError(ex, $"Error in Azure Function ValidateSourceData : {ex.Message}"); 44 | 45 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 46 | 47 | return response; 48 | } 49 | 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /FunctionApp.ETL/ExecuteTransform.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using FFRKApi.Logic.EnlirTransform; 6 | using FFRKApi.Model.EnlirImport; 7 | using FFRKApi.Model.EnlirTransform; 8 | using FunctionApp.ETL.DISupport; 9 | using Microsoft.Azure.WebJobs; 10 | using Microsoft.Azure.WebJobs.Extensions.Http; 11 | using Microsoft.Azure.WebJobs.Host; 12 | using Microsoft.Extensions.Logging; 13 | using Newtonsoft.Json; 14 | 15 | namespace FunctionApp.ETL 16 | { 17 | public static class ExecuteTransform 18 | { 19 | [FunctionName("ExecuteTransform")] 20 | public static async Task Run( 21 | [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, TraceWriter log, 22 | [Inject]ITransformManager transformManager, [Inject]ILogger logger) 23 | { 24 | logger.LogInformation("Azure Function ExecuteTransform processed a request."); 25 | 26 | try 27 | { 28 | dynamic data = await req.Content.ReadAsAsync(); 29 | 30 | string datastring = data.ToString(); 31 | 32 | //this data had better be serializable to ImportResultsContainer 33 | ImportResultsContainer irc = JsonConvert.DeserializeObject(datastring); 34 | 35 | TransformResultsContainer trc = transformManager.TransformAll(irc); 36 | 37 | var response = req.CreateResponse(HttpStatusCode.OK, trc); 38 | 39 | return response; 40 | } 41 | catch (System.Exception ex) 42 | { 43 | logger.LogError(ex, $"Error in Azure Function ExecuteTransform : {ex.Message}"); 44 | 45 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 46 | 47 | return response; 48 | } 49 | 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Logic.Api/CharacterRating/AltemaCharacterNodeParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using FFRKApi.Model.Api.CharacterRating; 6 | using HtmlAgilityPack; 7 | 8 | namespace FFRKApi.Logic.Api.CharacterRating 9 | { 10 | public interface IAltemaCharacterNodeParser 11 | { 12 | AltemaCharacterNodeComponents ParseCharacterNode(HtmlNode characterNode); 13 | } 14 | 15 | public class AltemaCharacterNodeParser : IAltemaCharacterNodeParser 16 | { 17 | private const string ImageSourceAttributeName = "src"; 18 | private const string ImageLazySourceAttributeName = "data-lazy-src"; 19 | private const string ImageLazyLoadedAttributeName = "data-lazy-loaded"; 20 | 21 | 22 | public AltemaCharacterNodeComponents ParseCharacterNode(HtmlNode characterNode) 23 | { 24 | AltemaCharacterNodeComponents components = new AltemaCharacterNodeComponents(); 25 | 26 | components.CharacterNode = characterNode; 27 | components.NameNode = characterNode.SelectSingleNode(@"./td[1]/a[1]"); 28 | components.ImageNode = characterNode.SelectSingleNode(@"./td[1]/a[1]/img[1]"); 29 | components.RoleNode = characterNode.SelectSingleNode(@"./td[2]/span[@class='b']"); 30 | components.RatingNode = characterNode.SelectSingleNode(@"./td[3]/span[@class='redtxt']"); 31 | 32 | components.CharacterIdAttribute = components.NameNode.Attributes.FirstOrDefault(); 33 | components.ImageLazyLoadedAttribute = components.ImageNode?.Attributes.FirstOrDefault(a => a.Name == ImageLazyLoadedAttributeName); 34 | components.ImageLazySourceAttribute = components.ImageNode?.Attributes.FirstOrDefault(a => a.Name == ImageLazySourceAttributeName); 35 | components.ImageSourceAttribute = components.ImageNode?.Attributes.FirstOrDefault(a => a.Name == ImageSourceAttributeName); 36 | 37 | return components; 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Api.FFRK/Program.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | 5 | namespace FFRKApi.Api.FFRK 6 | { 7 | public class Program 8 | { 9 | 10 | #region Constants 11 | 12 | private const string LocalEnvironmentKey = "local"; 13 | private const string ConfigFileName = "config"; 14 | private const string ConfigFileExtension = "json"; 15 | #endregion 16 | 17 | public static void Main(string[] args) 18 | { 19 | BuildWebHost(args).Run(); 20 | } 21 | 22 | //public static IWebHost BuildWebHost(string[] args) => 23 | // WebHost.CreateDefaultBuilder(args) 24 | 25 | // .UseStartup() 26 | // .Build(); 27 | 28 | public static IWebHost BuildWebHost(string[] args) 29 | { 30 | IWebHost webHost = new WebHostBuilder() 31 | .UseKestrel() 32 | .ConfigureAppConfiguration((hostingContext, config) => ConfigureConfiguration(hostingContext, config)) 33 | .UseStartup() 34 | .Build(); 35 | 36 | 37 | return webHost; 38 | } 39 | 40 | public static IConfigurationBuilder ConfigureConfiguration(WebHostBuilderContext hostingContext, IConfigurationBuilder builder) 41 | { 42 | var env = hostingContext.HostingEnvironment; 43 | 44 | builder.SetBasePath(Directory.GetCurrentDirectory()); 45 | 46 | builder.AddJsonFile("hosting.json", optional: true); 47 | 48 | if (env.IsEnvironment(LocalEnvironmentKey)) 49 | { 50 | builder.AddJsonFile($"{ConfigFileName}.{LocalEnvironmentKey}.{ConfigFileExtension}", optional: true); 51 | } 52 | else 53 | { 54 | builder.AddJsonFile($"{ConfigFileName}.{ConfigFileExtension}"); 55 | } 56 | 57 | builder.AddEnvironmentVariables(); 58 | 59 | return builder; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Model.EnlirTransform/SoulBreak.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class SoulBreak : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | public int Realm { get; set; } 15 | 16 | public string CharacterName { get; set; } 17 | public int CharacterId { get; set; } //filled in during merge phase 18 | public string RelicName { get; set; } 19 | public int RelicId { get; set; } //filled in during merge phase 20 | 21 | public IEnumerable Commands { get; set; } //filled in during merge phase 22 | public IEnumerable BraveActions { get; set; } //filled in during merge phase 23 | public IEnumerable Statuses { get; set; } //filled in during merge phase 24 | public IEnumerable OtherEffects { get; set; } //filled in during merge phase 25 | 26 | public string ImagePath { get; set; } 27 | 28 | public string SoulBreakName { get; set; } 29 | public string JapaneseName { get; set; } 30 | 31 | public int AbilityType { get; set; } 32 | public int TargetType { get; set; } 33 | public int AutoTargetType { get; set; } 34 | public int DamageFormulaType { get; set; } 35 | public double Multiplier { get; set; } 36 | public IEnumerable Elements { get; set; } 37 | public double CastTime { get; set; } 38 | public string Effects { get; set; } 39 | public bool IsCounterable { get; set; } 40 | public bool IsInGlobal { get; set; } 41 | public bool IsChecked { get; set; } 42 | 43 | 44 | public int SoulBreakPointsRequired { get; set; } 45 | public int SoulBreakTier { get; set; } 46 | public string MasteryBonus { get; set; } 47 | 48 | 49 | 50 | public string EnlirId { get; set; } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Model.EnlirImport/ExperienceRow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirImport 6 | { 7 | public enum ExperienceColumn 8 | { 9 | Level = 0, 10 | Character = 1, 11 | NextLevelCharacter = 2, 12 | Tyro = 3, 13 | NextLevelTyro = 4, 14 | Magicite1 = 5, 15 | NextLevelMagicite1 = 6, 16 | Magicite2 = 7, 17 | NextLevelMagicite2 = 8, 18 | Magicite3 = 9, 19 | NextLevelMagicite3 = 10, 20 | Magicite4 = 11, 21 | NextLevelMagicite4 = 12, 22 | Magicite5 = 13, 23 | NextLevelMagicite5 = 14, 24 | Inheritance3 = 15, 25 | NextLevelInheritance3 = 16, 26 | Inheritance4 = 17, 27 | NextLevelInheritance4 = 18, 28 | Inheritance5 = 19, 29 | NextLevelInheritance5 = 20 30 | } 31 | 32 | public class ExperienceRow 33 | { 34 | public string Level { get; set; } 35 | public string Character { get; set; } 36 | public string NextLevelCharacter { get; set; } 37 | public string Tyro { get; set; } 38 | public string NextLevelTyro { get; set; } 39 | public string Magicite1 { get; set; } 40 | public string NextLevelMagicite1 { get; set; } 41 | public string Magicite2 { get; set; } 42 | public string NextLevelMagicite2 { get; set; } 43 | public string Magicite3 { get; set; } 44 | public string NextLevelMagicite3 { get; set; } 45 | public string Magicite4 { get; set; } 46 | public string NextLevelMagicite4 { get; set; } 47 | public string Magicite5 { get; set; } 48 | public string NextLevelMagicite5 { get; set; } 49 | public string Inheritance3 { get; set; } 50 | public string NextLevelInheritance3 { get; set; } 51 | public string Inheritance4 { get; set; } 52 | public string NextLevelInheritance4 { get; set; } 53 | public string Inheritance5 { get; set; } 54 | public string NextLevelInheritance5 { get; set; } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Logic.EnlirImport/RecordMateriaImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRK.Api.Infra.Options.EnlirETL; 5 | using FFRKApi.Model.EnlirImport; 6 | using FFRKApi.SheetsApiHelper; 7 | using Microsoft.Extensions.Logging; 8 | using Microsoft.Extensions.Options; 9 | 10 | namespace FFRKApi.Logic.EnlirImport 11 | { 12 | public class RecordMateriaImporter : RowImporterBase 13 | { 14 | public RecordMateriaImporter(ISheetsApiHelper sheetsApiHelper, IOptions importerOptionsAccessor, ILogger> logger) 15 | : base(sheetsApiHelper, importerOptionsAccessor, logger) 16 | { 17 | } 18 | 19 | protected override RecordMateriaRow AssignColumnToProperty(int columnCount, IList row) 20 | { 21 | RecordMateriaRow importedRow = new RecordMateriaRow(); 22 | 23 | importedRow.Realm = ResolveColumnContents(columnCount, RecordMateriaColumn.Realm, row); 24 | importedRow.Character = ResolveColumnContents(columnCount, RecordMateriaColumn.Character, row); 25 | importedRow.ImagePath = ResolveColumnContents(columnCount, RecordMateriaColumn.ImagePath, row); 26 | importedRow.RecordMateriaName = ResolveColumnContents(columnCount, RecordMateriaColumn.RecordMateriaName, row); 27 | importedRow.Effect = ResolveColumnContents(columnCount, RecordMateriaColumn.Effect, row); 28 | importedRow.UnlockCriteria = ResolveColumnContents(columnCount, RecordMateriaColumn.UnlockCriteria, row); 29 | importedRow.JapaneseName = ResolveColumnContents(columnCount, RecordMateriaColumn.JapaneseName, row); 30 | importedRow.ID = ResolveColumnContents(columnCount, RecordMateriaColumn.ID, row); 31 | importedRow.IsInGlobal = ResolveColumnContents(columnCount, RecordMateriaColumn.IsInGlobal, row); 32 | importedRow.Checked = ResolveColumnContents(columnCount, RecordMateriaColumn.Checked, row); 33 | 34 | return importedRow; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/SoulBreakTierList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class SoulBreakTierList : ITypeList 8 | { 9 | private IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, "Default"), 13 | new KeyValuePair(2, "Shared"), 14 | new KeyValuePair(3, "RW"), 15 | new KeyValuePair(4, "SB"), 16 | new KeyValuePair(5, "SSB"), 17 | new KeyValuePair(6, "BSB"), 18 | new KeyValuePair(7, "OSB"), 19 | new KeyValuePair(8, "USB"), 20 | new KeyValuePair(9, "CSB"), 21 | new KeyValuePair(10, "Glint"), 22 | new KeyValuePair(11, "Glint+"), 23 | new KeyValuePair(12, "AOSB"), 24 | new KeyValuePair(13, "AASB") 25 | }; 26 | 27 | public IList> TypeList => _typeList; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Logic.EnlirTransform/StatusTransformer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRKApi.Model.EnlirImport; 5 | using FFRKApi.Model.EnlirTransform; 6 | using FFRKApi.Model.EnlirTransform.Converters; 7 | using Microsoft.Extensions.Logging; 8 | 9 | namespace FFRKApi.Logic.EnlirTransform 10 | { 11 | public class StatusTransformer : RowTransformerBase 12 | { 13 | #region Class Variables 14 | private readonly IntConverter _intConverter; 15 | private readonly DoubleConverter _doubleConverter; 16 | private readonly PercentConverter _percentConverter; 17 | 18 | #endregion 19 | 20 | #region Constants 21 | private readonly char[] PlusMinusCharArray = "±".ToCharArray(); 22 | #endregion 23 | 24 | public StatusTransformer(ILogger> logger) : base(logger) 25 | { 26 | _doubleConverter = new DoubleConverter(); 27 | _intConverter = new IntConverter(); 28 | _percentConverter = new PercentConverter(); 29 | 30 | } 31 | 32 | protected override Status ConvertRowToModel(int generatedId, StatusRow row) 33 | { 34 | Status model = new Status(); 35 | 36 | model.Id = generatedId; 37 | model.Description = row.CommonName; 38 | 39 | model.StatusId = _intConverter.ConvertFromStringToInt(row.ID); 40 | model.CommonName = row.CommonName; 41 | model.Effects = row.Effects; 42 | model.DefaultDuration = _intConverter.ConvertFromStringToInt(row.DefaultDuration); 43 | model.MindModifier = _percentConverter.ConvertFromStringToDouble(row.MindModifier.TrimStart(PlusMinusCharArray)); 44 | model.ExclusiveStatuses = ConvertCommaSeparatedStringToList(row.ExclusiveStatus); 45 | model.CodedName = row.CodedName; 46 | model.Notes = row.Notes.Replace(DashCharacter, String.Empty); 47 | 48 | _logger.LogDebug("Converted StatusRow to Status: {Id} - {Description}", model.Id, model.Description); 49 | 50 | return model; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Logic.EnlirImport/LegendMateriaImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRK.Api.Infra.Options.EnlirETL; 5 | using FFRKApi.Model.EnlirImport; 6 | using FFRKApi.SheetsApiHelper; 7 | using Microsoft.Extensions.Logging; 8 | using Microsoft.Extensions.Options; 9 | 10 | namespace FFRKApi.Logic.EnlirImport 11 | { 12 | public class LegendMateriaImporter : RowImporterBase 13 | { 14 | public LegendMateriaImporter(ISheetsApiHelper sheetsApiHelper, IOptions importerOptionsAccessor, ILogger> logger) 15 | : base(sheetsApiHelper, importerOptionsAccessor, logger) 16 | { 17 | } 18 | 19 | protected override LegendMateriaRow AssignColumnToProperty(int columnCount, IList row) 20 | { 21 | LegendMateriaRow importedRow = new LegendMateriaRow(); 22 | 23 | importedRow.Realm = ResolveColumnContents(columnCount, LegendMateriaColumn.Realm, row); 24 | importedRow.Character = ResolveColumnContents(columnCount, LegendMateriaColumn.Character, row); 25 | importedRow.ImagePath = ResolveColumnContents(columnCount, LegendMateriaColumn.ImagePath, row); 26 | importedRow.LegendMateriaName = ResolveColumnContents(columnCount, LegendMateriaColumn.LegendMateriaName, row); 27 | importedRow.Effect = ResolveColumnContents(columnCount, LegendMateriaColumn.Effect, row); 28 | importedRow.Master = ResolveColumnContents(columnCount, LegendMateriaColumn.Master, row); 29 | importedRow.Relic = ResolveColumnContents(columnCount, LegendMateriaColumn.Relic, row); 30 | importedRow.JapaneseName = ResolveColumnContents(columnCount, LegendMateriaColumn.JapaneseName, row); 31 | importedRow.ID = ResolveColumnContents(columnCount, LegendMateriaColumn.ID, row); 32 | importedRow.IsInGlobal = ResolveColumnContents(columnCount, LegendMateriaColumn.IsInGlobal, row); 33 | importedRow.Checked = ResolveColumnContents(columnCount, LegendMateriaColumn.Checked, row); 34 | 35 | return importedRow; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/EventTypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class EventTypeList : ITypeList 8 | { 9 | private IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, "Challenge Event"), 13 | new KeyValuePair(2, "Collection Event"), 14 | new KeyValuePair(3, "Crystal Tower"), 15 | new KeyValuePair(4, "Dungeons Update"), 16 | new KeyValuePair(5, "Endless Battle"), 17 | new KeyValuePair(6, "Festival"), 18 | new KeyValuePair(7, "Magicite Dungeon"), 19 | new KeyValuePair(8, "Mote Dungeon"), 20 | new KeyValuePair(9, "Nightmare Dungeon"), 21 | new KeyValuePair(10, "Record Dungeon"), 22 | new KeyValuePair(11, "Record Missions"), 23 | new KeyValuePair(12, "Survival Event"), 24 | new KeyValuePair(12, "Torment Dungeon") 25 | }; 26 | 27 | 28 | public IList> TypeList => _typeList; 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /FunctionApp.ETL/StoreImport.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using FFRKApi.Data.Storage; 6 | using FFRKApi.Model.EnlirImport; 7 | using FunctionApp.ETL.DISupport; 8 | using Microsoft.Azure.WebJobs; 9 | using Microsoft.Azure.WebJobs.Extensions.Http; 10 | using Microsoft.Azure.WebJobs.Host; 11 | using Microsoft.Extensions.Logging; 12 | using Newtonsoft.Json; 13 | 14 | namespace FunctionApp.ETL 15 | { 16 | public static class StoreImport 17 | { 18 | [FunctionName("StoreImport")] 19 | public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 20 | [Inject]IImportStorageProvider importStorageProvider, [Inject]ILogger logger) 21 | { 22 | logger.LogInformation("Azure Function StoreImport processed a request."); 23 | 24 | try 25 | { 26 | // parse query parameter -can be null 27 | string formattedDateString = req.GetQueryNameValuePairs() 28 | .FirstOrDefault(q => string.Compare(q.Key, "formattedDateString", true) == 0) 29 | .Value; 30 | 31 | // Get request body 32 | dynamic data = await req.Content.ReadAsAsync(); 33 | 34 | string datastring = data.ToString(); 35 | 36 | //this data had better be serializable to ImportResultsContainer 37 | ImportResultsContainer irc = JsonConvert.DeserializeObject(datastring); 38 | 39 | 40 | string filePath = importStorageProvider.StoreImportResults(irc, formattedDateString); 41 | 42 | var response = req.CreateResponse(HttpStatusCode.OK, filePath); 43 | 44 | return response; 45 | } 46 | catch (System.Exception ex) 47 | { 48 | logger.LogError(ex, $"Error in Azure Function StoreImport : {ex.Message}"); 49 | 50 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 51 | 52 | return response; 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /FunctionApp.ETL/StoreMerge.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using FFRKApi.Data.Storage; 6 | using FFRKApi.Model.EnlirMerge; 7 | using FFRKApi.Model.EnlirTransform; 8 | using FunctionApp.ETL.DISupport; 9 | using Microsoft.Azure.WebJobs; 10 | using Microsoft.Azure.WebJobs.Extensions.Http; 11 | using Microsoft.Azure.WebJobs.Host; 12 | using Microsoft.Extensions.Logging; 13 | using Newtonsoft.Json; 14 | 15 | namespace FunctionApp.ETL 16 | { 17 | public static class StoreMerge 18 | { 19 | [FunctionName("StoreMerge")] 20 | public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 21 | [Inject]IMergeStorageProvider mergeStorageProvider, [Inject]ILogger logger) 22 | { 23 | logger.LogInformation("Azure Function StoreMerge processed a request."); 24 | 25 | try 26 | { 27 | // parse query parameter -can be null 28 | string formattedDateString = req.GetQueryNameValuePairs() 29 | .FirstOrDefault(q => string.Compare(q.Key, "formattedDateString", true) == 0) 30 | .Value; 31 | 32 | // Get request body 33 | dynamic data = await req.Content.ReadAsAsync(); 34 | 35 | string datastring = data.ToString(); 36 | 37 | //this data had better be serializable to MergeResultsContainer 38 | MergeResultsContainer mrc = JsonConvert.DeserializeObject(datastring); 39 | 40 | 41 | string filePath = mergeStorageProvider.StoreMergeResults(mrc, formattedDateString); 42 | 43 | var response = req.CreateResponse(HttpStatusCode.OK, filePath); 44 | 45 | return response; 46 | } 47 | catch (System.Exception ex) 48 | { 49 | 50 | logger.LogError(ex, $"Error in Azure Function StoreMerge : {ex.Message}"); 51 | 52 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 53 | 54 | return response; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /FunctionApp.ETL/StoreTransform.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Net; 3 | using System.Net.Http; 4 | using System.Threading.Tasks; 5 | using FFRKApi.Data.Storage; 6 | using FFRKApi.Model.EnlirTransform; 7 | using FunctionApp.ETL.DISupport; 8 | using Microsoft.Azure.WebJobs; 9 | using Microsoft.Azure.WebJobs.Extensions.Http; 10 | using Microsoft.Azure.WebJobs.Host; 11 | using Microsoft.Extensions.Logging; 12 | using Newtonsoft.Json; 13 | 14 | namespace FunctionApp.ETL 15 | { 16 | public static class StoreTransform 17 | { 18 | [FunctionName("StoreTransform")] 19 | public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 20 | [Inject]ITransformStorageProvider transformStorageProvider, [Inject]ILogger logger) 21 | { 22 | logger.LogInformation("Azure Function StoreTransform processed a request."); 23 | 24 | try 25 | { 26 | // parse query parameter - can be null 27 | string formattedDateString = req.GetQueryNameValuePairs() 28 | .FirstOrDefault(q => string.Compare(q.Key, "formattedDateString", true) == 0) 29 | .Value; 30 | 31 | // Get request body 32 | dynamic data = await req.Content.ReadAsAsync(); 33 | 34 | string datastring = data.ToString(); 35 | 36 | //this data had better be serializable to TransformResultsContainer 37 | TransformResultsContainer trc = JsonConvert.DeserializeObject(datastring); 38 | 39 | string filePath = transformStorageProvider.StoreTransformResults(trc, formattedDateString); 40 | 41 | var response = req.CreateResponse(HttpStatusCode.OK, filePath); 42 | 43 | return response; 44 | } 45 | catch (System.Exception ex) 46 | { 47 | logger.LogError(ex, $"Error in Azure Function StoreTransform : {ex.Message}"); 48 | 49 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 50 | 51 | return response; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Model.EnlirTransform/IdLists/MissionTypeList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform.IdLists 6 | { 7 | public class MissionTypeList : ITypeList 8 | { 9 | private IList> _typeList = new List>() 10 | { 11 | new KeyValuePair(0, "Unknown"), 12 | new KeyValuePair(1, "Book of Challenges"), 13 | new KeyValuePair(2, "Book of Dates"), 14 | new KeyValuePair(3, "Book of Time"), 15 | new KeyValuePair(4, "Book of Trials, Vol. I"), 16 | new KeyValuePair(5, "Book of Trials, Vol. II"), 17 | new KeyValuePair(6, "Book of Trials, Vol. III"), 18 | new KeyValuePair(7, "Book of Trials, Vol. IV"), 19 | new KeyValuePair(8, "Book of Trials, Vol. V"), 20 | new KeyValuePair(9, "Book of Trials, Vol. VI"), 21 | new KeyValuePair(10, "Book of Trials, Vol. VII"), 22 | new KeyValuePair(11, "Book of Trials, Vol. VIII"), 23 | new KeyValuePair(12, "Book of Trials, Vol. IX"), 24 | new KeyValuePair(13, "Book of Transcendence") 25 | 26 | }; 27 | 28 | public IList> TypeList => _typeList; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Data.Api/EnlirRepository.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRKApi.Data.Storage; 5 | using FFRKApi.Model.EnlirMerge; 6 | 7 | namespace Data.Api 8 | { 9 | /// 10 | /// Provides Methods to load the Repository with data from the Enlir Merge Operation, 11 | /// and to serve out that data to callers 12 | /// 13 | public interface IEnlirRepository 14 | { 15 | /// 16 | /// Loads the latest copy of the Enlir Merge data 17 | /// 18 | void LoadMergeResultsContainer(); 19 | 20 | /// 21 | /// Returns the currently loaded Enlir Merge data 22 | /// 23 | /// 24 | MergeResultsContainer GetMergeResultsContainer(); 25 | 26 | } 27 | 28 | /// 29 | /// This class is meant to be used as a singleton in the api, so the actual data is held as a property. 30 | /// That way, although the repository class will be static, the data can be updated live through the Load method 31 | /// 32 | /// The MergeResultsContainer is lazy loaded, so the very first call will incur the cost of loading the big dataset, 33 | /// but after that the data is always instantly available in memory 34 | /// 35 | public class EnlirRepository : IEnlirRepository 36 | { 37 | #region Class Variables 38 | 39 | private readonly IMergeStorageProvider _mergeStorageProvider; 40 | 41 | private MergeResultsContainer _mergeResultsContainer = null; 42 | #endregion 43 | 44 | #region Constructors 45 | 46 | public EnlirRepository(IMergeStorageProvider mergeStorageProvider) 47 | { 48 | _mergeStorageProvider = mergeStorageProvider; 49 | } 50 | #endregion 51 | 52 | public void LoadMergeResultsContainer() 53 | { 54 | _mergeResultsContainer = _mergeStorageProvider.RetrieveMergeResults(); 55 | } 56 | 57 | public MergeResultsContainer GetMergeResultsContainer() 58 | { 59 | if (_mergeResultsContainer == null) 60 | { 61 | LoadMergeResultsContainer(); 62 | } 63 | 64 | return _mergeResultsContainer; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Converters/TypeListConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using FFRKApi.Model.EnlirTransform.IdLists; 7 | 8 | namespace FFRKApi.Model.EnlirTransform.Converters 9 | { 10 | public class TypeListConverter 11 | { 12 | #region Class Variables 13 | private readonly ITypeList _typeList; 14 | #endregion 15 | 16 | #region Constants 17 | 18 | protected const string CommaCharacter = ","; 19 | 20 | #endregion 21 | 22 | #region Constructors 23 | public TypeListConverter(ITypeList typeList) 24 | { 25 | _typeList = typeList; 26 | } 27 | #endregion 28 | 29 | #region Public Methods 30 | 31 | public int ConvertFromNameToId(string input) 32 | { 33 | int id = 0; 34 | 35 | try 36 | { 37 | id = _typeList.TypeList.SingleOrDefault(r => r.Value == input.Trim()).Key; 38 | } 39 | catch (Exception e) 40 | { 41 | id = 0; 42 | } 43 | return id; 44 | } 45 | 46 | 47 | 48 | 49 | public IEnumerable ConvertFromCommaSeparatedListToIds(string input) 50 | { 51 | IList ids = new List(); 52 | 53 | IList inputParts = ConvertCommaSeparatedStringToList(input); 54 | 55 | foreach (var part in inputParts) 56 | { 57 | int id = _typeList.TypeList.SingleOrDefault(r => r.Value == part.Trim()).Key; 58 | 59 | if (!ids.Contains(id)) 60 | { 61 | ids.Add(id); 62 | } 63 | 64 | } 65 | 66 | return ids; 67 | } 68 | #endregion 69 | 70 | #region Private Methods 71 | private IList ConvertCommaSeparatedStringToList(string input) 72 | { 73 | IList results = new List(); 74 | 75 | if (!String.IsNullOrWhiteSpace(input)) 76 | { 77 | results = input.Split(new string[] { CommaCharacter }, StringSplitOptions.None).Select(s => s.Trim()).ToList(); 78 | } 79 | 80 | return results; 81 | } 82 | #endregion 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Data.Storage/FileMergeStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using FFRK.Api.Infra.Options.EnlirETL; 7 | using FFRKApi.Model.EnlirMerge; 8 | using FFRKApi.Model.EnlirTransform; 9 | using Microsoft.Extensions.Logging; 10 | using Microsoft.Extensions.Options; 11 | using Newtonsoft.Json; 12 | 13 | namespace FFRKApi.Data.Storage 14 | { 15 | public class FileMergeStorageProvider : FileStorageProviderBase, IMergeStorageProvider 16 | { 17 | #region Class Variables 18 | 19 | private readonly FileMergeStorageOptions _fileMergeStorageOptions; 20 | #endregion 21 | 22 | #region Constants 23 | 24 | private const string MergeResultFileFilterExpression = "MergeResults*.json"; 25 | #endregion 26 | 27 | #region Constructors 28 | public FileMergeStorageProvider(IOptions fileMergeStorageOptions, ILogger logger) : base(logger) 29 | { 30 | _fileMergeStorageOptions = fileMergeStorageOptions.Value; 31 | } 32 | #endregion 33 | 34 | public string StoreMergeResults(MergeResultsContainer mergeResultsContainer, string formattedDateString) 35 | { 36 | string serializedMergeResults = JsonConvert.SerializeObject(mergeResultsContainer); 37 | 38 | string datedFilePath = StoreSerializedData(serializedMergeResults, formattedDateString, _fileMergeStorageOptions.MergeResultsStoragePath); 39 | 40 | return datedFilePath; 41 | } 42 | 43 | public MergeResultsContainer RetrieveMergeResults() 44 | { 45 | string fileContents = RetrieveSerializedData(_fileMergeStorageOptions.MergeResultsStoragePath, MergeResultFileFilterExpression); 46 | 47 | MergeResultsContainer mergeResultsContainer = JsonConvert.DeserializeObject(fileContents); 48 | 49 | return mergeResultsContainer; 50 | } 51 | 52 | public MergeResultsContainer RetrieveMergeResults(string path) 53 | { 54 | string fileContents = RetrieveSerializedData(path); 55 | 56 | MergeResultsContainer mergeResultsContainer = JsonConvert.DeserializeObject(fileContents); 57 | 58 | return mergeResultsContainer; 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Data.Storage/FileImportStorageProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using FFRK.Api.Infra.Options.EnlirETL; 7 | using FFRKApi.Model.EnlirImport; 8 | using Microsoft.Extensions.Logging; 9 | using Microsoft.Extensions.Options; 10 | using Newtonsoft.Json; 11 | 12 | namespace FFRKApi.Data.Storage 13 | { 14 | public class FileImportStorageProvider : FileStorageProviderBase, IImportStorageProvider 15 | { 16 | #region Class Variables 17 | 18 | private readonly FileImportStorageOptions _fileImportStorageOptions; 19 | #endregion 20 | 21 | #region Constants 22 | 23 | private const string ImportResultFileFilterExpression = "ImportsResults*.json"; 24 | #endregion 25 | 26 | #region Constructors 27 | public FileImportStorageProvider(IOptions fileImportStorageOptions, ILogger logger): base(logger) 28 | { 29 | _fileImportStorageOptions = fileImportStorageOptions.Value; 30 | 31 | } 32 | #endregion 33 | 34 | public string StoreImportResults(ImportResultsContainer importResultsContainer, string formattedDateString) 35 | { 36 | string serializedImportResults = JsonConvert.SerializeObject(importResultsContainer); 37 | 38 | string datedFilePath = StoreSerializedData(serializedImportResults, formattedDateString, _fileImportStorageOptions.ImportResultsStoragePath); 39 | 40 | return datedFilePath; 41 | } 42 | 43 | public ImportResultsContainer RetrieveImportResults() 44 | { 45 | string fileContents = RetrieveSerializedData(_fileImportStorageOptions.ImportResultsStoragePath, ImportResultFileFilterExpression); 46 | 47 | ImportResultsContainer importResultsContainer = JsonConvert.DeserializeObject(fileContents); 48 | 49 | return importResultsContainer; 50 | } 51 | 52 | 53 | public ImportResultsContainer RetrieveImportResults(string path) 54 | { 55 | string fileContents = RetrieveSerializedData(path); 56 | 57 | ImportResultsContainer importResultsContainer = JsonConvert.DeserializeObject(fileContents); 58 | 59 | return importResultsContainer; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Logic.EnlirImport/DungeonImporter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRK.Api.Infra.Options.EnlirETL; 5 | using FFRKApi.Model.EnlirImport; 6 | using FFRKApi.SheetsApiHelper; 7 | using Microsoft.Extensions.Logging; 8 | using Microsoft.Extensions.Options; 9 | 10 | namespace FFRKApi.Logic.EnlirImport 11 | { 12 | public class DungeonImporter : RowImporterBase 13 | { 14 | public DungeonImporter(ISheetsApiHelper sheetsApiHelper, IOptions importerOptionsAccessor, ILogger> logger) 15 | : base(sheetsApiHelper, importerOptionsAccessor, logger) 16 | { 17 | } 18 | 19 | protected override DungeonRow AssignColumnToProperty(int columnCount, IList row) 20 | { 21 | DungeonRow importedRow = new DungeonRow(); 22 | 23 | importedRow.Realm = ResolveColumnContents(columnCount, DungeonColumn.Realm, row); 24 | importedRow.DungeonName = ResolveColumnContents(columnCount, DungeonColumn.DungeonName, row); 25 | importedRow.StaminaClassic = ResolveColumnContents(columnCount, DungeonColumn.StaminaClassic, row); 26 | importedRow.DifficultyClassic = ResolveColumnContents(columnCount, DungeonColumn.DifficultyClassic, row); 27 | importedRow.CompletionClassic = ResolveColumnContents(columnCount, DungeonColumn.CompletionClassic, row); 28 | importedRow.FirstTimeClassic = ResolveColumnContents(columnCount, DungeonColumn.FirstTimeClassic, row); 29 | importedRow.MasteryClassic = ResolveColumnContents(columnCount, DungeonColumn.MasteryClassic, row); 30 | importedRow.StaminaElite = ResolveColumnContents(columnCount, DungeonColumn.StaminaElite, row); 31 | importedRow.DifficultyElite = ResolveColumnContents(columnCount, DungeonColumn.DifficultyElite, row); 32 | importedRow.CompletionElite = ResolveColumnContents(columnCount, DungeonColumn.CompletionElite, row); 33 | importedRow.FirstTimeElite = ResolveColumnContents(columnCount, DungeonColumn.FirstTimeElite, row); 34 | importedRow.MasteryElite = ResolveColumnContents(columnCount, DungeonColumn.MasteryElite, row); 35 | importedRow.Update = ResolveColumnContents(columnCount, DungeonColumn.Update, row); 36 | 37 | return importedRow; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Dto.Api/Magicite.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace FFRKApi.Dto.Api 4 | { 5 | public class Magicite 6 | { 7 | #region IModelDescriptor Implementation 8 | public int Id { get; set; } 9 | public string Description { get; set; } 10 | #endregion 11 | 12 | //core attributes 13 | public string MagiciteName { get; set; } 14 | 15 | public int Element { get; set; } 16 | 17 | public int Rarity { get; set; } 18 | 19 | public int Realm { get; set; } 20 | 21 | public string ImagePath { get; set; } 22 | 23 | public string IntroducingEventName { get; set; } 24 | public int IntroducingEventId { get; set; } 25 | public bool IsInGlobal { get; set; } 26 | public bool IsChecked { get; set; } 27 | 28 | //stats 29 | public int HitPoints { get; set; } 30 | public int Attack { get; set; } 31 | public int Defense { get; set; } 32 | public int Magic { get; set; } 33 | public int Resistance { get; set; } 34 | public int Mind { get; set; } 35 | public int Speed { get; set; } 36 | 37 | //passives 38 | public IEnumerable PassiveEffects { get; set; } 39 | 40 | public UltraSkill UltraSkill { get; set; } 41 | 42 | public IEnumerable MagiciteSkills { get; set; } 43 | 44 | } 45 | 46 | public class UltraSkill 47 | { 48 | 49 | public string Name { get; set; } 50 | 51 | public string JapaneseName { get; set; } 52 | 53 | public int AbilityType { get; set; } 54 | 55 | public int AutoTargetType { get; set; } 56 | 57 | public int DamageFormulaType { get; set; } 58 | 59 | public double Multiplier { get; set; } 60 | 61 | public int Element { get; set; } 62 | 63 | public double CastTime { get; set; } 64 | 65 | public string Effects { get; set; } 66 | 67 | public bool IsCounterable { get; set; } 68 | 69 | public double Cooldown { get; set; } 70 | 71 | public double Duration { get; set; } 72 | 73 | public string EnlirId { get; set; } 74 | 75 | } 76 | 77 | public class PassiveEffectValueByLevelInfo 78 | { 79 | public string Name { get; set; } 80 | 81 | public int Level { get; set; } 82 | 83 | public int Value { get; set; } 84 | 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Dto.Api/Relic.cs: -------------------------------------------------------------------------------- 1 | namespace FFRKApi.Dto.Api 2 | { 3 | public class Relic 4 | { 5 | #region IModelDescriptor Implementation 6 | public int Id { get; set; } 7 | public string Description { get; set; } 8 | #endregion 9 | 10 | public string RelicName { get; set; } 11 | 12 | public int Realm { get; set; } 13 | 14 | public string CharacterName { get; set; } 15 | public int CharacterId { get; set; } //fill during merge phase 16 | 17 | public string SoulBreakName { get; set; } 18 | public int SoulBreakId { get; set; } //fill during merge phase 19 | 20 | public SoulBreak SoulBreak { get; set; } //fill during merge phase 21 | 22 | public string LegendMateriaName { get; set; } 23 | public int LegendMateriaId { get; set; } //fill during merge phase 24 | 25 | 26 | 27 | public int RelicType { get; set; } 28 | public bool HasSynergy { get; set; } 29 | public string CombineLevel { get; set; } 30 | public int Rarity { get; set; } 31 | public int Level { get; set; } 32 | public int Attack { get; set; } 33 | public int Defense { get; set; } 34 | public int Magic { get; set; } 35 | public int Resistance { get; set; } 36 | public int Mind { get; set; } 37 | public int Accuracy { get; set; } 38 | public int Evasion { get; set; } 39 | public string Effect { get; set; } 40 | 41 | 42 | public int BaseRarity { get; set; } 43 | public int BaseLevel { get; set; } 44 | public int BaseAttack { get; set; } 45 | public int BaseDefense { get; set; } 46 | public int BaseMagic { get; set; } 47 | public int BaseResistance { get; set; } 48 | public int BaseMind { get; set; } 49 | public int BaseAccuracy { get; set; } 50 | public int BaseEvasion { get; set; } 51 | 52 | public int MaxRarity { get; set; } 53 | public int MaxLevel { get; set; } 54 | public int MaxAttack { get; set; } 55 | public int MaxDefense { get; set; } 56 | public int MaxMagic { get; set; } 57 | public int MaxResistance { get; set; } 58 | public int MaxMind { get; set; } 59 | public int MaxAccuracy { get; set; } 60 | public int MaxEvasion { get; set; } 61 | 62 | public string EnlirId { get; set; } 63 | public bool IsInGlobal { get; set; } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /FunctionApp.ETL/GetFormattedDate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Net; 4 | using System.Net.Http; 5 | using System.Threading.Tasks; 6 | using FFRKApi.Logic.EnlirImport; 7 | using FFRKApi.Logic.EnlirTransform; 8 | using FunctionApp.ETL.DISupport; 9 | using Microsoft.Azure.WebJobs; 10 | using Microsoft.Azure.WebJobs.Extensions.Http; 11 | using Microsoft.Azure.WebJobs.Host; 12 | using Microsoft.Extensions.Logging; 13 | 14 | namespace FunctionApp.ETL 15 | { 16 | public static class GetFormattedDate 17 | { 18 | [FunctionName("GetFormattedDate")] 19 | public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)]HttpRequestMessage req, 20 | [Inject]ILogger logger) 21 | { 22 | 23 | logger.LogInformation("Azure Function GetFormattedDate processed a request."); 24 | 25 | const string DateFormatSpecifier = "yyyy-MM-dd_hh-mm-ss"; 26 | 27 | try 28 | { 29 | //user might pass a specific date in that they want formatted. The query string param will be "date" if so 30 | string date = req.GetQueryNameValuePairs() 31 | .FirstOrDefault(q => string.Compare(q.Key, "date", true) == 0) 32 | .Value; 33 | 34 | DateTime resolvedDate = DateTime.UtcNow; 35 | 36 | if (!String.IsNullOrWhiteSpace(date)) 37 | { 38 | DateTime submittedDate; 39 | 40 | if (DateTime.TryParse(date, out submittedDate)) 41 | { 42 | resolvedDate = submittedDate; 43 | } 44 | } 45 | 46 | string formattedDateString = resolvedDate.ToString(DateFormatSpecifier); 47 | 48 | var response = req.CreateResponse(HttpStatusCode.OK, formattedDateString); 49 | //var response = req.CreateResponse(HttpStatusCode.InternalServerError, "Fake Failure"); 50 | 51 | return response; 52 | } 53 | catch (Exception ex) 54 | { 55 | logger.LogError(ex, $"Error in Azure Function GetFormattedDate : {ex.Message}"); 56 | 57 | var response = req.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); 58 | 59 | return response; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Logic.EnlirTransform/RecordMateriaTransformer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using FFRKApi.Model.EnlirImport; 5 | using FFRKApi.Model.EnlirTransform; 6 | using FFRKApi.Model.EnlirTransform.Converters; 7 | using FFRKApi.Model.EnlirTransform.IdLists; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace FFRKApi.Logic.EnlirTransform 11 | { 12 | public class RecordMateriaTransformer : RowTransformerBase 13 | { 14 | #region Class Variables 15 | 16 | private readonly StringToBooleanConverter _stringToBooleanConverter; 17 | private readonly TypeListConverter _realmConverter; 18 | #endregion 19 | 20 | #region Constructors 21 | public RecordMateriaTransformer(ILogger> logger) : base(logger) 22 | { 23 | //prepare converters so we only need one instance no matter how many rows are processed 24 | _realmConverter = new TypeListConverter(new RealmList()); 25 | _stringToBooleanConverter = new StringToBooleanConverter(); 26 | } 27 | #endregion 28 | 29 | #region RowTransformerBase Overrides 30 | protected override RecordMateria ConvertRowToModel(int generatedId, RecordMateriaRow row) 31 | { 32 | RecordMateria model = new RecordMateria(); 33 | 34 | model.Id = generatedId; 35 | model.Description = $"{row.Character} - {row.RecordMateriaName}"; 36 | 37 | model.RecordMateriaName = row.RecordMateriaName; 38 | model.JapaneseName = row.JapaneseName ?? String.Empty; 39 | 40 | model.ImagePath = row.ImagePath; 41 | model.Realm = _realmConverter.ConvertFromNameToId(row.Realm); 42 | 43 | model.CharacterName = row.Character; 44 | model.CharacterId = 0; //filled in during merge phase 45 | 46 | 47 | model.Effect = row.Effect; 48 | model.UnlockCriteria = row.UnlockCriteria; 49 | model.EnlirId = row.ID; 50 | model.IsInGlobal = _stringToBooleanConverter.ConvertFromStringToBool(row.IsInGlobal); 51 | model.IsChecked = _stringToBooleanConverter.ConvertFromStringToBool(row.Checked); 52 | 53 | 54 | _logger.LogDebug("Converted RecordMateriaRow to RecordMateria: {Id} - {Description}", model.Id, model.Description); 55 | 56 | return model; 57 | } 58 | #endregion 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Model.EnlirTransform/Magicite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FFRKApi.Model.EnlirTransform 6 | { 7 | public class Magicite : IModelDescriptor 8 | { 9 | #region IModelDescriptor Implementation 10 | public int Id { get; set; } 11 | public string Description { get; set; } 12 | #endregion 13 | 14 | //core attributes 15 | public string MagiciteName { get; set; } 16 | 17 | public int Element { get; set; } 18 | 19 | public int Rarity { get; set; } 20 | 21 | public int Realm { get; set; } 22 | 23 | public string ImagePath { get; set; } 24 | 25 | public string IntroducingEventName { get; set; } 26 | public int IntroducingEventId { get; set; } 27 | public bool IsInGlobal { get; set; } 28 | public bool IsChecked { get; set; } 29 | 30 | //stats 31 | public int HitPoints { get; set; } 32 | public int Attack { get; set; } 33 | public int Defense { get; set; } 34 | public int Magic { get; set; } 35 | public int Resistance { get; set; } 36 | public int Mind { get; set; } 37 | public int Speed { get; set; } 38 | 39 | //passives 40 | public IEnumerable PassiveEffects { get; set; } 41 | 42 | public UltraSkill UltraSkill { get; set; } 43 | 44 | public IEnumerable MagiciteSkills { get; set; } 45 | 46 | } 47 | 48 | public class UltraSkill 49 | { 50 | 51 | public string Name { get; set; } 52 | 53 | public string JapaneseName { get; set; } 54 | 55 | public int AbilityType { get; set; } 56 | 57 | public int AutoTargetType { get; set; } 58 | 59 | public int DamageFormulaType { get; set; } 60 | 61 | public double Multiplier { get; set; } 62 | 63 | public int Element { get; set; } 64 | 65 | public double CastTime { get; set; } 66 | 67 | public string Effects { get; set; } 68 | 69 | public bool IsCounterable { get; set; } 70 | 71 | public double Cooldown { get; set; } 72 | 73 | public double Duration { get; set; } 74 | 75 | public string EnlirId { get; set; } 76 | 77 | } 78 | 79 | public class PassiveEffectValueByLevelInfo 80 | { 81 | public string Name { get; set; } 82 | 83 | public int Level { get; set; } 84 | 85 | public int Value { get; set; } 86 | 87 | } 88 | } 89 | --------------------------------------------------------------------------------