/// <summary> /// Turns a sGear list into a charm list string that can be used in Honey Hunters World /// </summary> /// <param name="gear">sGear list with the charm information</param> /// <returns>string structure</returns> public static string ExportCharmsToHoney(sGear[] gear) { if (HoneyGearData == null) { LoadHoneyGearData(); } StringBuilder data = new StringBuilder(); // Filter based on only on charms sGear[] charms = gear.Where(x => x.Type == (uint)GearType.Charm).ToArray(); // Parse charms into a dictionary to make it easier to organize the string structure Dictionary <int, int> sCharms = new Dictionary <int, int>(); foreach (sGear charm in charms) { // Check if player doesn't have that gear if (charm.Category != 2) { continue; } int HoneyCharmId = GetCharmHoneyIdByGameId(charm.Id); int level = GetCharmLevel(charm.Id); // unique charms have level 0, but we need them to become 1 in order to Honey recoginize them level = level == 0 ? level + 1 : level; if (sCharms.ContainsKey(HoneyCharmId)) { //If the level we find is actually larger, use that instead if (sCharms[HoneyCharmId] < level) { sCharms[HoneyCharmId] = level; } } else { sCharms[HoneyCharmId] = level; } } // Now we build the charm string structure const int MaxCharmId = 108; for (int i = 1; i <= MaxCharmId; i++) { data.Append($"{(i != 1 ? "," : "")}{(sCharms.ContainsKey(i) ? sCharms[i] : 0)}"); } Debugger.Debug(data); UnloadHoneyGearData(); return(data.ToString()); }
/// <summary> /// Turns a sItem list into a decoration list string that can be used in Honey Hunters World /// </summary> /// <param name="decorations">sItem list with the decorations information</param> /// <returns>string structure</returns> public static string ExportDecorationsToHoney(sItem[] decorations) { if (HoneyGearData == null) { LoadHoneyGearData(); } StringBuilder data = new StringBuilder(); // Parse decorations into a dictionary to make it easier to organize the string structure Dictionary <int, int> sDecorations = new Dictionary <int, int>(); foreach (sItem deco in decorations) { int HoneyDecoId = GetDecorationHoneyIdByGameId(deco.ItemId); if (sDecorations.ContainsKey(HoneyDecoId)) { sDecorations[HoneyDecoId] += deco.Amount; } else { sDecorations[HoneyDecoId] = deco.Amount; } } // Now we build the decoration string structure const int MaxDecoId = 401; for (int i = 1; i <= MaxDecoId; i++) { data.Append($"{(i != 1 ? "," : "")}{(sDecorations.ContainsKey(i) ? GetDecorationAmountLimit(i, sDecorations[i]) : 0)}"); } Debugger.Debug(data); UnloadHoneyGearData(); return(data.ToString()); }
// Integration with Honey Hunter World peepoHappy public static string LinkStructureBuilder(GameStructs.Gear Build) { if (HoneyGearData == null) { LoadHoneyGearData(); } StringBuilder LinkBuilder = new StringBuilder(); LinkBuilder.Append(HoneyLink); // Basic data LinkBuilder.Append(GetWeaponHoneyID(Build.Weapon.Type, Build.Weapon.ID) + ","); LinkBuilder.Append(GetGearHoneyID("Helms", "Helm", Build.Helmet.ID) + ","); LinkBuilder.Append(GetGearHoneyID("Armors", "Armor", Build.Chest.ID) + ","); LinkBuilder.Append(GetGearHoneyID("Arms", "Arm", Build.Hands.ID) + ","); LinkBuilder.Append(GetGearHoneyID("Waists", "Waist", Build.Waist.ID) + ","); LinkBuilder.Append(GetGearHoneyID("Legs", "Leg", Build.Legs.ID) + ","); LinkBuilder.Append(GetGearHoneyID("Charms", "Charm", Build.Charm.ID) + ","); // Augments int AugmentsTotal = 0; for (int AugmentIndex = 0; AugmentIndex < Build.Weapon.NewAugments.Length; AugmentIndex++) { string AugId = GetNewAugment(Build.Weapon.NewAugments[AugmentIndex].ID); if (Build.Weapon.NewAugments[AugmentIndex].Level == 0) { continue; } else { AugmentsTotal++; } if (AugmentsTotal > 1) { LinkBuilder.Append($";{AugId}:{Build.Weapon.NewAugments[AugmentIndex].Level}"); } else { LinkBuilder.Append($"{AugId}:{Build.Weapon.NewAugments[AugmentIndex].Level}"); } } // Custom Augments LinkBuilder.Append("-"); LinkBuilder.Append(BuildCustomPartsStructure(Build.Weapon.Type, Build.Weapon.CustomAugments)); // Awakening Skills LinkBuilder.Append("-"); LinkBuilder.Append(BuildAwakeningSkillsStructure(Build.Weapon.Awakenings)); LinkBuilder.Append(",0,0"); // Decorations int[] ExtraSlotAwakening = new int[3] { 38, 39, 40 }; bool HasExtraSlot = Build.Weapon.Awakenings.Where(deco => ExtraSlotAwakening.Contains(deco.ID)).ToArray().Length > 0; LinkBuilder.Append(BuildDecorationStringStructure(Build.Weapon.Decorations, isWeapon: true, HasDecorationExtraSlot: HasExtraSlot)); LinkBuilder.Append(BuildDecorationStringStructure(Build.Helmet.Decorations)); LinkBuilder.Append(BuildDecorationStringStructure(Build.Chest.Decorations)); LinkBuilder.Append(BuildDecorationStringStructure(Build.Hands.Decorations)); LinkBuilder.Append(BuildDecorationStringStructure(Build.Waist.Decorations)); LinkBuilder.Append(BuildDecorationStringStructure(Build.Legs.Decorations)); // The rest LinkBuilder.Append("," + GetCharmLevel(Build.Charm.ID)); LinkBuilder.Append(":" + GetMantleHoneyID(Build.SpecializedTools[0].ID)); LinkBuilder.Append(":" + GetMantleHoneyID(Build.SpecializedTools[1].ID)); LinkBuilder.Append(BuildDecorationStringStructure(Build.SpecializedTools[0].Decorations, 2).Replace(',', ':')); LinkBuilder.Append(BuildDecorationStringStructure(Build.SpecializedTools[1].Decorations, 2).Replace(',', ':')); // Bowgun mods if (Build.Weapon.Type == 12 || Build.Weapon.Type == 13) { foreach (GameStructs.BowgunMod bowgunMod in Build.Weapon.BowgunMods) { LinkBuilder.Append("," + (HoneyGearData.SelectSingleNode($"//Honey/Weapons/BowgunMods/Mod[@ID='{bowgunMod.ID}']/@HoneyID")?.Value ?? "none")); } } Debugger.Debug(LinkBuilder); UnloadHoneyGearData(); return(LinkBuilder.ToString()); }
/// <summary> /// Turns a sItem list into a decoration list string that can be used in Honey Hunters World /// </summary> /// <param name="decorations">sItem array with the decorations information</param> /// <param name="gears">sGear array with the gear information</param> /// <returns>string structure</returns> public static string ExportDecorationsToHoney(sItem[] decorations, sGear[] gears) { if (HoneyGearData == null) { LoadHoneyGearData(); } StringBuilder data = new StringBuilder(); // Merge decorations in box and decorations in gear List <sItem> decoMerge = decorations.ToList <sItem>(); foreach (sGear gear in gears) { // Skip gear the player does not have anymore if (gear.Category == uint.MaxValue) { continue; } // Skip charms if (gear.Category == 2) { continue; } if (gear.DecorationSlot1 != uint.MaxValue) { decoMerge.Add(new sItem { Amount = 1, ItemId = GetDecorationGameIdById((int)gear.DecorationSlot1) }); } if (gear.DecorationSlot2 != uint.MaxValue) { decoMerge.Add(new sItem { Amount = 1, ItemId = GetDecorationGameIdById((int)gear.DecorationSlot2) }); } if (gear.DecorationSlot3 != uint.MaxValue) { decoMerge.Add(new sItem { Amount = 1, ItemId = GetDecorationGameIdById((int)gear.DecorationSlot3) }); } } decorations = decoMerge.ToArray <sItem>(); // Parse decorations into a dictionary to make it easier to organize the string structure Dictionary <int, int> sDecorations = new Dictionary <int, int>(); foreach (sItem deco in decorations) { int HoneyDecoId = GetDecorationHoneyIdByGameId(deco.ItemId); int StacksWith = GetStacksWithDecorationId(deco.ItemId); if (sDecorations.ContainsKey(HoneyDecoId)) { sDecorations[HoneyDecoId] += deco.Amount; } else { sDecorations[HoneyDecoId] = deco.Amount; } if (StacksWith != int.MaxValue) { StacksWith = GetDecorationHoneyIdByGameId(StacksWith); if (sDecorations.ContainsKey(StacksWith)) { sDecorations[HoneyDecoId] += sDecorations[StacksWith]; sDecorations[StacksWith] += deco.Amount; } } } // Now we build the decoration string structure const int MaxDecoId = 401; for (int i = 1; i <= MaxDecoId; i++) { data.Append($"{(i != 1 ? "," : "")}{(sDecorations.ContainsKey(i) ? GetDecorationAmountLimit(i, sDecorations[i]) : 0)}"); } Debugger.Debug(data); Debugger.Debug($"Total unique decorations found: {sDecorations.Count}"); UnloadHoneyGearData(); return(data.ToString()); }