Beispiel #1
0
 private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     if (!Context.IsMultiplayer || Context.IsMainPlayer)
     {
         Helper.Data.WriteSaveData(PlacedAugmentorsManager.SavedDataKey, new SerializablePlacedAugmentors(PlacedAugmentorsManager.Instance));
     }
 }
 private void GameLoop_Saving(object?sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     //reset invincibility settings while saving to help prevent future potential errors if the mod is disabled later
     //redundant with DayEnding to handle farmhand inconsistency
     Game1.player.temporaryInvincibilityTimer           = 0;
     Game1.player.currentTemporaryInvincibilityDuration = 0;
     Game1.player.temporarilyInvincible = false;
 }
        private void OnSaving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
        {
            if (!Context.IsMainPlayer)
            {
                return;
            }

            Helper.Data.WriteSaveData(SaveProfileKey, session);
        }
        private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
        {
            var svd = new ShopSaveData();

            foreach (var s in MapTKShop.Bought)
            {
                svd.BoughtItems.Add(s.Key, s.Value);
            }

            Plato.ModHelper.Data.WriteSaveData(ShopSaveData, svd);
        }
Beispiel #5
0
        private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
        {
            UtilitySystemDictData dict = new UtilitySystemDictData();

            Monitor.Log($"writing grid data for {utilitySystemDict.Count} locations from save");
            foreach (var kvp in utilitySystemDict)
            {
                UtilitySystemData gridData = new UtilitySystemData(kvp.Value[GridType.water].pipes, kvp.Value[GridType.electric].pipes);
                dict.dict[kvp.Key] = gridData;
                Monitor.Log($"writing {gridData.electricData.Count} ep and {gridData.waterData.Count} wp for location {kvp.Key} to save");
            }
            Helper.Data.WriteSaveData(saveKey, dict);
        }
Beispiel #6
0
        /// <summary>
        /// Serializes the worn extra rings to disk.
        /// </summary>
        void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
        {
            if (!Game1.IsMasterGame)
            {
                return;
            }
            var savedata = new SaveRingsDict();

            foreach (Farmer f in Game1.getAllFarmers())
            {
                savedata[f.UniqueMultiplayerID] = new SaveRings(actualdata.GetValue(f, FarmerNotFound));
            }
            Helper.Data.WriteSaveData("extra-rings", savedata);
            Monitor.Log("Saved extra rings data.");
        }
Beispiel #7
0
        private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
        {
            ColorDictData dict = new ColorDictData();

            Monitor.Log($"writing recolor data for {colorDict.Count} locations from save");
            foreach (var kvp in colorDict)
            {
                Monitor.Log($"writing {kvp.Value.Count} recolors for location {kvp.Key} to save");
                dict.colorDict[kvp.Key] = new List <RecolorData>();
                foreach (var kvp2 in kvp.Value)
                {
                    dict.colorDict[kvp.Key].Add(kvp2.Value);
                }
            }
            Helper.Data.WriteSaveData(saveKey, dict);
        }
        //~~~~~~~~~~~~~~~~~~~~//
        //  Static Functions  //
        //~~~~~~~~~~~~~~~~~~~~//


        public static void BeforeSave_SaveRecipeBooks(object o, StardewModdingAPI.Events.SavingEventArgs e)
        {
            if (!Directory.Exists(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData")))
            {
                Directory.CreateDirectory(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"));
            }
            string[] directories = Directory.GetDirectories(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"));
            string   playerData  = Path.Combine(Path.Combine(Revitalize.ModCore.ModHelper.DirectoryPath, "SaveData"), PlayerUtilities.GetUniqueCharacterString());
            string   objectPath  = Path.Combine(playerData, "RecipeInformation");

            Directory.CreateDirectory(objectPath);
            string[] objectFiles = Directory.GetFiles(objectPath);

            foreach (KeyValuePair <string, CraftingRecipeBook> book in CraftingRecipeBook.CraftingRecipesByGroup)
            {
                string recipePath = Path.Combine(objectPath, book.Key + ".json");
                ModCore.Serializer.Serialize(recipePath, book.Value);
            }
        }
Beispiel #9
0
        private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
        {
            Monitor.Log($"saving Grange display items: {Game1.player.team.grangeDisplay.Count}");

            List <PersistentItem> grangeItems = new List <PersistentItem>();

            foreach (Item item in Game1.player.team.grangeDisplay)
            {
                if (item is Object)
                {
                    grangeItems.Add(new PersistentItem(item));
                }
                else
                {
                    grangeItems.Add(null);
                }
            }

            PersistentGrangeDisplayData data = new PersistentGrangeDisplayData();

            data.PersistentGrangeDisplay = grangeItems;

            Helper.Data.WriteSaveData("PersistentGrangeDisplay", data);
        }
Beispiel #10
0
 void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     SafeState();
 }
Beispiel #11
0
 void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     Pests.Save();
     Cultivation.Save();
 }
 private static void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     _helper.Data.WriteSaveData<List<PylonData>>(SaveKey, Pylons);
 }
Beispiel #13
0
 private void GameLoop_Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     this.storageProvider.Serialize(this.Helper.Data);
 }
Beispiel #14
0
 private void Saving(object sender, StardewModdingAPI.Events.SavingEventArgs e)
 {
     CheckForEdits("Saving");
 }