private void OnSaveCreating(object sender, SaveCreatingEventArgs e) { if (Game1.IsMasterGame && plusButton.sourceRect.X == 236) { Game1.addMail($"{this.ModManifest.UniqueID}/ReceivedLegacyToken", true); Game1.player.addItemByMenuIfNecessary(new LegacyToken()); if (Config.StockList) { Game1.addMailForTomorrow("gotMissingStocklist", true, true); } if (Config.GingerIsland) { Game1.addMailForTomorrow("willyBackRoomInvitation", true, true); Game1.addMailForTomorrow("willyBoatTicketMachine", true, true); Game1.addMailForTomorrow("willyBoatHull", true, true); Game1.addMailForTomorrow("willyBoatAnchor", true, true); } if (Config.AdditionalProfitMultiplier != 1) { Game1.MasterPlayer.difficultyModifier *= Config.AdditionalProfitMultiplier; } if (Config.RelationshipPenaltyPercentage != 1) { Game1.player.modData.Add("NG+/relationshipPenalty", Config.RelationshipPenaltyPercentage.ToString()); } if (Config.ExpCurveExponent != 1) { Game1.player.modData.Add("NG+/expExponent", Config.ExpCurveExponent.ToString()); } Game1.player.modData.Add("NG+/startingPoints", Config.StartingPoints.ToString()); Game1.player.modData.Add("NG+/goldPerPoint", Config.GoldPerLeftoverPoint.ToString()); } }
private void GameLoop_SaveCreating(object sender, SaveCreatingEventArgs e) { if (!Context.IsMainPlayer) { return; } //cleanup any spawned monsters foreach (GameLocation l in Game1.locations) { for (int index = l.characters.Count - 1; index >= 0; --index) { if (l.characters[index] is Monster && !(l.characters[index] is GreenSlime)) { l.characters.RemoveAt(index); } } } if (IsEclipse) { IsEclipse = false; } //moon works after frost does OurMoon.HandleMoonAtSleep(Game1.getFarm()); }
/// <summary> /// Callback method on the event a newly created game is about to be saved to disk. /// </summary> /// <param name="sender">The caller.</param> /// <param name="e">Event arguments.</param> private void OnSaveCreation(object sender, SaveCreatingEventArgs e) { foreach (var item in this.addOnNewGame) { if (!this.audioApi.AddToJukebox(item.Name, out var errorCode)) { this.Monitor.Log($"Unable to add audio to jukebox's playlist {errorCode}", LogLevel.Warn); } } }
private void NewMtnSave(object sender, SaveCreatingEventArgs e) { MtnFarmData data = Helper.Data.ReadSaveData <MtnFarmData>("MtnFarmData"); if (data == null && !CustomManager.Canon) { CustomFarm farm = CustomManager.SelectedFarm; MtnFarmData customData = new MtnFarmData { FarmTypeName = farm.Name }; Helper.Data.WriteSaveData("MtnFarmData", customData); } }
private void SaveCreating(object sender, SaveCreatingEventArgs e) { NetCollection <Building> ToBuild = new NetCollection <Building>(); foreach (Building building in Game1.getFarm().buildings) { if (building.buildingType.Value.Contains("Cabin")) { ToBuild.Add(CreateGreenhouse(building)); } } foreach (Building building in ToBuild) { Game1.getFarm().buildings.Add(building); } Game1.chatBox.addMessage("Greanhouses Created: " + ToBuild.Count.ToString(), Color.White); }
//At this step, we want to shuffle the recipes as this is when the save is initially created private void GameLoop_SaveCreating(object sender, SaveCreatingEventArgs e) { //We need to find out how many QoS recipes there are by loading the file: IDictionary <string, string> BaseQoSRecipes = Helper.Content.Load <IDictionary <string, string> >(XNBDataPath, ContentSource.GameContent); //the format: // "IDNum" : "text data ShuffleData = new Dictionary <int, int>(); List <int> AvailableIDs = Enumerable.Range(1, BaseQoSRecipes.Count).ToList(); List <string> OldIDLists = BaseQoSRecipes.Keys.ToList(); for (int i = 0; i < OldIDLists.Count; i++) { int oldID = int.Parse(OldIDLists[i]); int newID = AvailableIDs[Game1.random.Next(0, AvailableIDs.Count)]; AvailableIDs.Remove(newID); ShuffleData.Add(oldID, newID); } Helper.Data.WriteSaveData(OurDataPath, ShuffleData); }
/// <summary>Raised before the game creates a new save file.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> protected virtual void OnSaveCreating(object sender, SaveCreatingEventArgs e) { }