static void FixObjectsXmlInvalidSingles(PhxEngineBuild build, KSoft.IO.XmlElementStream s) { if (build == PhxEngineBuild.Alpha) { FixObjectsXmlInvalidSinglesAlpha(s); } else { FixObjectsXmlInvalidSinglesCobra(s); } }
static void FixGameDataXmlInfectionMap(PhxEngineBuild build, KSoft.IO.XmlElementStream s) { string xpath; XmlNodeList elements; if (!ToLowerName(PhxLib.Engine.DatabaseObjectKind.Object)) { xpath = "InfectionMap/InfectionMapEntry[contains(@base, 'needlergrunt')]"; elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var attr = e.Attributes["base"]; attr.Value = attr.Value.Replace("needlergrunt", "needlerGrunt"); } } FixGameDataXmlInfectionMapEntryInfected(s, "fld_inf_InfectedBrute_01"); FixGameDataXmlInfectionMapEntryInfected(s, "fld_inf_InfectedJackal_01"); FixGameDataXmlInfectionMapEntryInfected(s, "fld_inf_InfectedGrunt_01"); } if (!ToLowerName(PhxLib.Engine.DatabaseObjectKind.Squad)) { xpath = "InfectionMap/InfectionMapEntry[contains(@infectedSquad, '_Inf')]"; elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var attr = e.Attributes["infectedSquad"]; attr.Value = attr.Value.Replace("_Inf", "_inf"); } } } #region Alpha only if (build == PhxEngineBuild.Alpha) { xpath = "InfectionMap/InfectionMapEntry[contains(@base, 'unsc_inf_heavymarine_01')]"; elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { e.ParentNode.RemoveChild(e); } } } #endregion }
// Remove non-existent ProtoTechs that are referenced by effects static void FixTechsXmlEffectsInvalid(KSoft.IO.XmlElementStream s, XML.BListXmlParams op, PhxEngineBuild build) { string xpath_target = string.Format( "/{0}/{1}/Effects/Effect/Target", op.RootName, op.ElementName); XmlNodeList elements; if (build == PhxEngineBuild.Release) { elements = s.Document.SelectNodes(xpath_target); foreach (XmlElement e in elements) { if (e.InnerText != "unsc_turret_upgrade3") { continue; } var p = e.ParentNode; p.ParentNode.RemoveChild(p); } } }
static void FixTechsXmlBadNames(KSoft.IO.XmlElementStream s, XML.BListXmlParams op, PhxEngineBuild build) { const string k_attr_command_data = "CommandData"; const string k_element_target = "Target"; string invalid_command_data_format = string.Format( "/{0}/{1}/Effects/Effect[@{2}='", op.RootName, op.ElementName, k_attr_command_data) + "{0}']"; string invalid_target_format = string.Format( "/{0}/{1}/Effects/Effect[Target='", op.RootName, op.ElementName) + "{0}']"; string xpath; XmlNodeList elements; if (!ToLowerName(PhxLib.Engine.DatabaseObjectKind.Unit)) { #region Alpha only if (build == PhxEngineBuild.Alpha) { xpath = string.Format(invalid_target_format, "cov_inf_eliteleader_01"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "cov_inf_eliteLeader_01"; } } } #endregion } #region Alpha only if (build == PhxEngineBuild.Alpha) { xpath = string.Format(invalid_target_format, "cov_inf_elite_leader01"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "cov_inf_eliteLeader_01"; } } } #endregion if (!ToLowerName(PhxLib.Engine.DatabaseObjectKind.Tech)) { #region unsc_MAC_upgrade xpath = string.Format(invalid_command_data_format, "unsc_mac_upgrade1"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { e.Attributes[k_attr_command_data].Value = "unsc_MAC_upgrade1"; } } xpath = string.Format(invalid_command_data_format, "unsc_mac_upgrade2"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { e.Attributes[k_attr_command_data].Value = "unsc_MAC_upgrade2"; } } xpath = string.Format(invalid_command_data_format, "unsc_mac_upgrade3"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { e.Attributes[k_attr_command_data].Value = "unsc_MAC_upgrade3"; } } #endregion #region unsc_flameMarine_upgrade xpath = string.Format(invalid_target_format, "unsc_flamemarine_upgrade1"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "unsc_flameMarine_upgrade1"; } } xpath = string.Format(invalid_target_format, "unsc_flamemarine_upgrade2"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "unsc_flameMarine_upgrade2"; } } xpath = string.Format(invalid_target_format, "unsc_flamemarine_upgrade3"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "unsc_flameMarine_upgrade3"; } } #endregion } if (!ToLowerName(PhxLib.Engine.DatabaseObjectKind.Squad)) { xpath = string.Format(invalid_target_format, "unsc_inf_flamemarine_01"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "unsc_inf_flameMarine_01"; } } xpath = string.Format(invalid_target_format, "unsc_inf_Marine_01"); elements = s.Cursor.SelectNodes(xpath); if (elements.Count > 0) { foreach (XmlElement e in elements) { var fc = e[k_element_target].FirstChild; fc.Value = "unsc_inf_marine_01"; } } } }