private string CreateNinjaLeagueParameter(string league, string leagueType) { if (leagueType.ToLower() == "hardcore" && league.ToLower() == "standard") { return("Hardcore"); } if (leagueType.ToLower() == "standard" || league.ToLower() == "standard") { return("Standard"); } if (leagueType.ToLower() == "hardcore" || leagueType.ToLower() == "tmphardcore") { return("Hardcore " + league); } if (league == string.Empty) { LoggingFacade.LogWarning("League information missing! Using Standard!!!"); return("Standard"); } return(league); }
public bool TestItemClass(ClassBTA itemClass, AbstractClassAbstractionComparisonObject comparisonData) { var confPrice = LevelAction(x => itemClass.ConfPrices[x], comparisonData, comparisonData.PriceTreatment); var fullPrice = LevelAction(x => itemClass.FullPrices[x], comparisonData, comparisonData.PriceTreatment); var validCount = LevelAction(x => itemClass.ValidItems[x], comparisonData, comparisonData.ValidityTreatment); if (confPrice.Item2 == false || fullPrice.Item2 == false || validCount.Item2 == false) { LoggingFacade.LogDebug($"No results found for:{ itemClass.ClassName }"); return(false); } if (confPrice.Item1 < comparisonData.MinimumConfPrice) { return(false); } if (fullPrice.Item1 < comparisonData.MinimumFullPrice) { return(false); } if ((float)(validCount.Item1) / (float)itemClass.BaseTypes.Count < comparisonData.MinimumValidityRating) { return(false); } return(true); }
private Filter PerformFilterWork() { var outputFolder = Configuration.AppSettings["Output Folder"]; var defaultPath = outputFolder + "\\Unnamed filter - SEED (SeedFilter) .filter"; string filePath; if (System.IO.File.Exists(defaultPath)) { filePath = defaultPath; } else { this.SelectSeedFilterFile(null, null); return(this.FilterAccessFacade.PrimaryFilter); } LoggingFacade.LogInfo($"Loading Filter: {filePath}"); this.FilterRawString = FileWork.ReadLinesFromFile(filePath); if (this.FilterRawString == null || this.FilterRawString.Count < 4500) { LoggingFacade.LogWarning($"Loading Filter: Filter Content Suspiciously Short"); } return(new Filter(this.FilterRawString)); }
public void ChangeDropLevel(string section, string itemName, string dropLevel = "") { if (dropLevel == "") { var itemStats = BaseTypeDataProvider.BaseTypeData[itemName]; dropLevel = itemStats["DropLevel"]; } var tier = LookUpTier(section, itemName, true); if (tier.IsNull()) { LoggingFacade.LogWarning("No tier found for item!? Fix it future me"); return; } var entry = tier.Value.Entry[0]; if (entry.GetLines("BaseType").Any()) { RemoveFromBaseTypeTiers(section, itemName); ChangeDropLevel(itemName, dropLevel); return; } // detect T3 using class/droplevel var classLine = entry.Content.GetFirst("Class"); var dropLine = entry.Content.GetFirst("DropLevel"); if (classLine != null && dropLine != null) { (dropLine.Value as NumericValueContainer).Value = dropLevel; } }
private void UploadToPoe_Single(string filterId, string accessToken, string descr, string filterContent) { var url = "https://www.pathofexile.com/api/item-filter/" + filterId + "?access_token=" + accessToken; var body = new { filter = filterContent, filterID = filterId, description = descr, version = FilterAccessFacade.GetInstance().PrimaryFilter.GetHeaderMetaData("VERSION") }; LoggingFacade.LogInfo($"[PoeUpload] Sending request..."); var resp = FileDownloader.StaticHttpClient.PostAsJsonAsync(url, body); resp.Wait(); if (resp.Result.StatusCode != HttpStatusCode.OK) { LoggingFacade.LogError($"[PoeUpload] Error: " + resp.Result.StatusCode); } else { LoggingFacade.LogInfo($"[PoeUpload] Success"); } }
public void ApplyAllSuggestions() { LoggingFacade.LogInfo("Applying All Suggestions!"); this.Changelog.Clear(); foreach (var section in this.Suggestions) { this.Changelog.Add(section.Key, new List <TieringChange>()); this.ApplyAllSuggestionsInSection(section.Key); } var keys = this.Changelog.Keys.ToList(); foreach (var section in keys) { this.Changelog[section] = this.Changelog[section].OrderBy(x => x.BaseType).ToList(); } if (this.generatePrimitiveReport) { var report = this.GeneratePrimitiveReport(); var seedPath = this.WriteFolder + "tierlistchanges\\" + DateTime.Today.ToString().Replace("/", "-").Replace(":", "") + ".txt"; FileWork.WriteTextAsync(seedPath, report); } }
public void Run(FileRequestResult dataRes) { if (dataRes != FileRequestResult.Success) { PublishPrice = false; } var filterOutFolder = Path.GetTempPath() + "filterGenerationResult"; var repoFolder = filterOutFolder + "\\" + RepoName; LoggingFacade.LogInfo($"Tempfolder prepared"); if (!Directory.Exists(filterOutFolder)) { Directory.CreateDirectory(filterOutFolder); } // clone/pull the repo. after that, we will edit these existing files by generating the new versions // and push the update as the actual small changes. if (Directory.Exists(repoFolder)) { LoggingFacade.LogInfo($"Repo folder existing... pulling"); RunCommand(filterOutFolder, "git", "branch --set-upstream-to=origin/master master"); using (var repo = new Repository(repoFolder)) { var options = new PullOptions(); var author = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; var email = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; Commands.Pull(repo, new Signature(author, email, DateTimeOffset.Now), options); LoggingFacade.LogInfo($"Pulling done"); } } else { LoggingFacade.LogInfo($"Repo folder not existing... cloning"); Repository.Clone("https://github.com/NeverSinkDev/" + RepoName + ".git", repoFolder); LoggingFacade.LogInfo($"Cloning done!"); } // create filter LoggingFacade.LogInfo($"Performing filter generation operations"); FilterWriter.WriteFilter(this.Filter, true, repoFolder + "\\", Path.GetDirectoryName(GenerateFilters.DataFiles.FilterStyleFilesPaths.First().Value) + "\\"); LoggingFacade.LogInfo($"Performing filter generation operations: DONE"); LoggingFacade.LogInfo($"Starting publishing!"); PushToFTP("www", repoFolder, "NeverSink_AutoEcoUpdate_" + GenerateFilters.DataFiles.LeagueType); LoggingFacade.LogInfo($"Publishing to filterblade: done"); PushToFTP("beta", repoFolder, "NeverSink_AutoEcoUpdate_" + GenerateFilters.DataFiles.LeagueType); LoggingFacade.LogInfo($"Publishing to filterblade-beta: done"); PushToGit(repoFolder, PublishPrice); LoggingFacade.LogInfo($"Publishing to GitHub: done"); UploadToPoe(repoFolder); LoggingFacade.LogInfo($"PoeUpload: done"); // no cleanUp -> we keep this folder here and just pull/push whenever we generate new filters }
public static void AdjustPricingInformation() { SuperTierBreakPoint = Math.Max(1f * ExaltedOrbPrice, 75); // Uniques UniqueT1BreakPoint = UniqueT1Base + UniqueExaltedOrbInfluence * T1ExaltedInfluence * ExaltedOrbPrice; UniqueT2BreakPoint = UniqueT2Base + UniqueExaltedOrbInfluence * T2ExaltedInfluence * ExaltedOrbPrice; // BaseTypes BaseTypeT1BreakPoint = BaseTypeT1Base + BasesExaltedOrbInfluence * T1ExaltedInfluence * ExaltedOrbPrice; BaseTypeT2BreakPoint = BaseTypeT2Base + BasesExaltedOrbInfluence * T2ExaltedInfluence * ExaltedOrbPrice; // Divination DiviT1BreakPoint = DiviT1Base + DivinationExaltedOrbInfluence * T1ExaltedInfluence * ExaltedOrbPrice; DiviT2BreakPoint = DiviT2Base + DivinationExaltedOrbInfluence * T2ExaltedInfluence * ExaltedOrbPrice; DiviT3BreakPoint = DiviT3Base + DivinationExaltedOrbInfluence * T3ExaltedInfluence * ExaltedOrbPrice; DiviT5BreakPoint = DiviT5Base + DivinationExaltedOrbInfluence * T5ExaltedInfluence * ExaltedOrbPrice; // Misc MiscT1BreakPoint = MiscT1Base + MiscExaltedOrbInfluence * T1ExaltedInfluence * ExaltedOrbPrice; MiscT2BreakPoint = MiscT2Base + MiscExaltedOrbInfluence * T2ExaltedInfluence * ExaltedOrbPrice; MiscT3BreakPoint = MiscT3Base + MiscExaltedOrbInfluence * T3ExaltedInfluence * ExaltedOrbPrice; MiscT4BreakPoint = MiscT4Base + MiscExaltedOrbInfluence * T4ExaltedInfluence * ExaltedOrbPrice; // InfluenceGroups InfluenceGroupT1BreakPoint = InfluenceGroupT1Base + InfluenceGroupExaltedOrbInfluence * T1ExaltedInfluence * ExaltedOrbPrice; InfluenceGroupT2BreakPoint = InfluenceGroupT2Base + InfluenceGroupExaltedOrbInfluence * T2ExaltedInfluence * ExaltedOrbPrice; LoggingFacade.LogInfo($"Prices Adjusted based on exalted orb price!"); }
public static void Check(bool condition, string message) { if (condition) { LoggingFacade.LogError(message); Throw(message); } }
public void LoadFromSaveFile() { foreach (var branchKey in EconomyRequestFacade.GetInstance().EconomyTierlistOverview.Keys) { LoggingFacade.LogDebug($"Loading AspectFile: {branchKey}"); this.LoadFromSaveFile(branchKey); } }
private async Task WriteSeedFilter(Filter baseFilter, string filePath) { LoggingFacade.LogInfo("Writing SeedFilter!"); var seedFilterString = baseFilter.Serialize(); await FileWork.WriteTextAsync(filePath, seedFilterString); LoggingFacade.LogInfo("DONE: Writing SeedFilter!"); }
public ExoBlock GetParent() { if (this.Type == ExoFilterType.root) { LoggingFacade.LogWarning("Attempting to get parent of root!"); throw new Exception("Attempting to get parent of root!"); } return(this.Parent); }
public void Execute(ExpressionBuilder builder) { var result = new List <ExoExpressionCommand>(); // treat a whole entry for (int j = 0; j < builder.expressions.Count; j++) { TreatSinglePage(builder.expressions[j]); } // treat a single line void TreatSinglePage(List <StructureExpr> page) { List <string> rawtokens = new List <string>(); for (int i = 0; i < page.Count; i++) { var current = page[i]; if (current.Mode == FilterExoConfig.StructurizerMode.comm) { continue; } if (i == 0) { if (current?.Value == null) { LoggingFacade.LogDebug("No VALUE on: " + current.ToString()); continue; } } rawtokens.Add(current.Value); } //var command = rawtokens.First(); //rawtokens.RemoveAt(0); var filterCommand = new ExoExpressionCommand(rawtokens); result.Add(filterCommand); } // Resolve rule into a "Show" filter entry. var newEntry = new ExoBlock(); newEntry.Parent = builder.Owner.WriteCursor; builder.Owner.WriteCursor.Scopes.Add(newEntry); foreach (var item in result) { newEntry.AddCommand(item); } }
public void Init(FileRequestResult dataRes) { if (dataRes != FileRequestResult.Success) { PublishPrice = false; } var filterOutFolder = Path.GetTempPath() + "filterGenerationResult"; var repoFolder = filterOutFolder + "\\" + RepoName; this.RepoFolder = repoFolder; LoggingFacade.LogInfo($"Tempfolder prepared"); if (!Directory.Exists(filterOutFolder)) { Directory.CreateDirectory(filterOutFolder); } // clone/pull the repo. after that, we will edit these existing files by generating the new versions // and push the update as the actual small changes. if (Directory.Exists(repoFolder)) { LoggingFacade.LogInfo($"Repo folder existing... renewing"); DeleteDirectory(repoFolder); // RunCommand(filterOutFolder, "git", "branch --set-upstream-to=origin/master master"); // using (var repo = new Repository(repoFolder)) // { // var options = new PullOptions(); // var author = Environment.GetEnvironmentVariable("author", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; // var email = Environment.GetEnvironmentVariable("email", EnvironmentVariableTarget.Process) ?? "FilterPolishZ"; // Commands.Pull(repo, new Signature(author, email, DateTimeOffset.Now), options); // LoggingFacade.LogInfo($"Pulling done"); // } } { LoggingFacade.LogInfo($"Repo folder not existing... cloning"); Repository.Clone("https://github.com/NeverSinkDev/" + RepoName + ".git", repoFolder); LoggingFacade.LogInfo($"Cloning done!"); } // create filter LoggingFacade.LogInfo($"Performing filter generation operations"); var filterWriter = FilterWriter.WriteFilter(this.Filter, true, repoFolder + "\\", Path.GetDirectoryName(MainGenerationRoutine.DataFiles.FilterStyleFilesPaths.First().Value) + "\\"); filterWriter.Wait(); LoggingFacade.LogInfo($"Performing filter generation operations: DONE"); LoggingFacade.LogInfo($"Repofolder is: {RepoFolder}"); }
public void GenerateAndAddSuggestions() { LoggingFacade.LogDebug($"Generating Suggestions for: {this.GoverningSection}"); if (!Enabled) { LoggingFacade.LogWarning($"SKIP Suggestions generation for: {this.GoverningSection}"); return; } this.SuggestionTarget.Clear(); this.SuggestionTarget.AddRange(this.GenerateSuggestions()); }
private void RemoveBaseTypeLinesIfEmpty(string section) { var ident = this.TierListData[section].KeyIdent; this.TierListData[section].FilterEntries .SelectMany(x => x.Value.Entry) .Where(x => !x.GetLines <EnumValueContainer>(ident).Any(z => z.Value.IsValid()) && !this.TierListData[section].NonBaseTypeEntries.Contains(x.Header.TierTags.Serialize())).ToList() .ForEach(x => { x.Content.RemoveAll(ident); LoggingFacade.LogDebug($"Removing Empty BaseType Line: {x.Header.TierTags.Serialize()}"); }); }
public static string Run([ActivityTrigger] string req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); try { FilterGen.Execute(req, log); return("finished generation succesfully!"); } catch (Exception e) { LoggingFacade.LogError("ERROR: " + e.Message); return(e.ToString()); } }
// TODO: Refactor public void Enrich(string baseType, ItemList <NinjaItem> data) { if (baseType == "Exalted Orb") { var cPrice = data.Where(x => x.Name == "Exalted Orb")?.FirstOrDefault()?.CVal; if (cPrice != null && cPrice > 30) { FilterPolishUtil.FilterPolishConfig.ExaltedOrbPrice = cPrice.Value; LoggingFacade.LogInfo($"Exalted Price: {cPrice.Value}"); } } return; }
public static string ReadFromFile(string adress) { try { // Open the text file using a stream reader. var logFile = File.ReadAllText(adress); return(logFile); } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); LoggingFacade.LogError("File cound not be read. Path: " + adress + ". Error: " + e.Message); return(null); } }
private void CreateZipFiles(object sender, RoutedEventArgs e) { using (var zipFileStream = new FileStream(Configuration.AppSettings["Output Folder"] + "RESULTS.zip", FileMode.OpenOrCreate)) { using (var zipArch = new ZipArchive(zipFileStream, ZipArchiveMode.Create)) { zipArch.ZipDirectory(Configuration.AppSettings["Output Folder"], x => (x.Contains(".filter") && !x.ToLower().Contains("unnamed") && !x.ToLower().Contains("copy") && !x.ToLower().Contains("seed")), x => (x.Contains("STYLE") || x.Contains("Console"))); } } Process.Start(Configuration.AppSettings["Output Folder"]); LoggingFacade.LogInfo("Succesfully Archived Files!"); }
private void ApplyAllSuggestions(object sender, RoutedEventArgs e) { this.TierListFacade.ApplyAllSuggestions(); this.TierListFacade.TierListData.Values.ToList().ForEach(x => x.ReEvaluate()); LoggingFacade.LogInfo($"Writing Changelog! Tiers Logged: {this.TierListFacade.Changelog.Select(x => x.Value.Count).Sum()}"); var json = JsonConvert.SerializeObject(this.TierListFacade.Changelog).Replace("->", "_"); var changeLogPath = LocalConfiguration.GetInstance().AppSettings["Output Folder"] + "/Changelog/changelog.json"; FileWork.WriteTextAsync(changeLogPath, json); this.EventGrid.Publish(); }
public void GenerateAndAddSuggestions() { LoggingFacade.LogDebug($"Generating Suggestions for: {this.GoverningSection}"); this.SuggestionTarget.Clear(); this.SuggestionTarget.AddRange(this.GenerateSuggestions()); if (!TierListFacade.GetInstance().EnabledSuggestions.ContainsKey(this.GoverningSection)) { TierListFacade.GetInstance().EnabledSuggestions.Add(this.GoverningSection, Enabled); } else { TierListFacade.GetInstance().EnabledSuggestions[this.GoverningSection] = Enabled; } }
public void ApplyAllSuggestionsInSection(string section) { LoggingFacade.LogDebug($"Applying Suggestions in section: {section}"); this.AddNonBaseTypeExceptionList(section); this.AddBaseTypeLinesIfMissing(section); foreach (var item in this.Suggestions[section]) { this.ApplyCommand(item); this.Changelog[section].Add(TieringChange.FromTieringCommand(item)); } this.RemoveBaseTypeLinesIfEmpty(section); this.HandleEnabledDisabledState(section); }
public void Execute() { // base type abstraction facade var bta = InfluencedBasesAbstractionOverview.InfluencedItemInformation; foreach (var comparison in ConcreteAbstractionComparisons.ComparisonObjects) { foreach (var influence in bta.InfluenceTypes) { var classes = influence.Value.GetBreakPointClasses(comparison); LoggingFacade.LogDebug ($"{influence}:{comparison.RuleName}::" + $"{string.Join(" ", classes.Select(x => x.ClassName))}"); } } }
public void RemoveFromBaseTypeTiers(string section, string itemName) { var tier = this.LookUpTier(section, itemName); if (tier.Key != null && (tier.Key.Contains("t1") || tier.Key.Contains("t2"))) { var entry = tier.Value.Entry[0]; var values = entry.GetLines("BaseType").First().Value as EnumValueContainer; values.Value.RemoveWhere(x => x.value == itemName); if (values.Value.Count == 0) { LoggingFacade.LogWarning($"Empty basetype line in: {tier.Key} after removing {itemName}"); } } }
private void LoadMetaFilter(object sender, RoutedEventArgs e) { var outputFolder = Configuration.AppSettings["Meta Filter Path"]; LoggingFacade.LogInfo($"Loading Meta Filter: {outputFolder}"); this.FilterExoFacade.RawMetaFilterText = FileWork.ReadLinesFromFile(outputFolder); var output = this.FilterExoFacade.Execute(); GenerationOptions.TextSources = output; EventGrid.Publish(); if (this.FilterRawString == null || this.FilterRawString.Count < 4500) { LoggingFacade.LogWarning($"Loading Filter: Meta-Filter Content Suspiciously Short"); } }
public bool IsLeagueActive() { PoeLeague activeLeague = this.PoeLeagues?.FirstOrDefault(x => x.Key.Contains("Hardcore")).Value; if (activeLeague == null) { LoggingFacade.LogWarning($"No active league data found!"); return(false); } if (activeLeague.StartAt < DateTime.Now && activeLeague.EndAt > DateTime.Now) { return(true); } return(false); }
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); Logging?.Clean(); Logging = LoggingFacade.GetInstance(); try { PerformMainRoutine(); return(new OkObjectResult("successfully generated filters")); } catch (Exception e) { Logging.Log(e.Message, LoggingLevel.Errors); return(new ConflictObjectResult(e)); } }
private void CopyResultFilesToFilterFolder(object sender, RoutedEventArgs e) { var poeFolder = "%userprofile%/Documents/My Games/Path of Exile"; poeFolder = Environment.ExpandEnvironmentVariables(poeFolder); LoggingFacade.LogInfo($"Copying filter files from: {poeFolder}"); LoggingFacade.LogInfo($"Copying filter files to: {Configuration.AppSettings["Output Folder"]}"); foreach (var file in System.IO.Directory.EnumerateFiles(Configuration.AppSettings["Output Folder"])) { if (!file.EndsWith(".filter")) { continue; } var targetPath = poeFolder + "\\" + file.Split('/', '\\').Last(); System.IO.File.Copy(file, targetPath, true); } }
public void CreateSubEconomyTiers() { LoggingFacade.LogInfo($"Generating Sub-Economy Tiers"); List <string> influenceTypes = new List <string>() { "Shaper", "Elder", "Warlord", "Crusader", "Redeemer", "Hunter" }; var metaDictionary = new Dictionary <string, Dictionary <string, ItemList <NinjaItem> > >(); var otherbases = new Dictionary <string, ItemList <FilterEconomy.Model.NinjaItem> >(); influenceTypes.ForEach(x => metaDictionary.Add(x, new Dictionary <string, ItemList <NinjaItem> >())); foreach (var items in this.EconomyTierlistOverview["basetypes"]) { foreach (var influence in influenceTypes) { var influencedGroup = items.Value.Where(x => x.Variant == influence).ToList(); if (influencedGroup.Count != 0) { metaDictionary[influence].Add(items.Key, new ItemList <NinjaItem>()); metaDictionary[influence][items.Key].AddRange((influencedGroup)); } } var othergroup = items.Value.Where(x => !influenceTypes.Contains(x.Variant)).ToList(); if (othergroup.Count != 0) { otherbases.Add(items.Key, new ItemList <NinjaItem>()); otherbases[items.Key].AddRange((othergroup)); } } this.AddToDictionary("rare->shaper", metaDictionary["Shaper"]); this.AddToDictionary("rare->elder", metaDictionary["Elder"]); this.AddToDictionary("rare->warlord", metaDictionary["Warlord"]); this.AddToDictionary("rare->crusader", metaDictionary["Crusader"]); this.AddToDictionary("rare->redeemer", metaDictionary["Redeemer"]); this.AddToDictionary("rare->hunter", metaDictionary["Hunter"]); this.AddToDictionary("generalcrafting", otherbases); LoggingFacade.LogInfo($"Done Generating Sub-Economy Tiers"); }