diff --git a/CloseDoors/CloseDoors.csproj b/CloseDoors/CloseDoors.csproj
new file mode 100644
index 00000000..7b4db518
--- /dev/null
+++ b/CloseDoors/CloseDoors.csproj
@@ -0,0 +1,27 @@
+
+
+ 1.0.0
+ net6.0
+ true
+ AnyCPU;x64
+
+
+
+
+
+
+ PreserveNewest
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+
\ No newline at end of file
diff --git a/CloseDoors/CodePatches.cs b/CloseDoors/CodePatches.cs
new file mode 100644
index 00000000..7caf457b
--- /dev/null
+++ b/CloseDoors/CodePatches.cs
@@ -0,0 +1,127 @@
+using HarmonyLib;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+using StardewValley.Audio;
+using StardewValley.Extensions;
+using StardewValley.Network;
+using StardewValley.Projectiles;
+using System;
+using System.Collections.Generic;
+using xTile.Dimensions;
+using xTile.Layers;
+using xTile.Tiles;
+using Object = StardewValley.Object;
+using Rectangle = Microsoft.Xna.Framework.Rectangle;
+
+namespace CloseDoors
+{
+ public partial class ModEntry
+ {
+ public static Dictionary> doorDict = new();
+ [HarmonyPatch(typeof(GameLocation), nameof(GameLocation.isCollidingPosition), new Type[] { typeof(Rectangle), typeof(xTile.Dimensions.Rectangle), typeof(bool), typeof(int), typeof(bool), typeof(Character), typeof(bool), typeof(bool), typeof(bool) })]
+ public class GameLocation_isCollidingPosition_Patch
+ {
+ public static void Postfix(GameLocation __instance, Rectangle position, xTile.Dimensions.Rectangle viewport, bool isFarmer, int damagesFarmer, bool glider, Character character, bool pathfinding, bool projectile, bool ignoreCharacterRequirement)
+ {
+ if (!Config.ModEnabled)
+ return;
+ if (!isFarmer)
+ {
+ if (((character != null) ? character.controller : null) != null && character.FacingDirection % 2 == 0)
+ {
+ Layer buildings_layer = __instance.map.RequireLayer("Buildings");
+ Point tileLocation = character.FacingDirection == 2 ? new Point(position.Center.X / 64, position.Bottom / 64) : new Point(position.Center.X / 64, position.Top / 64);
+ if (IsDoorOpen(__instance, tileLocation))
+ {
+ if(!doorDict.TryGetValue(__instance, out var dict))
+ {
+ doorDict[__instance] = new();
+ dict = new();
+ }
+ dict[character] = tileLocation;
+ }
+ else if(doorDict.TryGetValue(__instance, out var dict) && dict.TryGetValue(character, out var point) && point == (character.FacingDirection == 2 ? tileLocation + new Point(0, -2) : tileLocation + new Point(0, 2)))
+ {
+ dict.Remove(character);
+ if(TryCloseDoor(__instance, point))
+ {
+ }
+ }
+ else if(character.FacingDirection == 0)
+ {
+ Tile tile = buildings_layer.Tiles[tileLocation.X, tileLocation.Y];
+ if (tile != null && tile.Properties.ContainsKey("Action"))
+ {
+ __instance.openDoor(new Location(tileLocation.X, tileLocation.Y), Game1.currentLocation.Equals(__instance));
+ }
+ else
+ {
+ tileLocation = new Point(position.Center.X / 64, position.Top / 64);
+ tile = buildings_layer.Tiles[tileLocation.X, tileLocation.Y];
+ if (tile != null && tile.Properties.ContainsKey("Action"))
+ {
+ __instance.openDoor(new Location(tileLocation.X, tileLocation.Y), Game1.currentLocation.Equals(__instance));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ [HarmonyPatch(typeof(GameLocation), nameof(GameLocation.performAction), new Type[] { typeof(string[]), typeof(Farmer), typeof(Location) })]
+ public class GameLocation_performAction_Patch
+ {
+ public static void Prefix(string[] action, Farmer who, Location tileLocation)
+ {
+ if (!Config.ModEnabled)
+ return;
+ }
+ }
+ [HarmonyPatch(typeof(GameLocation), nameof(GameLocation.openDoor))]
+ public class GameLocation_openDoor_Patch
+ {
+ public static void Postfix(Location tileLocation, bool playSound)
+ {
+ if (!Config.ModEnabled)
+ return;
+ }
+ }
+ [HarmonyPatch(typeof(InteriorDoor), "openDoorTiles")]
+ public class InteriorDoor_openDoorTiles_Patch
+ {
+ public static bool Prefix(InteriorDoor __instance)
+ {
+
+ if (!Config.ModEnabled)
+ return true;
+ return true;
+ }
+ public static void Postfix(InteriorDoor __instance)
+ {
+
+ if (!Config.ModEnabled)
+ return;
+ }
+ }
+ [HarmonyPatch(typeof(GameLocation), nameof(GameLocation.checkAction))]
+ public class GameLocation_checkAction_Patch
+ {
+ public static bool Prefix(GameLocation __instance, Location tileLocation, xTile.Dimensions.Rectangle viewport, Farmer who)
+ {
+ if (!Config.ModEnabled)
+ return true;
+ if (!string.IsNullOrEmpty(__instance.doesTileHaveProperty(tileLocation.X, tileLocation.Y, "Action", "Buildings")))
+ return true;
+ var tilePoint = new Point(tileLocation.X, tileLocation.Y);
+ if (TryCloseDoor(__instance, tilePoint))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/CloseDoors/IBuffFrameworkAPI.cs b/CloseDoors/IBuffFrameworkAPI.cs
new file mode 100644
index 00000000..472829f9
--- /dev/null
+++ b/CloseDoors/IBuffFrameworkAPI.cs
@@ -0,0 +1,7 @@
+namespace CloseDoors
+{
+ public interface IBuffFrameworkAPI
+ {
+ public void UpdateBuffs();
+ }
+}
\ No newline at end of file
diff --git a/CloseDoors/IGenericModConfigMenuApi.cs b/CloseDoors/IGenericModConfigMenuApi.cs
new file mode 100644
index 00000000..008c7888
--- /dev/null
+++ b/CloseDoors/IGenericModConfigMenuApi.cs
@@ -0,0 +1,82 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using StardewModdingAPI;
+using StardewModdingAPI.Utilities;
+using StardewValley;
+
+namespace CloseDoors
+{
+ /// The API which lets other mods add a config UI through Generic Mod Config Menu.
+ public interface IGenericModConfigMenuApi
+ {
+ /*********
+ ** Methods
+ *********/
+ /****
+ ** Must be called first
+ ****/
+ /// Register a mod whose config can be edited through the UI.
+ /// The mod's manifest.
+ /// Reset the mod's config to its default values.
+ /// Save the mod's current config to the config.json file.
+ /// Whether the options can only be edited from the title screen.
+ /// Each mod can only be registered once, unless it's deleted via before calling this again.
+ void Register(IManifest mod, Action reset, Action save, bool titleScreenOnly = false);
+
+ /// Add a key binding at the current position in the form.
+ /// The mod's manifest.
+ /// Get the current value from the mod config.
+ /// Set a new value in the mod config.
+ /// The label text to show in the form.
+ /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip.
+ /// The unique field ID for use with , or null to auto-generate a randomized ID.
+ void AddKeybind(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null);
+
+ /// Add a boolean option at the current position in the form.
+ /// The mod's manifest.
+ /// Get the current value from the mod config.
+ /// Set a new value in the mod config.
+ /// The label text to show in the form.
+ /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip.
+ /// The unique field ID for use with , or null to auto-generate a randomized ID.
+
+ /// Add a key binding list at the current position in the form.
+ /// The mod's manifest.
+ /// Get the current value from the mod config.
+ /// Set a new value in the mod config.
+ /// The label text to show in the form.
+ /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip.
+ /// The unique field ID for use with , or null to auto-generate a randomized ID.
+ void AddKeybindList(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null);
+
+ void AddBoolOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string fieldId = null);
+
+ /// Add an integer option at the current position in the form.
+ /// The mod's manifest.
+ /// Get the current value from the mod config.
+ /// Set a new value in the mod config.
+ /// The label text to show in the form.
+ /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip.
+ /// The minimum allowed value, or null to allow any.
+ /// The maximum allowed value, or null to allow any.
+ /// The interval of values that can be selected.
+ /// The unique field ID for use with , or null to auto-generate a randomized ID.
+ void AddNumberOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, int? min = null, int? max = null, int? interval = null, string fieldId = null);
+
+ /// Add a string option at the current position in the form.
+ /// The mod's manifest.
+ /// Get the current value from the mod config.
+ /// Set a new value in the mod config.
+ /// The label text to show in the form.
+ /// The tooltip text shown when the cursor hovers on the field, or null to disable the tooltip.
+ /// The values that can be selected, or null to allow any.
+ /// Get the display text to show for a value from , or null to show the values as-is.
+ /// The unique field ID for use with , or null to auto-generate a randomized ID.
+ void AddTextOption(IManifest mod, Func getValue, Action setValue, Func name, Func tooltip = null, string[] allowedValues = null, Func formatAllowedValue = null, string fieldId = null);
+
+ /// Remove a mod from the config UI and delete all its options and pages.
+ /// The mod's manifest.
+ void Unregister(IManifest mod);
+ }
+}
diff --git a/CloseDoors/Methods.cs b/CloseDoors/Methods.cs
new file mode 100644
index 00000000..f83db5e3
--- /dev/null
+++ b/CloseDoors/Methods.cs
@@ -0,0 +1,43 @@
+using HarmonyLib;
+using Microsoft.Xna.Framework;
+using StardewModdingAPI;
+using StardewValley;
+using StardewValley.Audio;
+using System;
+using System.Collections.Generic;
+
+namespace CloseDoors
+{
+ public partial class ModEntry
+ {
+ private static bool TryCloseDoor(GameLocation location, Point tilePoint)
+ {
+ foreach (var d in location.interiorDoors.Doors)
+ {
+ if (d.Position == tilePoint)
+ {
+ if (!d.Value)
+ return false;
+ location.playSound("doorClose", Utility.PointToVector2(tilePoint), null, SoundContext.Default);
+ d.CleanUpLocalState();
+ d.ResetLocalState();
+ location.interiorDoors[tilePoint] = false;
+ return true;
+ }
+ }
+ return false;
+ }
+ private static bool IsDoorOpen(GameLocation location, Point tilePoint)
+ {
+
+ foreach (var d in location.interiorDoors.Doors)
+ {
+ if (d.Position == tilePoint)
+ {
+ return d.Value;
+ }
+ }
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/CloseDoors/ModConfig.cs b/CloseDoors/ModConfig.cs
new file mode 100644
index 00000000..7c83941c
--- /dev/null
+++ b/CloseDoors/ModConfig.cs
@@ -0,0 +1,10 @@
+using StardewModdingAPI;
+using StardewModdingAPI.Utilities;
+
+namespace CloseDoors
+{
+ public class ModConfig
+ {
+ public bool ModEnabled { get; set; } = true;
+ }
+}
diff --git a/CloseDoors/ModEntry.cs b/CloseDoors/ModEntry.cs
new file mode 100644
index 00000000..b41c1f4c
--- /dev/null
+++ b/CloseDoors/ModEntry.cs
@@ -0,0 +1,71 @@
+using HarmonyLib;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using StardewModdingAPI;
+using StardewModdingAPI.Utilities;
+using StardewValley;
+using StardewValley.Network;
+using StardewValley.Projectiles;
+using System;
+using System.Collections.Generic;
+
+namespace CloseDoors
+{
+ /// The mod entry point.
+ public partial class ModEntry : Mod
+ {
+
+ public static IMonitor SMonitor;
+ public static IModHelper SHelper;
+ public static ModConfig Config;
+
+ public static ModEntry context;
+
+ public static string CloseDoorsKey = "aedenthorn.CloseDoors";
+
+
+ /// The mod entry point, called after the mod is first loaded.
+ /// Provides simplified APIs for writing mods.
+ public override void Entry(IModHelper helper)
+ {
+ Config = Helper.ReadConfig();
+
+ context = this;
+
+ SMonitor = Monitor;
+ SHelper = helper;
+
+ helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched;
+
+ var harmony = new Harmony(ModManifest.UniqueID);
+ harmony.PatchAll();
+
+ }
+
+ private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
+ {
+
+ // get Generic Mod Config Menu's API (if it's installed)
+ var configMenu = Helper.ModRegistry.GetApi("spacechase0.GenericModConfigMenu");
+ if (configMenu is not null)
+ {
+
+ // register mod
+ configMenu.Register(
+ mod: ModManifest,
+ reset: () => Config = new ModConfig(),
+ save: () => Helper.WriteConfig(Config)
+ );
+
+ configMenu.AddBoolOption(
+ mod: ModManifest,
+ name: () => Helper.Translation.Get("GMCM_Option_ModEnabled_Name"),
+ getValue: () => Config.ModEnabled,
+ setValue: value => Config.ModEnabled = value
+ );
+
+ }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/CloseDoors/i18n/default.json b/CloseDoors/i18n/default.json
new file mode 100644
index 00000000..d6dcbffe
--- /dev/null
+++ b/CloseDoors/i18n/default.json
@@ -0,0 +1,16 @@
+{
+ "GMCM_Option_ModEnabled_Name": "Mod Enabled",
+ "GMCM_Option_EatTrigger_Name": "Eat Trigger",
+ "GMCM_Option_EatLastSeconds_Name": "Duration (s)",
+ "GMCM_Option_TransformKey_Name": "Key Trigger",
+ "GMCM_Option_FireKey_Name": "Fire Key",
+ "GMCM_Option_MoveSpeed_Name": "Move Speed",
+ "GMCM_Option_Defense_Name": "Defense",
+ "GMCM_Option_StaminaUse_Name": "Stamina Use",
+ "GMCM_Option_FireDamage_Name": "Fire Damage",
+ "GMCM_Option_FireDistance_Name": "Fire Distance",
+ "GMCM_Option_TransformSound_Name": "Transform Sound",
+ "GMCM_Option_FireSound_Name": "Mod",
+ "dino-form": "Dino Form",
+ "dino-buff-description": "Speed {0}\nDefense +{1}\nDemolish\nFire Breath"
+}
\ No newline at end of file
diff --git a/CloseDoors/manifest.json b/CloseDoors/manifest.json
new file mode 100644
index 00000000..01e7da24
--- /dev/null
+++ b/CloseDoors/manifest.json
@@ -0,0 +1,16 @@
+{
+ "Name": "Close Doors",
+ "Author": "aedenthorn",
+ "Version": "0.1.0",
+ "Description": "Close Doors.",
+ "UniqueID": "aedenthorn.CloseDoors",
+ "EntryDll": "CloseDoors.dll",
+ "MinimumApiVersion": "3.99.0",
+ "ModUpdater": {
+ "Repository": "StardewValleyMods",
+ "User": "aedenthorn",
+ "Directory": "_releases",
+ "ModFolder": "CloseDoors"
+ },
+ "UpdateKeys": [ "Nexus:" ]
+}
\ No newline at end of file
diff --git a/FastForward/FastForward.csproj b/FastForward/FastForward.csproj
index 1455fc54..25171773 100644
--- a/FastForward/FastForward.csproj
+++ b/FastForward/FastForward.csproj
@@ -1,7 +1,7 @@
1.0.0
- net5.0
+ net6.0
true
AnyCPU;x64
@@ -12,15 +12,6 @@
-
- PreserveNewest
-
-
- PreserveNewest
-
-
- PreserveNewest
-
PreserveNewest
diff --git a/FastForward/OrderData.cs b/FastForward/OrderData.cs
deleted file mode 100644
index 0d451d07..00000000
--- a/FastForward/OrderData.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-namespace FastForward
-{
- internal class OrderData
- {
- public int dish;
- public string dishName;
- public bool loved;
-
- public OrderData(int dish, string dishName, bool loved)
- {
- this.dish = dish;
- this.dishName = dishName;
- this.loved = loved;
- }
- }
-}
\ No newline at end of file
diff --git a/FreeLove/FarmerPatches.cs b/FreeLove/FarmerPatches.cs
index 68b03b27..af47bf1c 100644
--- a/FreeLove/FarmerPatches.cs
+++ b/FreeLove/FarmerPatches.cs
@@ -25,7 +25,7 @@ public static bool Farmer_doDivorce_Prefix(ref Farmer __instance)
{
Monitor.Log("Trying to divorce");
__instance.divorceTonight.Value = false;
- if (!__instance.isMarried() || ModEntry.spouseToDivorce == null)
+ if (!__instance.isMarriedOrRoommates() || ModEntry.spouseToDivorce == null)
{
Monitor.Log("Tried to divorce but no spouse to divorce!");
return false;
@@ -66,7 +66,7 @@ public static bool Farmer_doDivorce_Prefix(ref Farmer __instance)
Helper.GameContent.InvalidateCache("Maps/FarmHouse1_marriage");
Helper.GameContent.InvalidateCache("Maps/FarmHouse2_marriage");
- Monitor.Log($"New spouse: {__instance.spouse}, married {__instance.isMarried()}");
+ Monitor.Log($"New spouse: {__instance.spouse}, married {__instance.isMarriedOrRoommates()}");
Utility.getHomeOfFarmer(__instance).showSpouseRoom();
Utility.getHomeOfFarmer(__instance).setWallpapers();
diff --git a/FreeLove/FreeLove.csproj b/FreeLove/FreeLove.csproj
index b4094f94..a5d082ac 100644
--- a/FreeLove/FreeLove.csproj
+++ b/FreeLove/FreeLove.csproj
@@ -1,7 +1,7 @@
1.0.0
- net5.0
+ net6.0
true
AnyCPU;x64
diff --git a/FreeLove/LocationPatches.cs b/FreeLove/LocationPatches.cs
index afd6dc1f..310d996e 100644
--- a/FreeLove/LocationPatches.cs
+++ b/FreeLove/LocationPatches.cs
@@ -52,7 +52,7 @@ public static bool FarmHouse_getSpouseBedSpot_Prefix(FarmHouse __instance, strin
if (!spouses.TryGetValue(spouseName, out NPC spouse) || spouse is null || spouse.isMoving() || !ModEntry.IsInBed(__instance, spouse.GetBoundingBox()))
return true;
- __result = spouse.getTileLocationPoint();
+ __result = spouse.TilePoint;
return false;
}
catch (Exception ex)
@@ -82,7 +82,7 @@ public static bool Beach_checkAction_Prefix(Beach __instance, Location tileLocat
{
try
{
- if (___oldMariner != null && ___oldMariner.getTileX() == tileLocation.X && ___oldMariner.getTileY() == tileLocation.Y)
+ if (___oldMariner != null && ___oldMariner.TilePoint.X == tileLocation.X && ___oldMariner.TilePoint.Y == tileLocation.Y)
{
string playerTerm = Game1.content.LoadString("Strings\\Locations:Beach_Mariner_Player_" + (who.IsMale ? "Male" : "Female"));
if (who.hasAFriendWithHeartLevel(10, true) && who.HouseUpgradeLevel == 0)
@@ -123,12 +123,7 @@ public static void GameLocation_checkEventPrecondition_Prefix(ref string precond
string[] split = precondition.Split('/');
if (split.Length == 0)
return;
- int eventId;
- if (!int.TryParse(split[0], out eventId))
- {
- return;
- }
- if (Game1.player.eventsSeen.Contains(eventId))
+ if (Game1.player.eventsSeen.Contains(split[0]))
{
return;
}
@@ -165,37 +160,13 @@ public static void GameLocation_checkEventPrecondition_Prefix(ref string precond
}
}
-
- public static void Desert_getDesertMerchantTradeStock_Postfix(Farmer who, ref Dictionary __result)
- {
- try
- {
- if (who != null && who.getFriendshipHeartLevelForNPC("Krobus") >= 10 && !who.friendshipData["Krobus"].RoommateMarriage && who.HouseUpgradeLevel >= 1 && (who.isMarried() || who.isEngaged()) && !who.hasItemInInventory(808, 1, 0))
- {
- ISalable i = new StardewValley.Object(808, 1, false, -1, 0);
- __result.Add(i, new int[]
- {
- 0,
- 1,
- 769,
- 200
- });
- }
- }
- catch (Exception ex)
- {
- Monitor.Log($"Failed in {nameof(Desert_getDesertMerchantTradeStock_Postfix)}:\n{ex}", LogLevel.Error);
- }
- }
-
-
public static bool ManorHouse_performAction_Prefix(ManorHouse __instance, string action, Farmer who, ref bool __result)
{
try
{
ModEntry.ResetSpouses(who);
Dictionary spouses = ModEntry.GetSpouses(who, true);
- if (action != null && who.IsLocalPlayer && !Game1.player.divorceTonight.Value && (Game1.player.isMarried() || spouses.Count > 0))
+ if (action != null && who.IsLocalPlayer && !Game1.player.divorceTonight.Value && (Game1.player.isMarriedOrRoommates() || spouses.Count > 0))
{
string a = action.Split(new char[]
{
@@ -248,13 +219,13 @@ public static bool GameLocation_answerDialogueAction_Prefix(string questionAndAn
else
{
Game1.player.Money -= Config.PendantPrice;
- Game1.player.addItemByMenuIfNecessary(new Object(460, 1, false, -1, 0)
+ Game1.player.addItemByMenuIfNecessary(new Object("(O)460", 1, false, -1, 0)
{
specialItem = true
}, null);
if (Game1.activeClickableMenu == null)
{
- Game1.player.holdUpItemThenMessage(new Object(460, 1, false, -1, 0), true);
+ Game1.player.holdUpItemThenMessage(new Object("(O)460", 1, false, -1, 0), true);
}
}
__result = true;
diff --git a/FreeLove/Misc.cs b/FreeLove/Misc.cs
index 5ad7177e..0c792710 100644
--- a/FreeLove/Misc.cs
+++ b/FreeLove/Misc.cs
@@ -168,7 +168,7 @@ public static void PlaceSpousesInFarmhouse(FarmHouse farmHouse)
{
SMonitor.Log("made patio spouse: " + spouse.Name);
spouse.setUpForOutdoorPatioActivity();
- SMonitor.Log($"{spouse.Name} at {spouse.currentLocation.Name} {spouse.getTileLocation()}");
+ SMonitor.Log($"{spouse.Name} at {spouse.currentLocation.Name} {spouse.TilePoint}");
}
}
}
@@ -228,7 +228,7 @@ public static void PlaceSpousesInFarmhouse(FarmHouse farmHouse)
{
spouse.setTilePosition(farmHouse.getRandomOpenPointInHouse(myRand));
spouse.faceDirection(myRand.Next(0, 4));
- SMonitor.Log($"{spouse.Name} spouse random loc {spouse.getTileLocationPoint()}");
+ SMonitor.Log($"{spouse.Name} spouse random loc {spouse.TilePoint}");
spouse.setRandomAfternoonMarriageDialogue(Game1.timeOfDay, farmHouse, false);
}
}
diff --git a/FreeLove/ModEntry.cs b/FreeLove/ModEntry.cs
index 21187b8f..2600811a 100644
--- a/FreeLove/ModEntry.cs
+++ b/FreeLove/ModEntry.cs
@@ -4,8 +4,10 @@
using StardewValley;
using StardewValley.Characters;
using StardewValley.Events;
+using StardewValley.GameData.Shops;
using StardewValley.Locations;
using StardewValley.Menus;
+using StardewValley.Pathfinding;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -194,11 +196,6 @@ public override void Entry(IModHelper helper)
original: AccessTools.Method(typeof(GameLocation), "checkEventPrecondition"),
prefix: new HarmonyMethod(typeof(LocationPatches), nameof(LocationPatches.GameLocation_checkEventPrecondition_Prefix))
);
-
- harmony.Patch(
- original: AccessTools.Method(typeof(Desert), nameof(Desert.getDesertMerchantTradeStock)),
- postfix: new HarmonyMethod(typeof(LocationPatches), nameof(LocationPatches.Desert_getDesertMerchantTradeStock_Postfix))
- );
harmony.Patch(
original: AccessTools.Method(typeof(ManorHouse), nameof(ManorHouse.performAction)),
@@ -246,7 +243,7 @@ public override void Entry(IModHelper helper)
);
harmony.Patch(
- original: AccessTools.Method(typeof(Farmer), nameof(Farmer.isMarried)),
+ original: AccessTools.Method(typeof(Farmer), nameof(Farmer.isMarriedOrRoommates)),
prefix: new HarmonyMethod(typeof(FarmerPatches), nameof(FarmerPatches.Farmer_isMarried_Prefix))
);
@@ -288,7 +285,7 @@ public override void Entry(IModHelper helper)
);
harmony.Patch(
- original: AccessTools.Method(typeof(SocialPage), nameof(SocialPage.isMarriedToAnyone)),
+ original: AccessTools.Method(typeof(SocialPage.SocialEntry), nameof(SocialPage.SocialEntry.IsMarriedToAnyone)),
prefix: new HarmonyMethod(typeof(UIPatches), nameof(UIPatches.SocialPage_isMarriedToAnyone_Prefix))
);
@@ -305,7 +302,7 @@ public override void Entry(IModHelper helper)
prefix: new HarmonyMethod(typeof(EventPatches), nameof(EventPatches.Event_answerDialogueQuestion_Prefix))
);
harmony.Patch(
- original: AccessTools.Method(typeof(Event), nameof(Event.command_loadActors)),
+ original: AccessTools.Method(typeof(Event), nameof(Event.DefaultCommands.LoadActors)),
prefix: new HarmonyMethod(typeof(EventPatches), nameof(EventPatches.Event_command_loadActors_Prefix)),
postfix: new HarmonyMethod(typeof(EventPatches), nameof(EventPatches.Event_command_loadActors_Postfix))
);
@@ -325,12 +322,30 @@ public override object GetApi()
return new FreeLoveAPI();
}
-
private void Content_AssetRequested(object sender, StardewModdingAPI.Events.AssetRequestedEventArgs e)
{
if (!Config.EnableMod)
return;
- if (e.NameWithoutLocale.IsEquivalentTo("Data/Events/HaleyHouse"))
+ if (e.NameWithoutLocale.IsEquivalentTo("Data/Shops"))
+ {
+ e.Edit(delegate (IAssetData data)
+ {
+ var dict = data.AsDictionary();
+ try
+ {
+ for(int i = 0; i < dict.Data["DesertTrade"].Items.Count; i++)
+ {
+ if (dict.Data["DesertTrade"].Items[i].ItemId == "(O)808")
+ dict.Data["DesertTrade"].Items[i].Condition = "PLAYER_FARMHOUSE_UPGRADE Current 1, !PLAYER_HAS_ITEM Current 808";
+ }
+ }
+ catch
+ {
+
+ }
+ });
+ }
+ else if (e.NameWithoutLocale.IsEquivalentTo("Data/Events/HaleyHouse"))
{
e.Edit(delegate (IAssetData idata)
{
diff --git a/FreeLove/NPCPatches.cs b/FreeLove/NPCPatches.cs
index 9fc92958..b1641ddd 100644
--- a/FreeLove/NPCPatches.cs
+++ b/FreeLove/NPCPatches.cs
@@ -2,7 +2,9 @@
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
+using StardewValley.Audio;
using StardewValley.Characters;
+using StardewValley.Extensions;
using StardewValley.Locations;
using StardewValley.Network;
using System;
@@ -193,7 +195,7 @@ internal static void NPC_GetDispositionModifiedString_Prefix(NPC __instance, ref
{
try
{
- if (Game1.player.isMarried() && Game1.player.friendshipData.ContainsKey(__instance.Name) && Game1.player.friendshipData[__instance.Name].IsMarried() && Game1.player.spouse != __instance.Name)
+ if (Game1.player.isMarriedOrRoommates() && Game1.player.friendshipData.ContainsKey(__instance.Name) && Game1.player.friendshipData[__instance.Name].IsMarried() && Game1.player.spouse != __instance.Name)
{
ModEntry.tempOfficialSpouse = __instance;
__state = true;
@@ -400,7 +402,7 @@ public static bool NPC_spouseObstacleCheck_Prefix(NPC __instance, GameLocation c
{
if (!Config.EnableMod || currentLocation is not FarmHouse)
return true;
- if (NPC.checkTileOccupancyForSpouse(currentLocation, __instance.getTileLocation(), __instance.Name))
+ if (NPC.checkTileOccupancyForSpouse(currentLocation, __instance.Tile, __instance.Name))
{
Game1.warpCharacter(__instance, __instance.DefaultMap, (Game1.getLocationFromName(__instance.DefaultMap) as FarmHouse).getSpouseBedSpot(__instance.Name));
__instance.faceDirection(1);
@@ -521,7 +523,7 @@ public static void NPC_loadCurrentDialogue_Postfix(string __state)
public static bool NPC_checkAction_Prefix(ref NPC __instance, ref Farmer who, GameLocation l, ref bool __result)
{
- if (!Config.EnableMod || __instance.IsInvisible || __instance.isSleeping.Value || !who.canMove || who.checkForQuestComplete(__instance, -1, -1, who.ActiveObject, null, -1, 5) || (who.pantsItem.Value?.ParentSheetIndex == 15 && (__instance.Name.Equals("Lewis") || __instance.Name.Equals("Marnie"))) || (__instance.Name.Equals("Krobus") && who.hasQuest(28)))
+ if (!Config.EnableMod || __instance.IsInvisible || __instance.isSleeping.Value || !who.canMove || who.checkForQuestComplete(__instance, -1, -1, who.ActiveObject, null, -1, 5) || (who.pantsItem.Value?.ParentSheetIndex == 15 && (__instance.Name.Equals("Lewis") || __instance.Name.Equals("Marnie"))) || (__instance.Name.Equals("Krobus") && who.hasQuest("28")))
return true;
try
@@ -534,14 +536,16 @@ public static bool NPC_checkAction_Prefix(ref NPC __instance, ref Farmer who, Ga
__instance.faceDirection(-3);
- if (who.friendshipData.ContainsKey(__instance.Name) && who.friendshipData[__instance.Name].Points >= 3125 && !who.mailReceived.Contains("CF_Spouse"))
+ if (who.friendshipData.ContainsKey(__instance.Name) && who.friendshipData[__instance.Name].Points >= 3125 && who.mailReceived.Add("CF_Spouse"))
{
Monitor.Log($"getting starfruit");
- __instance.CurrentDialogue.Push(new Dialogue(Game1.content.LoadString(Game1.player.isRoommate(who.spouse) ? "Strings\\StringsFromCSFiles:Krobus_Stardrop" : "Strings\\StringsFromCSFiles:NPC.cs.4001"), __instance));
- Game1.player.addItemByMenuIfNecessary(new Object(Vector2.Zero, 434, "Cosmic Fruit", false, false, false, false), null);
+ __instance.CurrentDialogue.Push(new Dialogue(__instance, Game1.player.isRoommate(who.spouse) ? "Strings\\StringsFromCSFiles:Krobus_Stardrop" : "Strings\\StringsFromCSFiles:NPC.cs.4001", false));
+ Object stardrop = ItemRegistry.Create