public static void MaxSteel(string pathToWorldXml) { Dictionary <string, int> Items = new Dictionary <string, int>() { { "ItemSteelSheets", 50 }, { "ItemSteelFrames", 30 } }; Console.WriteLine("Working on steel building materials"); XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; foreach (XmlNode Thing in ThingsRoot.ChildNodes) { if (Items.ContainsKey(Thing.SelectSingleNode("PrefabName").InnerText) && Thing.SelectSingleNode("ParentReferenceId").InnerText == "0") { if (Items.TryGetValue(Thing.SelectSingleNode("PrefabName").InnerText, out int Quantity)) { Console.WriteLine($"Setting {Thing.SelectSingleNode("PrefabName").InnerText} stack to Quantity: {Quantity}"); Thing.SelectSingleNode("Quantity").InnerText = Quantity.ToString("0"); } } } WorldReader.SaveWorld(pathToWorldXml, World); }
public static void CreateStatistics(string pathToWorldXml, int Minimum = 25) { XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; SortedList <string, int> ThingTypes = new SortedList <string, int>(); foreach (XmlNode Thing in ThingsRoot.ChildNodes) { string PrefabName = Thing.SelectSingleNode("PrefabName").InnerText; if (ThingTypes.ContainsKey(PrefabName)) { ThingTypes[PrefabName] += 1; } else { ThingTypes.Add(PrefabName, 1); } } foreach (string PrefabName in ThingTypes.Keys) { if (ThingTypes[PrefabName] > Minimum) { Debug.WriteLine($"{PrefabName} -> {ThingTypes[PrefabName]}"); } } }
public static void MaxIce(string pathToWorldXml) { Console.WriteLine("Setting all ingots to 500 items in stack"); XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; _MaxIce(ThingsRoot.ChildNodes, "50"); WorldReader.SaveWorld(pathToWorldXml, World); }
public static void MaxAll(string pathToWorldXml) { XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; _MaxIngots(ThingsRoot.ChildNodes, "500"); _MaxOres(ThingsRoot.ChildNodes, "50"); _MaxIce(ThingsRoot.ChildNodes, "50"); WorldReader.SaveWorld(pathToWorldXml, World); }
public static void FillLockers(string pathToWorldXml) { Console.WriteLine("Filling Printers with 10kg of Reagents..."); XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; _FillLockers(ThingsRoot.ChildNodes); WorldReader.SaveWorld(pathToWorldXml, World); }
public static void FillTanks(string pathToWorldXml) { Console.WriteLine("Filling Tanks"); XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; XmlNode AtmosRoot = World.GetElementsByTagName("Atmospheres")[0]; _FillTanks(ThingsRoot.ChildNodes, AtmosRoot.ChildNodes); WorldReader.SaveWorld(pathToWorldXml, World); }
public static void BuildSteelFrames(string pathToWorldXml, int FromState = 0, int ToState = 2) { Console.WriteLine("Working on steel frames"); int Counter = 0; XmlDocument World = WorldReader.ReadWorld(pathToWorldXml); XmlNode ThingsRoot = World.GetElementsByTagName("Things")[0]; foreach (XmlNode Thing in ThingsRoot.ChildNodes) { if (Thing.SelectSingleNode("PrefabName").InnerText == "StructureFrame" && Thing.SelectSingleNode("CurrentBuildState").InnerText == FromState.ToString("0")) { Counter += 1; Thing.SelectSingleNode("CurrentBuildState").InnerText = ToState.ToString("0"); } } Console.WriteLine($"Updated {Counter} SteelFrames."); WorldReader.SaveWorld(pathToWorldXml, World); }