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); }
public void LoadFromSaveFile() { foreach (var branchKey in EconomyRequestFacade.GetInstance().EconomyTierlistOverview.Keys) { LoggingFacade.LogDebug($"Loading AspectFile: {branchKey}"); this.LoadFromSaveFile(branchKey); } }
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 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 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 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; } }
private void HandleEnabledDisabledState(string section) { var ident = this.TierListData[section].KeyIdent; this.TierListData[section].FilterEntries .SelectMany(x => x.Value.Entry) .Where(x => !this.TierListData[section].NonBaseTypeEntries.Contains(x.Header.TierTags.Serialize())).ToList() .ForEach(x => { if (x.HasLine <EnumValueContainer>(ident)) { x.SetEnabled(true); } else { x.SetEnabled(false); LoggingFacade.LogDebug($"Disabling empty entry: {x.Header.TierTags.Serialize()}"); } }); }
public void EnrichAll(Dictionary <string, List <IDataEnrichment> > enrichments) { LoggingFacade.LogInfo($"Starting Enriching Economy Information"); // for every section (divination card etc) foreach (var section in this.EconomyTierlistOverview) { LoggingFacade.LogDebug($"Enriching Economy Information: {section.Key}"); // go through every item foreach (var item in section.Value) { if (!enrichments.ContainsKey(section.Key)) { continue; } enrichments[section.Key].ForEach(z => z.Enrich(item.Key, item.Value)); } } LoggingFacade.LogInfo($"Done Enriching Economy Information"); }
private TierListFacade LoadTierLists(Filter filter) { LoggingFacade.LogInfo($"Loading Tierlists..."); TierListFacade tierList = TierListFacade.GetInstance(); tierList.WriteFolder = Configuration.AppSettings["EcoFile Folder"]; var workTiers = FilterPolishConfig.FilterTierLists; var tiers = filter.ExtractTiers(workTiers); tierList.TierListData = tiers; foreach (var item in tierList.TierListData.Values) { LoggingFacade.LogDebug($"Loading Tierlist: {item.Category}"); item.ReEvaluate(); } LoggingFacade.LogInfo($"Done Loading Tierlists..."); return(tierList); }
private ItemInformationFacade LoadItemInformationOverview() { ItemInformationFacade result = ItemInformationFacade.GetInstance(); LoggingFacade.LogDebug("Economy Item Information Loaded..."); var leagueType = Configuration.AppSettings["leagueType"]; var baseStoragePath = Configuration.AppSettings["Aspect Folder"]; result.LeagueType = leagueType; result.BaseStoragePath = baseStoragePath; var branchKeys = FilterPolishConfig.TierableEconomySections; branchKeys.ForEach(key => result.EconomyTierListOverview.Add(key, new Dictionary <string, List <ItemInformationData> >())); result.LoadFromSaveFile(); LoggingFacade.LogDebug("Item Information Loaded..."); return(result); }
private EconomyRequestFacade LoadEconomyOverviewData() { LoggingFacade.LogDebug("Loading Economy Data..."); var result = EconomyRequestFacade.GetInstance(); var seedFolder = Configuration.AppSettings["EcoFile Folder"]; var variation = Configuration.AppSettings["leagueType"]; var league = Configuration.AppSettings["currentLeague"]; foreach (var tuple in FilterPolishConfig.FileRequestData) { PerformEcoRequest(tuple.Item1, tuple.Item2, tuple.Item3); LoggingFacade.LogDebug($"Loading Economy: {tuple.Item1} + {tuple.Item2} + {tuple.Item3}"); } void PerformEcoRequest(string dictionaryKey, string requestKey, string url) => result.AddToDictionary(dictionaryKey, result.PerformRequest(league, variation, requestKey, url, seedFolder)); LoggingFacade.LogInfo("Economy Data Loaded..."); return(result); }
private void AddBaseTypeLinesIfMissing(string section) { var ident = this.TierListData[section].KeyIdent; this.TierListData[section].FilterEntries .SelectMany(x => x.Value.Entry) .Where(x => !x.HasLine <EnumValueContainer>(ident) && !this.TierListData[section].NonBaseTypeEntries.Contains(x.Header.TierTags.Serialize())).ToList() .ForEach(x => { x.Content.Content.Add(ident, new List <IFilterLine> { new FilterLine <EnumValueContainer> { Ident = ident, Parent = x, Value = new EnumValueContainer() } }); LoggingFacade.LogDebug($"Adding Missing BaseType Line: {x.Header.TierTags.Serialize()}"); }); }
public void Execute() { InfluencedItemInformation = null; LoggingFacade.LogInfo($"Performing Influenced Class Abstractions"); List <KeyValuePair <float, string> > sortedConfList = new List <KeyValuePair <float, string> >(); List <KeyValuePair <float, string> > sortedPriceList = new List <KeyValuePair <float, string> >(); List <KeyValuePair <float, string> > sortedFullPriceList = new List <KeyValuePair <float, string> >(); var abstractionList = new InfluenceBTA(); foreach (var section in EconomyRequestFacade.GetInstance().EconomyTierlistOverview) { if (!section.Key.Contains("rare")) { continue; } var currentSection = abstractionList.AddNewSection(section.Key); foreach (var item in section.Value) { if (BaseTypeDataProvider.BaseTypeData.ContainsKey(item.Key)) { var currentBaseType = new BaseBTA(); currentBaseType.Name = item.Key; for (int ilvl = 80; ilvl <= 86; ilvl++) { BaseBTA.ItemLevelContext = ilvl; // Atlas bases falsify the results, so we're skipping them. if (FilterPolishConfig.SpecialBases.Contains(item.Key)) { currentBaseType.SpecialBase = true; } // We need to access the facade to augment eco information with basetypedata var itemInfo = BaseTypeDataProvider.BaseTypeData[item.Key]; var dropLevel = int.Parse(itemInfo["DropLevel"]); var itemClass = itemInfo["Class"].ToLower(); // New section treatment if (!currentSection.Classes.ContainsKey(itemClass)) { currentSection.AddNewClass(itemClass); } currentSection[itemClass][item.Key] = currentBaseType; currentBaseType.EnterPrice(ilvl, item.Value, itemClass); } } } // Sort each list and omit the outliers var filteredValueList = new Dictionary <string, List <float> >(); var filteredFullValueList = new Dictionary <string, List <float> >(); for (int ilvl = 80; ilvl <= 86; ilvl++) { BaseBTA.ItemLevelContext = ilvl; foreach (var item in currentSection.Classes) { item.Value.CreateList(); var confPrice = item.Value.BaseTypesList .Where(x => !x.SpecialBase).Average(x => x.ConfValueList.Count == 0 ? 0 : x.ConfValueList[ilvl]); var fullPrice = item.Value.BaseTypesList .Where(x => !x.SpecialBase).Average(x => x.FullValueList[ilvl]); var validPrices = item.Value.BaseTypesList.Count(x => x.ConfValueList[ilvl] > 0.5f); item.Value.AvgConfidence = item.Value.BaseTypes.Average(x => x.Value.Confidence); item.Value.ConfPrices.Add(ilvl, confPrice); item.Value.FullPrices.Add(ilvl, fullPrice); item.Value.ValidItems.Add(ilvl, validPrices); if (ilvl == 86) { sortedPriceList.Add(new KeyValuePair <float, string>(confPrice, $"[{ilvl}]{section.Key} >> {item.Key} >> { confPrice } { fullPrice } VALID: { validPrices }/{ item.Value.BaseTypes.Count }")); } } } } var sortedValueList1 = sortedPriceList.OrderBy(x => x.Key).ToList(); foreach (var item in sortedValueList1) { LoggingFacade.LogDebug(item.Value); } InfluencedItemInformation = abstractionList; }
public void Publish() { FilterChangeEvent?.Invoke(null, EventArgs.Empty); LoggingFacade.LogDebug($"EVENT: Reset event published"); }
public void Execute(ExpressionBuilder builder) { var properties = builder.Owner.ReadCursor.PropertyExpression; var functionName = properties[1]; var split = properties.SelectInnerContents( x => x.Value == "(", x => x.Value == ")"); List <string> varNames = new List <string>(); if (split != null) { var vars = split.SplitDivide(x => x.Value == ","); if (vars != null && vars.Count >= 1) { varNames = vars.Select(x => x.FirstOrDefault().Value).ToList(); } } 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 filterCommand = new ExoExpressionCommand(rawtokens); result.Add(filterCommand); } var newEntry = new ExoBlock(); newEntry.Parent = builder.Owner.WriteCursor; // newEntry.Parent = builder.Owner.WriteCursor; //builder.Owner.WriteCursor.Scopes.Add(newEntry); foreach (var item in result) { newEntry.AddCommand(item); } // Resolve rule into a "Show" filter entry. var function = new ExoFunction { Name = functionName.Value, Content = newEntry, Variables = varNames }; builder.Owner.WriteCursor.Functions.Add(functionName.Value, new ExoAtom(function)); }
public static async Task WriteFilter(Filter baseFilter, bool isGeneratingStylesAndSeed, string outputFolder, string styleSheetFolderPath) { var isStopping = VerifyFilter(baseFilter); if (isStopping) { return; } new FilterTableOfContentsCreator(baseFilter).Run(); const string filterName = "NeverSink's"; var generationTasks = new List <Task>(); var seedFilterString = baseFilter.Serialize(); if (isGeneratingStylesAndSeed) { var seedPath = outputFolder + "ADDITIONAL-FILES\\SeedFilter\\"; if (!Directory.Exists(seedPath)) { Directory.CreateDirectory(seedPath); } seedPath += filterName + " filter - SEED (SeedFilter) .filter"; generationTasks.Add(FileWork.WriteTextAsync(seedPath, seedFilterString)); } baseFilter = new Filter(seedFilterString); // we do not want to edit the seedFilter directly and execute its tag commands baseFilter.ExecuteCommandTags(); var baseFilterString = baseFilter.Serialize(); if (baseFilterString == null || baseFilterString.Count < 4500) { LoggingFacade.LogError("Warning: (seed) filter result line count: " + baseFilterString?.Count); } for (var strictnessIndex = 0; strictnessIndex < FilterGenerationConfig.FilterStrictnessLevels.Count; strictnessIndex++) { if (isGeneratingStylesAndSeed) { foreach (var style in FilterGenerationConfig.FilterStyles) { if (style.ToLower() == "default" || style.ToLower() == "backup" || style.ToLower() == "streamsound") { continue; } generationTasks.Add(GenerateFilter_Inner(style, strictnessIndex)); } } // default style generationTasks.Add(GenerateFilter_Inner("", strictnessIndex)); } if (isGeneratingStylesAndSeed) { generationTasks.Add(GenerateFilter_Inner("", 3, 2, explicitName: "NeverSink's filter - 1X-ConStrict")); generationTasks.Add(GenerateFilter_Inner("", 4, 2, explicitName: "NeverSink's filter - 2X-ConStrict")); generationTasks.Add(GenerateFilter_Inner("", 4, 3, explicitName: "NeverSink's filter - 3X-ConStrict")); generationTasks.Add(GenerateFilter_Inner("", 5, 3, explicitName: "NeverSink's filter - 4X-ConStrict")); generationTasks.Add(GenerateFilter_Inner("", 6, 3, explicitName: "NeverSink's filter - 5X-ConStrict")); } await Task.WhenAll(generationTasks); LoggingFacade.LogInfo("Filter generation successfully done!", true); // local func async Task GenerateFilter_Inner(string style, int strictnessIndex, int?consoleStrictness = null, string explicitName = null) { var filePath = outputFolder; var fileName = filterName + " filter - " + strictnessIndex + "-" + FilterGenerationConfig.FilterStrictnessLevels[strictnessIndex].ToUpper(); var filter = new Filter(baseFilterString); LoggingFacade.LogDebug($"GENERATING: {fileName}"); new FilterTableOfContentsCreator(filter).Run(); filter.ExecuteStrictnessCommands(strictnessIndex, consoleStrictness); if (style != "") { new StyleGenerator(filter, styleSheetFolderPath + style + ".fsty", style).Apply(); filePath += "(STYLE) " + style.ToUpper() + "\\"; fileName += " (" + style + ") "; } if (consoleStrictness.HasValue) { // little dirty fix filePath += "(Console-Strictness)\\"; fileName += " Console-Strictness "; } if (explicitName != null) { fileName = explicitName; } if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } var result = filter.Serialize(); if (result.Count <= seedFilterString?.Count) { LoggingFacade.LogError("Error: style/strictness variant is smaller size than seed"); } await FileWork.WriteTextAsync(filePath + "\\" + fileName + ".filter", result); LoggingFacade.LogInfo($"DONE GENERATING: {fileName}"); } }
public void SaveItemInformation(string filePath, string branchKey) { LoggingFacade.LogDebug($"Saving AspectFile: {branchKey}"); FileWork.WriteTextAsync(filePath, this.Serialize(branchKey)); }