public static void AdjustBuffs(CombatData combatData, Dictionary <long, Buff> buffsByID, ParserController operation) { var solved = new Dictionary <byte, ArcDPSEnums.BuffAttribute>(); foreach (KeyValuePair <BuffFormulaDescriptor, long> pair in _recognizer) { if (buffsByID.TryGetValue(pair.Value, out Buff buff)) { BuffInfoEvent buffInfoEvent = combatData.GetBuffInfoEvent(buff.ID); if (buffInfoEvent != null) { foreach (BuffFormula formula in buffInfoEvent.Formulas) { pair.Key.Match(formula, solved); } } } } if (solved.Values.Distinct().Count() != solved.Values.Count) { operation.UpdateProgressWithCancellationCheck("Incoherent Data in Buff Info Solver, no formula attribute adjustement will be done"); solved.Clear(); } foreach (KeyValuePair <long, Buff> pair in buffsByID) { BuffInfoEvent buffInfoEvent = combatData.GetBuffInfoEvent(pair.Key); if (buffInfoEvent != null) { pair.Value.VerifyBuffInfoEvent(buffInfoEvent, operation); buffInfoEvent.AdjustBuffInfo(solved); } } }
internal BuffsContainer(ulong build, CombatData combatData, ParserController operation) { var AllBuffs = new List <List <Buff> >() { Boons, Conditions, Commons, Gear, NormalFoods, AscendedFood, FoodProcs, Utilities, Potions, Writs, FightSpecific, FractalInstabilities, // RevenantHelper.Buffs, HeraldHelper.Buffs, RenegadeHelper.Buffs, VindicatorHelper.Buffs, // WarriorHelper.Buffs, BerserkerHelper.Buffs, SpellbreakerHelper.Buffs, BladeswornHelper.Buffs, // GuardianHelper.Buffs, DragonhunterHelper.Buffs, FirebrandHelper.Buffs, WillbenderHelper.Buffs, // RangerHelper.Buffs, DruidHelper.Buffs, SoulbeastHelper.Buffs, UntamedHelper.Buffs, // ThiefHelper.Buffs, DaredevilHelper.Buffs, DeadeyeHelper.Buffs, SpecterHelper.Buffs, // EngineerHelper.Buffs, ScrapperHelper.Buffs, HolosmithHelper.Buffs, MechanistHelper.Buffs, // MesmerHelper.Buffs, ChronomancerHelper.Buffs, MirageHelper.Buffs, VirtuosoHelper.Buffs, // NecromancerHelper.Buffs, ReaperHelper.Buffs, ScourgeHelper.Buffs, HarbingerHelper.Buffs, // ElementalistHelper.Buffs, TempestHelper.Buffs, WeaverHelper.Buffs, CatalystHelper.Buffs, }; var currentBuffs = new List <Buff>(); foreach (List <Buff> buffs in AllBuffs) { currentBuffs.AddRange(buffs.Where(x => x.Available(build))); } _buffsByName = currentBuffs.GroupBy(x => x.Name).ToDictionary(x => x.Key, x => { var list = x.ToList(); if (list.Count > 1) { throw new InvalidDataException("Same name present multiple times in buffs - " + x.First().Name); } return(x.First()); }); // Unknown consumables var buffIDs = new HashSet <long>(currentBuffs.Select(x => x.ID)); var foodAndUtility = new List <BuffInfoEvent>(combatData.GetBuffInfoEvent(BuffCategory.Enhancement)); foodAndUtility.AddRange(combatData.GetBuffInfoEvent(BuffCategory.Food)); foreach (BuffInfoEvent buffInfoEvent in foodAndUtility) { if (!buffIDs.Contains(buffInfoEvent.BuffID)) { string name = buffInfoEvent.Category == BuffCategory.Enhancement ? "Utility" : "Food"; string link = buffInfoEvent.Category == BuffCategory.Enhancement ? "https://wiki.guildwars2.com/images/2/23/Nourishment_utility.png" : "https://wiki.guildwars2.com/images/c/ca/Nourishment_food.png"; operation.UpdateProgressWithCancellationCheck("Creating consumable " + name + " " + buffInfoEvent.BuffID); currentBuffs.Add(CreateCustomConsumable(name, buffInfoEvent.BuffID, link, buffInfoEvent.MaxStacks)); } } // BuffsByIds = currentBuffs.GroupBy(x => x.ID).ToDictionary(x => x.Key, x => { var list = x.ToList(); if (list.Count > 1 && x.Key != Buff.NoBuff && x.Key != Buff.Unknown) { throw new InvalidDataException("Same id present multiple times in buffs - " + x.First().ID); } return(x.First()); }); operation.UpdateProgressWithCancellationCheck("Adjusting Buffs"); BuffInfoSolver.AdjustBuffs(combatData, BuffsByIds, operation, build); foreach (Buff buff in currentBuffs) { BuffInfoEvent buffInfoEvt = combatData.GetBuffInfoEvent(buff.ID); if (buffInfoEvt != null) { foreach (BuffFormula formula in buffInfoEvt.Formulas) { if (formula.Attr1 == BuffAttribute.Unknown) { operation.UpdateProgressWithCancellationCheck("Unknown Formula for " + buff.Name + ": " + formula.GetDescription(true, BuffsByIds)); } } } } BuffsByClassification = currentBuffs.GroupBy(x => x.Classification).ToDictionary(x => x.Key, x => (IReadOnlyList <Buff>)x.ToList()); BuffsBySource = currentBuffs.GroupBy(x => x.Source).ToDictionary(x => x.Key, x => (IReadOnlyList <Buff>)x.ToList()); // _buffSourceFinder = GetBuffSourceFinder(build, new HashSet <long>(BuffsByClassification[BuffClassification.Boon].Select(x => x.ID))); }