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/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.cs b/ShareSuite/ShareSuite.cs
index eaa6211..eeff941 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",
@@ -625,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.")]
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