private void LoadAllComponents() { // request ninja-economy info this.EconomyData = this.LoadEconomyOverviewData(); this.EconomyData.RequestPoeLeagueInfo(); if (Configuration.AppSettings["testLeague"] == "true" && !this.EconomyData.IsLeagueActive()) { LoggingFacade.LogWarning("No Active League detected!"); } // load aspects this.ItemInfoData = this.LoadItemInformationOverview(); // load filter tierlists this.TierListFacade = this.LoadTierLists(this.FilterAccessFacade.PrimaryFilter); // add derived tiers (Shaper, Elder) this.EconomyData.CreateSubEconomyTiers(); BaseTypeDataProvider.Initialize(); // run all the enrichment procedures (calculate confidence, min price, max price etc) this.EconomyData.EnrichAll(EnrichmentProcedureConfiguration.PriorityEnrichmentProcedures); FilterPolishUtil.FilterPolishConfig.AdjustPricingInformation(); this.EconomyData.EnrichAll(EnrichmentProcedureConfiguration.EnrichmentProcedures); // experimental basetype->class abstraction var abstractions = new InfluencedBasesAbstractionOverview(); abstractions.Execute(); var abstractionConclusons = new InfluencedBasesAbstractionConclusions(); abstractionConclusons.Execute(); // run tiering this.TierListFacade.TierListData.Values.ToList().ForEach(x => x.ReEvaluate()); // Disable if CRASHY this.InitializeMatrixFacade(); LoggingFacade.LogInfo($"FilterBlade main subroutine loaded succesfully"); }
public static void PerformMainRoutine(string req) { // 0) Cleanup EconomyData?.Clean(); ItemInfoData?.Clean(); TierListFacade?.Clean(); FilterAccessFacade?.Clean(); BaseTypeDataProvider.Initialize(); EconomyData = EconomyRequestFacade.GetInstance(); TierListFacade = TierListFacade.GetInstance(); FilterAccessFacade = FilterAccessFacade.GetInstance(); ItemInfoData = ItemInformationFacade.GetInstance(); // 0) Get Current League information etc EconomyData.RequestPoeLeagueInfo(); if (!EconomyData.IsLeagueActive()) { LoggingFacade.LogWarning("No Active League detected!"); } var requestedLeagueName = EconomyData.GetActiveLeagueName(); // 1) Acquire Data var localMode = Environment.GetEnvironmentVariable("localMode", EnvironmentVariableTarget.Process) ?? "true"; // string body = new StreamReader(req.Body).ReadToEnd(); // var repoName = GetReqParams(req, data, "repoName", "NeverSink-EconomyUpdated-Filter"); // var leagueType = GetReqParams(req, data.leagueType, "leagueType", "tmpstandard"); dynamic data = JsonConvert.DeserializeObject(req); string leagueType = data.leagueType ?? "tmpstandard"; string repoName = data.repoName ?? "NeverSink-EconomyUpdated-Filter"; string league = requestedLeagueName; //GetReqParams(req, data, "currentLeague", "Metamorph"); LoggingFacade.LogInfo($"[CONFIG] leagueType: {leagueType}"); LoggingFacade.LogInfo($"[CONFIG] league: {league}"); LoggingFacade.LogInfo($"[CONFIG] repoName: {repoName}"); LoggingFacade.LogInfo($"[CONFIG] localMode: {localMode}"); FilterPolishConfig.ApplicationExecutionMode = ExecutionMode.Function; if (localMode == "true") { FilterPolishConfig.ActiveRequestMode = RequestType.Dynamic; } else { FilterPolishConfig.ActiveRequestMode = RequestType.ForceOnline; } DataFiles = new DataFileRequestFacade(); LoggingFacade.LogInfo($"[CONFIG] FileRequestFacade Created!"); FileRequestResult dataRes = DataFiles.GetAllFiles(league, leagueType); // 3) Parse filter FilterAccessFacade.PrimaryFilter = new Filter(DataFiles.SeedFilter); var newVersion = FilterAccessFacade.PrimaryFilter.GetHeaderMetaData("VERSION") + "." + DateTime.Now.Year + "." + DateTime.Now.DayOfYear + "." + DateTime.Now.Hour; FilterAccessFacade.PrimaryFilter.SetHeaderMetaData("VERSION", newVersion); LoggingFacade.LogInfo($"[CONFIG] version: {newVersion}"); LoggingFacade.LogInfo($"[DEBUG] FileRequestResult: {dataRes.ToString()}"); LoggingFacade.LogInfo($"[DEBUG] League Active: {EconomyData.IsLeagueActive().ToString()}"); // null check the ecoData in case of disabled/early leagues if (dataRes == FileRequestResult.Success) { // 4) Load tier list information and enrichment procedures var tiers = FilterAccessFacade.PrimaryFilter.ExtractTiers(FilterPolishConfig.FilterTierLists); TierListFacade.TierListData = tiers; EconomyData.CreateSubEconomyTiers(); ConcreteEnrichmentProcedures.Initialize(); EconomyData.EnrichAll(EnrichmentProcedureConfiguration.PriorityEnrichmentProcedures); FilterPolishUtil.FilterPolishConfig.AdjustPricingInformation(); EconomyData.EnrichAll(EnrichmentProcedureConfiguration.EnrichmentProcedures); // EconomyData.PerformClassAbstractionProcedures(); TierListFacade.TierListData.Values.ToList().ForEach(x => x.ReEvaluate()); // 5) Generate Suggestions var economyTieringSystem = new ConcreteEconomyRules(); economyTieringSystem.GenerateSuggestions(); // 6) Apply suggestions TierListFacade.ApplyAllSuggestions(); } // 7) Generate changelogs // todo LoggingFacade.LogInfo($"[DEBUG] Seedfiler regeneration done. Starting publishing..."); // 8) Generate and Upload Filters new FilterPublisher(FilterAccessFacade.PrimaryFilter, repoName, leagueType).Run(dataRes); }