void processKingdoms(XmlDocument document) { var nodes = document.SelectNodes("/Kingdoms/Kingdom"); foreach (XmlNode node in nodes) { string attr(string attrName) => node.Attributes[attrName]?.Value; var id = attr("id"); var banner = attr("banner_key") ?? Banner.CreateRandomClanBanner(id.GetDeterministicHashCode()).Serialize(); var color = attr("color"); if (color?.Trim()?.Length > 0) { color = Color.FromUint(Convert.ToUInt32(color, 16)).ToString(); } var color2 = attr("color2"); if (color2?.Trim()?.Length > 0) { color2 = Color.FromUint(Convert.ToUInt32(color2, 16)).ToString(); } var primaryBannerColor = BannerManager.GetColorId(Convert.ToUInt32(attr("primary_banner_color") ?? "-1", 16)); var secondaryBannerColor = BannerManager.GetColorId(Convert.ToUInt32(attr("secondary_banner_color") ?? "-1", 16)); Settings.UniformColorOverride.Add(new UniformColor(id, color, color2)); Settings.FactionColorOverride.Add(new FactionColor(id, primaryBannerColor, secondaryBannerColor)); // get ruling clan banner var rulingClan = MBObjectManager.Instance.ReadObjectReferenceFromXml <Hero>("owner", node)?.Clan; if (rulingClan != null) { Settings.ClanBannerOverride.Add(new ClanBanner(rulingClan.StringId, banner, true)); } } }