static string BuildCustomPartsStructure(int WeaponType, GameStructs.CustomAugment[] CustomAugments, bool ShowError) { StringBuilder[] Structure = new StringBuilder[5]; for (int cAugmentIndex = 0; cAugmentIndex < CustomAugments.Length; cAugmentIndex++) { GameStructs.CustomAugment cAugment = CustomAugments[cAugmentIndex]; // Skip empty slots if (cAugment.ID == byte.MaxValue) { continue; } string AugmentType = HoneyGearData.SelectSingleNode($"//Honey/Weapons/Custom").ChildNodes[WeaponType].SelectSingleNode($"Part[@Level='{cAugment.Level + 1}' and @ID='{cAugment.ID}']/@Type")?.Value; // If we dont find the augment id, then we try the wildcard ones, since there are some // missing IDs if (AugmentType == null) { AugmentType = HoneyGearData.SelectSingleNode($"//Honey/Weapons/Custom").ChildNodes[WeaponType].SelectSingleNode($"Part[@Level='{cAugment.Level + 1}' and @ID='?']/@Type")?.Value; } // If the augment is still null, then it isn't supported yet. In this case we display an error // with the augment ID, so it's easier to map it. if (AugmentType == null && ShowError) { Debugger.Error($"Unsupported custom augment (ID = {cAugment.ID}, Level = {cAugment.Level})"); continue; } // Initializes StringBuilder if it isn't initialized yet int.TryParse(AugmentType, out int parsed); if (Structure[parsed] == null) { Structure[parsed] = new StringBuilder(); } Structure[parsed].Append((cAugment.Level + 1).ToString()); } StringBuilder JoinedResult = new StringBuilder(); foreach (StringBuilder SubBuilder in Structure) { JoinedResult.Append(SubBuilder?.ToString() + ";"); } JoinedResult.Remove(JoinedResult.Length - 1, 1); return(JoinedResult.ToString()); }
static string BuildAwakeningSkillsStructure(GameStructs.AwakenedSkill[] AwakenedSkills) { StringBuilder[] Structure = new StringBuilder[5]; for (int AwakIndex = 0; AwakIndex < 5; AwakIndex++) { GameStructs.AwakenedSkill awakened = AwakenedSkills[AwakIndex]; if (Structure[AwakIndex] == null) { Structure[AwakIndex] = new StringBuilder(); } Structure[AwakIndex].Append(HoneyGearData.SelectSingleNode($"//Honey/Weapons/Awakening/Skill[@ID='{awakened.ID}']/@HoneyID")?.Value); } StringBuilder JoinedResult = new StringBuilder(); foreach (StringBuilder SubBuilder in Structure) { JoinedResult.Append(SubBuilder?.ToString() + ";"); } JoinedResult.Remove(JoinedResult.Length - 1, 1); return(JoinedResult.ToString()); }