From b0b8e37e0ac3af237e897ae72ff781fa0e0a3663 Mon Sep 17 00:00:00 2001 From: "B. M. Willemstein" Date: Sat, 22 Nov 2025 17:58:05 +0100 Subject: [PATCH 1/3] Launch game using start debugging. --- ShareSuite/Properties/launchSettings.json | 12 ++++++++++++ ShareSuite/ShareSuite.csproj.user | 9 +++++++++ 2 files changed, 21 insertions(+) create mode 100644 ShareSuite/Properties/launchSettings.json create mode 100644 ShareSuite/ShareSuite.csproj.user diff --git a/ShareSuite/Properties/launchSettings.json b/ShareSuite/Properties/launchSettings.json new file mode 100644 index 0000000..47223f1 --- /dev/null +++ b/ShareSuite/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "ShareSuite": { + "commandName": "Project" + }, + "RoR2 Mod Launch": { + "commandName": "Executable", + "executablePath": "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Risk of Rain 2\\Risk of Rain 2.exe", + "commandLineArgs": "--doorstop-enabled true --doorstop-target-assembly \"%appdata%\\r2modmanPlus-local\\RiskOfRain2\\profiles\\Default\\BepInEx\\core\\BepInEx.Preloader.dll\"" + } + } +} \ No newline at end of file diff --git a/ShareSuite/ShareSuite.csproj.user b/ShareSuite/ShareSuite.csproj.user new file mode 100644 index 0000000..fc2496c --- /dev/null +++ b/ShareSuite/ShareSuite.csproj.user @@ -0,0 +1,9 @@ + + + + ProjectDebugger + + + RoR2 Mod Launch + + \ No newline at end of file From 585bf469b5c169c2e9fe6a7ba54be0f90afdfab0 Mon Sep 17 00:00:00 2001 From: "B. M. Willemstein" Date: Sat, 22 Nov 2025 19:08:05 +0100 Subject: [PATCH 2/3] Add config for temporary item sharing (untested) --- ShareSuite/ChatHandler.cs | 27 ++++++++++++++++++++------- ShareSuite/ItemSharingHooks.cs | 16 ++++++++++------ ShareSuite/ShareSuite.cs | 8 ++++++++ 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/ShareSuite/ChatHandler.cs b/ShareSuite/ChatHandler.cs index 333f551..51b6b2f 100644 --- a/ShareSuite/ChatHandler.cs +++ b/ShareSuite/ChatHandler.cs @@ -98,13 +98,26 @@ public static void SendRichPickupMessage(CharacterMaster player, PickupDef picku if (temporary) { - var singlePickupMessage = - $"{body.GetUserName()} picked up " + - $"" + - $"{(string.IsNullOrEmpty(pickupName) ? "???" : pickupName)} ({itemCount}) for themselves. " + - $"(Item is temporary, so not shared)"; - Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = singlePickupMessage }); - return; + if (ShareSuite.TemporaryItemsShared.Value) + { + var tempPickupMessage = + $"{body.GetUserName()} picked up temporary " + + $"" + + $"{(string.IsNullOrEmpty(pickupName) ? "???" : pickupName)} ({itemCount}) for everyone" + + $"{ItemPickupFormatter(body)}."; + Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = tempPickupMessage }); + return; + } + else + { + var singlePickupMessage = + $"{body.GetUserName()} picked up " + + $"" + + $"{(string.IsNullOrEmpty(pickupName) ? "???" : pickupName)} ({itemCount}) for themselves. " + + $"(Item is temporary, so not shared)"; + Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = singlePickupMessage }); + return; + } } if (Blacklist.HasItem(pickupDef.itemIndex) || !ItemSharingHooks.IsValidItemPickup(pickupDef.pickupIndex)) diff --git a/ShareSuite/ItemSharingHooks.cs b/ShareSuite/ItemSharingHooks.cs index dcb716b..68df950 100644 --- a/ShareSuite/ItemSharingHooks.cs +++ b/ShareSuite/ItemSharingHooks.cs @@ -1,4 +1,5 @@ using EntityStates.Scrapper; +using IL.RoR2.Achievements.FalseSon; using MonoMod.Cil; using R2API.Utils; using RewiredConsts; @@ -156,7 +157,7 @@ private static void OnGrantItem(On.RoR2.GenericPickupController.orig_AttemptGran && IsValidItemPickup(self.pickupIndex) && IsValidPickupObject(self, body) && GeneralHooks.IsMultiplayer() - && !self.pickup.isTempItem) // Don't share the item with anyone else if the item is temporary + && (!self.pickup.isTempItem || ShareSuite.TemporaryItemsShared.Value)) // Don't share the item with anyone else if the item is temporary unless TemporaryItemsShared is enabled { if (ShareSuite.RandomizeSharedPickups.Value) { @@ -196,7 +197,7 @@ private static void OnGrantItem(On.RoR2.GenericPickupController.orig_AttemptGran var giveItem = PickupCatalog.GetPickupDef(pickupIndex.Value); - HandleGiveItem(player, giveItem); + HandleGiveItem(player, giveItem, self.pickup.isTempItem); // Alternative: Only show pickup text for yourself // var givePickupDef = PickupCatalog.GetPickupDef(givePickupIndex); // Chat.AddPickupMessage(body, givePickupDef.nameToken, givePickupDef.baseColor, 1); @@ -209,7 +210,7 @@ private static void OnGrantItem(On.RoR2.GenericPickupController.orig_AttemptGran // Otherwise give everyone the same item else { - HandleGiveItem(player, item); + HandleGiveItem(player, item, self.pickup.isTempItem); } } @@ -314,7 +315,7 @@ private static void OnShopPurchase(On.RoR2.PurchaseInteraction.orig_OnInteractio else { Log.Debug("Sharesuite: handling give item"); - HandleGiveItem(characterBody.master, PickupCatalog.GetPickupDef(shop.CurrentPickupIndex())); + HandleGiveItem(characterBody.master, PickupCatalog.GetPickupDef(shop.CurrentPickupIndex()), false); } Log.Debug("Sharesuite: orig"); @@ -521,9 +522,12 @@ internal static void SetInstanceField(Type type, object instance, string fieldNa ? collection[Random.Range(0, collection.Count)] : (T?) null; - private static void HandleGiveItem(CharacterMaster characterMaster, PickupDef pickupDef) + private static void HandleGiveItem(CharacterMaster characterMaster, PickupDef pickupDef, bool tempItem) { - characterMaster.inventory.GiveItem(pickupDef.itemIndex); + if (!tempItem) + characterMaster.inventory.GiveItemPermanent(pickupDef.itemIndex); + else + characterMaster.inventory.GiveItemTemp(pickupDef.itemIndex); var connectionId = characterMaster.playerCharacterMasterController.networkUser?.connectionToClient ?.connectionId; diff --git a/ShareSuite/ShareSuite.cs b/ShareSuite/ShareSuite.cs index 4d870fa..9d7fd8e 100644 --- a/ShareSuite/ShareSuite.cs +++ b/ShareSuite/ShareSuite.cs @@ -53,6 +53,7 @@ public static ConfigEntry LunarItemsShared, BossItemsShared, VoidItemsShared, + TemporaryItemsShared, RichMessagesEnabled, DropBlacklistedEquipmentOnShare, PrinterCauldronFixEnabled, @@ -190,6 +191,13 @@ private void InitConfig() "Toggles item sharing for void (purple/corrupted) items." ); + TemporaryItemsShared = Config.Bind( + "Settings", + "TemporaryItemsShared", + false, + "Toggles item sharing for temporary items." + ); + RichMessagesEnabled = Config.Bind( "Settings", "RichMessagesEnabled", From 4fa5c750d955fedf24dfd25839405d3703cc7645 Mon Sep 17 00:00:00 2001 From: "B. Willemstein" Date: Sun, 23 Nov 2025 11:25:53 +0100 Subject: [PATCH 3/3] Fix; add shared items command. --- ShareSuite/ShareSuite.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ShareSuite/ShareSuite.cs b/ShareSuite/ShareSuite.cs index 74343de..eeff941 100644 --- a/ShareSuite/ShareSuite.cs +++ b/ShareSuite/ShareSuite.cs @@ -633,6 +633,27 @@ private static void CcVoidItemsShared(ConCommandArgs args) } } + // TemporaryItemsShared + [ConCommand(commandName = "ss_TemporaryItemsShared", flags = ConVarFlags.None, + helpText = "Modifies whether temporary items are shared or not.")] + private static void CcTemporaryItemsShared(ConCommandArgs args) + { + if (args.Count == 0) + { + Debug.Log(TemporaryItemsShared.Value); + return; + } + + var valid = TryGetBool(args[0]); + if (!valid.HasValue) + Debug.Log("Couldn't parse to boolean."); + else + { + TemporaryItemsShared.Value = valid.Value; + Debug.Log($"Temporary item sharing set to {TemporaryItemsShared.Value}."); + } + } + // RichMessagesEnabled [ConCommand(commandName = "ss_RichMessagesEnabled", flags = ConVarFlags.None, helpText = "Modifies whether rich messages are enabled or not.")]