Beispiel #1
0
		public static SaveGameCore AddResource(this SaveGameCore input, ResourceType resourceType, int count = 1)
		{
			SaveGameCore saveGame = input;
			int currentId = saveGame.IdGenerator.NextId.Value;

			for (int i = 0; i < count; i++)
			{
				ResourceCore resource = new ResourceCore()
				{
					Condition = new ValueAttribute<double>() { Value = 1 },
					Durability = new ValueAttribute<double>() { Value = 1 },
					Id = new ValueAttribute<int>() { Value = currentId },
					Location = new ValueAttribute<int>() { Value = 1 },
					Orientation = new CoordinatesCore() { X = 0, Y = 0, Z = 0 },
					Position = new CoordinatesCore() { X = 0, Y = 0, Z = 0 },
					State = new ValueAttribute<int>() { Value = 1 },
					Traderid = new ValueAttribute<int>() { Value = -1 },
					Subtype = new ValueAttribute<int>() { Value = 0 },
					Type = resourceType
				};
				currentId++;
				saveGame.Resources.Resource.Add(resource);
			}

			saveGame.IdGenerator.NextId.Value = currentId;

			return saveGame;
		}
Beispiel #2
0
        public static SaveGame ConvertToSaveGame(this SaveGameCore saveGameCore)
        {
            SaveGame result = new SaveGame();



            return(result);
        }
Beispiel #3
0
        public static SaveGameCore RepairAllConstructions(this SaveGameCore input)
        {
            SaveGameCore saveGame = input;

            foreach (ConstructionCore construction in saveGame.Constructions.Construction.Where(x => x.ModuleType != null && x.ModuleType.Value == ModuleType.ModuleTypePowerCollector))
            {
                construction.Condition.Value = 1;
            }

            return(saveGame);
        }
Beispiel #4
0
 private void buttonRefillAllPowerCollectors_Click(object sender, EventArgs e)
 {
     if (_loadedSaveGame != null)
     {
         _loadedSaveGame = _loadedSaveGame.FillAllPowerCollectors();
         textBoxLog.AppendText("Done." + Environment.NewLine);
     }
     else
     {
         textBoxLog.AppendText("No SaveGame selected." + Environment.NewLine);
     }
 }
Beispiel #5
0
 private void buttonPatchAll_Click(object sender, EventArgs e)
 {
     if (coBxSaveGames.SelectedText == String.Empty)
     {
         textBoxLog.AppendText("No file selected." + Environment.NewLine + Environment.NewLine);
     }
     else
     {
         textBoxLog.AppendText("Patching..." + Environment.NewLine);
         _loadedSaveGame = _loadedSaveGame.FillAllCollectors().HealAllCharacters().DoAllConstructions();
     }
 }
Beispiel #6
0
 private void buttonBuildAndRepairAllBuildings_Click(object sender, EventArgs e)
 {
     if (_loadedSaveGame != null)
     {
         _loadedSaveGame = _loadedSaveGame.DoAllConstructions();
         textBoxLog.AppendText("Done." + Environment.NewLine);
     }
     else
     {
         textBoxLog.AppendText("No SaveGame selected." + Environment.NewLine);
     }
 }
Beispiel #7
0
        static void Main(string[] args)
        {
            string filePath = @"..\..\..\Solution Items\SaveGame Samples\save9.sav";

            string fileContent = File.ReadAllText(filePath);

            SaveGameCore saveGame = FileManager.DeSerializeFromXml <SaveGameCore>(fileContent).FillAllCollectors().HealAllCharacters().DoAllConstructions();

            string saveGameXml = FileManager.SerializeToXml(saveGame);

            Console.ReadLine();
        }
Beispiel #8
0
        public static SaveGameCore BuildAllConstructions(this SaveGameCore input)
        {
            SaveGameCore saveGame = input;

            foreach (ConstructionCore construction in saveGame.Constructions.Construction.Where(x => x.ModuleType != null && x.ModuleType.Value == ModuleType.ModuleTypeWaterTank))
            {
                construction.State.Value  = 3;
                construction.Oxygen.Value = 1;
            }

            return(saveGame);
        }
Beispiel #9
0
 private void buttonHealAndRepairAllCharacterTypes_Click(object sender, EventArgs e)
 {
     if (_loadedSaveGame != null)
     {
         _loadedSaveGame = _loadedSaveGame.HealAllCharacters();
         textBoxLog.AppendText("Done." + Environment.NewLine);
     }
     else
     {
         textBoxLog.AppendText("No SaveGame selected." + Environment.NewLine);
     }
 }
        public static SaveGameCore RepairAllBots(this SaveGameCore input)
        {
            SaveGameCore saveGame = input;

            foreach (BaseCharacter character in saveGame.Characters.Where(x => x.CharacterType == CharacterType.Bot))
            {
                BotCharacter botCharacter = (BotCharacter)character;
                botCharacter.State.Value     = 1;
                botCharacter.Condition.Value = 1;
                botCharacter.Integrity.Value = 1;
            }

            return(saveGame);
        }
        public static SaveGameCore HealAllColonists(this SaveGameCore input)
        {
            SaveGameCore saveGame = input;

            foreach (BaseCharacter character in saveGame.Characters.Where(x => x.CharacterType == CharacterType.Colonist || x.CharacterType == CharacterType.Guest))
            {
                ColonistCharacter colonistCharacter = (ColonistCharacter)character;
                colonistCharacter.Health.Value    = 1;
                colonistCharacter.Nutrition.Value = 1;
                colonistCharacter.Hydration.Value = 1;
                colonistCharacter.Oxygen.Value    = 1;
                colonistCharacter.Sleep.Value     = 1;
                colonistCharacter.Morale.Value    = 1;
            }

            return(saveGame);
        }
Beispiel #12
0
        public static SaveGameCore FillAllWatterTanks(this SaveGameCore input)
        {
            SaveGameCore saveGame = input;

            foreach (ConstructionCore construction in saveGame.Constructions.Construction.Where(x => x.ModuleType != null && x.ModuleType.Value == ModuleType.ModuleTypeWaterTank))
            {
                if (construction.SizeIndex.Value == 2)
                {
                    construction.WaterStorage.Value = 600000;
                }
                else if (construction.SizeIndex.Value == 0)
                {
                    construction.WaterStorage.Value = 400000;
                }
            }

            return(saveGame);
        }
Beispiel #13
0
        private void LoadFile()
        {
            textBoxLog.AppendText("Updating selected file..." + Environment.NewLine);
            _selectedSaveGame = (SaveGameFile)coBxSaveGames.SelectedItem;
            textBoxLog.AppendText("Loaded file: " + _selectedSaveGame.FullName + Environment.NewLine);


            textBoxLog.AppendText("Reading file..." + Environment.NewLine);
            string fileContent = File.ReadAllText(_selectedSaveGame.FullName);

            textBoxLog.AppendText("Deserializing..." + Environment.NewLine);
            _loadedSaveGame = FileManager.DeSerializeFromXml <SaveGameCore>(fileContent).FillAllCollectors().HealAllCharacters().DoAllConstructions();

            textBoxLog.AppendText("Computing data..." + Environment.NewLine);
            UpdateResourceDatagrid();
            UpdateCharacterDatagrid();
            textBoxLog.AppendText("Done." + Environment.NewLine);
        }
Beispiel #14
0
        public static SaveGameCore FillAllPowerCollectors(this SaveGameCore input)
        {
            SaveGameCore saveGame = input;

            foreach (ConstructionCore construction in saveGame.Constructions.Construction.Where(x => x.ModuleType != null && x.ModuleType.Value == ModuleType.ModuleTypePowerCollector))
            {
                if (construction.SizeIndex.Value == 2)
                {
                    construction.PowerStorage.Value = 12500000;
                }
                else if (construction.SizeIndex.Value == 1)
                {
                    construction.PowerStorage.Value = 7500000;
                }
                else if (construction.SizeIndex.Value == 0)
                {
                    construction.PowerStorage.Value = 5000000;
                }
            }

            return(saveGame);
        }
Beispiel #15
0
 public static SaveGameCore DoAllConstructions(this SaveGameCore input)
 {
     return(input.RepairAllConstructions().BuildAllConstructions());
 }
Beispiel #16
0
 public static SaveGameCore FillAllCollectors(this SaveGameCore input)
 {
     return(input.FillAllPowerCollectors().FillAllWatterTanks());
 }
 public static SaveGameCore HealAllCharacters(this SaveGameCore input)
 {
     return(input.HealAllColonists().RepairAllBots());
 }