public void Load(ConfigNode node) { if (node.HasNode(configNodeName)) { ConfigNode TSTStockPlanetOrderNode = new ConfigNode(); node.TryGetNode(configNodeName, ref TSTStockPlanetOrderNode); string tmpPlanetOrderString = ""; TSTStockPlanetOrderNode.TryGetValue("planets", ref tmpPlanetOrderString); string[] tmpPlanetOrder = tmpPlanetOrderString.Split(','); NHPlanetOrder = new string[tmpPlanetOrder.Length]; if (tmpPlanetOrder.Length > 0) { for (int i = 0; i < tmpPlanetOrder.Length; i++) { NHPlanetOrder[i] = tmpPlanetOrder[i]; } } } Utilities.Log_Debug("TSTNHPlanetOrder load complete"); }
private void LoadKerbal(ConfigNode crewNode) { if (crewNode == null) { DarkLog.Debug("crewNode is null!"); return; } if (crewNode.GetValue("type") == "Tourist") { ConfigNode dmpNode = null; if (crewNode.TryGetNode("DarkMultiPlayer", ref dmpNode)) { string dmpOwner = null; if (dmpNode.TryGetValue("touristOwner", ref dmpOwner)) { if (dmpOwner != Settings.fetch.playerPublicKey) { DarkLog.Debug("Skipping load of tourist that belongs to another player"); return; } } } } ProtoCrewMember protoCrew = new ProtoCrewMember(HighLogic.CurrentGame.Mode, crewNode); if (protoCrew == null) { DarkLog.Debug("protoCrew is null!"); return; } if (string.IsNullOrEmpty(protoCrew.name)) { DarkLog.Debug("protoName is blank!"); return; } if (!HighLogic.CurrentGame.CrewRoster.Exists(protoCrew.name)) { AddCrewMemberToRoster(protoCrew); ConfigNode kerbalNode = new ConfigNode(); protoCrew.Save(kerbalNode); byte[] kerbalBytes = ConfigNodeSerializer.fetch.Serialize(kerbalNode); if (kerbalBytes != null && kerbalBytes.Length != 0) { serverKerbals[protoCrew.name] = Common.CalculateSHA256Hash(kerbalBytes); } } else { ConfigNode careerLogNode = crewNode.GetNode("CAREER_LOG"); if (careerLogNode != null) { //Insert wolf howling at the moon here HighLogic.CurrentGame.CrewRoster[protoCrew.name].careerLog.Entries.Clear(); HighLogic.CurrentGame.CrewRoster[protoCrew.name].careerLog.Load(careerLogNode); } else { DarkLog.Debug("Career log node for " + protoCrew.name + " is empty!"); } ConfigNode flightLogNode = crewNode.GetNode("FLIGHT_LOG"); if (flightLogNode != null) { //And here. Someone "cannot into" lists and how to protect them. HighLogic.CurrentGame.CrewRoster[protoCrew.name].flightLog.Entries.Clear(); HighLogic.CurrentGame.CrewRoster[protoCrew.name].flightLog.Load(flightLogNode); } HighLogic.CurrentGame.CrewRoster[protoCrew.name].courage = protoCrew.courage; HighLogic.CurrentGame.CrewRoster[protoCrew.name].experience = protoCrew.experience; HighLogic.CurrentGame.CrewRoster[protoCrew.name].experienceLevel = protoCrew.experienceLevel; HighLogic.CurrentGame.CrewRoster[protoCrew.name].experienceTrait = protoCrew.experienceTrait; HighLogic.CurrentGame.CrewRoster[protoCrew.name].gender = protoCrew.gender; HighLogic.CurrentGame.CrewRoster[protoCrew.name].gExperienced = protoCrew.gExperienced; HighLogic.CurrentGame.CrewRoster[protoCrew.name].hasToured = protoCrew.hasToured; HighLogic.CurrentGame.CrewRoster[protoCrew.name].isBadass = protoCrew.isBadass; HighLogic.CurrentGame.CrewRoster[protoCrew.name].KerbalRef = protoCrew.KerbalRef; HighLogic.CurrentGame.CrewRoster[protoCrew.name].outDueToG = protoCrew.outDueToG; HighLogic.CurrentGame.CrewRoster[protoCrew.name].rosterStatus = protoCrew.rosterStatus; HighLogic.CurrentGame.CrewRoster[protoCrew.name].seat = protoCrew.seat; HighLogic.CurrentGame.CrewRoster[protoCrew.name].seatIdx = protoCrew.seatIdx; HighLogic.CurrentGame.CrewRoster[protoCrew.name].stupidity = protoCrew.stupidity; HighLogic.CurrentGame.CrewRoster[protoCrew.name].trait = protoCrew.trait; HighLogic.CurrentGame.CrewRoster[protoCrew.name].type = protoCrew.type; HighLogic.CurrentGame.CrewRoster[protoCrew.name].UTaR = protoCrew.UTaR; HighLogic.CurrentGame.CrewRoster[protoCrew.name].veteran = protoCrew.veteran; } }
//Settings Functions Follow public void Load(ConfigNode node) { if (node.HasNode(configNodeName)) { ConfigNode TSTsettingsNode = new ConfigNode(); node.TryGetNode(configNodeName, ref TSTsettingsNode); TSTsettingsNode.TryGetValue( "FwindowPosX", ref FwindowPosX); TSTsettingsNode.TryGetValue( "FwindowPosY", ref FwindowPosY); TSTsettingsNode.TryGetValue( "SCwindowPosX", ref FwindowPosX); TSTsettingsNode.TryGetValue( "SCwindowPosY", ref FwindowPosY); TSTsettingsNode.TryGetValue( "CwindowPosX", ref CwindowPosX); TSTsettingsNode.TryGetValue( "CwindowPosY", ref CwindowPosY); TSTsettingsNode.TryGetValue( "GalwindowPosX", ref GalwindowPosX); TSTsettingsNode.TryGetValue( "GalwindowPosY", ref GalwindowPosY); TSTsettingsNode.TryGetValue( "BodwindowPosX", ref BodwindowPosX); TSTsettingsNode.TryGetValue( "BodwindowPosY", ref BodwindowPosY); TSTsettingsNode.TryGetValue( "ChemwinSml", ref ChemwinSml); TSTsettingsNode.TryGetValue( "ChemwinLge", ref ChemwinLge); TSTsettingsNode.TryGetValue( "TelewinSml", ref TelewinSml); TSTsettingsNode.TryGetValue( "TelewinLge", ref TelewinLge); TSTsettingsNode.TryGetValue( "UseAppLauncher", ref UseAppLauncher); TSTsettingsNode.TryGetValue( "debugging", ref debugging); TSTsettingsNode.TryGetValue( "Tooltips", ref Tooltips); Utilities.debuggingOn = debugging; TSTsettingsNode.TryGetValue( "maxChemCamContracts", ref maxChemCamContracts); TSTsettingsNode.TryGetValue( "photoOnlyChemCamContracts", ref photoOnlyChemCamContracts); TSTsettingsNode.TryGetValue("ZoomSkyBox", ref ZoomSkyBox); TSTsettingsNode.TryGetValue("scienceUndiscoveredScope", ref scienceUndiscoveredScope); TSTsettingsNode.TryGetValue("scienceDiscoveredScope", ref scienceDiscoveredScope); TSTsettingsNode.TryGetValue("repUndiscoveredScope", ref repUndiscoveredScope); TSTsettingsNode.TryGetValue("repDiscoveredScope", ref repDiscoveredScope); TSTsettingsNode.TryGetValue("fundsUndiscoveredScope", ref fundsUndiscoveredScope); TSTsettingsNode.TryGetValue("fundsdiscoveredScope", ref fundsdiscoveredScope); TSTsettingsNode.TryGetValue("scienceUndiscoveredChem", ref scienceUndiscoveredChem); TSTsettingsNode.TryGetValue("scienceDiscoveredChem", ref scienceDiscoveredChem); TSTsettingsNode.TryGetValue("repUndiscoveredChem", ref repUndiscoveredChem); TSTsettingsNode.TryGetValue("repDiscoveredChem", ref repDiscoveredChem); TSTsettingsNode.TryGetValue("fundsUndiscoveredChem", ref fundsUndiscoveredChem); TSTsettingsNode.TryGetValue("fundsdiscoveredChem", ref fundsdiscoveredChem); Utilities.Log_Debug("TSTSettings load complete"); } }